:root {
  color-scheme: light;
  --bg: #f4f4f2; --surface: #fcfcfb; --surface-2: #f0efec; --line: #dedcd6;
  --ink: #0b0b0b; --ink-2: #52514e; --ink-3: #7a7873; --accent: #0f8b94;
  --rail: 208px; --rail-narrow: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --line: #33322f;
    --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #8f8e86; --accent: #39c5cf;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --line: #33322f;
  --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #8f8e86; --accent: #39c5cf;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100dvh; }

.rail { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-right: 1px solid var(--line); min-width: 0; }
.brand { padding: 4px 8px 12px; }
.brand .mark { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.brand .tag { display: block; font-size: 11px; color: var(--ink-3); line-height: 1.3; }
.tab { display: grid; grid-template-columns: 26px minmax(0, 1fr); grid-template-areas: "ico lbl" "ico hint"; column-gap: 8px; align-items: center;
  text-align: left; font: inherit; color: var(--ink-2); background: transparent; border: 1px solid transparent; border-radius: 10px;
  padding: 9px 8px; min-height: 48px; cursor: pointer; width: 100%; }
.tab .ico { grid-area: ico; font-size: 18px; text-align: center; }
.tab .lbl { grid-area: lbl; font-weight: 600; color: var(--ink); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .hint { grid-area: hint; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab:hover { background: var(--surface-2); }
.tab.on { background: var(--surface-2); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.spacer { flex: 1; }
.open { font-size: 12px; color: var(--accent); text-decoration: none; padding: 6px 8px; }
.by { font-size: 11px; color: var(--ink-3); padding: 2px 8px; }

.stage { min-width: 0; min-height: 0; position: relative; }
.frames { position: absolute; inset: 0; }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.frames iframe[hidden] { display: none; }

@media (max-width: 719px) {
  .shell { grid-template-columns: var(--rail-narrow) minmax(0, 1fr); }
  .rail { padding: 10px 6px calc(8px + env(safe-area-inset-bottom)); }
  .brand { padding: 2px 0 10px; text-align: center; }
  .brand .mark { font-size: 15px; }
  .brand .tag, .tab .lbl, .tab .hint, .by { display: none; }
  .tab { grid-template-columns: 1fr; grid-template-areas: "ico"; padding: 10px 0; justify-items: center; }
  .tab .ico { font-size: 22px; }
  .open { text-align: center; padding: 6px 0; }
}
