:root {
  --bg: #0d1424;
  --bg2: #131c31;
  --panel: #182238;
  --line: #26324d;
  --text: #e8edf7;
  --muted: #93a0bb;
  --accent: #ffcc33;
  --accent-ink: #1a1400;
  --danger: #ff7b7b;
  --ok: #7fdca4;
  --b1: #fbc400; --b2: #69c8f2; --b3: #ff7272; --b4: #aaaaaa; --b5: #b0d840;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f7; --bg2: #e3e8f2; --panel: #ffffff; --line: #d6dce8;
    --text: #18213a; --muted: #5d6882; --accent: #e8a800; --accent-ink: #1a1400;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans KR", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1d2a4a 0%, transparent 60%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
@media (prefers-color-scheme: light) {
  body { background: var(--bg); }
}

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.15rem; font-weight: 900; margin: 0; letter-spacing: -0.02em; }
.logo {
  width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(var(--b1) 0 20%, var(--b2) 0 40%, var(--b3) 0 60%, var(--b4) 0 80%, var(--b5) 0);
  box-shadow: inset 0 0 0 5px var(--bg);
}
.data-badge { font-size: 0.8rem; color: var(--muted); text-align: right; }

.layout {
  flex: 1;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr);
  gap: 20px; padding: 20px 24px; max-width: 1440px; width: 100%; margin: 0 auto;
}
.stage {
  position: relative; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  height: min(78vh, 760px); min-height: 520px;
  display: flex; flex-direction: column;
}
.scene { position: relative; flex: 1; min-height: 0; }
.scene canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.stage-caption {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center;
  font-weight: 700; font-size: 0.95rem; pointer-events: none;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.stage-note { margin: 0; padding: 8px 14px 12px; font-size: 0.75rem; color: var(--muted); text-align: center; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; min-width: 0;
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px -4px 14px; padding: 0 4px; }
.tab {
  flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700;
  padding: 10px 6px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tabpane[hidden] { display: none; }

.seg { display: inline-flex; background: var(--bg2); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg-btn {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700;
  padding: 7px 18px; border-radius: 999px; cursor: pointer;
}
.seg-btn.active { background: var(--accent); color: var(--accent-ink); }

label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
label.inline select { width: auto; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 0.85rem; }
input[type="text"], input[type="number"], select {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 0.9rem; min-width: 0; width: 100%;
}
input.short { width: 76px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid3 { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 10px; }
.actions { margin: 12px 0 4px; }

.btn {
  font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; padding: 12px 28px; font-size: 1rem; }
.btn.ghost:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: progress; }

.filter-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 4px; }
.filter-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
table.cond { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.cond th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px; white-space: nowrap; }
table.cond td { padding: 4px; }
table.cond td input[type="number"] { width: 72px; padding: 6px 8px; }
.src { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.src.user { background: rgba(105, 200, 242, 0.18); color: var(--b2); }
.src.suggested { background: rgba(255, 204, 51, 0.16); color: var(--accent); }
.src.none { color: var(--muted); }
.hint { font-size: 0.78rem; color: var(--muted); line-height: 1.55; margin: 8px 0 0; }

.error { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(255,123,123,0.12); color: var(--danger); font-size: 0.88rem; white-space: pre-wrap; }

.result { margin-top: 14px; }
.games { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.games li {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent;
}
.games li:hover, .games li.current { border-color: var(--line); background: var(--bg2); }
.games .tag { width: 22px; font-weight: 900; color: var(--muted); font-size: 0.85rem; }
.chip {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 900; font-size: 0.92rem; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  box-shadow: inset -3px -4px 8px rgba(0,0,0,0.22), inset 3px 3px 6px rgba(255,255,255,0.35);
  animation: pop 0.35s both;
}
.chip.sm { width: 28px; height: 28px; font-size: 0.8rem; }
.z1 { background: var(--b1); } .z2 { background: var(--b2); } .z3 { background: var(--b3); }
.z4 { background: var(--b4); } .z5 { background: var(--b5); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chip { animation: none; } }

.info { margin-top: 12px; font-size: 0.82rem; line-height: 1.6; color: var(--muted); }
.info b { color: var(--text); }
.info ul { margin: 4px 0; padding-left: 18px; }

/* 통계 */
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; }
.card h3 { margin: 0 0 8px; font-size: 0.9rem; }
.freq { display: grid; grid-template-columns: repeat(45, 1fr); align-items: end; gap: 2px; height: 130px; position: relative; }
.freq .bar { border-radius: 3px 3px 0 0; min-height: 2px; }
.freq .exp { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--text); opacity: 0.45; }
.freq-axis { display: grid; grid-template-columns: repeat(45, 1fr); gap: 2px; font-size: 0.55rem; color: var(--muted); text-align: center; margin-top: 3px; }
.hbars { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.hbar { display: grid; grid-template-columns: 70px 1fr 74px; align-items: center; gap: 8px; }
.hbar .track { background: var(--bg2); border-radius: 4px; height: 12px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--b2); }
.hbar .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.kv div { background: var(--bg2); border-radius: 8px; padding: 8px; }
.kv span { display: block; font-size: 0.72rem; color: var(--muted); }
.kv b { font-size: 1.05rem; }

/* 검증 */
table.bt { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
table.bt th, table.bt td { padding: 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.bt th:first-child, table.bt td:first-child { text-align: left; color: var(--muted); }
.verdict { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--bg2); font-size: 0.85rem; line-height: 1.55; }
.warn { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: rgba(255,204,51,0.12); color: var(--accent); font-size: 0.85rem; line-height: 1.55; }

.notice { text-align: center; font-size: 0.8rem; color: var(--muted); padding: 12px 16px 18px; }

@media (max-width: 900px) {
  .top { padding: 12px 16px; }
  .layout { grid-template-columns: 1fr; padding: 12px 16px; gap: 14px; }
  .stage { height: 62vh; min-height: 400px; }
  .grid3 { grid-template-columns: 80px 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 label:first-child { grid-column: 1 / -1; }
  .chip { width: 30px; height: 30px; font-size: 0.82rem; }
  .data-badge { display: none; }
}


/* SDLAB studio — shared light-first visual identity, October 2026. */
@font-face{font-family:Pretendard;src:url('assets/PretendardVariable.woff2') format('woff2');font-weight:45 920;font-display:swap}
:root,:root:not([data-theme="dark"]){--bg:#f6f9f8;--bg2:#edf5f1;--panel:#fff;--line:#dce8e3;--text:#173d34;--muted:#5e766d;--accent:#087f6b;--accent-ink:#fff;--danger:#b73545;--ok:#087b60;--radius:24px;color-scheme:light}
:root[data-theme="dark"]{--bg:#101e1b;--bg2:#1c302a;--panel:#182923;--line:#355046;--text:#e7f5ee;--muted:#abc4b8;--accent:#84ddbf;--accent-ink:#112a21;--danger:#ff9caa;--ok:#84ddbf;color-scheme:dark}
body{font-family:Pretendard,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg);min-height:100dvh;line-height:1.65}
a{color:inherit}button,input,select{font:inherit}button{touch-action:manipulation}button:focus-visible,input:focus-visible,a:focus-visible,[tabindex]:focus-visible{outline:3px solid var(--accent);outline-offset:4px}
[hidden]{display:none!important}.skip-link{position:fixed;left:12px;top:-100px;background:var(--accent);color:var(--accent-ink);padding:12px;z-index:10}.skip-link:focus{top:12px}
.top{max-width:1240px;width:100%;margin:auto;padding:22px 32px;border-bottom:1px solid var(--line)}.brand{text-decoration:none;gap:20px}.brand-word{font-weight:850;font-size:32px;letter-spacing:-1.8px}.brand-word>span{color:var(--accent)}.brand-divider{border-left:1px solid var(--line);padding-left:20px;font-size:12px;color:var(--muted)}.back-home{font-size:12px;text-decoration:none}
.intro{max-width:1240px;width:100%;margin:0 auto;padding:48px 32px 30px;display:flex;align-items:flex-end;justify-content:space-between;gap:28px}.eyebrow{font-size:10px;letter-spacing:2.1px;color:var(--accent);font-weight:750;margin:0 0 16px}.intro h1{font-size:clamp(32px,4vw,54px);line-height:1.18;letter-spacing:-2.5px;margin:0 0 18px;font-weight:780}.intro h1 em{font-style:normal;color:var(--accent)}.intro-copy{color:var(--muted);font-size:15px;margin:0}.intro-meta{max-width:300px;padding-bottom:6px}.meta-label{font-size:10px;letter-spacing:2px;font-weight:750}.data-badge{text-align:left;line-height:1.9;font-size:12px;margin-top:13px}.probability{display:block;margin-top:18px;font-size:11px;color:var(--muted);border-top:1px solid var(--line);padding-top:12px}.probability b{display:block;font-size:19px;letter-spacing:1px;color:var(--text);margin-top:4px}
.layout{max-width:1240px;padding:12px 32px 32px;grid-template-columns:minmax(0,1fr) minmax(0,1.08fr);gap:24px;align-items:start;flex:0}.stage{height:570px;min-height:0;background:var(--bg2);border:0;position:sticky;top:24px;box-shadow:inset 0 0 0 1px var(--line)}.stage-heading{position:absolute;inset:23px 25px auto;display:flex;align-items:center;justify-content:space-between;z-index:2;font-size:10px;letter-spacing:1.8px;font-weight:750;color:var(--muted);pointer-events:none}.live-dot{color:var(--accent);letter-spacing:1px}.live-dot:before{content:'';display:inline-block;width:6px;height:6px;background:var(--accent);border-radius:50%;margin-right:7px}.scene{min-height:320px}.scene-fallback{width:100%;height:100%;object-fit:cover;position:absolute;inset:0;display:block}.scene[data-renderer="three"] .scene-fallback{visibility:hidden}.scene[data-renderer="fallback"] canvas{display:none}.stage-caption{top:auto;bottom:63px;left:24px;right:24px;font-size:13px;text-shadow:none;padding:10px 12px;background:var(--panel);border:1px solid var(--line);border-radius:10px;line-height:1.5}.stage-note{padding:14px 24px 18px;font-size:11px;line-height:1.65;max-width:450px;align-self:center}
.panel{border:1px solid var(--line);background:var(--panel);border-radius:24px;overflow:hidden;padding:0;min-width:0;box-shadow:0 12px 45px #173d3405}.tabs{padding:8px 16px 0;gap:0;border-bottom:1px solid var(--line);margin:0;background:none;display:flex}.tab{border:0;border-radius:0;background:transparent;color:var(--muted);padding:16px 12px;flex:1;font-size:13px;min-height:48px}.tab.active{color:var(--accent);background:transparent;box-shadow:inset 0 -3px var(--accent);font-weight:750}.tabpane{padding:24px;min-width:0}.panel-intro h2{font-size:23px;letter-spacing:-.8px;margin:0 0 6px}.panel-intro p{color:var(--muted);font-size:13px;margin:0 0 23px}.seg{background:var(--bg);border:1px solid var(--line);border-radius:12px;padding:4px;gap:4px;margin-bottom:22px}.seg-btn{border-radius:8px;min-height:44px;font-size:13px}.seg-btn.active{background:var(--panel);color:var(--accent);box-shadow:0 2px 7px #173d3412;border:1px solid var(--line)}.grid3{gap:12px;grid-template-columns:.65fr 1fr 1fr}.grid3 label{font-size:12px;color:var(--muted);gap:7px}input:not([type=checkbox]),select{border:1px solid var(--line);background:var(--bg);color:var(--text);border-radius:9px;min-height:46px;padding:10px 12px;font-size:14px;min-width:0}input[type=checkbox]{accent-color:var(--accent);width:16px;height:16px}.actions{margin-top:22px;gap:12px}.actions .primary{flex:1;min-height:52px;font-size:16px;font-weight:750;border-radius:12px;box-shadow:0 5px 12px #087f6b17}.check{font-size:12px;color:var(--muted);white-space:normal}.btn.ghost{border-color:var(--line);background:var(--panel);color:var(--text);border-radius:8px;min-height:42px;font-size:12px}.primary:hover{filter:brightness(1.06)}.btn:disabled{opacity:.6;cursor:wait}.filter-box{background:var(--bg);border-color:var(--line);padding:12px;border-radius:12px}.cond input[type=number]{padding:6px;width:100%;font-size:12px;min-height:38px}.cond td{padding:7px 3px}.cond th{font-size:10px}.cond td:first-child{font-size:12px;white-space:nowrap}.src{white-space:normal}.filter-head{gap:10px;flex-wrap:wrap}
.result{border-top:1px solid var(--line);padding-top:22px;margin-top:24px}.result-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.result-heading h3{font-size:16px;margin:0}.result-heading span{font-size:11px;color:var(--accent)}.games{padding:0;display:grid;gap:9px}.games li{background:var(--bg);border:1px solid var(--line);border-radius:11px;padding:12px;display:flex;align-items:center;gap:9px;cursor:pointer}.games li.current{background:var(--bg2);border-color:color-mix(in srgb,var(--accent) 35%,var(--line))}.games .tag{color:var(--muted);font-size:12px;width:18px;flex-shrink:0}.chip{width:36px;height:36px;font-size:14px;font-weight:800;border:0;box-shadow:inset 0 -3px 4px #0000000f,0 3px 5px #173d3410;color:#142d29;flex-shrink:0}.info{font-size:11px;color:var(--muted);line-height:1.8}.hint{font-size:12px;line-height:1.8}.error{border-radius:10px;line-height:1.8;font-size:13px}.card,.kv{background:var(--bg);border-color:var(--line)}.freq{min-width:0}.freq-label{color:var(--text)}.notice{max-width:1176px;margin:0 auto;width:calc(100% - 64px);padding:25px 0 32px;border-top:1px solid var(--line);background:transparent;text-align:center;font-size:11px;color:var(--muted)}.how-it-works{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:40px;max-width:1240px;padding:28px 32px 44px;margin:auto;width:100%}.how-it-works span{font-size:10px;letter-spacing:1.5px;color:var(--accent);font-weight:700}.how-it-works h2{font-size:17px;margin:10px 0}.how-it-works p{font-size:13px;color:var(--muted);line-height:1.9;margin:0}.embedded body{min-height:0;background:transparent}.embedded .intro,.embedded .top,.embedded .how-it-works,.embedded .notice{display:none}.embedded .layout{padding:0;max-width:none;margin:0}.embedded .stage{position:relative;top:auto}
@media(max-width:820px){.intro{padding-top:30px}.intro-meta{max-width:220px}.layout{grid-template-columns:1fr}.stage{height:380px;position:relative;top:auto}.scene{min-height:260px}.stage-note{max-width:100%}.panel{border-radius:20px}.how-it-works{gap:24px}.stage-caption{bottom:52px}}
@media(max-width:560px){.top{padding:15px 20px}.brand-divider{display:none}.brand-word{font-size:27px}.intro{padding:28px 20px 20px;display:block}.intro h1{font-size:36px;letter-spacing:-1.8px}.intro-copy{font-size:13px}.intro-meta{max-width:none;margin-top:20px;border-top:1px solid var(--line);padding-top:12px}.meta-label,.probability{display:none}.data-badge{margin:0;font-size:11px}.layout{padding:8px 16px 24px;gap:16px}.stage{height:305px;border-radius:20px}.scene{min-height:220px}.stage-heading{inset:17px 18px auto;font-size:9px}.stage-caption{font-size:11px;left:16px;right:16px;bottom:49px;padding:8px}.stage-note{font-size:10px;padding:10px 15px}.tabpane{padding:20px 16px}.tabs{padding:4px 8px 0}.tab{padding:14px 8px;font-size:12px}.panel-intro h2{font-size:21px}.grid3{gap:8px}.grid3 label{font-size:11px}input:not([type=checkbox]),select{font-size:16px;padding:9px 8px}.games li{gap:6px;padding:10px 8px}.chip{width:32px;height:32px;font-size:12px}.games .tag{width:15px}.how-it-works{grid-template-columns:1fr;padding:10px 24px 28px;gap:24px}.notice{width:calc(100% - 40px);font-size:10px}.row{flex-wrap:wrap}.cond td:first-child{font-size:11px}.src{font-size:9px}.embedded .stage{height:280px}.cond{width:100%;table-layout:fixed}.cond th:first-child{width:27%}.cond th:nth-child(4){width:22%}.cond th:last-child{width:12%}.bt{font-size:10px;table-layout:fixed;width:100%}.bt td,.bt th{padding:5px;overflow-wrap:anywhere}.kv{grid-template-columns:1fr}.result-heading{flex-wrap:wrap}}
@media(max-width:359px){.chip{width:28px;height:28px}.games li{gap:5px}.panel-intro h2{font-size:19px}.tab{font-size:11px}.grid3{grid-template-columns:1fr 1fr}.grid3 label:first-child{grid-column:1/-1}.actions .primary{min-width:100%}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.games{max-height:420px;scrollbar-width:thin;scrollbar-color:var(--line) transparent}.chip{text-shadow:none}.stage-heading,.stage-caption{user-select:none}
