:root {
  --bg: #0a0f24;
  --bg2: #111936;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-solid: #141c3d;
  --line: rgba(255, 255, 255, 0.11);
  --text: #eaf0ff;
  --muted: #9aa7c7;
  --accent: #ffb86b;
  --sky: #7cc4ff;
  --good: #50f0e6;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, #1d2a5e 0%, transparent 60%), var(--bg);
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #1a1205; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
a { color: var(--sky); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: 1120px; margin: 0 auto; padding: 18px 20px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 0.02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; position: relative; background: #0d1530; border: 1px solid var(--line); overflow: hidden;
}
.brand-mark::before { content: ""; position: absolute; width: 11px; height: 11px; border-radius: 50%; right: 4px; top: 4px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.brand-mark::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 0; height: 12px; background: var(--sky);
  clip-path: polygon(0 100%, 0 45%, 25% 45%, 25% 20%, 50% 20%, 50% 60%, 65% 60%, 65% 0, 100% 0, 100% 100%); opacity: 0.9; }

.search { position: relative; flex: 1 1 280px; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; padding: 11px 44px 11px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07); color: var(--text); font: inherit; font-size: 15px;
}
.search input::placeholder { color: #7f8cae; }
.btn-search { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #1a1205; cursor: pointer; display: grid; place-items: center; }
.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; z-index: 20;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.results li { padding: 9px 12px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.results li small { color: var(--muted); }
.results li[aria-selected="true"], .results li:hover { background: rgba(124, 196, 255, 0.16); }
.results li.empty { cursor: default; color: var(--muted); }
.results li.empty:hover { background: none; }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--sky); color: #08162b; }
.seg.small button { padding: 5px 11px; font-size: 13px; }

main { max-width: 1120px; margin: 0 auto; padding: 0 20px 30px; }
.banner { margin: 6px 0 14px; padding: 12px 16px; border-radius: 12px; background: rgba(255, 90, 90, 0.14); border: 1px solid rgba(255, 120, 120, 0.4); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.banner.info { background: rgba(124, 196, 255, 0.12); border-color: rgba(124, 196, 255, 0.35); }
.banner button { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.1); padding: 6px 12px; border-radius: 8px; cursor: pointer; }

.hero { position: relative; border-radius: 24px; overflow: hidden; height: clamp(300px, 46vw, 440px); border: 1px solid var(--line); box-shadow: var(--shadow); background: #0b1535; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-text { position: absolute; left: clamp(18px, 3vw, 34px); top: clamp(16px, 3vw, 30px); text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45); pointer-events: none; }
.hero-text p { margin: 0; }
.hero-place { font-family: var(--font-display); font-size: clamp(20px, 3vw, 30px); font-weight: 650; }
.hero-time { color: rgba(255, 255, 255, 0.82); font-size: 14px; }
.hero-temp { font-family: var(--font-display); font-size: clamp(64px, 11vw, 112px); font-weight: 300; line-height: 1; margin-top: 6px !important; letter-spacing: -0.03em; }
.hero-cond { font-size: clamp(17px, 2vw, 22px); font-weight: 600; }
.hero-sub { color: rgba(255, 255, 255, 0.85); font-size: 14px; }
.hero-hint { position: absolute; right: 16px; bottom: 10px; margin: 0; font-size: 12px; color: rgba(255, 255, 255, 0.7); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.hero-preview { position: absolute; right: 14px; top: 14px; display: flex; gap: 10px; align-items: center; padding: 8px 10px 8px 14px; border-radius: 999px; background: rgba(10, 15, 36, 0.7); backdrop-filter: blur(8px); border: 1px solid var(--line); font-size: 14px; }
.hero-preview button { border: 0; border-radius: 999px; background: var(--accent); color: #1a1205; font-weight: 700; padding: 5px 12px; cursor: pointer; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; backdrop-filter: blur(6px); min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h2 { margin: 0 0 12px; font-family: var(--font-display); font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 12px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.muted { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.045); }
.stats dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stats dd small { font-size: 13px; font-weight: 400; color: var(--muted); }
.arrow { width: 22px; height: 22px; flex: none; transition: transform 0.4s; }

.air-big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.air-num { font-family: var(--font-display); font-size: 54px; font-weight: 300; line-height: 1; }
.air-band { font-size: 20px; font-weight: 700; padding: 3px 12px; border-radius: 999px; color: #101010; }
.air-advice { margin: 8px 0 14px; color: #cfd8f2; }
.gauge { position: relative; display: flex; height: 12px; border-radius: 999px; overflow: visible; margin: 18px 0 6px; }
.gauge span { flex: 1; }
.gauge span:first-child { border-radius: 999px 0 0 999px; }
.gauge span:last-child { border-radius: 0 999px 999px 0; }
.gauge i { position: absolute; top: -5px; width: 4px; height: 22px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5); transform: translateX(-50%); transition: left 0.5s; }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); font-size: 13px; }
.chip b { font-weight: 600; }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.chart-wrap { position: relative; }
#chart { width: 100%; height: 200px; display: block; touch-action: pan-y; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; padding: 4px 9px; font-size: 12px; border-radius: 8px; background: rgba(10, 15, 36, 0.9); border: 1px solid var(--line); white-space: nowrap; }
.hours { list-style: none; margin: 10px 0 0; padding: 0 0 8px; display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; }
.hours li { flex: 0 0 auto; }
.hours button {
  width: 74px; padding: 9px 4px; border-radius: 14px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.045); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; scroll-snap-align: start;
}
.hours button:hover { background: rgba(255, 255, 255, 0.09); }
.hours button[aria-pressed="true"] { border-color: var(--accent); background: rgba(255, 184, 107, 0.12); }
.hours .t { color: var(--muted); font-size: 12px; }
.hours .ic { font-size: 22px; line-height: 1.2; }
.hours .v { font-weight: 650; font-size: 15px; }
.hours .r { color: var(--sky); font-size: 12px; min-height: 16px; }
.hours .w { color: var(--muted); font-size: 12px; }

.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.day { display: grid; grid-template-columns: 92px 34px minmax(70px, 1fr) minmax(130px, 2fr) 78px 84px; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.day:last-child { border-bottom: 0; }
.day .dn { font-weight: 650; }
.day .dn small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.day .ic { font-size: 24px; }
.day .cd { color: var(--muted); font-size: 13px; }
.rangebar { position: relative; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.09); }
.rangebar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--sky), var(--accent)); }
.rangewrap { display: grid; grid-template-columns: 42px 1fr 42px; gap: 8px; align-items: center; font-size: 14px; }
.rangewrap span:first-child { color: var(--muted); text-align: right; }
.day .rn { color: var(--sky); font-size: 13px; text-align: right; }
.day .wn { color: var(--muted); font-size: 13px; text-align: right; }

