@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&display=swap');

:root {
  --bg: #060b16;
  --surface: #161b22;
  --text: #d8e2ee;
  --accent: #36c4ff;
  --accent-strong: #2476ff;
  --border: rgba(110, 118, 129, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Sora', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(54, 196, 255, 0.17), transparent 30%),
    radial-gradient(circle at 86% 16%, rgba(36, 118, 255, 0.18), transparent 32%),
    linear-gradient(180deg, #070d1a 0%, var(--bg) 100%);
  color: var(--text);
}

.app-shell {
  max-width: 840px;
  margin: 4rem auto;
  padding: 0 1.5rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-link {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.admin-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.login-form input[type="text"],
input[type="url"],
input[type="file"],
.admin-shortener-form input[type="url"] {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #0d1117;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.admin-shortener-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.admin-shortener-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-short-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.admin-short-result p {
  margin: 0.5rem 0;
}

.admin-short-result #admin-short-url {
  word-break: break-all;
}

.login-form button {
  width: 100%;
}

.login-hint {
  margin-top: 1rem;
  color: #8b949e;
}

.error-message {
  margin-top: 1rem;
  color: #ff7b72;
}

#search-input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #0d1117;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.delete-button {
  padding: 0.6rem 0.85rem;
  border: none;
  border-radius: 0.75rem;
  color: white;
  background: #f85149;
  cursor: pointer;
}

.delete-button:hover {
  opacity: 0.9;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2.25rem, 4vw, 3rem);
}

p {
  line-height: 1.7;
  color: #8b949e;
}

.card {
  margin-top: 2rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(13, 18, 33, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

input[type="url"] {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #0d1117;
  color: var(--text);
  font-size: 1rem;
}

button {
  margin-top: 1rem;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  cursor: pointer;
}

button:hover {
  opacity: 0.95;
}

.public-shell {
  max-width: 980px;
}

.public-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(97, 145, 255, 0.32);
}

.public-hero::before {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  right: -80px;
  top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(54, 196, 255, 0.35) 0%, rgba(54, 196, 255, 0) 72%);
  pointer-events: none;
}

.public-kicker {
  margin: 0;
  color: #84d9ff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.public-shortener {
  margin-top: 1.1rem;
}

.public-shortener-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
}

.public-shortener-row button {
  margin-top: 0;
  min-width: 150px;
}

.public-result {
  margin-top: 1rem;
  background: rgba(8, 13, 24, 0.86);
  border: 1px solid rgba(110, 118, 129, 0.3);
  border-radius: 0.9rem;
  padding: 1rem;
}

.public-section h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.admin-shell {
  max-width: 1280px;
}

.admin-kicker {
  margin: 0;
  color: #7dd3fc;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.admin-subcopy {
  max-width: 700px;
}

.admin-shell .page-header {
  padding: 1.2rem 1.3rem;
  border: 1px solid rgba(110, 118, 129, 0.25);
  border-radius: 1rem;
  background: linear-gradient(150deg, rgba(16, 22, 38, 0.9), rgba(8, 13, 24, 0.9));
  backdrop-filter: blur(4px);
}

.admin-shell .card {
  border-radius: 1.1rem;
  border: 1px solid rgba(110, 118, 129, 0.25);
  background: linear-gradient(170deg, rgba(12, 18, 32, 0.88), rgba(6, 10, 20, 0.88));
}

