:root {
  --shadow-soft: 0 24px 60px rgba(7, 20, 38, 0.14);
  --shadow-card: 0 16px 36px rgba(16, 32, 51, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --content-width: min(1120px, calc(100vw - 32px));
  --nav-height: 82px;
  --transition-soft: 220ms ease;
}

:root[data-theme="day"] {
  --bg-main: #eef3ff;
  --bg-card: #ffffff;
  --bg-panel: rgba(255, 255, 255, 0.82);
  --primary: #30489a;
  --primary-dark: #171d4a;
  --accent: #d6263f;
  --accent-soft: #ffe4e8;
  --sky-blue: #7f93d7;
  --cloud-white: #ffffff;
  --text-main: #171f45;
  --text-muted: #5f6994;
  --border: #d9dff7;
  --surface-tint: rgba(48, 72, 154, 0.1);
  --hero-gradient: linear-gradient(145deg, #ffffff 0%, #e4eaff 54%, #cad5ff 100%);
  --glow: rgba(214, 38, 63, 0.18);
}

:root[data-theme="night"] {
  --bg-main: #161842;
  --bg-card: #222a67;
  --bg-panel: rgba(23, 29, 74, 0.86);
  --primary: #92a5f3;
  --primary-dark: #3b4ca2;
  --accent: #e3384f;
  --accent-soft: #4a1730;
  --star-gold: #f4f6ff;
  --moon: #f4f0d8;
  --text-main: #f7f8ff;
  --text-muted: #bcc5ec;
  --border: #34428c;
  --surface-tint: rgba(146, 165, 243, 0.14);
  --hero-gradient: linear-gradient(145deg, #29357d 0%, #202865 52%, #151742 100%);
  --glow: rgba(227, 56, 79, 0.22);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.34), transparent 30%),
    radial-gradient(circle at top right, var(--glow), transparent 28%),
    var(--bg-main);
  color: var(--text-main);
  font: 16px/1.6 "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  transition:
    background-color var(--transition-soft),
    color var(--transition-soft);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.sky-backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.day-atmosphere,
.night-atmosphere {
  position: absolute;
  inset: 0;
  transition: opacity 320ms ease;
}

:root[data-theme="day"] .day-atmosphere,
:root[data-theme="night"] .night-atmosphere {
  opacity: 1;
}

:root[data-theme="day"] .night-atmosphere,
:root[data-theme="night"] .day-atmosphere {
  opacity: 0;
}

.sun-glow,
.moon-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.sun-glow {
  top: 6%;
  right: 10%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 231, 160, 0.92) 0%, rgba(255, 231, 160, 0.28) 55%, transparent 72%);
}

.moon-glow {
  top: 9%;
  right: 11%;
  width: 132px;
  height: 132px;
  background: radial-gradient(circle, rgba(244, 240, 216, 0.95) 0%, rgba(244, 240, 216, 0.24) 58%, transparent 76%);
  box-shadow: 0 0 48px rgba(244, 240, 216, 0.24);
}

.cloud {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    36px 12px 0 8px rgba(255, 255, 255, 0.76),
    82px 2px 0 0 rgba(255, 255, 255, 0.9),
    58px -16px 0 8px rgba(255, 255, 255, 0.84);
  opacity: 0.85;
  animation: cloud-drift linear infinite;
}

.cloud-one {
  top: 16%;
  left: -14%;
  width: 124px;
  height: 44px;
  animation-duration: 38s;
}

.cloud-two {
  top: 30%;
  left: -22%;
  width: 164px;
  height: 56px;
  animation-duration: 52s;
}

.cloud-three {
  top: 58%;
  left: -18%;
  width: 144px;
  height: 50px;
  animation-duration: 46s;
}

.star {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--star-gold);
  box-shadow: 0 0 12px rgba(255, 215, 106, 0.84);
  animation: twinkle 3.2s ease-in-out infinite;
}

