/* ============================================================
   Chalkera player shell — "in front of the slate".
   A dark lecture-room wall; one framed chalkboard is the hero.
   Every control is chalk-tray furniture around it.
   (Engine codename: Khanvas.)
   ============================================================ */
:root{
  --slate:#0d1014;        /* the room / wall */
  --slate-2:#0a0c0f;      /* deeper wall, for the vignette */
  --surface:#141922;      /* raised chrome: compose, ledge, buttons */
  --surface-2:#1b212b;    /* hover */
  --line:#232b35;         /* hairlines */
  --line-soft:#1a212a;
  --chalk:#ecebe3;        /* warm chalk white */
  --chalk-2:#c4c8cb;      /* secondary chalk */
  --dim:#7f8894;          /* muted labels */
  --faint:#535c68;        /* placeholders, faintest ink */
  --accent:#f0e94e;       /* chalk-yellow — the one bold note */
  --accent-2:#fff6a0;
  --accent-soft:rgba(240,233,78,.14);
  --accent-ink:#141207;   /* text on chalk-yellow */
  --hand:'Kalam','Comic Sans MS','Chalkboard SE','Segoe Print',cursive;
  --ui:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --board-w:1180px;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;height:100%}
body{
  background:var(--slate);
  color:var(--chalk);
  font-family:var(--ui);
  display:flex;flex-direction:column;min-height:100%;
  position:relative;overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
/* room atmosphere: overhead light + edge vignette + faint chalk-dust grain */
body::before{
  content:'';position:fixed;inset:0;z-index:0;pointer-events:none;
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(240,233,78,.05), transparent 55%),
    radial-gradient(140% 120% at 50% 40%, transparent 55%, rgba(0,0,0,.45) 100%),
    linear-gradient(180deg, #10141a 0%, var(--slate) 34%, var(--slate-2) 100%);
}
body::after{
  content:'';position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.4;mix-blend-mode:soft-light;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
body>*{position:relative;z-index:1}

/* ---------- top rail: wordmark + compose line ---------- */
.rail{
  display:flex;align-items:center;gap:20px;
  padding:16px clamp(16px,4vw,34px);
  border-bottom:1px solid var(--line-soft);
}
.brand{position:relative;flex:none;padding-bottom:8px;user-select:none}
.mark{
  font-family:var(--hand);font-weight:700;font-size:27px;line-height:1;
  color:var(--accent);letter-spacing:.4px;
  text-shadow:0 1px 0 rgba(0,0,0,.4);
}
.mark em{color:var(--chalk);font-style:normal}
.mark-ul{position:absolute;left:1px;bottom:0;width:calc(100% - 2px);height:8px;overflow:visible}
.mark-ul path{
  fill:none;stroke:var(--accent);stroke-width:2.4;stroke-linecap:round;
  opacity:.85;filter:drop-shadow(0 0 3px rgba(240,233,78,.25));
  stroke-dasharray:230;stroke-dashoffset:230;
  animation:chalk-draw 1.1s .35s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes chalk-draw{to{stroke-dashoffset:0}}

.compose{
  flex:1;display:flex;align-items:center;gap:8px;
  min-width:0;padding:5px 6px 5px 14px;
  background:linear-gradient(180deg,rgba(255,255,255,.015),transparent),var(--surface);
  border:1px solid var(--line);border-radius:13px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03),0 1px 2px rgba(0,0,0,.3);
  transition:border-color .18s,box-shadow .18s;
}
.compose:focus-within{
  border-color:rgba(240,233,78,.45);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03),0 0 0 3px var(--accent-soft);
}
#topic{
  flex:1;min-width:0;resize:none;
  min-height:30px;max-height:104px;line-height:1.4;
  background:transparent;border:0;color:var(--chalk);
  font-family:var(--ui);font-size:14.5px;padding:5px 2px;
}
#topic:focus{outline:none}
#topic::placeholder{color:var(--faint)}

.attach{
  flex:none;display:grid;place-items:center;
  width:36px;height:36px;padding:0;border-radius:9px;
  border:1px solid transparent;background:transparent;color:var(--dim);
  cursor:pointer;transition:.15s;
}
.attach:hover{color:var(--chalk);background:var(--surface-2)}
.attach:disabled{opacity:.4;cursor:default}

