:root {
  --bg: #05090f;
  --glass: rgba(10, 17, 28, 0.74);
  --glass2: rgba(16, 27, 42, 0.8);
  --line: rgba(150, 190, 230, 0.16);
  --txt: #e6eef6;
  --dim: #8fa3b8;
  --acc: #6fd3ff;
  --yel: #ffd479;
  --red: #ff7a6b;
  --cold: #5fb7ff;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
.mono, output { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--dim); }
button { font-family: inherit; color: inherit; }

/* ---------- stage ---------- */
#stage { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 15%, #0d1c2c 0%, #05090f 62%, #03060a 100%); }
canvas#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.panel { position: absolute; background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.35); z-index: 5; }
.panel.slim { border-radius: 12px; }
.ph { font-size: 12px; letter-spacing: 0.06em; color: var(--dim); font-weight: 600; margin: 0 0 8px; }
.ph span { font-weight: 400; opacity: 0.7; margin-left: 4px; }

#brand { position: absolute; left: 22px; top: 16px; z-index: 6; pointer-events: none; text-shadow: 0 2px 18px rgba(0,0,0,0.7); }
#brand .kicker { font-size: 11px; color: var(--acc); letter-spacing: 0.04em; font-weight: 600; }
#brand h1 { margin: 2px 0 0; font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  background: linear-gradient(180deg, #ffffff 10%, #9fd8ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
#brand .sub { font-size: 13px; color: var(--dim); margin-top: 3px; font-weight: 500; }
#brand .sub span { opacity: 0.7; }

#left { left: 16px; top: 112px; width: 300px; padding: 12px; max-height: calc(100% - 128px); overflow: auto; scrollbar-width: thin; }
#epList { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ep { text-align: left; background: rgba(255,255,255,0.035); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; cursor: pointer; transition: all .18s; }
.ep:hover { background: rgba(111,211,255,0.08); border-color: rgba(111,211,255,0.35); }
.ep.on { background: linear-gradient(135deg, rgba(111,211,255,0.2), rgba(111,211,255,0.05)); border-color: rgba(111,211,255,0.6); }
.ep b { display: block; font-size: 14px; font-weight: 800; }
.ep i { display: block; font-style: normal; font-size: 10.5px; color: var(--dim); margin-top: 1px; font-family: var(--mono); }
.card { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line); line-height: 1.55; font-size: 12.5px; }
#now .tt { font-size: 15px; font-weight: 800; display: flex; justify-content: space-between; align-items: baseline; }
#now .tt span { font-size: 11px; color: var(--dim); font-weight: 500; font-family: var(--mono); }
#now .sn { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim); }
#now .sn b { font-size: 14px; color: #fff; margin-right: 4px; }
#now .pos { font-family: var(--mono); font-size: 11.5px; color: #cfe3f5; margin-top: 1px; }
#now .kv { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin-top: 6px; font-size: 12px; }
#now .kv dt { color: var(--dim); }
#now .kv dd { margin: 0; font-family: var(--mono); color: #fff; text-align: right; }
#now .kv dd em { font-style: normal; color: var(--dim); font-size: 10.5px; margin-left: 4px; }
#now .kv dd.cool { color: #8fd0ff; }
#now .kv .sep { grid-column: 1 / -1; border-top: 1px solid var(--line); margin: 4px 0 2px; }
.story h3 { margin: 0 0 4px; font-size: 13.5px; }
.story p { margin: 4px 0 8px; color: #cfdbe7; }
.keys { display: flex; flex-direction: column; gap: 4px; }
.key { text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,0.03); border-radius: 9px; padding: 6px 8px; cursor: pointer; font-size: 12px; line-height: 1.4; }
.key b { color: var(--yel); font-family: var(--mono); font-weight: 600; margin-right: 6px; font-size: 11px; }
.key:hover, .key.on { border-color: rgba(255,212,121,0.55); background: rgba(255,212,121,0.08); }