.star-1 {
  top: 16%;
  left: 12%;
}

.star-2 {
  top: 24%;
  left: 28%;
  animation-delay: 0.7s;
}

.star-3 {
  top: 14%;
  left: 47%;
  animation-delay: 1.4s;
}

.star-4 {
  top: 38%;
  left: 18%;
  animation-delay: 1s;
}

.star-5 {
  top: 30%;
  left: 63%;
  animation-delay: 0.2s;
}

.star-6 {
  top: 20%;
  left: 74%;
  animation-delay: 2.1s;
}

.star-7 {
  top: 52%;
  left: 12%;
  animation-delay: 0.5s;
}

.star-8 {
  top: 61%;
  left: 40%;
  animation-delay: 1.7s;
}

.star-9 {
  top: 49%;
  left: 72%;
  animation-delay: 2.4s;
}

.star-10 {
  top: 72%;
  left: 84%;
  animation-delay: 1.1s;
}

.app-shell {
  width: var(--content-width);
  margin: 0 auto;
  padding: 20px 0 calc(var(--nav-height) + 24px);
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  background: var(--bg-panel);
  box-shadow: var(--shadow-soft);
}

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

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

.brand-block h1 {
  margin: 0;
  font:
    700 clamp(1.55rem, 1.2rem + 1.1vw, 2.4rem) / 1.05
    "Avenir Next Condensed", "Trebuchet MS", sans-serif;
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background:
    linear-gradient(
      180deg,
      #6f7fc3 0%,
      var(--primary) 44%,
      var(--accent) 45%,
      var(--accent) 76%,
      var(--primary-dark) 100%
    );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  flex: 0 0 auto;
}

.brand-sun,
.brand-orbit {
  position: absolute;
  border-radius: 50%;
}

.brand-sun {
  width: 18px;
  height: 18px;
  top: 11px;
  left: 13px;
  background: #fff5bf;
  box-shadow: 0 0 18px rgba(255, 245, 191, 0.44);
}

.brand-orbit {
  width: 28px;
  height: 28px;
  right: 10px;
  bottom: 9px;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.mode-badge,
.mini-badge,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  background: var(--surface-tint);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.top-nav,
.bottom-nav {
  display: flex;
  gap: 10px;
}

.top-nav {
  flex-wrap: wrap;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 24px));
  padding: 10px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  z-index: 30;
}

.nav-button {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  transition:
    color var(--transition-soft),
    background-color var(--transition-soft),
    transform var(--transition-soft),
    border-color var(--transition-soft);
}

.nav-button:hover,
.nav-button:focus-visible {
  color: var(--text-main);
  background: var(--surface-tint);
  border-color: var(--border);
  outline: none;
}

.nav-button.is-active {
  color: var(--text-main);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), var(--surface-tint));
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nav-icon {
  font-size: 1.05rem;
}

.app-content {
  padding: 26px 0 14px;
}

.screen-stack {
  display: grid;
  gap: 20px;
}

.hero-card,
.panel-card,
.info-card,
.quiz-card,
.tip-strip,
.stats-band {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 20px;
  padding: 28px;
  background: var(--hero-gradient);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -26% auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 20px;
}

.hero-copy h2,
.section-heading h2 {
  margin: 0;
  font:
    700 clamp(1.8rem, 1.4rem + 1.2vw, 3.3rem) / 1.05
    "Avenir Next Condensed", "Trebuchet MS", sans-serif;
}

.hero-copy p,
.section-heading p,
.support-text,
.card-meta,
.fact-text {
  margin: 0;
  color: var(--text-muted);
}

.hero-actions,
.button-row,
.filter-row,
.fact-row,
.mini-grid,
.stats-row,
.progress-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 700;
  transition:
    transform var(--transition-soft),
    box-shadow var(--transition-soft),
    border-color var(--transition-soft),
    background-color var(--transition-soft);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.button-primary {
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 14px 28px rgba(11, 61, 145, 0.18);
}