/* ---------- buttons (shared) ---------- */
button{font-family:var(--ui);font-size:14px;font-weight:600;cursor:pointer;border:1px solid var(--line);background:var(--surface);color:var(--chalk);border-radius:10px;transition:.15s}
button:hover{border-color:#39434f;background:var(--surface-2)}
button:disabled{opacity:.5;cursor:default}
button:focus-visible,.attach:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
button.primary{
  flex:none;height:38px;padding:0 18px;
  background:linear-gradient(180deg,var(--accent-2),var(--accent));
  color:var(--accent-ink);border-color:var(--accent);
  box-shadow:0 2px 10px -2px rgba(240,233,78,.35);
  letter-spacing:.2px;
}
button.primary:hover{background:var(--accent-2);border-color:var(--accent-2)}
button.primary:disabled{box-shadow:none}

/* attached-doc chip */
.chip{display:flex;align-items:center;gap:4px;max-width:190px;background:rgba(240,233,78,.09);border:1px solid rgba(240,233,78,.3);border-radius:999px;padding:3px 5px 3px 11px;font-size:12.5px;color:var(--chalk)}
.chip #docName{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chip button{height:20px;width:20px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--dim);font-size:15px;line-height:1;display:grid;place-items:center}
.chip button:hover{color:var(--chalk);background:rgba(255,255,255,.08)}

/* ---------- main / hero board ---------- */
main{flex:1;display:flex;flex-direction:column;align-items:center;gap:14px;padding:clamp(16px,3vw,30px) clamp(14px,4vw,30px) 26px;min-height:0}
.stage-wrap{width:100%;max-width:var(--board-w);display:flex;justify-content:center}
.board{
  position:relative;width:100%;aspect-ratio:16/9;
  background:#000;border-radius:16px;overflow:hidden;
  cursor:grab;touch-action:none;
  box-shadow:
    0 34px 70px -30px rgba(0,0,0,.85),
    0 8px 26px -12px rgba(0,0,0,.6),
    0 0 0 1px rgba(0,0,0,.6),
    inset 0 0 0 1px rgba(236,235,227,.07),
    inset 0 40px 80px -60px rgba(236,235,227,.10),
    inset 0 -60px 90px -70px rgba(0,0,0,.7);
}
.board.dragging{cursor:grabbing}
svg#stage{position:absolute;inset:0;width:100%;height:100%;display:block}
#ink path{fill:none}

/* play overlay */
.overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;cursor:pointer;background:radial-gradient(ellipse at center,rgba(0,0,0,.10),rgba(0,0,0,.62));z-index:5}
.overlay .play{
  width:74px;height:74px;border-radius:50%;
  border:2px solid rgba(236,235,227,.85);
  display:flex;align-items:center;justify-content:center;
  color:var(--chalk);font-size:27px;padding-left:6px;
  background:rgba(10,12,15,.4);backdrop-filter:blur(2px);
  transition:.18s;
}
.overlay:hover .play{transform:scale(1.06);border-color:var(--accent);color:var(--accent);box-shadow:0 0 26px -4px rgba(240,233,78,.4)}
.overlay-hint{font-family:var(--hand);font-size:16px;color:var(--chalk-2);letter-spacing:.4px;opacity:.9;text-shadow:0 1px 3px rgba(0,0,0,.7)}
.overlay:hover .overlay-hint{color:var(--accent)}
.overlay.hidden{display:none}

/* handwritten caption */
.caption{
  width:100%;max-width:var(--board-w);min-height:30px;margin:0;
  font-family:var(--hand);font-size:19px;line-height:1.45;
  color:var(--chalk);text-align:center;
  text-shadow:0 1px 0 #000,0 0 14px rgba(0,0,0,.6);
}

/* ---------- the chalk tray (controls) ---------- */
.ledge{
  width:100%;max-width:var(--board-w);
  display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:14px 18px;
  padding:11px 18px;
  background:linear-gradient(180deg,rgba(255,255,255,.03),transparent 40%),var(--surface);
  border:1px solid var(--line);border-radius:14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05),0 6px 20px -12px rgba(0,0,0,.6);
}
.transport{display:flex;align-items:center;gap:8px}
.sep{width:1px;height:24px;background:var(--line);flex:none}

