*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: #090d16;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background-color: #090d16;
  background-image: radial-gradient(circle at top, #131c31 0%, #090d16 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: #f1f5f9;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
}

.page-wrap {
  width: 100%;
  max-width: 1120px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-chip,
.lang-select,
.icon-btn {
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.lang-select,
.icon-btn {
  cursor: pointer;
  transition: background 0.15s ease;
}

.lang-select:hover,
.icon-btn:hover {
  background: rgba(51, 65, 85, 0.9);
}

.main-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.center-card {
  text-align: center;
  padding: 48px 20px;
}

.route-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.city-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

.city-tag.origin {
  color: #38bdf8;
}

.city-tag.dest {
  color: #34d399;
}

.distance-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  font-weight: 700;
  font-size: 0.9rem;
}

.map-shell {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #0b1220;
}

.map-canvas {
  width: 100%;
  height: 340px;
  display: block;
}

.map-placeholder {
  height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: #0f172a;
}

.placeholder-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.placeholder-desc {
  margin: 0;
  max-width: 420px;
  font-size: 0.86rem;
  color: #94a3b8;
  line-height: 1.5;
}

.traffic-bar {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.traffic-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
}

.traffic-light {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

.traffic-moderate {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.traffic-heavy {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.traffic-summary {
  color: #cbd5e1;
}

.play-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.play-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.remaining-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
}

.guess-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.time-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #0b1220;
  color: #f8fafc;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

.colon {
  font-size: 1.5rem;
  font-weight: 700;
  padding-bottom: 10px;
  color: #64748b;
}

.submit-btn,
.share-btn {
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #0284c7, #10b981);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint-text {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.result-banner {
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.result-banner.won {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.result-banner.lost {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.result-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.answer-reveal {
  margin: 0 0 12px;
  font-size: 0.92rem;
}

.base-time {
  color: #94a3b8;
  font-size: 0.82rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.countdown {
  font-size: 0.82rem;
  color: #cbd5e1;
  font-weight: 600;
}

.error-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.85rem;
}

.guesses-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guess-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.guess-row.empty {
  grid-template-columns: 36px 1fr;
  color: #475569;
  background: rgba(15, 23, 42, 0.4);
}

.guess-row.prox-exact {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
}

.guess-row.prox-close {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(234, 179, 8, 0.45);
}

.guess-row.prox-warm {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.45);
}

.guess-row.prox-cold {
  background: rgba(51, 65, 85, 0.45);
}

.guess-num {
  color: #94a3b8;
}

.guess-time {
  font-weight: 700;
  font-size: 0.95rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  text-align: center;
  padding: 14px 8px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.7);
}

.stat-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-lbl {
  font-size: 0.78rem;
  color: #94a3b8;
}

.rules-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  border: 3px solid rgba(148, 163, 184, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ad-banner-shell {
  margin-top: 20px;
  min-height: 90px;
  border-radius: 14px;
  overflow: hidden;
  text-align: center;
}
