:root {
  --bg: #0d1117; --panel: #161b22; --panel-2: #1c2430; --line: #2a3140;
  --fg: #e6edf3; --muted: #8b949e; --accent: #6ea8fe; --accent-2: #7ee787;
  --fail: #ff7b72; --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--sans); display: flex; flex-direction: column; }

header {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; letter-spacing: -.5px; }
.brand span { color: var(--accent); }
nav { display: flex; gap: .25rem; }
nav button { background: none; border: 0; color: var(--muted); padding: .4rem .8rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
nav button:hover { color: var(--fg); }
nav button.active { color: var(--fg); background: var(--panel-2); }
.status { margin-left: auto; color: var(--accent-2); font-family: var(--mono); font-size: .78rem; }

main { flex: 1; overflow: hidden; }
.view { display: none; height: 100%; }
.view.active { display: flex; }

.problems { width: 240px; border-right: 1px solid var(--line); padding: 1rem; overflow: auto; background: var(--panel); }
.problems h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .6rem; }
.problems ul { list-style: none; margin: 0; padding: 0; }
.problems li { padding: .5rem .6rem; border-radius: 6px; cursor: pointer; font-size: .88rem; margin-bottom: 2px; }
.problems li:hover { background: var(--panel-2); }
.problems li.active { background: var(--panel-2); color: var(--accent); }
.problems li .track { display: inline-block; font-family: var(--mono); font-size: .62rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; margin-right: .4rem; }

.workspace { flex: 1; display: flex; flex-direction: column; padding: 1.2rem 1.5rem; overflow: auto; gap: 1rem; }
.problem-head { display: flex; align-items: center; gap: 1rem; }
.problem-head h1 { font-size: 1.3rem; margin: 0; }
.controls { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.controls label { font-size: .78rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; }
select { background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .5rem; font-family: var(--mono); }
button.primary { background: var(--accent); color: #06101f; border: 0; border-radius: 7px; padding: .5rem .9rem; font-weight: 600; cursor: pointer; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 7px; padding: .5rem .8rem; cursor: pointer; }
button.ghost:hover { color: var(--fg); }

.statement { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; color: var(--muted); }
.statement h1 { display: none; }

.editor-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.editor-label { position: absolute; top: 0; right: 0; font-family: var(--mono); font-size: .68rem; color: var(--muted); padding: .3rem .6rem; background: var(--panel); border-bottom-left-radius: 8px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#editor { width: 100%; min-height: 260px; resize: vertical; background: transparent; color: var(--fg); border: 0; padding: 1rem; font-family: var(--mono); font-size: .86rem; line-height: 1.6; outline: none; tab-size: 2; }

.results { min-height: 60px; }
.results .hint { color: var(--muted); font-size: .85rem; line-height: 1.5; background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: .9rem 1rem; }
.case { font-family: var(--mono); font-size: .82rem; padding: .35rem .6rem; border-radius: 6px; margin-bottom: 3px; }
.case.pass { color: var(--accent-2); background: rgba(126,231,135,.08); }
.case.fail { color: var(--fail); background: rgba(255,123,114,.08); }
.summary { font-family: var(--mono); font-weight: 700; margin-top: .5rem; }
.summary.ok { color: var(--accent-2); }
.summary.bad { color: var(--fail); }
.needs-runtime { color: var(--accent); background: rgba(110,168,254,.08); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; font-size: .85rem; }

.docs { max-width: 820px; margin: 0 auto; padding: 2rem 1.5rem; line-height: 1.65; }
.docs h1, .docs h2 { line-height: 1.25; }
.docs code { font-family: var(--mono); background: var(--panel-2); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }
.docs pre { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; overflow: auto; }
.docs pre code { background: none; padding: 0; }

.preview-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
#preview { width: 100%; height: 240px; border: 0; display: block; background: #fff; }


footer {
  padding: .55rem 1.2rem; border-top: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: .74rem; text-align: center;
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.update-available { color: var(--accent); margin-left: .4rem; text-decoration: none; }
.update-available:hover { text-decoration: underline; }