.icon{
  width:40px;height:40px;padding:0;border-radius:10px;
  font-size:17px;font-weight:400;display:grid;place-items:center;color:var(--chalk-2);
}
.icon:hover{color:var(--chalk)}
.play-btn{
  width:46px;height:46px;padding:0;border-radius:50%;
  font-size:17px;padding-left:1px;display:grid;place-items:center;
  background:var(--surface-2);border-color:#3a4350;color:var(--chalk);
}
.play-btn:hover{border-color:var(--accent);color:var(--accent);background:var(--surface-2)}

.setting{display:flex;align-items:center;gap:9px}
.micro{font-size:10.5px;font-weight:600;letter-spacing:.15em;text-transform:uppercase;color:var(--faint)}

/* speed slider */
input[type=range]{
  -webkit-appearance:none;appearance:none;
  width:120px;height:3px;border-radius:999px;background:var(--line);cursor:pointer;
}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:15px;height:15px;border-radius:50%;background:var(--accent);border:3px solid var(--surface);box-shadow:0 0 0 1px var(--accent);transition:.12s}
input[type=range]::-webkit-slider-thumb:hover{background:var(--accent-2)}
input[type=range]::-moz-range-thumb{width:12px;height:12px;border-radius:50%;background:var(--accent);border:3px solid var(--surface);box-shadow:0 0 0 1px var(--accent)}
input[type=range]::-moz-range-track{height:3px;border-radius:999px;background:var(--line)}

/* follow / narrate toggles */
.toggle{display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;color:var(--dim)}
.toggle span{transition:color .15s}
.toggle:has(:checked) span{color:var(--chalk)}
input[type=checkbox]{
  -webkit-appearance:none;appearance:none;flex:none;
  width:34px;height:19px;border-radius:999px;position:relative;cursor:pointer;
  background:#20262f;border:1px solid var(--line);transition:.18s;
}
input[type=checkbox]::after{content:'';position:absolute;top:1.5px;left:1.5px;width:14px;height:14px;border-radius:50%;background:var(--dim);transition:.18s}
input[type=checkbox]:checked{background:var(--accent-soft);border-color:rgba(240,233,78,.55)}
input[type=checkbox]:checked::after{background:var(--accent);transform:translateX(15px)}

/* library select */
.select{position:relative;display:inline-flex}
.select::after{content:'';position:absolute;right:12px;top:50%;width:7px;height:7px;border-right:1.6px solid var(--dim);border-bottom:1.6px solid var(--dim);transform:translateY(-65%) rotate(45deg);pointer-events:none}
select{
  font-family:var(--ui);font-size:13.5px;font-weight:500;cursor:pointer;
  -webkit-appearance:none;appearance:none;
  border:1px solid var(--line);background:var(--surface-2);color:var(--chalk);
  border-radius:10px;padding:0 32px 0 13px;height:38px;max-width:230px;
  text-overflow:ellipsis;transition:.15s;
}
select:hover{border-color:#39434f}

/* status line */
.status{margin:2px auto 0;font-size:12.5px;color:var(--dim);text-align:center;max-width:720px;line-height:1.5;min-height:17px}
.status a{color:var(--chalk-2);text-decoration-color:var(--faint)}
.status b{color:var(--chalk);font-weight:600}

/* ---------- responsive ---------- */
@media (max-width:760px){
  .rail{flex-wrap:wrap;gap:12px;padding:13px 16px}
  .compose{order:2;flex:1 0 100%}
  .brand{padding-bottom:6px}
  .mark{font-size:24px}
}
@media (max-width:520px){
  .caption{font-size:16px}
  .ledge{gap:12px 14px;padding:12px 14px}
  .sep{display:none}
  .setting.library{flex:1 0 100%;justify-content:center}
  select{max-width:100%;width:auto;min-width:180px}
  .status{font-size:12px}
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion:reduce){
  *{transition:none!important}
  .mark-ul path{animation:none;stroke-dashoffset:0}
  .overlay:hover .play{transform:none}
}

/* ---------- browser surfaces ----------
   The parts we didn't draw still carry the design: selection, caret,
   scrollbars and focus all ship with defaults that belong to no system. */
::selection{background:var(--accent-soft);color:var(--chalk)}
:root{caret-color:var(--accent);accent-color:var(--accent)}
*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background:var(--line);border-radius:999px;border:3px solid transparent;background-clip:content-box}
*::-webkit-scrollbar-thumb:hover{background:#39434f;background-clip:content-box}
