/* Date Creator — styles for the creator shell (login / library / editor) and the
   player (room / profile / slide player / finale). Reuses the global tokens + buttons
   from /client/ui (tokens.css, app.css). Pastel, sharp/low-radius, minimal words. */

/* ----- break out of the photobooth's narrow centered shell --------------------------
   The global app.css caps `.scene` at 760px and centers #app — perfect for the booth,
   but the Date Creator wants full width. We override only the date's OWN scenes (the
   embedded photobooth/debate scenes keep their centered layout). The editor becomes a
   full-viewport layer so it ignores #app's padding/centering entirely. */
.scene.dl, .scene.lib, .scene.dr, .scene.pf, .scene.dp, .scene.dover {
  min-height: 100vh; box-sizing: border-box;
}
.scene.dl, .scene.lib, .scene.dr, .scene.pf, .scene.dp, .scene.dover, .scene.ed { max-width: none; }
/* The editor toggles body.date-editing (date/scenes/editor.js) so we can neutralise
   #app's narrow centered shell at the source — full width, full height, no padding. */
body.date-editing #app { max-width: none; width: 100%; padding: 0; align-items: stretch; justify-content: flex-start; }
.scene.ed { width: 100%; height: 100vh; background: var(--paper); }
/* keep the editor top bar clear of the fixed account avatar (top-right) */
.ed-top { padding-right: 64px; }

/* ================================================================= LOGIN / JOINING */
.scene.dl { display: flex; align-items: center; justify-content: center; padding: 24px; }
.dl-card {
  width: min(420px, 92vw); background: var(--paper-raised); border: 1px solid var(--line);
  border-radius: 8px; padding: 34px 28px; text-align: center;
  box-shadow: 0 6px 24px rgba(23,24,28,.06); display: flex; flex-direction: column; gap: 12px;
}
.dl-mark { width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 50%;
  display: grid; place-items: center; background: var(--pink-tint); color: var(--pink); }
.dl-mark--pulse { animation: dl-pulse 1.4s ease-in-out infinite; }
@keyframes dl-pulse { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }
.dl-title { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; margin: 0; }
.dl-sub { color: var(--ink-soft); font-size: 15px; margin: 0 0 6px; line-height: 1.4; }
.dl-or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
.dl-or::before, .dl-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.dl-email-row { display: flex; gap: 8px; }
.dl-email { flex: 1; }
.dl-note { font-size: 13px; color: var(--ink-soft); min-height: 18px; }
.dl-note.is-ok { color: #2e9c6a; }
.dl-back { font-size: 13px; color: var(--ink-soft); text-decoration: none; margin-top: 4px; }
.dl-back:hover { color: var(--ink); }

/* ======================================================================== LIBRARY */
/* Full-width dashboard (capped on ultrawide), matching the editor/game widths. */
.scene.lib { max-width: min(1320px, 100%); margin: 0 auto; padding: 22px 24px 80px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; }
.lib-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); }
.lib-brand .icon { color: var(--pink); }
.lib-link { color: var(--ink-soft); text-decoration: none; font-size: 14px; }
.lib-link:hover { color: var(--ink); }
.lib-hero { margin: 34px 0 18px; }
.lib-title { font-family: var(--font-display); font-weight: 800; font-size: 38px; letter-spacing: -.02em; margin: 0; }
.lib-sub { color: var(--ink-soft); margin: 6px 0 0; }
.lib-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.lib-note { color: var(--ink-soft); font-size: 14px; }
.lib-empty { grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 50px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-soft); }
.lib-empty-mark { color: var(--pink); opacity: .6; }
.lib-card { position: relative; text-align: left; background: var(--paper-raised); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; cursor: pointer; padding: 0; transition: transform .12s, box-shadow .12s; }
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(23,24,28,.10); }

