:root {
  color-scheme: dark;
  --bg: #020804;
  --bg-2: #041008;
  --bg-3: #071810;
  --card: rgba(4, 14, 9, 0.94);
  --card-2: rgba(6, 20, 12, 0.92);
  --border: rgba(48, 110, 72, 0.22);
  --border-strong: rgba(56, 130, 84, 0.3);
  --text: #e8f5ec;
  --muted: rgba(180, 210, 190, 0.68);
  --faint: rgba(130, 165, 140, 0.5);
  --accent: #2eb872;
  --accent-2: #228b52;
  --accent-soft: rgba(46, 184, 114, 0.14);
  --accent-text: #d8f0e0;
  --shadow: 0 18px 48px rgba(1, 5, 3, 0.45);
  --shadow-soft: 0 10px 30px rgba(1, 5, 3, 0.28);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --max-width: 1320px;
  --header-h: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg), var(--bg-2) 42%, var(--bg-3));
  color: var(--text);
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
}

body.menu-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
  color: inherit;
}

a {
  text-decoration: none;
}

#app {
  min-height: 100dvh;
}

.page {
  position: relative;
  min-height: 100dvh;
  overflow-x: clip;
}

.site-shell,
main,
.result-main,
.section,
.hero-inner {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.site-shell {
  padding-top: 48px;
  padding-bottom: 48px;
}

.bg-glow {
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(48px);
}

.bg-glow-top {
  top: -140px;
  left: -120px;
  right: -120px;
  height: 320px;
  background: radial-gradient(circle, rgba(30, 90, 55, 0.16), transparent 70%);
}

.bg-glow-bottom {
  bottom: -180px;
  left: -160px;
  right: -160px;
  height: 420px;
  background: radial-gradient(circle, rgba(20, 70, 45, 0.12), transparent 72%);
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(2, 8, 4, 0.82);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(3, 10, 6, 0.94);
  padding: 8px;
  object-fit: contain;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.site-nav {
  display: none;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover,
.nav-btn:hover {
  color: var(--text);
  background: rgba(46, 184, 114, 0.08);
}

.nav-btn {
  border: none;
  background: transparent;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn,
.btn-ghost,
.btn-primary,
.date-btn,
.menu-btn {
  border: 1px solid var(--border);
  background: rgba(3, 10, 6, 0.94);
  color: var(--text);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover,
.btn-ghost:hover,
.btn-primary:hover,
.date-btn:hover,
.menu-btn:hover {
  border-color: var(--border-strong);
}

.btn-ghost {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
}

.btn-primary {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: var(--border-strong);
  color: var(--accent-text);
}

.btn-block {
  width: 100%;
}

.burger {
  width: 42px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(3, 10, 6, 0.94);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

/* ── Hero / welcome ── */
.hero {
  padding: 28px 0 20px;
}

.welcome-banner {
  position: relative;
  overflow: hidden;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.welcome-banner-glow {
  position: absolute;
  inset: -60px -60px auto;
  height: 170px;
  background: radial-gradient(circle, rgba(8, 24, 15, 0.98), transparent 72%);
  pointer-events: none;
}

.welcome-title {
  position: relative;
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.35rem);
  font-weight: 900;
  letter-spacing: 0.4px;
}

/* ── Sections ── */
.section {
  padding: 12px 0 56px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
}

.notice-center {
  margin-top: 32px;
  text-align: center;
}

.result-unavailable-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

/* ── City cards (app-matching) ── */
.city-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.city-card {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.city-card-border {
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(30, 90, 55, 0.22), rgba(2, 8, 5, 0.5), rgba(20, 70, 45, 0.18));
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.city-card:hover .city-card-border {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.city-card-inner {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius-xl) - 1px);
  padding: 18px 16px 16px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
}

.city-card-bg {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 72px;
  background: linear-gradient(180deg, rgba(8, 42, 24, 0.92), rgba(12, 52, 30, 0.88));
  opacity: 0.78;
  pointer-events: none;
}

.city-card-surface {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(6, 18, 11, 0.98), rgba(4, 14, 9, 0.97));
  pointer-events: none;
}

.city-card-number-wrap {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 10px 18px;
  margin: 6px auto 12px;
  border-radius: 16px;
  border: 1px solid rgba(48, 110, 72, 0.45);
  background: rgba(2, 8, 5, 0.88);
  overflow: hidden;
}

.city-card-number-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(14, 72, 42, 0.98), rgba(22, 96, 56, 0.94), rgba(32, 120, 68, 0.9));
  opacity: 0.96;
}

.city-card-label {
  position: relative;
  z-index: 1;
  color: rgba(240, 249, 255, 0.76);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.city-card-number {
  position: relative;
  z-index: 1;
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  color: #f8fcff;
}

.city-card-name {
  position: relative;
  z-index: 1;
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.city-card-meta {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

/* ── Result page ── */
.result-main {
  padding-bottom: 56px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0 8px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 700;
}

.breadcrumbs a {
  color: var(--accent);
}

.result-hero {
  position: relative;
  overflow: hidden;
  margin: 8px 0 24px;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  box-shadow: var(--shadow-soft);
}

.result-hero-glow {
  position: absolute;
  inset: -60px -60px auto;
  height: 170px;
  background: radial-gradient(circle, rgba(8, 24, 15, 0.98), transparent 72%);
  pointer-events: none;
}

.result-hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.result-hero-copy h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.result-hero-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.result-live-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(48, 110, 72, 0.45);
  background: rgba(2, 8, 5, 0.88);
}

.result-live-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(14, 72, 42, 0.98), rgba(22, 96, 56, 0.94), rgba(32, 120, 68, 0.9));
}

.result-live-number {
  position: relative;
  z-index: 1;
  font-size: clamp(2.8rem, 8vw, 4rem);
  font-weight: 900;
  line-height: 1;
  color: #f8fcff;
}

.result-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.date-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 16px;
  min-width: 160px;
}

.date-btn-label {
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.date-btn-value {
  font-size: 14px;
  font-weight: 800;
}

.history-panel {
  padding: 22px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}

.history-table {
  margin-top: 8px;
}

.history-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 0 6px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.history-head span:last-child {
  min-width: 52px;
  text-align: right;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(3, 10, 6, 0.88);
}

.history-left {
  font-size: 14px;
  font-weight: 800;
}

.history-number {
  min-width: 52px;
  text-align: right;
  font-size: 22px;
  font-weight: 900;
  color: var(--accent);
}

.empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--faint);
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ── Footer ── */
.site-footer {
  margin-top: 24px;
  padding: 40px 24px 28px;
  border-top: 1px solid var(--border);
  background: rgba(2, 8, 4, 0.72);
}

.footer-grid {
  width: min(100%, var(--max-width));
  margin: 0 auto 28px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

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

.footer-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(4, 14, 9, 0.94);
  padding: 8px;
  object-fit: contain;
}

.footer-title {
  font-size: 16px;
  font-weight: 800;
}

.footer-tag {
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.footer-copy {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 14px;
}

.footer-heading {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a,
.footer-link-btn {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.footer-col a:hover,
.footer-link-btn:hover {
  color: var(--accent);
}

.footer-bottom {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--faint);
  font-size: 12px;
}

/* ── Loader / menu / modal ── */
.loader-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 700;
}

.loader-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(46, 184, 114, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.menu-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 50, 32, 0.32);
  z-index: 40;
}

.menu-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(100%, 340px);
  z-index: 50;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 18px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

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

.menu-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(4, 14, 9, 0.94);
  padding: 8px;
  object-fit: contain;
}

.menu-title {
  font-size: 16px;
  font-weight: 800;
}

.menu-version {
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.menu-btn {
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
}

.menu-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.menu-cities {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.menu-city {
  text-align: left;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-2);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.modal-card {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  pointer-events: none;
}

.modal-inner {
  width: min(100%, 380px);
  pointer-events: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.modal-top h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.modal-selected {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 800;
}

.cal-week,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-week {
  margin-bottom: 6px;
}

.cal-week span {
  text-align: center;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
}

.cal-cell {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(3, 10, 6, 0.88);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.cal-empty {
  border: none;
  background: transparent;
}

.cal-active {
  background: var(--accent);
  border-color: var(--border-strong);
  color: var(--accent-text);
}

.cal-blocked {
  opacity: 0.35;
  cursor: not-allowed;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(3, 10, 6, 0.96);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (min-width: 720px) {
  .site-nav {
    display: flex;
  }

  .city-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1.4fr 0.8fr 0.8fr;
  }

  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .result-hero-grid {
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }
}

@media (min-width: 1024px) {
  .city-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .header-actions .btn-ghost:not([data-action='share']) {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .header-actions .btn-ghost {
    display: none;
  }

  .header-actions .btn-primary[data-action='refresh-home'] {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-header-inner,
  .site-shell,
  main,
  .result-main,
  .section,
  .hero-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    padding-top: 28px;
  }

  .city-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .city-card-number {
    font-size: 30px;
  }
}
