:root {
  color-scheme: dark;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --ink: #e9f5db;
  --muted: #a5c4c8;
  --panel: #102f42;
  --panel-dark: #0a2232;
  --line: #2e6e82;
  --yellow: #ffd166;
  --orange: #f79646;
  --land: #87a96b;
  --land-light: #aac786;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    #071b29;
  background-size: 16px 16px;
}

button, input { font: inherit; }
button { touch-action: manipulation; }

.app-shell { max-width: 1440px; margin: auto; padding: 24px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.eyebrow, .panel-heading p, .map-title p { margin: 0 0 5px; color: #6fbdc7; font: 700 12px ui-monospace, monospace; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 52px); letter-spacing: .06em; text-shadow: 4px 4px 0 #123e55; }
h2 { margin-bottom: 0; font-size: 20px; }
.date-card { min-width: 118px; padding: 9px 14px; border: 3px solid #2d7185; background: var(--panel); box-shadow: 5px 5px 0 #06131d; text-align: center; }
.date-card span, .date-card strong { display: block; }
.date-card span { color: var(--yellow); font-weight: 900; font-size: 20px; }
.date-card strong { margin-top: 2px; font-size: 13px; color: var(--muted); }

.workspace { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 18px; }
.control-panel, .map-card { border: 4px solid #225970; background: var(--panel); box-shadow: 8px 8px 0 #040e15; }
.control-panel { padding: 18px; }
.panel-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 2px solid var(--line); }
.pixel-icon { display: grid; place-items: center; width: 48px; height: 48px; color: #402b10; background: var(--yellow); box-shadow: inset -6px -6px 0 #d9923b; font-size: 28px; }
.control-block { display: block; margin-top: 24px; }
.control-block > span { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.control-block output { color: var(--yellow); font-weight: 900; }
input[type="range"] { width: 100%; height: 28px; accent-color: var(--yellow); cursor: pointer; }
.hint-card { margin: 26px 0; padding: 14px; border: 2px dashed #5595a2; background: #0a2535; }
.hint-card strong { color: var(--yellow); }
.hint-card p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.time-controls { display: grid; gap: 10px; }
button { min-height: 48px; border: 0; border-radius: 0; cursor: pointer; font-weight: 900; box-shadow: 4px 4px 0 #031018; }
button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #031018; }
button:focus-visible, [tabindex]:focus-visible { outline: 4px solid white; outline-offset: 3px; }
button.primary { color: #1a291e; background: var(--yellow); }
button.secondary { color: var(--ink); background: #316b7c; }

.map-card { overflow: hidden; }
.map-title { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 3px solid #225970; background: var(--panel-dark); }
.legend { color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 14px; height: 14px; margin-right: 5px; background: #1c7597; vertical-align: -2px; }
.map-stage { position: relative; background: #17698c; overflow: hidden; touch-action: none; }
#weatherMap { display: block; width: 100%; max-height: calc(100vh - 190px); min-height: 420px; }
.land { fill: var(--land); stroke: #d6e5a9; stroke-width: 2.5; stroke-linejoin: miter; filter: drop-shadow(3px 4px 0 rgba(4,25,28,.45)); shape-rendering: crispEdges; }
.map-labels text { fill: #e7f0c5; font-size: 16px; font-weight: 900; paint-order: stroke; stroke: #173f43; stroke-width: 5; }
.map-labels .accent { fill: var(--yellow); font-size: 18px; }
.map-labels .ocean-label { fill: #63a9bf; stroke: none; font-size: 24px; letter-spacing: .2em; }
.high-pressure { cursor: grab; filter: url(#pixelShadow); }
.high-pressure:active { cursor: grabbing; }
.high-pressure rect { fill: #e15d45; stroke: #ffe5a3; stroke-width: 7; }
.high-pressure .high-inner { fill: #be3e39; stroke: none; }
.high-pressure text { fill: white; font-size: 44px; font-weight: 1000; paint-order: stroke; stroke: #77292c; stroke-width: 4; pointer-events: none; }
.high-pressure .drag-label { fill: var(--ink); stroke: #0b3343; font-size: 13px; letter-spacing: .08em; }
.compass path { stroke: #b6d8d9; stroke-width: 5; }
.compass text { fill: #b6d8d9; font: 900 18px ui-monospace, monospace; }
.question-strip { display: flex; gap: 8px; flex-wrap: wrap; padding: 13px 16px; border-top: 3px solid #225970; background: #0a2535; }
.question-strip span { color: var(--yellow); font-weight: 900; }

@media (max-width: 780px) {
  .app-shell { padding: 12px; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel { order: 2; }
  .map-card { order: 1; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
  .panel-heading, .hint-card, .time-controls { grid-column: 1 / -1; }
  .control-block { margin-top: 8px; }
  #weatherMap { min-height: 350px; }
}

@media (max-width: 500px) {
  .topbar { align-items: center; }
  .date-card { min-width: 92px; }
  .map-title .legend { display: none; }
  .control-panel { grid-template-columns: 1fr; }
  .panel-heading, .hint-card, .time-controls { grid-column: auto; }
}

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