.best { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.best b { color: var(--accent); }
.game-intro { margin: -4px 0 12px; }
.game-frame { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #0b1535; }
#game { display: block; width: 100%; aspect-ratio: 16 / 9; touch-action: none; outline-offset: -3px; }
.touch { display: none; justify-content: space-between; gap: 10px; padding: 10px; background: rgba(0, 0, 0, 0.35); }
.touch-group { display: flex; gap: 8px; }
.touch button { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.1); font-weight: 650; touch-action: none; user-select: none; }
.touch button.on { background: var(--accent); color: #1a1205; }
@media (pointer: coarse), (max-width: 760px) { .touch { display: flex; } }
@media (max-width: 760px) { .touch button { padding: 12px 10px; font-size: 14px; } .touch-group { flex: 1; } .touch button { flex: 1; } }
.game-actions { display: flex; gap: 10px; margin-top: 12px; }
.game-actions button { padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text); font-weight: 650; cursor: pointer; }
.game-actions .btn-primary { background: var(--accent); color: #1a1205; border-color: transparent; }
.game-actions button:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.flightlog { margin: 10px 0 0; font: 12px/1.4 ui-monospace, Consolas, monospace; color: var(--muted); overflow-wrap: anywhere; }
.keys { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 12px 0 0; padding: 0; color: var(--muted); font-size: 14px; }
kbd { display: inline-block; min-width: 24px; text-align: center; padding: 1px 7px; margin-right: 4px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: rgba(255, 255, 255, 0.07); color: var(--text); font: 600 12px var(--font); }

.foot { max-width: 1120px; margin: 0 auto; padding: 8px 20px 36px; color: var(--muted); font-size: 13px; }
.foot p { margin: 0; border-top: 1px solid var(--line); padding-top: 16px; max-width: 80ch; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .day { grid-template-columns: 70px 30px 1fr 64px; row-gap: 4px; }
  .day .cd { display: none; }
  .day .wn { grid-column: 3; text-align: left; }
  .day .rn { grid-column: 4; }
  .day .rangewrap { grid-column: 3 / 5; grid-row: 1; }
  .top { padding-bottom: 6px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .seg:not(.small) { margin-left: auto; }
}
@media (max-width: 520px) {
  .day { grid-template-columns: 64px 28px 1fr; }
  .day .rangewrap { grid-column: 3; grid-row: 1; }
  .day .rn { grid-column: 3; grid-row: 2; text-align: left; }
  .day .wn { grid-column: 1 / 3; grid-row: 2; text-align: left; display: none; }
  .stats dd { font-size: 17px; }
  .hero-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