.button-secondary {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.16));
  color: var(--text-main);
  border-color: var(--border);
}

.button-ghost {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border);
}

.button.is-selected,
.filter-button.is-selected {
  background: linear-gradient(145deg, var(--accent), var(--primary-dark));
  color: white;
  border-color: transparent;
}

.stats-band,
.panel-card,
.quiz-card {
  padding: 22px;
}

.stats-band {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.24), var(--bg-card));
}

.stat-pill {
  min-width: 120px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
}

.stat-pill strong {
  display: block;
  font-size: 1.3rem;
  line-height: 1.1;
}

.section-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.section-heading {
  display: grid;
  gap: 10px;
}

.section-heading h3,
.card-title,
.quiz-card h3,
.panel-card h3 {
  margin: 0;
  font:
    700 clamp(1.15rem, 1rem + 0.45vw, 1.55rem) / 1.15
    "Avenir Next Condensed", "Trebuchet MS", sans-serif;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.info-card {
  overflow: hidden;
}

.info-card[open] {
  border-color: var(--primary);
}

.info-card summary {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 20px;
  cursor: pointer;
}

.info-card summary::-webkit-details-marker {
  display: none;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface-tint);
  font-size: 1.25rem;
}

.card-body {
  padding: 0 20px 20px;
}

.card-note,
.info-list li,
.checklist-text,
.quiz-feedback p,
.tip-line {
  color: var(--text-muted);
}

.info-list {
  margin: 0;
  padding-left: 18px;
}

.info-list li + li {
  margin-top: 8px;
}

.compass-layout {
  display: grid;
  gap: 18px;
}

.compass-rose {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 12px;
  align-items: center;
  max-width: 360px;
}

.compass-center {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 22px;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent);
  font-weight: 700;
}

.compass-button {
  min-height: 78px;
  padding: 14px;
  border-radius: 22px;
}

.compass-button.north {
  grid-column: 2;
}

.compass-button.west {
  grid-column: 1;
  grid-row: 2;
}

.compass-button.east {
  grid-column: 3;
  grid-row: 2;
}

.compass-button.south {
  grid-column: 2;
  grid-row: 3;
}

.compass-panel {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
}

.checklist {
  display: grid;
  gap: 12px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), var(--surface-tint));
  border: 1px solid var(--border);
}

.checklist-item input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.checklist-item.is-checked {
  border-color: var(--primary);
}

.fact-card,
.event-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent);
}

.event-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.filter-button,
.quiz-option {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  font-weight: 700;
}

.quiz-options {
  display: grid;
  gap: 12px;
}

.quiz-option {
  text-align: left;
}

.quiz-option.is-correct {
  border-color: #2b9b64;
  background: rgba(43, 155, 100, 0.16);
}

.quiz-option.is-wrong {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz-feedback {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
}

.progress-bar {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(145deg, var(--accent), var(--primary));
}

.empty-state {
  padding: 22px;
  border-radius: 20px;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  text-align: center;
}

.site-footer {
  padding: 18px 0 10px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes cloud-drift {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(calc(100vw + 320px));
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.85);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@media (min-width: 768px) {
  .app-shell {
    padding-bottom: 26px;
  }

  .top-nav {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .hero-grid,
  .compass-layout {
    grid-template-columns: 1.4fr 1fr;
  }

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

  .site-header {
    top: 18px;
    padding: 22px;
  }
}

@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-grid {
    grid-template-columns: 1.6fr 0.95fr;
  }
}

@media (max-width: 767px) {
  .top-nav {
    display: none;
  }

  .brand-block,
  .header-actions {
    align-items: flex-start;
  }

  .header-actions {
    flex-direction: column;
  }

  .nav-button {
    flex-direction: column;
    gap: 4px;
    padding: 10px 6px;
    font-size: 0.74rem;
  }

  .nav-icon {
    font-size: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
