
:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f5f5f9;
  --bg-night: #050712;
  --bg-night-alt: #0b1020;
  --card: #ffffff;
  --card-night: #111827;
  --accent: #2b4a8a;
  --accent-soft: #dfe6ff;
  --accent-night: #60a5fa;
  --text-main: #222222;
  --text-muted: #666666;
  --text-night: #e5e7eb;
  --border-soft: #e0e0e7;
  --border-night: #1f2937;
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.05);
  --shadow-night: 0 16px 30px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #fdfbff 0, var(--bg) 45%, #eceff4 100%);
  color: var(--text-main);
  transition: background 0.4s ease, color 0.4s ease;
}

body.theme-night {
  background: radial-gradient(circle at top, var(--bg-night-alt) 0, var(--bg-night) 48%, #020617 100%);
  color: var(--text-night);
}

a {
  color: var(--accent);
  text-decoration: none;
}

body.theme-night a {
  color: var(--accent-night);
}

a:hover {
  text-decoration: underline;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

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

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
}

.brand-title {
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.brand-title span {
  background: linear-gradient(90deg, #2b4a8a, #8252a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.theme-night .brand-title span {
  background: linear-gradient(90deg, #60a5fa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

body.theme-night .brand-subtitle {
  color: #9ca3af;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.top-nav {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
}

.top-nav a {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.top-nav a:hover {
  border-color: var(--accent-soft);
  background: #ffffff;
  text-decoration: none;
}

body.theme-night .top-nav a:hover {
  border-color: #1f2937;
  background: #020617;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 2px;
  background: rgba(255, 255, 255, 0.9);
}

body.theme-night .theme-toggle {
  border-color: var(--border-night);
  background: rgba(15, 23, 42, 0.9);
}

.theme-toggle button {
  border: none;
  background: transparent;
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
}

.theme-toggle button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

body.theme-night .theme-toggle button.active {
  background: #1f2937;
  color: var(--accent-night);
}

.kids-toggle {
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.kids-toggle input {
  margin: 0;
}

body.theme-night .kids-toggle {
  border-color: var(--border-night);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
}

.date-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

body.theme-night .date-time {
  color: #9ca3af;
}

.search-bar {
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  padding: 6px 10px 6px 14px;
  border: 1px solid var(--border-soft);
  align-items: center;
}

body.theme-night .search-box {
  background: var(--card-night);
  border-color: var(--border-night);
  box-shadow: var(--shadow-night);
}

.search-box input[type="text"] {
  border: none;
  flex: 1;
  min-width: 160px;
  padding: 6px 4px;
  font-size: 0.95rem;
  outline: none;
  background: transparent;
  color: inherit;
}

.search-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
}

.search-modes label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.02);
}

body.theme-night .search-modes label {
  background: rgba(15, 23, 42, 0.9);
}

.search-modes input {
  margin: 0;
}

body.kids-mode .search-modes label[data-kid-safe="false"] {
  display: none;
}

.search-box button {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
}

.search-box button:hover {
  filter: brightness(1.05);
}

.search-note {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-left: 8px;
}

body.theme-night .search-note {
  color: #9ca3af;
}

.hero-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.hero-card {
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-soft);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

body.theme-night .hero-card {
  background: var(--card-night);
  border-color: var(--border-night);
  box-shadow: var(--shadow-night);
}

.hero-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.11);
}

body.theme-night .hero-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.hero-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.hero-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.hero-list li + li {
  margin-top: 4px;
}

.quote-weather-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .quote-weather-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.quote-card {
  background: var(--card);
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px dashed var(--border-soft);
  font-size: 0.9rem;
}

body.theme-night .quote-card {
  background: rgba(15, 23, 42, 0.9);
  border-color: #1f2937;
}

.quote-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  color: var(--text-muted);
}

body.theme-night .quote-label {
  color: #9ca3af;
}

.quote-text {
  font-style: italic;
}

.weather-card {
  background: var(--card);
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body.theme-night .weather-card {
  background: var(--card-night);
  border-color: var(--border-night);
}

.weather-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  color: var(--text-muted);
}

body.theme-night .weather-title {
  color: #9ca3af;
}

.weather-body {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.weather-temp {
  font-size: 1.4rem;
  font-weight: 600;
}

.weather-meta {
  font-size: 0.8rem;
}

.weather-summary {
  margin-bottom: 2px;
}

.weather-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
}

body.theme-night .weather-updated {
  color: #9ca3af;
}

main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.section-card {
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px 10px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

body.theme-night .section-card {
  background: var(--card-night);
  border-color: var(--border-night);
  box-shadow: var(--shadow-night);
}

.section-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.09);
}

body.theme-night .section-card:hover {
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.6);
}

.section-card h2 {
  font-size: 1rem;
  margin: 0 0 6px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 4px;
}

body.theme-night .section-card h2 {
  border-color: #1f2937;
}

body.kids-mode #kids-section h2::after {
  content: " (kids focus)";
  font-size: 0.8rem;
  color: var(--accent);
  margin-left: 4px;
}

body.theme-night.kids-mode #kids-section h2::after {
  color: var(--accent-night);
}

.section-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.section-card li + li {
  margin-top: 4px;
}

body.kids-mode .section-card[data-kid-safe="false"] {
  display: none;
}

footer {
  margin-top: 28px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

body.theme-night footer {
  color: #9ca3af;
  border-top-color: #1f2937;
}

.simple-page main {
  max-width: 680px;
  margin: 0 auto;
}

.simple-page h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.simple-page p {
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 10px;
}

.simple-page .back-link {
  margin-top: 16px;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  header {
    align-items: flex-start;
  }
  .header-right {
    align-items: flex-start;
  }
  .header-controls {
    align-items: flex-start;
    flex-direction: column-reverse;
  }
  .search-box {
    border-radius: 16px;
  }
}

/* Retro easter egg mode */
body.retro-mode {
  font-family: "Verdana", "Tahoma", system-ui, sans-serif;
  background: #c0c0c0;
  color: #000000;
}

body.retro-mode .page {
  max-width: 960px;
  background: #f0f0ff;
  border: 1px solid #9999cc;
  padding-top: 16px;
}

body.retro-mode a {
  color: #0000ee;
  text-decoration: underline;
}

body.retro-mode header,
body.retro-mode .search-box,
body.retro-mode .hero-card,
body.retro-mode .quote-card,
body.retro-mode .weather-card,
body.retro-mode .section-card,
body.retro-mode footer {
  box-shadow: none;
  border-radius: 0;
}

body.retro-mode header {
  border-bottom: 2px solid #9999cc;
  padding-bottom: 4px;
}

body.retro-mode .brand-title {
  font-size: 1.6rem;
  letter-spacing: 0.08em;
}

body.retro-mode .brand-title span {
  background: none;
  -webkit-text-fill-color: inherit;
  color: #000080;
}

body.retro-mode .brand-subtitle {
  color: #000000;
}

body.retro-mode .theme-toggle,
body.retro-mode .kids-toggle {
  background: #f0f0ff;
  border-color: #9999cc;
}

body.retro-mode .theme-toggle button.active {
  background: #ffffff;
  color: #000080;
}

body.retro-mode .hero-card,
body.retro-mode .section-card {
  background: #ffffff;
  border: 1px solid #c0c0c0;
}

body.retro-mode .quote-card,
body.retro-mode .weather-card {
  background: #ffffff;
  border-style: solid;
}

body.retro-mode footer {
  border-top: 1px solid #9999cc;
}
