/* CuePrompt web · Rematefy design system: Montserrat 400/700, 4 px spacing, radii 6/10/16/pill,
   dark theme by default (#121212), action green #6cc04a with Tinta label, amber = "now". */

@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("fonts/Montserrat_400Regular.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("fonts/Montserrat_700Bold.ttf") format("truetype"); }
@font-face { font-family: "CP Orbitron"; font-display: swap; src: url("fonts/Orbitron_500Medium.ttf") format("truetype"); }
@font-face { font-family: "CP Share Tech Mono"; font-display: swap; src: url("fonts/ShareTechMono_400Regular.ttf") format("truetype"); }
@font-face { font-family: "CP Space Mono"; font-display: swap; src: url("fonts/SpaceMono_400Regular.ttf") format("truetype"); }
@font-face { font-family: "CP Roboto Mono"; font-display: swap; src: url("fonts/RobotoMono_500Medium.ttf") format("truetype"); }
@font-face { font-family: "CP Inter"; font-display: swap; src: url("fonts/Inter_500Medium.ttf") format("truetype"); }

:root {
  --bg: #121212;
  --surface: #1d1d1d;
  --surface-high: #272727;
  --border: #2f2f2f;
  --text: #ffffff;
  --text-2: #a8aaa6;
  --primary: #6cc04a;
  --on-primary: #1d1d1d;
  --brand: #479d3a;
  --amber: #fcb913;
  --gold: #eec344;
  --error: #e57373;
  --focus: rgba(108, 192, 74, 0.25);
  --scrim: rgba(0, 0, 0, 0.6);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not(.force-dark) {
    --bg: #f5f6f2;
    --surface: #ffffff;
    --surface-high: #eceee8;
    --border: #dfe3dc;
    --text: #1d1d1d;
    --text-2: #5d645c;
    --error: #b3261e;
    --scrim: rgba(29, 29, 29, 0.45);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/24px var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus), 0 0 0 1px var(--primary); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(var(--s4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--s4), env(safe-area-inset-right, 0px));
}
.wrap { width: 100%; max-width: 720px; margin: 0 auto; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-block: var(--s4); }
.brand { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.brand svg { width: 36px; height: 36px; flex: none; }
.wordmark { font-weight: 700; font-size: 20px; line-height: 28px; letter-spacing: 0.01em; }
.wordmark span { color: var(--brand); }
.topbar-actions { display: flex; gap: var(--s2); }

/* ---------- Buttons (48 px, radius 10, 14 px bold, sentence case) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s5); border-radius: var(--r-md);
  font-weight: 700; font-size: 14px; line-height: 20px;
  border: 1px solid transparent; background: none; white-space: nowrap;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-secondary { border-color: var(--border); color: var(--text); background: transparent; }
.btn-text { color: var(--brand); padding: 0 var(--s3); }
.btn-danger { border-color: var(--error); color: var(--error); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-md); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-high); border: 1px solid transparent; color: var(--text);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.ghost { background: transparent; }
.icon-btn[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }

/* ---------- Script list ---------- */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.card {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
}
.card-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: var(--s1) 0; color: inherit; }
.card-title { font-weight: 700; font-size: 16px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-preview { color: var(--text-2); font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--text-2); font-size: 12px; line-height: 16px; margin-top: var(--s1); font-variant-numeric: tabular-nums; }
.play-btn {
  width: 52px; height: 52px; border-radius: var(--r-pill); border: 0; flex: none;
  background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.play-btn svg { width: 24px; height: 24px; }

.empty { text-align: center; padding: var(--s7) var(--s4); color: var(--text-2); display: grid; gap: var(--s2); justify-items: center; }
.empty strong { color: var(--text); font-size: 20px; line-height: 28px; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--bg); border-top: 1px solid var(--border);
  padding: var(--s3) max(var(--s4), env(safe-area-inset-right, 0px)) calc(var(--s3) + env(safe-area-inset-bottom, 0px)) max(var(--s4), env(safe-area-inset-left, 0px));
}
.bottombar .wrap { display: flex; gap: var(--s3); }
.bottombar .btn-primary { flex: 1; }

.hint {
  display: flex; gap: var(--s3); align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s3) var(--s4); margin-bottom: var(--s3); font-size: 14px; line-height: 20px; color: var(--text-2);
}
.hint strong { color: var(--text); }
.hint .btn-text { margin-left: auto; min-height: 32px; padding: 0 var(--s2); }

