:root {
  color-scheme: dark;
  --bg: #0e0e0e;
  --panel: #161616;
  --card: #242424;
  --text: #f4f4f4;
  --muted: #8f8f8f;
  --line: #2e2e2e;
  --accent: #ff4e4e;
  --focus: #3ea6ff;
  --ok: #9ed6a6;
  --danger: #ff8d8d;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.prompter-open { overflow: hidden; height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { min-height: 100dvh; display: flex; flex-direction: column; container-type: inline-size; }
header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
header h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: 0.04em; }
header h1 span { color: var(--accent); }
.grow { flex: 1; }
.btn, .text-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 40px;
}
.btn:hover, .text-btn:hover { border-color: #5a5a5a; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-danger { border-color: transparent; color: var(--danger); }
.board {
  flex: 1;
  display: grid;
  gap: 12px;
  padding: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  align-items: start;
  grid-template-columns: 1fr;
  container-type: inline-size;
}
@container (min-width: 40rem) { .board { grid-template-columns: 1fr 1fr; } }
@container (min-width: 70rem) { .board { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  min-height: 8rem;
}
.col.over { outline: 2px dashed var(--focus); outline-offset: -2px; }
.col-h { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px 8px; }
.col-h h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.count { font-size: 11px; color: var(--muted); }
.card {
  position: relative;
  border-radius: 10px;
  padding: 9px 10px;
  margin: 0;
  min-height: 44px;
  cursor: pointer;
}
.card:hover, .card:focus-within { background: var(--card); }
.card.dragging { opacity: 0.45; }
.card-top { display: flex; align-items: flex-start; gap: 6px; }
.card h3 {
  flex: 1;
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1.35;
}
.card time {
  display: block;
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.75;
}
.move {
  position: absolute;
  top: 6px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  padding: 0;
}
.card:hover .move, .card:focus-within .move, .move[aria-expanded="true"] { opacity: 1; }
@media (hover: none) {
  .move { opacity: 0.8; }
  .card-top { padding-right: 28px; }
}
.move-menu {
  position: absolute;
  z-index: 4;
  top: 36px;
  right: 8px;
  display: grid;
  gap: 2px;
  min-width: 9rem;
  padding: 6px;
  background: #1c1c1c;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.move-menu button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 40px;
}
.move-menu button:hover { background: var(--card); }
.move-menu button:disabled { color: var(--muted); }
.empty { color: var(--muted); font-size: 13px; padding: 16px 8px; }
.gate {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, 0.72);
  display: grid; place-items: center;
  padding: 18px;
}
.box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  width: min(100%, 24rem);
}
.box h1 { margin: 0 0 14px; font-size: 18px; }
label, .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--focus); }
.err { color: var(--accent); font-size: 13px; min-height: 1.2em; }
.hidden { display: none !important; }
.editor {
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: 18px 16px 64px;
  container-type: inline-size;
}
.editor-head { display: grid; gap: 12px; margin-bottom: 16px; }
.title-row { display: flex; gap: 8px; align-items: stretch; }
.title-row input {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  padding: 12px 14px;
}
.column-select { width: auto; min-width: 8.5rem; }
@container (max-width: 36rem) {
  .title-row { flex-direction: column; }
  .column-select { width: 100%; }
}
.meta-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.save-state { font-size: 12px; color: var(--muted); min-height: 1.2em; }
.save-state[data-state="saved"] { color: var(--ok); }
.save-state[data-state="error"] { color: var(--accent); }
.brief {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 16px;
}
.brief summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}
.brief-body {
  margin: 0;
  padding: 0 12px 12px;
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font: 13px/1.5 inherit;
}
.editor-grid { display: grid; gap: 16px; align-items: start; }
@container (min-width: 56rem) {
  .editor-grid { grid-template-columns: minmax(0, 1fr) 20rem; }
  .ai { position: sticky; top: 72px; }
}
.script {
  display: block;
  width: 100%;
  min-height: 62vh;
  resize: vertical;
  line-height: 1.65;
  font-size: 17px;
  padding: 16px;
  border-radius: 14px;
}
.ai {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 12px;
  display: grid;
  gap: 10px;
  container-type: inline-size;
}
.ai h2 { margin: 0; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 7px 10px;
  min-height: 36px;
  color: var(--muted);
}
.actions button[aria-pressed="true"] { color: var(--text); border-color: #666; background: #222; }
.instruction { min-height: 5.5rem; resize: vertical; }
.job-status { margin: 0; color: var(--muted); font-size: 13px; }
.suggestion {
  margin: 0;
  white-space: pre-wrap;
  font: 14px/1.55 inherit;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px;
  max-height: 22rem;
  overflow: auto;
}
.review { color: var(--muted); font-size: 12px; }
.review summary { cursor: pointer; }
.review pre { white-space: pre-wrap; margin: 8px 0 0; font: 12px/1.45 inherit; }
.suggestion-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.prompter {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  color: #fff;
  container-type: size;
}
.prompter-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  touch-action: pan-y;
}
.prompter-text {
  width: min(18em, calc(100% - 2.2rem));
  margin: 0 auto;
  padding: 32vh 0 78vh;
  font-size: var(--prompter-size, 40px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  white-space: pre-wrap;
  user-select: none;
  -webkit-user-select: none;
}
.prompter-text.mirror { transform: scaleX(-1); }
.prompter-text.flip { transform: scaleY(-1); }
.prompter-text.mirror.flip { transform: scale(-1); }
.prompter-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0) 26%,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.78) 70%,
    #000 100%
  );
}
.reading-line {
  position: absolute;
  left: max(16px, 8vw);
  right: max(16px, 8vw);
  top: 32%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(255, 78, 78, 0.45);
  pointer-events: none;
}
.prompter-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.72) 70%, transparent);
  transition: opacity 180ms linear;
}
.prompter.controls-hidden .prompter-controls { opacity: 0; pointer-events: none; }
.prompter-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #ddd;
  font-size: 12px;
}
.prompter-controls input[type="range"] { width: 7.5rem; padding: 0; }
.play {
  min-width: 88px;
  min-height: 44px;
  border-radius: 999px;
  border: 0;
  background: #fff;
  color: #111;
  font-weight: 650;
}
.check { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.check input { width: auto; }
@container (max-width: 40rem) {
  .prompter-controls { gap: 8px 10px; }
  .prompter-controls input[type="range"] { width: 5.5rem; }
}
