/* Same family as VIC GLITCH: dark, monospace, yellow for the main action. */
:root {
  --bg: #1b1b1d;
  --panel: #2a2a2d;
  --tile: #3a3a3e;
  --tile-hi: #48484d;
  --text: #e8e8ea;
  --dim: #8d8d93;
  --accent: #f4f05a;
  --danger: #ff6b5d;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  overscroll-behavior: none;
  touch-action: manipulation; /* no double-tap zoom */
  -webkit-user-select: none;
  user-select: none;
}

button { font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: 0.35; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { fill: currentColor; }

.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; }

/* ---------- home ---------- */

.home-inner {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 20px 24px;
}
.wordmark { font-size: 56px; line-height: 0.9; margin: 8px 0 18px; font-weight: 800; letter-spacing: -0.02em; }
.wordmark span { color: var(--accent); }
.big-btn {
  display: block; text-align: center; padding: 18px; border-radius: 14px;
  background: var(--accent); color: #111; font-weight: 700; font-size: 15px;
}
.projects { display: grid; gap: 8px; }
.proj { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 12px; padding: 6px 6px 6px 12px; }
.proj-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 0; }
.shape { width: 28px; height: 28px; flex: none; display: grid; place-items: center; }
.shape i, .glyph { display: block; border: 2px solid currentColor; border-radius: 3px; }
.shape i { color: var(--dim); }
.proj-text { display: grid; gap: 3px; min-width: 0; }
.proj-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-meta { color: var(--dim); font-size: 11px; }
.proj-del { flex: none; color: var(--dim); padding: 10px 12px; border-radius: 8px; font-size: 12px; }
.proj-del.armed { color: #111; background: var(--danger); font-weight: 700; }
.fine { color: var(--dim); font-size: 12px; line-height: 1.6; text-align: center; margin-top: auto; padding-top: 16px; }

/* ---------- new project sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card {
  width: 100%; max-width: 520px; display: grid; gap: 10px;
  background: var(--panel); border-radius: 18px 18px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet-card h2 { margin: 0 0 4px; font-size: 15px; }
.label { color: var(--dim); font-size: 11px; margin-top: 6px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { background: var(--tile); border-radius: 10px; padding: 12px 4px; display: grid; justify-items: center; align-content: end; gap: 8px; min-height: 48px; }
.seg.grid { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
.glyph.dashed { border-style: dashed; }
.hint { color: var(--dim); font-size: 11px; margin: 0; line-height: 1.5; }
.sheet-text { margin: 0; line-height: 1.5; }
.sheet-text.dim { color: var(--dim); }
.seg button[aria-pressed="true"] { background: var(--text); color: #111; font-weight: 700; }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.pill { background: var(--tile); border-radius: 999px; padding: 9px 14px; font-size: 12px; }
.pill.on { background: var(--accent); color: #111; font-weight: 700; }

/* ---------- editor ---------- */

.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; font-size: 26px; flex: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.small { width: 36px; height: 36px; font-size: 20px; background: var(--panel); }
.icon-btn:active, .tool:active, .play:active { background: var(--tile-hi); }
.title { flex: 1; text-align: center; color: var(--dim); font-size: 11px; line-height: 1.4; }
.title span { font-size: 10px; opacity: 0.75; }
.top-right { display: flex; gap: 6px; }

.stage {
  flex: 1; min-height: 0; position: relative; display: grid; place-items: center;
  margin: 0 10px; border-radius: 10px; overflow: hidden; background: #111;
}
#view { display: block; background: #000; grid-area: 1 / 1; }
.stage > * { grid-area: 1 / 1; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.stage-empty { position: absolute; color: var(--dim); text-align: center; padding: 20px; line-height: 1.6; }
.stage-empty b { color: var(--accent); font-weight: 600; }

.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; padding: 6px 10px; }
.tc { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc b { color: var(--text); font-weight: 600; }
.transport-mid { display: flex; gap: 6px; align-items: center; }
.play { width: 56px; height: 44px; border-radius: 12px; background: var(--tile); display: grid; place-items: center; }
.play svg { width: 22px; height: 22px; }
.zoom { justify-self: end; display: flex; gap: 6px; }

.timeline { display: block; width: 100%; height: 100px; flex: none; touch-action: none; }

.toolbar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 10px; scrollbar-width: none; flex: none; }
.toolbar::-webkit-scrollbar { display: none; }
.tool {
  flex: none; min-width: 72px; padding: 13px 12px; border-radius: 10px;
  background: var(--panel); text-align: center; font-size: 11px; font-weight: 600;
}
.tool.accent { background: var(--accent); color: #111; font-weight: 700; cursor: pointer; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(150px + env(safe-area-inset-bottom));
  max-width: min(90vw, 420px); padding: 10px 14px; border-radius: 10px;
  background: var(--text); color: #111; text-align: center; line-height: 1.4;
}