#right { position: absolute; right: 16px; top: 16px; bottom: 96px; width: 290px; display: flex; flex-direction: column; gap: 10px; z-index: 5; pointer-events: none; }
#right > .panel { position: relative; pointer-events: auto; }
#layers { padding: 11px 14px; flex: 0 1 auto; min-height: 0; overflow: auto; scrollbar-width: thin; }
.grp { padding: 7px 0; border-top: 1px solid var(--line); }
.grp:first-of-type { border-top: 0; padding-top: 0; }
.lbl { font-size: 12px; color: var(--dim); margin-bottom: 6px; font-weight: 600; }
.tog em { font-style: normal; font-weight: 400; font-size: 11px; color: #6f8499; margin-left: 4px; }
.seg { display: flex; background: rgba(0,0,0,0.25); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 0 30%; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 4px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--dim); }
.seg.sm button { padding: 5px 4px; font-size: 12px; }
.seg button.on { background: rgba(111,211,255,0.18); color: #fff; box-shadow: inset 0 0 0 1px rgba(111,211,255,0.4); }
.seg button:disabled { opacity: 0.35; cursor: not-allowed; }
.row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.row output { min-width: 64px; text-align: right; color: #d7ecff; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; background: rgba(255,255,255,0.14); border-radius: 4px; outline: none; margin: 8px 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #dff4ff; border: 2px solid var(--acc); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #dff4ff; border: 2px solid var(--acc); cursor: pointer; }
.tog { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 13px; user-select: none; }
.tog.sm { font-weight: 500; font-size: 12.5px; margin-top: 5px; }
.tog input { display: none; }
.tog span { width: 28px; height: 16px; border-radius: 99px; background: rgba(255,255,255,0.14); position: relative; flex: none; transition: background .15s; }
.tog span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #c9d6e2; transition: transform .15s; }
.tog input:checked + span { background: rgba(111,211,255,0.55); }
.tog input:checked + span::after { transform: translateX(12px); background: #fff; }
.hint { font-size: 11px; margin-top: 5px; line-height: 1.45; }
.grp.chk { display: flex; flex-wrap: wrap; gap: 0 14px; }

#secPanel { flex: none; padding: 9px 10px 8px; }
#secCv { width: 100%; height: 190px; display: block; }
.note { font-size: 10.5px; color: var(--dim); margin-top: 3px; line-height: 1.4; }

#legend { left: 50%; transform: translateX(-50%); top: 16px; padding: 7px 12px 6px; display: flex; gap: 18px; align-items: center; }
.lg { min-width: 230px; }
.lg .t { font-size: 11.5px; color: var(--dim); margin-bottom: 3px; display: flex; justify-content: space-between; gap: 8px; }
.lg .t b { color: var(--txt); font-weight: 600; }
.lg .bar { height: 9px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }
.lg .ax { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: #b8c9da; margin-top: 2px; }

#timebar { left: calc(50% - 4px); transform: translateX(-50%); bottom: 16px; width: min(820px, calc(100vw - 680px)); min-width: 460px; padding: 8px 14px 6px 10px; display: flex; gap: 12px; align-items: center; }
#play { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(111,211,255,0.5); background: rgba(111,211,255,0.14); cursor: pointer; display: grid; place-items: center; flex: none; }
#play svg { width: 18px; height: 18px; fill: #e8f7ff; }
#play .i-pause { display: none; } #play.on .i-play { display: none; } #play.on .i-pause { display: block; }
.tl { flex: 1; min-width: 0; }
.tlhead { display: flex; gap: 10px; font-size: 13px; align-items: baseline; white-space: nowrap; }
.tlhead b { font-weight: 700; font-family: var(--mono); font-size: 13px; }
.tlhead span { font-size: 11px; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mini { border: 1px solid var(--line); background: rgba(255,255,255,0.05); border-radius: 7px; font-size: 11px; padding: 1px 7px; cursor: pointer; font-family: var(--mono); }
#track { position: relative; height: 40px; margin: 4px 8px 0 8px; cursor: pointer; touch-action: none; }
#spark { position: absolute; left: 0; right: 0; top: 0; height: 22px; width: 100%; }
#ticks { position: absolute; inset: 0; }
#ticks::before { content: ""; position: absolute; left: 0; right: 0; top: 22px; height: 2px; border-radius: 2px; background: rgba(255,255,255,0.14); }
.tk { position: absolute; top: 20px; transform: translateX(-50%); text-align: center; font-size: 10px; color: var(--dim); font-family: var(--mono); white-space: nowrap; }
.tk::before { content: ""; display: block; width: 1px; height: 6px; margin: 0 auto 1px; background: rgba(255,255,255,0.3); }
#thumb { position: absolute; top: 0; bottom: 14px; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 8px rgba(111,211,255,0.9); pointer-events: none; }
#thumb::after { content: ""; position: absolute; left: -6px; top: 16px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(111,211,255,0.35); }

#tip { position: fixed; z-index: 20; pointer-events: none; background: rgba(6, 12, 20, 0.92); border: 1px solid rgba(111,211,255,0.35); border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.55; min-width: 170px; box-shadow: 0 8px 30px rgba(0,0,0,0.45); }
#tip .v { font-family: var(--mono); color: #fff; }
#tip .k { color: var(--dim); display: inline-block; min-width: 62px; }
#tip .loc { color: var(--dim); font-family: var(--mono); font-size: 10.5px; margin-top: 3px; border-top: 1px solid var(--line); padding-top: 3px; }

.lab { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,0.95), 0 0 2px rgba(0,0,0,0.9); }
.lab.sea { font-size: 14px; font-weight: 700; color: rgba(214,238,255,0.8); letter-spacing: 0.08em; }
.lab.sea i { display: block; font-style: normal; font-size: 9.5px; font-weight: 500; color: rgba(170,205,235,0.65); letter-spacing: 0.1em; }
.lab.city { font-size: 11px; color: rgba(245,236,210,0.85); font-weight: 600; transform: translate(6px, -50%); }
.lab.city::before { content: ""; position: absolute; left: -7px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: #ffe7a8; box-shadow: 0 0 5px #ffd479; }
.lab.storm { font-size: 12px; font-weight: 800; color: #fff; padding: 3px 8px; border-radius: 8px; background: rgba(8,14,22,0.66); border: 1px solid rgba(255,255,255,0.25); transform: translate(-50%, calc(-100% - 10px)); text-shadow: none; }
.lab.storm span { font-family: var(--mono); font-weight: 500; font-size: 11px; color: #ffd9a8; margin-left: 5px; }
.lab.day { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,0.75); transform: translate(6px, -120%); }
.lab.buoy { font-size: 10px; color: #b9f3d9; transform: translate(5px, -50%); }

#down { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 4; font-size: 12px; color: var(--dim); text-decoration: none; padding: 4px 12px; border-radius: 99px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); display: none; }
#down span { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

#loading { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #0d1c2c, #04070b 70%); transition: opacity .6s; }
#loading.done { opacity: 0; pointer-events: none; }
.lb { text-align: center; color: var(--dim); font-size: 13px; }
.ring { width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid rgba(111,211,255,0.15); border-top-color: var(--acc); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 200px; height: 3px; background: rgba(255,255,255,0.1); border-radius: 3px; margin: 10px auto 0; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .3s; }
#err { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: #7a1d1d; color: #fff; padding: 6px 12px; font-size: 12px; font-family: var(--mono); }
#mtabs { display: none; }

/* ---------- document ---------- */
#doc { position: relative; z-index: 2; background: linear-gradient(180deg, #05090f 0%, #070d15 100%); border-top: 1px solid var(--line); }
.sec { max-width: 1160px; margin: 0 auto; padding: 56px 28px 26px; }
.sh { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.sh .no { font-family: var(--mono); color: var(--acc); font-size: 13px; }
.sh h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.sh .en { color: var(--dim); font-size: 12.5px; }
.lead { color: #c3d2e0; line-height: 1.7; margin: 0 0 14px; max-width: 900px; font-size: 14px; }
.prose { line-height: 1.75; color: #cfdbe7; font-size: 14px; }
.prose p { margin: 0 0 12px; }
.prose h3 { font-size: 15px; margin: 10px 0 6px; color: #fff; }
.prose ul { padding-left: 18px; margin: 4px 0 12px; }
.prose li { margin: 4px 0; }
.prose.small { font-size: 13px; line-height: 1.7; }
.cols2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
.cols2.tight { gap: 14px; grid-template-columns: 1.4fr 1fr; }
.chart { background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.chart canvas { width: 100%; display: block; }
.cap { font-size: 12.5px; color: var(--dim); line-height: 1.6; margin: 8px 2px 0; }
.legendrow { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: #c3d2e0; margin: 8px 2px 0; align-items: center; }
.legendrow i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legendrow i.dot { width: 9px; height: 9px; border-radius: 50%; }
.legendrow .bar { width: 240px; height: 9px; border-radius: 3px; margin: 0 6px; display: inline-block; vertical-align: middle; }
.maps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.maps3 figure { margin: 0; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.maps3 canvas { width: 100%; display: block; border-radius: 8px; }
.maps3 figcaption { font-size: 12px; color: var(--dim); padding: 6px 4px 2px; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: 11.5px; color: var(--dim); }
.stat .v { font-family: var(--mono); font-size: 22px; color: #fff; margin-top: 2px; }
.stat .v small { font-size: 12px; color: var(--dim); margin-left: 3px; }
.stat .s { font-size: 11px; color: var(--dim); margin-top: 2px; line-height: 1.4; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctrl { display: flex; gap: 14px; align-items: center; margin: 12px 2px 8px; font-size: 13px; flex-wrap: wrap; }
.ctrl select { background: #0c1826; color: var(--txt); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-family: inherit; font-size: 13px; margin-left: 6px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
.tbl th, .tbl td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-size: 12px; }
.tbl th { color: var(--dim); font-weight: 600; font-family: var(--sans); }
.tbl td:first-child, .tbl th:first-child { text-align: left; font-family: var(--sans); }
.tbl tr.sel td { background: rgba(111,211,255,0.08); }
.tbl tr { cursor: pointer; }
.tbl caption { text-align: left; font-size: 12px; color: var(--dim); padding: 4px 0; caption-side: top; }
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ex { background: rgba(255,255,255,0.025); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.ex h3 { margin: 0 0 8px; font-size: 16px; }
.ex p { margin: 0 0 10px; line-height: 1.75; color: #cfdbe7; font-size: 13.5px; }
#svgRes { width: 100%; height: auto; margin-top: 6px; }
#foot { max-width: 1160px; margin: 0 auto; padding: 26px 28px 40px; font-size: 12px; color: var(--dim); line-height: 1.7; border-top: 1px solid var(--line); }

/* ---------- mobile ---------- */
@media (max-width: 1100px) {
  #timebar { width: auto; left: 16px; right: 322px; transform: none; min-width: 0; }
  #left { width: 270px; }
}
@media (max-width: 760px) {
  html, body { font-size: 13px; }
  #stage { height: 100svh; min-height: 600px; }
  #right { display: contents; }
  #right > .panel { position: absolute; }
  #brand { left: 14px; top: 10px; }
  #brand h1 { font-size: 26px; }
  #brand .kicker { font-size: 9.5px; max-width: 360px; }
  #brand .sub { font-size: 11px; }
  #left, #layers, #secPanel { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(148px + env(safe-area-inset-bottom)); max-height: 48%; border-radius: 14px; display: none; overflow: auto; }
  #left.show, #layers.show, #secPanel.show { display: block; }
  #epList { grid-template-columns: repeat(4, 1fr); }
  .ep { padding: 6px 6px; } .ep b { font-size: 12.5px; } .ep i { font-size: 9.5px; }
  #legend { left: 8px; right: 8px; transform: none; top: auto; bottom: calc(148px + env(safe-area-inset-bottom)); justify-content: center; padding: 5px 8px; }
  .lg { min-width: 0; flex: 1; }
  .lg + .lg { display: none; }
  #legend.hidden { display: none; }
  #timebar { left: 8px; right: 8px; width: auto; min-width: 0; bottom: calc(54px + env(safe-area-inset-bottom)); padding: 6px 10px 4px 8px; gap: 8px; }
  #play { width: 34px; height: 34px; }
  .tlhead { font-size: 12px; } .tlhead span { display: none; }
  .tk { font-size: 9px; }
  #mtabs { display: flex; position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 7; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; backdrop-filter: blur(12px); }
  #mtabs button { flex: 1; border: 0; background: none; padding: 8px 0; font-size: 13px; font-weight: 700; color: var(--dim); border-radius: 9px; }
  #mtabs button.on { background: rgba(111,211,255,0.16); color: #fff; }
  #down { display: none !important; }
  .sec { padding: 40px 16px 16px; }
  .sh h2 { font-size: 20px; }
  .cols2, .cols2.tight, .maps3, .grid4 { grid-template-columns: 1fr; }
  .statgrid, .facts { grid-template-columns: 1fr 1fr; }
  #foot { padding: 20px 16px 36px; }
}