.admin-shell .stat-card {
  background: linear-gradient(170deg, rgba(20, 30, 52, 0.74), rgba(9, 14, 28, 0.74));
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.admin-shell .stat-card strong {
  color: #e7f2ff;
}

.admin-shell .chart-card {
  background: linear-gradient(165deg, rgba(17, 24, 40, 0.82), rgba(10, 15, 27, 0.82));
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.admin-shell .admin-panel h2,
.admin-shell .stats-panel h2,
.admin-shell .chart-card h3 {
  color: #e8f2ff;
}

.admin-shell input[type="search"],
.admin-shell input[type="text"],
.admin-shell input[type="url"],
.admin-shell input[type="number"],
.admin-shell input[type="password"],
.admin-shell select {
  background: #0a1220;
  border: 1px solid rgba(148, 163, 184, 0.36);
  border-radius: 0.75rem;
  color: #e2e8f0;
}

.admin-shell input:focus,
.admin-shell select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.admin-shell .admin-table {
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 0.85rem;
}

.admin-shell .admin-table th {
  background: rgba(30, 41, 59, 0.75);
  color: #c7dbf2;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-shell .admin-table td {
  background: rgba(7, 13, 24, 0.82);
}

.admin-shell .admin-table tbody tr:hover td {
  background: rgba(30, 58, 138, 0.28);
}

.admin-shell .admin-table a {
  color: #7dd3fc;
}

.admin-shell .detail-button,
.admin-shell #refresh-button,
.admin-shell #add-banner-button,
.admin-shell #add-video-button {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  border: none;
  border-radius: 0.7rem;
  padding: 0.58rem 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-shell .detail-button:hover,
.admin-shell #refresh-button:hover,
.admin-shell #add-banner-button:hover,
.admin-shell #add-video-button:hover {
  filter: brightness(1.05);
}

.admin-shell .delete-button {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.admin-shell .banner-config {
  border: 1px solid rgba(71, 85, 105, 0.4);
  background: rgba(8, 14, 25, 0.86);
}

.admin-shell .banner-config h3 {
  color: #cde6ff;
  font-weight: 700;
}

.admin-shell .status-message {
  font-weight: 600;
}

.admin-shell .media-counter {
  border-color: rgba(125, 211, 252, 0.35);
  color: #d8efff;
  background: rgba(14, 165, 233, 0.12);
}

.result-card {
  display: grid;
  gap: 1rem;
}

.banner-section {
  margin-top: 2rem;
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.banner-card {
  display: block;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(110, 118, 129, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.banner-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.banner-card img {
  width: 100%;
  display: block;
  height: auto;
}

.banner-placeholder,
.banner-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: #8b949e;
  text-align: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1rem;
}

.banner-form .banner-config {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(110, 118, 129, 0.2);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.banner-form .banner-config h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.banner-preview {
  margin-top: 1rem;
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(110, 118, 129, 0.2);
}

.banner-preview img {
  width: 100%;
  display: block;
  height: auto;
}

.banner-preview-video video {
  width: 100%;
  display: block;
  background: #000;
}

.video-section {
  margin-top: 2rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.video-card {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(110, 118, 129, 0.2);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
}

.video-card video {
  width: 100%;
  border-radius: 0.85rem;
  background: #000;
}

.video-player-wrap {
  position: relative;
}

.video-countdown {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f0f6fc;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(2px);
}

.video-countdown.danger {
  color: #fff;
  background: rgba(185, 28, 28, 0.82);
  border-color: rgba(248, 113, 113, 0.7);
}

.visitor-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(110, 118, 129, 0.45);
  background: rgba(2, 6, 23, 0.82);
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.visitor-shell {
  max-width: 760px;
}

.visitor-card {
  text-align: center;
}

.visitor-modern .visitor-card {
  border: 1px solid rgba(97, 145, 255, 0.36);
  background: linear-gradient(165deg, rgba(16, 23, 41, 0.88), rgba(7, 11, 20, 0.88));
}

.visitor-tag {
  display: inline-block;
  margin: 0;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(134, 212, 255, 0.46);
  color: #aee7ff;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.visitor-actions {
  display: flex;
  justify-content: center;
}

.visitor-progress {
  margin: 1rem auto 1.25rem;
  max-width: 520px;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(110, 118, 129, 0.35);
  background: rgba(7, 12, 24, 0.65);
}

.visitor-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.visitor-progress-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93c5fd;
  font-weight: 700;
}

#visitor-seconds {
  font-size: 1.05rem;
  color: #e0f2fe;
}

.visitor-progress-track {
  width: 100%;
  height: 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.visitor-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  transition: width 0.12s linear;
}

.visitor-state {
  margin: 0.65rem 0 0;
  color: #9fb5cc;
  font-size: 0.92rem;
}

.visitor-target {
  margin: 0.5rem 0 1.25rem;
  word-break: break-all;
}

#visitor-skip {
  margin-top: 1.25rem;
}

.video-card .video-label {
  margin: 0;
  color: #8b949e;
  font-size: 0.95rem;
}

.video-placeholder,
.video-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: #8b949e;
  text-align: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1rem;
}

.banner-form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-message {
  color: #8b949e;
  font-size: 0.95rem;
}

.media-counter {
  font-size: 0.9rem;
  color: #c9d1d9;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(110, 118, 129, 0.35);
  background: rgba(255, 255, 255, 0.03);
}

.status-message.error {
  color: #ff7b72;
}

.admin-panel {
  width: 100%;
  overflow-x: auto;
}

.stats-panel {
  margin-top: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.chart-card {
  padding: 1.25rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(110, 118, 129, 0.2);
}

.chart-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #c9d1d9;
}

.chart-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.chart-label {
  min-width: 70px;
  font-size: 0.9rem;
  color: #8b949e;
}

.chart-bar-wrap {
  width: 100%;
  height: 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.chart-value {
  min-width: 28px;
  text-align: right;
  font-size: 0.95rem;
}

.chart-empty {
  color: #8b949e;
  margin: 0;
}

.stat-card {
  padding: 1.25rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(110, 118, 129, 0.2);
}

.stat-card span {
  display: block;
  margin-bottom: 0.75rem;
  color: #8b949e;
}

.stat-card strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1.1;
}

.country-card ul {
  margin: 0;
  padding-left: 1rem;
  line-height: 1.6;
  color: #c9d1d9;
}

.country-card li {
  margin-bottom: 0.5rem;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(110, 118, 129, 0.2);
}

.admin-table th {
  text-align: left;
  color: #8b949e;
  background: rgba(255, 255, 255, 0.04);
}

.admin-table tbody tr:hover {
  background: rgba(88, 166, 255, 0.08);
}

.hidden {
  display: none;
}

#short-url {
  padding: 1rem;
  border-radius: 0.75rem;
  background: #010409;
  color: #c9d1d9;
  word-break: break-all;
}

.setup-shell {
  max-width: 1100px;
}

.setup-header {
  align-items: center;
}

.setup-badge {
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(88, 166, 255, 0.55);
  border-radius: 999px;
  color: #cde8ff;
  background: rgba(31, 111, 235, 0.2);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.setup-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
}

.setup-help {
  border: 1px solid rgba(110, 118, 129, 0.3);
  border-radius: 1rem;
  padding: 1rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.setup-help h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.setup-help ul {
  margin: 0;
  padding-left: 1rem;
  color: #9cb0c7;
  line-height: 1.6;
}

.setup-form {
  display: grid;
  gap: 1rem;
}

.setup-group {
  border: 1px solid rgba(110, 118, 129, 0.26);
  border-radius: 0.9rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.setup-group h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #d7e6f7;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.setup-field-full {
  grid-column: 1 / -1;
}

.setup-field span {
  font-size: 0.92rem;
  font-weight: 700;
  color: #d3e2f0;
}

.setup-field small {
  color: #8aa0b8;
  font-size: 0.82rem;
}

.setup-field input[type="text"],
.setup-field input[type="password"],
.setup-field input[type="number"] {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(110, 118, 129, 0.4);
  border-radius: 0.75rem;
  background: #0a0f16;
  color: #f0f6fc;
  font-size: 0.96rem;
  outline: none;
}

.setup-field input:focus {
  border-color: rgba(88, 166, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.setup-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .setup-layout {
    grid-template-columns: 1fr;
  }

  .setup-grid {
    grid-template-columns: 1fr;
  }

  .public-shortener-row {
    grid-template-columns: 1fr;
  }

  .public-shortener-row button {
    width: 100%;
  }
}
