/* Cinegram Booth — the projection booth for Cinegram 4K.
   Palette: velvet seats, marquee bulbs, silver screen, ticket paper. */
:root {
  --bg: #f7f4ff;          /* silver screen */
  --surface: #ffffff;
  --ticket: #fff8ec;      /* ticket paper */
  --ink: #1e1630;
  --muted: #6b6280;
  --line: #e6e0f2;
  --velvet: #3b0f24;      /* seat velvet */
  --velvet-2: #5a1a39;
  --amber: #f2b33d;       /* marquee bulb */
  --amber-ink: #4a3000;
  --board: #17121f;       /* letter board */
  --ok: #2ead6b; --bad: #e2554b; --info: #4c7dff; --violet: #8a5cf6; --grey: #8a8fa3;
  --radius-l: 20px; --radius-m: 14px; --radius-s: 10px;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="dark"] {
  --bg: #1d1529; --surface: #271d36; --ticket: #30243f; --ink: #f4eeff; --muted: #a99fbe; --line: #3a2e4d;
  --velvet: #f2b33d; --velvet-2: #ffd27a; --board: #0f0b16;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
body { padding-bottom: calc(var(--tabs-h) + var(--safe-b)); min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.05; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hide { display: none !important; }

/* ---------- film-leader intro (one orchestrated moment) ---------- */
.leader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--board); transition: opacity .35s ease; }
.leader.done { opacity: 0; pointer-events: none; }
.leader-ring { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--amber) var(--sweep, 0deg), #2b2238 0); box-shadow: 0 0 0 6px #2b2238, 0 0 0 7px #4d3f61; }
.leader-ring span { width: 118px; height: 118px; border-radius: 50%; background: var(--board); display: grid; place-items: center;
  font: 800 64px/1 var(--display); color: #fff; }
@media (prefers-reduced-motion: reduce) { .leader { display: none; } }

/* ---------- header ---------- */
.top { padding: 18px 18px 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top .hello { font-size: 13px; color: var(--muted); }
.top .back { border: 0; background: none; padding: 6px 8px 6px 0; font-size: 15px; color: var(--velvet); font-weight: 600; }
.chip-alert { background: var(--bad); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.view { padding: 0 16px 24px; outline: none; }

/* ---------- tabs ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); z-index: 20; }
.tabs button { border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 2px; font-size: 11px; color: var(--muted); position: relative; }
.tabs .ico { font-size: 20px; line-height: 1; filter: grayscale(.6); }
.tabs button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs button[aria-current="page"] .ico { filter: none; }
.tabs button[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- letter board (home signature) ---------- */
.board { background: var(--board); border-radius: var(--radius-l); padding: 16px 14px 18px; color: #fff; position: relative; overflow: hidden;
  background-image: repeating-linear-gradient(180deg, transparent 0 26px, rgba(255,255,255,.06) 26px 28px); }
.board::before, .board::after { content: ""; position: absolute; left: 10px; right: 10px; height: 8px;
  background: radial-gradient(circle, var(--amber) 2.2px, transparent 3px) 0 0/16px 8px repeat-x; opacity: .9; }
.board::before { top: 4px; } .board::after { bottom: 4px; }
.board-title { font-size: 12px; color: #c9bfdc; margin: 6px 2px 8px; }
.board-row { display: flex; align-items: baseline; gap: 10px; padding: 3px 2px; font: 700 18px/1.25 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.board-row .n { color: var(--amber); font-size: 15px; min-width: 28px; }
.board-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-empty { font: 600 15px/1.4 var(--display); color: #c9bfdc; padding: 6px 2px; }

/* ---------- generic blocks ---------- */
.section { margin-top: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.link { background: none; border: 0; color: var(--velvet); font-weight: 600; padding: 4px 0; }
.queues { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.queue { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px 10px 9px; text-align: left; }
.queue b { display: block; font: 800 24px/1 var(--display); }
.queue span { font-size: 12px; color: var(--muted); }
.queue.hot b { color: var(--bad); }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--amber);
  border-radius: var(--radius-s); padding: 10px 12px; margin-top: 10px; text-align: left; width: 100%; }
.notice.bad { border-left-color: var(--bad); }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 64px; padding: 6px 2px 0; }
.spark div { flex: 1; background: var(--velvet); border-radius: 6px 6px 2px 2px; min-height: 4px; opacity: .85; position: relative; }
.spark small { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); width: 100%; text-align: left; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------- ticket stubs (requests) ---------- */
.stub { display: grid; grid-template-columns: 70px 1fr; background: var(--ticket); border-radius: var(--radius-m); width: 100%; border: 0; padding: 0;
  text-align: left; position: relative; color: var(--ink);
  -webkit-mask: radial-gradient(circle 9px at 70px 0, transparent 98%, #000) top/100% 51% no-repeat, radial-gradient(circle 9px at 70px 100%, transparent 98%, #000) bottom/100% 51% no-repeat;
          mask: radial-gradient(circle 9px at 70px 0, transparent 98%, #000) top/100% 51% no-repeat, radial-gradient(circle 9px at 70px 100%, transparent 98%, #000) bottom/100% 51% no-repeat; }
.stub-left { border-right: 2px dashed color-mix(in srgb, var(--muted) 45%, transparent); padding: 12px 8px; display: grid; justify-items: center; align-content: center; gap: 2px; }
.stub-left .id { font: 800 15px/1 var(--display); }
.stub-left .ty { font-size: 22px; }
.stub-main { padding: 11px 12px 12px 14px; min-width: 0; }
.stub-main .title { font: 700 16px/1.25 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stub-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.stamp { display: inline-block; margin-top: 7px; padding: 2px 8px; border: 2px solid currentColor; border-radius: 6px; font-size: 12px; font-weight: 700;
  transform: rotate(-3deg); transform-origin: left center; }
.st-new { color: var(--info); } .st-awaiting_info { color: #c98a00; } .st-in_progress { color: var(--violet); }
.st-unavailable { color: var(--grey); } .st-available, .st-fulfilled { color: var(--ok); } .st-rejected { color: var(--bad); }
.st-duplicate, .st-cancelled { color: var(--grey); }
.demand { position: absolute; right: 10px; top: 10px; background: var(--amber); color: var(--amber-ink); border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 7px; }
.stub.punch { animation: punch .55s ease; }
@keyframes punch { 30% { transform: scale(.97) rotate(-1deg); } 60% { transform: scale(1.02); } }

/* ---------- filters / inputs ---------- */
.scroller { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.pill { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 600; }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.search { display: flex; gap: 8px; margin-bottom: 10px; }
input[type=text], input[type=number], input[type=url], input[type=date], input[type=time], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 11px 12px; font-size: 16px; }
textarea { min-height: 96px; resize: vertical; }
label.field { display: grid; gap: 6px; margin-bottom: 14px; }
label.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.help { font-size: 12.5px; color: var(--muted); margin-top: -2px; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; background: var(--velvet); color: #fff; }
:root[data-theme="dark"] .btn:not(.ghost):not(.danger) { color: var(--board); }
.btn.amber { background: var(--amber); color: var(--amber-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 auto; }

/* ---------- switches, segments ---------- */
.set { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.set:last-child { border-bottom: 0; }
.set .lbl { font-weight: 600; }
.set .help { grid-column: 1 / -1; }
.set .ctrl-wide { grid-column: 1 / -1; }
.switch { width: 50px; height: 30px; border-radius: 15px; border: 0; background: var(--line); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 11px; font-size: 13.5px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.acc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 10px; overflow: hidden; }
.acc > button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px; background: none; border: 0; font: 700 16px var(--display); }
.acc .body { padding: 0 14px 6px; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 8, 25, .45); z-index: 30; animation: fade .2s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--bg); z-index: 31;
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); animation: rise .25s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin-bottom: 12px; }
@keyframes rise { from { transform: translateY(30px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, .stub.punch { animation: none; } }

/* Telegram-style bubble for "what the user will receive" */
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 12px; font-size: 14.5px; white-space: pre-wrap; }
.bubble-head { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 14.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0 0 12px 14px; position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
.poster { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius-m); background: var(--line); }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions-grid .btn { padding: 11px 10px; font-size: 14px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 40; transition: all .25s; max-width: 90vw; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.skeleton { height: 70px; border-radius: var(--radius-m); background: linear-gradient(90deg, var(--line), var(--surface), var(--line)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.confetti { position: fixed; top: -10px; width: 8px; height: 14px; z-index: 45; border-radius: 2px; animation: drop 1.4s ease-in forwards; }
@keyframes drop { to { transform: translateY(105vh) rotate(540deg); opacity: .2; } }
.gate { min-height: 80vh; display: grid; place-items: center; text-align: center; padding: 24px; }

.card.dim { opacity: .62; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.notice.ok { border-left-color: var(--good, #2ead6b); }
.stepper { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.stepper .btn { padding: 6px 10px; min-height: 0; font-size: 13px; }
.stepper .val { flex: 1; text-align: center; font-weight: 700; min-width: 70px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 6px; text-align: center; }
.stats > div { background: var(--surface2, rgba(127,127,127,.08)); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; gap: 2px; }
.stats b { font-size: 17px; }