/* --- first-slide preview (faithful, percent-positioned via container units) --- */
.lib-card-prev { position: relative; aspect-ratio: 16/9; overflow: hidden; container-type: size;
  border-bottom: 1px solid var(--line); background: #FFF4F7; }
.lib-card-prev--empty { display: grid; place-items: center; color: var(--pink); opacity: .55;
  background: linear-gradient(135deg, var(--pink-tint), var(--blue-tint)); }
.lib-card-prev--act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink); text-align: center; padding: 8% 12%; background: linear-gradient(160deg, var(--pink-tint), var(--blue-tint)); }
.lib-card-prev--act[data-act="debate"] { background: linear-gradient(160deg, var(--blue-tint), #ece1fb); }
.lib-card-prev-ic { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.72);
  display: grid; place-items: center; color: var(--pink); }
.lib-card-prev--act[data-act="debate"] .lib-card-prev-ic { color: var(--blue); }
.lib-card-prev-act { font-weight: 700; font-size: 13px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* inert video element inside a preview: a poster box, never a real <video> */
.lib-card-prev .dp-img.is-video { background: #e7e9ee; display: grid; place-items: center; color: var(--ink-soft); }

.lib-card-meta { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 3px; }
.lib-card-title { font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card-date { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); }
.lib-card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .12s; }
.lib-card:hover .lib-card-actions { opacity: 1; }
.lib-icon-btn { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: rgba(255,255,255,.92); border: 1px solid var(--line); color: var(--ink-soft); cursor: pointer;
  box-shadow: 0 1px 3px rgba(23,24,28,.12); }
.lib-icon-btn:hover { color: var(--ink); }
.lib-icon-btn.is-play { color: var(--pink); }

/* ========================================================================= EDITOR */
/* align-items:stretch overrides the base .scene's center, so the top bar + body
   fill the full editor width instead of hugging their content in the middle. */
.scene.ed { display: flex; flex-direction: column; height: 100vh; align-items: stretch; }
.ed-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper-raised); }
.ed-icon { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.ed-icon:hover { background: var(--paper); }
.ed-title { flex: 1; border: none; background: none; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); padding: 6px 8px; min-width: 0; }
.ed-title:focus { outline: none; background: var(--paper); border-radius: 6px; }
.ed-save { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); min-width: 84px; text-align: right; }

.ed-body { flex: 1; display: flex; min-height: 0; }

/* left tools rail */
.ed-tools { width: 208px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--paper-raised);
  padding: 14px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.ed-tools-h { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); margin-top: 4px; }
.ed-tool { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); text-align: left; transition: background .12s, transform .12s; }
.ed-tool:hover { background: var(--pink-tint); border-color: transparent; transform: translateY(-1px); }
.ed-tool-ic { color: var(--pink); display: grid; place-items: center; }
.ed-tools-bg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ed-tools-note { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.ed-tools-note p { margin: 8px 0 0; }

/* center: contextual toolbar + canvas workspace */
.ed-center { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ed-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 16px; min-height: 46px;
  border-bottom: 1px solid var(--line); background: var(--paper-raised); }
.ed-tb-hint, .ed-tb-label { font-size: 13px; color: var(--ink-soft); }
.ed-tb-btn { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; min-width: 34px; justify-content: center; }
.ed-tb-btn:hover { background: var(--pink-tint); }
.ed-tb-btn.is-del:hover { color: #d94e6b; border-color: #f1b9c6; background: #fff; }
.ed-tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 5px; }
.ed-swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.ed-swatch.is-active { box-shadow: 0 0 0 2px var(--ink); }
.ed-stage { flex: 1; display: grid; place-items: center; padding: 24px; min-height: 0; min-width: 0; overflow: hidden; background: var(--paper);
  background-image: radial-gradient(circle, rgba(23,24,28,.05) 1px, transparent 1px); background-size: 22px 22px; }
/* width/height are set in JS (fitCanvas) so the 9:16 box always fits the stage cell. */
.ed-box { border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 12px 40px rgba(23,24,28,.16); }
.ed-surface, .dp-surface { position: relative; width: 100%; height: 100%; overflow: hidden; container-type: size; }
.ed-surface.is-drop { outline: 3px dashed var(--pink); outline-offset: -6px; }
.ed-el { position: absolute; cursor: move; box-sizing: border-box; }
.ed-el.is-sel { outline: 2px solid var(--blue); outline-offset: 1px; }
.ed-text, .dp-text { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; overflow: visible;
  line-height: 1.15; word-break: break-word; padding: 1cqw; box-sizing: border-box; }
.ed-img, .dp-img { width: 100%; height: 100%; background-position: center; background-repeat: no-repeat; }
.ed-video, .dp-video { width: 100%; height: 100%; display: block; background: #000; }
.ed-handle { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; background: var(--blue);
  border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* right pages panel */
.ed-pages { width: 162px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--paper);
  padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.ed-film { display: flex; flex-direction: column; gap: 8px; }
.ed-thumb { position: relative; aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: grab;
  overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 4px; }
.ed-thumb.is-active { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink-tint); }
.ed-thumb.is-dragging { opacity: .4; }
.ed-thumb.is-dragover { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-tint); }
.ed-thumb.is-activity { background: linear-gradient(160deg, var(--pink-tint), var(--blue-tint)); }
.ed-thumb-no { position: absolute; top: 3px; left: 5px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); z-index: 1; }
.ed-thumb-txt { font-size: 9px; text-align: center; color: var(--ink); padding: 0 4px; line-height: 1.2; max-height: 100%; overflow: hidden; }
.ed-thumb-img { position: absolute; inset: 0; background-size: cover; background-position: center; display: grid; place-items: center; color: var(--ink-soft); }
.ed-thumb-img.is-video { background: #e7e9ee; }
.ed-thumb-act { color: var(--pink); }
.ed-thumb-ctrls { position: absolute; inset: auto 0 0 0; display: none; justify-content: center; gap: 3px; padding: 3px; background: rgba(255,255,255,.94); }
.ed-thumb:hover .ed-thumb-ctrls { display: flex; }
.ed-mini { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; font-size: 11px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); cursor: pointer; }
.ed-mini.is-del:hover { color: #d94e6b; }
.ed-add { position: relative; }
.ed-add-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px;
  border: 1px dashed var(--line); border-radius: 8px; background: none; cursor: pointer; color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.ed-add-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.ed-addmenu { display: none; flex-direction: column; gap: 4px; margin-top: 6px; }
.ed-addmenu.is-open { display: flex; }
.ed-add-opt { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--paper-raised); cursor: pointer; font-size: 13px; color: var(--ink); }
.ed-add-opt:hover { background: var(--pink-tint); }

