:root {
  --bg: #0b1220;
  --panel: rgba(13, 21, 36, 0.86);
  --panel-line: rgba(255, 255, 255, 0.10);
  --text: #e8edf5;
  --muted: #9aa8bd;
  --accent: #ffd23f;
  --ridge: #ff5a4e;
  --subduction: #ffd23f;
  --transform: #3ddc97;
  --other: #b8c0cc;
  --land: #c9b98f;
  font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
canvas#globe { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.panel {
  position: fixed; z-index: 2; background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.top { top: 16px; left: 16px; width: 320px; max-height: calc(100% - 128px); overflow-y: auto; padding: 14px 16px; }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
h1 { font-size: 18px; margin: 0; letter-spacing: 0.01em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.sub { margin: 4px 0 10px; color: var(--muted); font-size: 13px; }

.back { display: inline-block; font-size: 12px; color: #9cc7ff; margin: 0 0 6px; text-decoration: none; }
.back:hover { text-decoration: underline; }

.lang { font-size: 12px; color: var(--muted); white-space: nowrap; }
.lang button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 2px 4px; }
.lang button[aria-current="true"] { color: var(--text); font-weight: 700; }

.age-block { margin: 6px 0 12px; }
.age { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.period { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.period i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.legend ul { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.sw { width: 28px; flex: none; display: inline-block; position: relative; }
.sw.line { height: 3px; border-radius: 2px; }
.sw.ridge { background: var(--ridge); }
.sw.transform { background: var(--transform); }
.sw.other { background: var(--other); height: 2px; opacity: 0.7; }
.sw.subduction { background: var(--subduction); }
.sw.subduction i { position: absolute; top: -6px; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 6px solid var(--subduction); }
.sw.subduction i:nth-child(1) { left: 2px; } .sw.subduction i:nth-child(2) { left: 11px; } .sw.subduction i:nth-child(3) { left: 20px; }
.sw.land { height: 12px; background: var(--land); border-radius: 2px; }
.sw.plates { height: 12px; border-radius: 2px; background: linear-gradient(90deg, #6f9fd8 0 33%, #d88f6f 33% 66%, #79c29a 66%); opacity: 0.7; }

.info { border-top: 1px solid var(--panel-line); padding-top: 10px; font-size: 13px; min-height: 40px; }
.info .hint { color: var(--muted); margin: 0; }
.info .name { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.info dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-variant-numeric: tabular-nums; }
.info .note { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

.source { border-top: 1px solid var(--panel-line); margin-top: 10px; padding-top: 8px; font-size: 12px; color: var(--muted); }
.source summary { cursor: pointer; color: var(--text); font-size: 13px; }
.source p { margin: 6px 0; line-height: 1.45; }
.source a { color: #9cc7ff; }
.source .caveat { color: var(--text); }

.timeline {
  left: 16px; right: 16px; bottom: 16px; padding: 10px 14px;
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "play track speed" "status status status";
  align-items: center; gap: 4px 14px;
}
.play { grid-area: play; display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #1a1a1a; border: 0; border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; min-width: 96px; justify-content: center; }
.play:focus-visible, .lang button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #9cc7ff; outline-offset: 2px; }
.track { grid-area: track; position: relative; padding-top: 16px; }
.periods { position: absolute; top: 14px; left: 0; right: 0; height: 8px; display: flex; }
.periods span { height: 100%; opacity: 0.85; position: relative; }
.periods span b { position: absolute; top: -15px; left: 2px; font-size: 10px; font-weight: 500; color: var(--muted); white-space: nowrap; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 12px 0 0; }
.ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.speed { grid-area: speed; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.speed select { background: #1a2436; color: var(--text); border: 1px solid var(--panel-line); border-radius: 6px; padding: 4px; font: inherit; }
.status { grid-area: status; font-size: 11px; color: var(--muted); min-height: 14px; }

@media (max-width: 640px) {
  .top { left: 16px; right: 16px; width: auto; top: 12px; max-height: 42%; padding: 10px 12px; }
  .sub, .legend { display: none; }
  .age { font-size: 26px; }
  .timeline { left: 8px; right: 8px; bottom: 8px; grid-template-columns: auto 1fr; grid-template-areas: "play track" "speed status"; }
  .periods span b { display: none; }
}
