:root {
  --bg: #05070b;
  --panel: #0d1119;
  --panel-2: #121826;
  --line: rgba(255, 255, 255, 0.12);
  --text: #e8edf3;
  --muted: #a3afbd;
  --accent: #7cc4ff;
  --accent-ink: #04121f;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
body { display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 8px; top: -40px; z-index: 10; background: var(--accent); color: var(--accent-ink); padding: 6px 10px; border-radius: 4px; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
button, input, .button {
  font: inherit; color: var(--text); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; min-height: 30px;
}
button, .button { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
button:hover, .button:hover { background: rgba(255, 255, 255, 0.12); }
#run { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.brand { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: 0.02em; }
.brand span { color: var(--muted); font-weight: 400; }
.search input { width: 240px; }
.links { margin-left: auto; display: flex; gap: 14px; }

.layout { flex: 1; display: grid; grid-template-columns: 290px 1fr; min-height: 0; }
.list { overflow: auto; border-right: 1px solid var(--line); background: var(--panel); padding: 6px 8px 20px; }
.list h3 { margin: 14px 4px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.list a { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: center; padding: 4px; border-radius: 6px; color: var(--text); text-decoration: none; }
.list a:hover { background: rgba(255, 255, 255, 0.06); }
.list a[aria-current="page"] { background: rgba(124, 196, 255, 0.16); box-shadow: inset 2px 0 0 var(--accent); }
.list img { width: 72px; height: 45px; object-fit: cover; border-radius: 4px; background: #111723; display: block; }
.list .t { font-weight: 550; font-size: 13px; }
.list .s { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list .none { color: var(--muted); padding: 8px; }

.work { display: grid; grid-template-columns: minmax(340px, 42%) 1fr; min-height: 0; }
.editor { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel-2); }
.head { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.head h2 { margin: 0 0 4px; font-size: 17px; }
.head p { margin: 0 0 4px; }
.cat { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.dlinks { font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.actions { display: flex; gap: 6px; flex-shrink: 0; }
#code {
  flex: 1; min-height: 0; resize: none; border: 0; border-radius: 0; padding: 10px 12px; margin: 0;
  background: #0a0e15; color: #dbe6f2; font: 12.5px/1.5 var(--mono); tab-size: 2; white-space: pre; overflow: auto;
}
.hint { margin: 0; padding: 6px 12px; font-size: 12px; border-top: 1px solid var(--line); }
.hint code { font-family: var(--mono); color: var(--text); }
.live { position: relative; min-height: 0; }
#frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }

@media (max-width: 1100px) {
  .work { grid-template-columns: 1fr; grid-template-rows: minmax(300px, 1fr) minmax(320px, 1fr); }
  .editor { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; }
  .list { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .work { grid-template-rows: auto 60vh; }
  .editor { min-height: 60vh; }
  .search input { width: 100%; }
  .search { flex: 1; }
  .links { margin-left: 0; }
  .head { flex-direction: column; }
}