/* activity slide on the editor canvas — pastel, on-brand (not a black box) */
.ed-box--activity { background: linear-gradient(160deg, var(--pink-tint), var(--blue-tint)); }
.ed-box--activity[data-act="debate"] { background: linear-gradient(160deg, var(--blue-tint), #ece1fb); }
.ed-act { color: var(--ink); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 9cqw; height: 100%; justify-content: center; box-sizing: border-box; }
.ed-act-icon { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.7); display: grid; place-items: center; color: var(--pink); }
.ed-box--activity[data-act="debate"] .ed-act-icon { color: var(--blue); }
.ed-act-title { background: rgba(255,255,255,.78); border: 1px solid rgba(23,24,28,.06); border-radius: 8px; color: var(--ink);
  text-align: center; font-weight: 700; font-size: 17px; padding: 9px 10px; width: 100%; box-sizing: border-box; }
.ed-act-title:focus { outline: none; border-color: var(--pink); }
.ed-act-kind { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); }
.ed-act-note { font-size: 12px; color: var(--ink-soft); margin: 0; line-height: 1.45; }

/* ====================================================================== ROOM (dr) */
.scene.dr { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.dr-mark { width: 54px; height: 54px; border-radius: 50%; background: var(--pink-tint); color: var(--pink); display: grid; place-items: center; }
.dr-title { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.02em; margin: 0; }
.dr-sub { color: var(--ink-soft); margin: 0 0 8px; max-width: 360px; }
.dr-copy { margin-top: 6px; }
.dr-back { margin-top: 6px; }

/* =================================================================== PROFILE (pf) */
.scene.pf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.pf-title { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -.02em; margin: 0; }
.pf-cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.pf-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 8px; padding: 18px; width: 220px; display: flex; flex-direction: column; gap: 12px; }
.pf-label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.pf-colors { display: flex; gap: 12px; }
.pf-color { width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.pf-color--pink { background: var(--pink); }
.pf-color--blue { background: var(--blue); }
.pf-color.is-active { border-color: var(--ink); }
.pf-partner { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.pf-ready.is-on { background: var(--pink); }

/* ==================================================================== PLAYER (dp) */
.scene.dp { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 14px; }
.dp-box { aspect-ratio: 16/9; width: min(94vw, calc(86vh * 16/9)); max-height: 86vh; border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(23,24,28,.18); }
/* activity slides are pastel + on-brand (matching the activity intro), never a black box */
.dp-box--activity .dp-surface { background: linear-gradient(160deg, var(--pink-tint), var(--blue-tint)); }
.dp-box--activity[data-act="debate"] .dp-surface { background: linear-gradient(160deg, var(--blue-tint), #ece1fb); }
.dp-fade { animation: dp-fade .28s ease; }
@keyframes dp-fade { from { opacity: 0; transform: scale(1.01); } to { opacity: 1; transform: none; } }
.dp-el { position: absolute; box-sizing: border-box; }
.dp-loading { display: grid; place-items: center; height: 100%; color: var(--ink-soft); }
.dp-act { color: var(--ink); text-align: center; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 9cqw; box-sizing: border-box; }
.dp-act-icon { width: 76px; height: 76px; border-radius: 50%; background: rgba(255,255,255,.7); display: grid; place-items: center; color: var(--pink); }
.dp-box--activity[data-act="debate"] .dp-act-icon { color: var(--blue); }
.dp-act-title { font-family: var(--font-display); font-weight: 800; font-size: 24px; margin: 0; }
.dp-act-sub { color: var(--ink-soft); font-size: 14px; margin: 0; max-width: 82%; }
.dp-act-go { margin-top: 6px; }
.dp-payoff { color: var(--ink); height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 7cqw; box-sizing: border-box; }
.dp-payoff-mark { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.7); color: var(--pink); display: grid; place-items: center; }
.dp-payoff-title { font-family: var(--font-display); font-weight: 800; font-size: 22px; margin: 0; text-align: center; }
.dp-strip-holder { flex: 1; min-height: 0; display: grid; place-items: center; color: var(--ink-soft); font-size: 13px; }
.dp-strip-canvas { max-height: 46cqh; max-width: 80%; border-radius: 4px; box-shadow: 0 6px 20px rgba(23,24,28,.25); }
.dp-payoff-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.dp-scores { display: flex; flex-direction: column; gap: 6px; width: 74%; }
.dp-score-row { display: flex; justify-content: space-between; padding: 9px 13px; background: rgba(255,255,255,.66); border-radius: 8px; }
.dp-score-name { font-weight: 600; }
.dp-score-val { font-family: var(--font-mono); font-weight: 700; }
.dp-toolbar { display: flex; align-items: center; gap: 16px; }
.dp-nav { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper-raised); cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.dp-nav:hover:not(:disabled) { background: var(--pink-tint); color: var(--pink); }
.dp-nav:disabled { opacity: .35; cursor: default; }
.dp-pos { font-family: var(--font-mono); font-size: 14px; color: var(--ink-soft); min-width: 54px; text-align: center; }

/* ================================================================== FINALE (dover) */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.scene.dover { display: flex; align-items: center; justify-content: center; padding: 24px; }
.dover-card { text-align: center; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 10px;
  padding: 38px 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 8px 30px rgba(23,24,28,.08); }
.dover-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--pink-tint); color: var(--pink); display: grid; place-items: center; }
.dover-title { font-family: var(--font-display); font-weight: 900; font-size: 32px; letter-spacing: -.02em; margin: 0; }
.dover-sub { color: var(--ink-soft); margin: 0 0 6px; }
.dover-actions { display: flex; gap: 10px; }
.dover-link { color: var(--ink-soft); font-size: 14px; text-decoration: none; margin-top: 4px; }
.dover-link:hover { color: var(--ink); }

/* ----- mobile: stack tools above, pages below the canvas ------------------------- */
@media (max-width: 820px) {
  .ed-body { flex-direction: column; }
  .ed-tools { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px;
    border-right: none; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .ed-tools-h { width: 100%; margin: 0; }
  .ed-tool { flex: 1 1 auto; justify-content: center; padding: 9px 12px; }
  .ed-tools-bg { grid-template-columns: repeat(7, 1fr); flex: 1 1 100%; }
  .ed-tools-note { width: 100%; }
  .ed-stage { padding: 16px; }
  .ed-pages { width: auto; border-left: none; border-top: 1px solid var(--line); }
  .ed-film { flex-direction: row; overflow-x: auto; }
  .ed-thumb { width: 58px; flex-shrink: 0; }
  .ed-add { min-width: 100px; }
  .pf-cards { flex-direction: column; }
}
