:root {
  --bg: #060b12; --glass: rgba(12, 20, 32, 0.76); --glass2: rgba(20, 32, 48, 0.8); --line: rgba(150, 190, 230, 0.16);
  --txt: #e6eef6; --dim: #8fa3b8; --acc: #6fd3ff; --yel: #ffd479; --red: #ff7a6b;
  --c1: #7fd6ff; --c2: #4f8cff; --c3: #ffb454;
  --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, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--txt); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
.mono, output { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--dim); }
button { font-family: inherit; color: inherit; }
.panel { position: fixed; 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; }
.ph { font-size: 12px; letter-spacing: 0.06em; color: var(--dim); font-weight: 700; margin: 0 0 8px; }
.ph span { font-weight: 400; opacity: 0.7; margin-left: 4px; }
.ph.mt { margin-top: 14px; }
#brand { position: fixed; 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: 11.5px; color: var(--acc); letter-spacing: 0.04em; font-weight: 600; }
#brand h1 { margin: 2px 0 0; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  background: linear-gradient(180deg, #fff 10%, #9fd8ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
#brand .sub { font-size: 13px; color: var(--dim); margin-top: 3px; }
#left { left: 16px; top: 104px; width: 318px; padding: 12px 13px; max-height: calc(100vh - 150px); overflow: auto; scrollbar-width: thin; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.seg3 button { background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 9px; padding: 7px 4px; cursor: pointer; font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.seg3 button i { display: block; font-style: normal; font-weight: 400; font-size: 10px; color: var(--dim); }
.seg3 button.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); }
.ginfo { margin-top: 8px; font-size: 11.5px; color: #c6d4e2; line-height: 1.55; background: var(--glass2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; }
.ginfo b { color: #fff; }
.comp { padding: 8px 0 6px; border-top: 1px solid var(--line); }
.comp:first-of-type { border-top: 0; }
.ch { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.ch b { font-size: 13px; }
.ch output { color: var(--acc); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.chips button { font-size: 11px; padding: 4px 7px; border-radius: 99px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); cursor: pointer; line-height: 1.2; }
.chips button em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--dim); margin-left: 3px; }
.chips button.on { background: rgba(111,211,255,0.16); border-color: rgba(111,211,255,0.6); }
.chips button.on em { color: var(--acc); }
input[type=range] { width: 100%; accent-color: var(--acc); margin: 2px 0 0; }
.warn { margin-top: 8px; font-size: 11.5px; color: var(--yel); background: rgba(255,212,121,0.08); border: 1px solid rgba(255,212,121,0.3); border-radius: 9px; padding: 6px 8px; line-height: 1.5; }
#res { right: 16px; top: 16px; width: 330px; padding: 13px 14px; max-height: calc(100vh - 60px); overflow: auto; scrollbar-width: thin; }
.big b { font-size: 34px; font-weight: 700; color: #fff; margin: 0 6px; font-family: var(--mono); }
.k { font-size: 12px; color: var(--dim); font-weight: 600; display: block; }
.u { font-size: 11.5px; color: var(--dim); }
.big > div { display: flex; flex-wrap: wrap; align-items: baseline; }
.big .k { width: 100%; }
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 6px 0 4px; background: rgba(255,255,255,0.05); }
.stack i { display: block; height: 100%; }
.stackl { display: flex; gap: 10px; font-size: 10.5px; color: var(--dim); flex-wrap: wrap; margin-bottom: 8px; }
.stackl span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: var(--c); vertical-align: -1px; }
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 6px; }
.nums > div { background: var(--glass2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; }
.nums b { font-size: 21px; color: #fff; font-family: var(--mono); font-weight: 700; margin-right: 3px; }
.cmp { font-size: 11.5px; color: #c6d4e2; line-height: 1.5; margin-bottom: 8px; }
.cmp b { color: #fff; font-family: var(--mono); font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.seg button { font-size: 11px; padding: 6px 4px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); cursor: pointer; }
.seg button.on { background: rgba(111,211,255,0.16); border-color: rgba(111,211,255,0.6); }
#curve { width: 100%; height: 150px; display: block; }
.note { font-size: 10.5px; color: var(--dim); margin: 3px 0 8px; line-height: 1.45; }
.datum { font-size: 11.5px; line-height: 1.6; background: var(--glass2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.datum h4 { margin: 0 0 4px; font-size: 12px; color: var(--dim); }
.datum .row { display: flex; justify-content: space-between; }
.datum .row b { font-family: var(--mono); font-weight: 600; }
.datum .sm { font-size: 10.5px; color: var(--dim); margin-top: 4px; line-height: 1.45; }
#legend { left: 50%; transform: translateX(-50%); bottom: 34px; padding: 7px 12px 6px; width: 260px; }
.lt { font-size: 11.5px; font-weight: 700; margin-bottom: 4px; }
.lbar { height: 9px; border-radius: 4px; background: linear-gradient(90deg, #b8f0ff 0%, #6fc8f5 16%, #3f8fe0 33%, #3a55c2 66%, #3a2a8a 100%); }
.lticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 2px; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.lab { position: absolute; transform: translate(-50%, -100%); font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,0.8); padding-bottom: 6px; }
.lab::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 6px; background: rgba(255,255,255,0.8); }
.lab.g { color: var(--yel); }
#tip { position: fixed; z-index: 8; pointer-events: none; background: rgba(8,14,22,0.92); border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; font-size: 11.5px; line-height: 1.5; min-width: 150px; }
#tip b { font-family: var(--mono); font-weight: 600; }
.pill { position: fixed; z-index: 6; right: 362px; bottom: 34px; background: var(--glass); border: 1px solid var(--line); border-radius: 99px; padding: 7px 13px; font-size: 12px; cursor: pointer; backdrop-filter: blur(10px); }
#credit { position: fixed; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 10.5px; color: var(--dim); z-index: 4; pointer-events: none; text-shadow: 0 1px 4px #000; padding: 0 10px; }
#mtabs { display: none; }
dialog#about { max-width: 720px; width: calc(100vw - 32px); max-height: 86vh; background: #0b1420; color: var(--txt); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; line-height: 1.65; font-size: 13.5px; }
dialog#about::backdrop { background: rgba(0,0,0,0.6); }
dialog h2 { margin: 0 0 8px; font-size: 20px; } dialog h3 { margin: 16px 0 4px; font-size: 14.5px; color: var(--acc); }
dialog ul { padding-left: 18px; margin: 4px 0; } dialog li { margin: 3px 0; }
dialog .x { position: absolute; right: 12px; top: 8px; background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--dim); }
#loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; background: rgba(6,11,18,0.9); transition: opacity .4s; }
#loading.done { opacity: 0; pointer-events: none; }
.lb { text-align: center; color: var(--dim); font-size: 13px; }
.ring { width: 38px; height: 38px; border: 3px solid rgba(111,211,255,0.2); border-top-color: var(--acc); border-radius: 50%; margin: 0 auto 10px; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
#err { position: fixed; top: 0; left: 0; right: 0; background: #b3261e; color: #fff; z-index: 30; padding: 6px 10px; font-size: 12px; }
@media (max-width: 760px) {
  #brand { left: 14px; top: 10px; } #brand h1 { font-size: 24px; } #brand .kicker { font-size: 10.5px; } #brand .sub { display: none; }
  #left, #res { left: 8px; right: 8px; width: auto; top: auto; bottom: 88px; max-height: 50vh; }
  #res.hide, #left.hide { display: none; }
  #legend { bottom: auto; top: 70px; width: 200px; left: auto; right: 8px; transform: none; }
  .pill { right: 8px; bottom: auto; top: 158px; }
  #mtabs { display: flex; position: fixed; left: 8px; right: 8px; bottom: 30px; z-index: 7; gap: 4px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
  #mtabs button { flex: 1; background: none; border: 0; padding: 8px; border-radius: 9px; font-size: 13px; }
  #mtabs button.on { background: rgba(111,211,255,0.16); }
  #credit { font-size: 9.5px; bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .big b { font-size: 28px; }
}
.lt2 { font-size: 10.5px; color: var(--dim); margin-top: 4px; } .lt2 i { display: inline-block; width: 10px; height: 8px; background: #5d7a8f; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