/* ---------- Dialogs / sheets ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0;
  background: var(--surface); color: var(--text); max-width: min(560px, calc(100vw - 32px)); width: 100%;
}
dialog::backdrop { background: var(--scrim); }
.sheet { padding: var(--s5); display: grid; gap: var(--s4); max-height: calc(100dvh - 48px); overflow: auto; }
.sheet h2 { margin: 0; font-size: 20px; line-height: 28px; }
.sheet p { margin: 0; color: var(--text-2); }
.sheet-actions { display: flex; justify-content: flex-end; gap: var(--s3); flex-wrap: wrap; }
.menu { display: grid; }
.menu button {
  display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 0 var(--s2);
  background: none; border: 0; border-radius: var(--r-md); text-align: left; font-weight: 700; font-size: 14px;
}
.menu button:hover { background: var(--surface-high); }
.menu button svg { width: 20px; height: 20px; }
.menu .danger { color: var(--error); }

.field { display: grid; gap: var(--s1); }
.field label, .label { font-size: 12px; line-height: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
.input {
  width: 100%; min-height: 48px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg); padding: var(--s3) var(--s4); font-size: 16px;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }

/* ---------- Editor ---------- */
.editor { position: fixed; inset: 0; z-index: 20; background: var(--bg); }
.editor .screen { height: 100%; padding-bottom: env(safe-area-inset-bottom, 0px); }
.editor .wrap { flex: 1; display: flex; flex-direction: column; gap: var(--s3); min-height: 0; padding-bottom: var(--s3); }
.editor textarea { flex: 1; min-height: 160px; resize: none; line-height: 26px; font-size: 17px; }
.editor-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.meta { color: var(--text-2); font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }

/* ---------- Typography controls ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-pill);
  background: var(--surface-high); border: 1px solid transparent; color: var(--text-2); font-size: 15px;
}
.chip[aria-checked="true"] { border-color: var(--primary); color: var(--text); }
.slider-row { display: grid; grid-template-columns: 88px 1fr 48px; align-items: center; gap: var(--s3); min-height: 44px; }
.slider-row .value { text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--primary); height: 32px; }
.preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); text-align: center; min-height: 96px; display: grid; place-items: center; overflow: hidden; }

/* ---------- Teleprompter (always dark) ---------- */
.prompter {
  position: fixed; inset: 0; z-index: 30; background: #121212; color: #ffffff;
  --text: #ffffff; --text-2: #a8aaa6; --surface: #1d1d1d; --surface-high: #272727; --border: #2f2f2f; --bg: #121212;
  color-scheme: dark;
}
.prompter-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; overscroll-behavior: contain; touch-action: pan-y; }
.prompter-scroll::-webkit-scrollbar { display: none; }
.prompter-scroll.mirror { transform: scaleX(-1); }
.prompter-text { max-width: 1200px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.prompter-text p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; text-align: center; }
.guide { position: absolute; left: 0; right: 0; height: 20px; pointer-events: none; display: flex; justify-content: space-between; }
.guide::before, .guide::after { content: ""; width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.guide::before { border-left: 14px solid var(--amber); }
.guide::after { border-right: 14px solid var(--amber); }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; display: grid; justify-items: center; gap: var(--s2);
  padding: 0 max(var(--s4), env(safe-area-inset-right, 0px)) calc(var(--s3) + env(safe-area-inset-bottom, 0px)) max(var(--s4), env(safe-area-inset-left, 0px));
}
.panel {
  width: 100%; max-width: 640px; background: rgba(29, 29, 29, 0.96); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s3) var(--s4) var(--s1);
}
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.big-play { width: 64px; height: 64px; border-radius: var(--r-pill); border: 0; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.big-play svg { width: 30px; height: 30px; }
.typo-panel { width: 100%; max-width: 640px; max-height: 45vh; overflow: auto; display: grid; gap: var(--s3); padding: var(--s4); }
.top-left { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top, 0px)); left: max(var(--s3), env(safe-area-inset-left, 0px)); display: flex; gap: var(--s2); align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: var(--s1); height: 28px; padding: 0 var(--s3); border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--amber); color: #1d1d1d;
}
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  background: var(--surface-high); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--s3) var(--s4); font-size: 14px; line-height: 20px; max-width: calc(100vw - 32px);
}
.busy { display: grid; justify-items: center; gap: var(--s3); padding: var(--s6); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface-high); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .btn:active { transform: none; } }
