/* StepCast. One idea runs through the whole look: the yellow highlighter box
   StepCast draws around "the thing to click". Yellow means that, and step numbers. */
:root {
  --ink: #141B2D;
  --ink-2: #222B42;
  --ink-3: #3A4560;
  --paper: #EEF1F6;
  --card: #FFFFFF;
  --marker: #FFD23F;
  --marker-soft: rgba(255, 210, 63, .45);
  --rec: #E5383B;
  --slate: #5B6478;
  --line: #DCE1EA;
  --ok: #1F8A5B;
  --radius: 10px;
  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font-size: .92em; background: rgba(20,27,45,.06); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- controls ---------- */
button, input, textarea, select { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; line-height: 1.25;
  transition: border-color .12s, background .12s;
}
button:hover { border-color: var(--ink-3); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.primary:hover { background: var(--ink-2); }
button.primary.alt { background: var(--marker); border-color: var(--marker); color: var(--ink); }
button.primary.alt:hover { background: #F5C61F; }
button.rec { background: var(--rec); border-color: var(--rec); color: #fff; }
button.rec::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #fff; margin-right: 8px; vertical-align: 1px; }
button.rec:hover { background: #CF2B2E; }
button.big { padding: 12px 20px; font-size: 16px; }
button.small { padding: 4px 10px; font-size: 14px; }
button.wide { width: 100%; text-align: left; }
button.link { border: 0; background: none; padding: 0; color: var(--slate); text-decoration: underline; font-weight: 500; }
button.danger { background: none; border-color: transparent; color: var(--rec); }
button.danger:hover { border-color: var(--rec); }
button.ghostDark { background: none; }
input[type=text], input[type=url], input[type=search], input[type=password], input[type=number], textarea, select {
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink-3); outline: none; box-shadow: 0 0 0 3px var(--marker-soft); }
textarea { resize: vertical; line-height: 1.45; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--slate); }
.check input { margin-top: 3px; accent-color: var(--ink); }
.fine { font-size: 13px; color: var(--slate); }
.err { color: var(--rec) !important; }

/* ---------- top bar ---------- */
.top { background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 21px/1 var(--display); letter-spacing: -.02em; color: #fff; text-decoration: none; }
.brandMark { width: 22px; height: 16px; border: 2.5px solid var(--marker); border-radius: 4px; position: relative; }
.brandMark::after { content: ""; position: absolute; right: -7px; bottom: -7px; width: 7px; height: 7px; background: var(--marker); border-radius: 50%; }
.topNav { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-end; font-size: 14px; }
.top .ghost, .onDark { background: transparent; color: #fff; border-color: rgba(255,255,255,.28); padding: 6px 12px; }
.top .ghost:hover, .onDark:hover { border-color: #fff; }
.top button.rec { padding: 7px 14px; }
.navLink { color: #C9D1E3; font-weight: 600; text-decoration: none; }
.navLink:hover { color: #fff; text-decoration: underline; }
.extOk { color: #C9D1E3; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.extOk::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; }
.account { display: inline-flex; gap: 10px; align-items: center; color: #C9D1E3; }

.banner { margin: 0; padding: 10px 24px; background: #FFF3C4; border-bottom: 1px solid #EAD27A; font-size: 14px; }

/* live recording strip */
.recLive { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 24px; background: var(--ink-2); color: #fff; font-weight: 600; }
.recLive .onDark { margin-left: auto; background: var(--rec); border-color: var(--rec); }
.recDot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 0 rgba(229,56,59,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(229,56,59,0); } 100% { box-shadow: 0 0 0 0 rgba(229,56,59,0); } }

/* ---------- sign-in ---------- */
.auth { max-width: 1080px; margin: 0 auto; padding: 9vh 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.auth h1 { font: 700 clamp(36px, 5vw, 56px)/1.04 var(--display); letter-spacing: -.03em; margin: 0 0 16px; }
.lede { font-size: 18px; color: var(--slate); margin: 0 0 24px; max-width: 46ch; }
button.google { display: inline-flex; align-items: center; gap: 12px; padding: 13px 22px; font-size: 16px; border-radius: 10px; box-shadow: 0 1px 2px rgba(20,27,45,.08); }
#authMsg { min-height: 22px; font-size: 14px; margin: 10px 0 0; }
.auth .fine { margin-top: 18px; }

.authDemo { margin: 0; }
.demoFrame { background: var(--ink); border-radius: 14px; padding: 10px; box-shadow: 0 30px 60px -30px rgba(20,27,45,.55); }
.demoBar { display: flex; align-items: center; gap: 6px; padding: 2px 6px 10px; color: #8C96AD; font-size: 12px; }
.demoBar i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.demoBar span { margin-left: 8px; }
.demoPage { background: #fff; border-radius: 8px; padding: 26px 26px 30px; display: grid; gap: 12px; }
.demoLine { height: 12px; border-radius: 6px; background: #E6EAF1; }
.demoLine.w60 { width: 60%; height: 18px; background: #D5DBE6; }
.demoLine.w40 { width: 40%; }
.demoField { height: 34px; border: 1.5px solid #D5DBE6; border-radius: 6px; margin-top: 6px; }
.demoField.short { width: 55%; }
.demoBtn { justify-self: start; position: relative; margin-top: 8px; padding: 9px 16px; border-radius: 6px; background: #E9EDF4; font-weight: 600; font-size: 14px; color: var(--ink); }
/* the one orchestrated moment: the highlight box draws itself around the button */
.demoHl { position: absolute; inset: -7px; border: 3px solid var(--marker); border-radius: 9px; box-shadow: 0 0 0 3px rgba(20,27,45,.55); animation: draw 1.1s .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes draw { from { opacity: 0; transform: scale(1.35); } to { opacity: 1; transform: scale(1); } }
.authDemo figcaption { display: flex; gap: 12px; align-items: center; margin-top: 16px; font-weight: 600; }

.stepTag { flex: none; display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; background: var(--marker); color: var(--ink); font: 700 16px/1 var(--display); }

/* ---------- app layout ---------- */
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.library { border-right: 1px solid var(--line); padding: 20px 14px; background: #E7EBF2; }
.libHead { display: flex; justify-content: space-between; align-items: center; margin: 0 6px 10px; }
.libHead h2 { font: 700 16px/1 var(--display); margin: 0; }
.search { width: 100%; margin-bottom: 10px; }
#guideList { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#guideList button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 10px; border-radius: 8px; font-weight: 600; font-size: 15px; }
#guideList button:hover { background: rgba(255,255,255,.6); }
#guideList button small { display: block; color: var(--slate); font-weight: 400; font-size: 13px; margin-top: 2px; }
#guideList button[aria-current="true"] { background: var(--card); box-shadow: inset 3px 0 0 var(--marker), 0 1px 2px rgba(20,27,45,.06); }
.sharedDot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: 6px; vertical-align: 2px; }

main { padding: 28px clamp(16px, 3vw, 40px) 80px; min-width: 0; }
.importMsg { margin: 0 0 20px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--marker); border-radius: 8px; font-weight: 600; }
.importMsg.err { border-left-color: var(--rec); }

/* start / empty state */
.start { max-width: 760px; }
.start h1 { font: 700 40px/1.08 var(--display); letter-spacing: -.025em; margin: 8px 0 12px; }
.recordForm { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 12px; margin-bottom: 28px; }
.recordForm > label:first-child { font-weight: 700; }
.recRow { display: flex; gap: 10px; flex-wrap: wrap; }
.recRow input { flex: 1 1 280px; font-size: 16px; padding: 12px 14px; }
.extHelp { background: #FFF8DC; border: 1px solid #EAD27A; border-radius: 14px; padding: 18px 20px; margin-bottom: 28px; }
.extHelp h2 { font: 700 18px/1.2 var(--display); margin: 0 0 6px; }
.howto { margin: 8px 0 0; padding-left: 20px; }
.howto li { margin: 4px 0; }
.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: f; }
.flow li { counter-increment: f; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 4px; }
.flow li::before { content: counter(f); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--marker); font: 700 15px/1 var(--display); margin-bottom: 6px; }
.flow strong { font: 700 17px/1.2 var(--display); }
.flow span { color: var(--slate); font-size: 14px; }

/* guide editor */
.guideHead { margin-bottom: 18px; }
.title { width: 100%; border: 0; border-bottom: 2px solid transparent; background: transparent; font: 700 clamp(26px, 3vw, 34px)/1.15 var(--display); letter-spacing: -.02em; padding: 2px 0; border-radius: 0; }
.title:hover { border-bottom-color: var(--line); }
.title:focus { box-shadow: none; border-bottom-color: var(--marker); }
.meta { color: var(--slate); margin: 6px 0 0; font-size: 14px; }
#saveState { margin-left: 6px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.story { min-width: 0; }
.lead { display: block; font-size: 13px; font-weight: 600; color: var(--slate); margin: 0 0 18px; }
.lead textarea { display: block; width: 100%; margin-top: 6px; font-weight: 400; font-size: 15px; color: var(--ink); }
#notice { min-height: 0; margin: 0 0 12px; font-size: 14px; color: var(--slate); }
#notice:empty { margin: 0; }
#notice.err { color: var(--rec); }

#steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 18px; }
#steps > li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px; }
.stepHead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stepHead input { flex: 1 1 220px; min-width: 0; border-color: transparent; background: transparent; font-size: 18px; font-weight: 700; padding: 5px 8px; }
.stepHead input:hover { border-color: var(--line); }
.tools { display: flex; gap: 4px; margin-left: auto; }
.tools button { padding: 4px 9px; font-size: 13px; font-weight: 600; color: var(--slate); background: transparent; border-color: transparent; }
.tools button:hover { border-color: var(--line); color: var(--ink); background: var(--paper); }
.tools button.del:hover { color: var(--rec); }
.shot { position: relative; margin: 12px 0; border-radius: 8px; overflow: hidden; background: var(--ink); line-height: 0; }
.shot img { width: 100%; height: auto; display: block; }
.hl { position: absolute; border: 3px solid var(--marker); border-radius: 6px; box-shadow: 0 0 0 3px rgba(20,27,45,.55), 0 0 0 9999px rgba(20,27,45,.18); pointer-events: none; }
.shot.blurring { cursor: crosshair; outline: 3px solid var(--marker); touch-action: none; }
.shot.blurring img { pointer-events: none; user-select: none; }
.blurBox { position: absolute; background: rgba(20,27,45,.55); border: 2px dashed #fff; pointer-events: none; }
.narr { display: block; font-size: 13px; font-weight: 600; color: var(--slate); }
.narr textarea { display: block; width: 100%; margin-top: 5px; font-size: 15px; font-weight: 400; color: var(--ink); }
.stepFoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center; margin-top: 8px; }
.voiceTag { font-size: 12px; color: var(--slate); }
.hold { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--slate); }
.hold input { width: 70px; padding: 5px 8px; }

/* side panel */
.panel { position: sticky; top: 16px; display: grid; gap: 12px; }
.panelCard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.panelCard.hero { padding: 10px; }
#poster { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
details.panelCard > summary { cursor: pointer; font: 700 16px/1.2 var(--display); list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.panelCard > summary::-webkit-details-marker { display: none; }
details.panelCard > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--slate); border-bottom: 2px solid var(--slate); transform: rotate(45deg); margin-right: 4px; transition: transform .15s; }
details.panelCard[open] > summary::after { transform: rotate(-135deg); }
details.panelCard:not([open]) { gap: 0; }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--slate); }
.field select, .field input { font-weight: 400; color: var(--ink); }
.hint { margin: 0; font-size: 13px; color: var(--slate); }
.musicInfo { display: grid; gap: 6px; font-size: 14px; }
#musicName { font-weight: 600; }
.panel > .danger { justify-self: start; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; max-width: min(94vw, 1100px); box-shadow: 0 30px 80px rgba(20,27,45,.4); color: var(--ink); }
dialog::backdrop { background: rgba(20,27,45,.62); }
dialog form { padding: 24px; width: min(92vw, 540px); }
dialog h2 { margin: 0 0 8px; font: 700 24px/1.15 var(--display); letter-spacing: -.01em; }
dialog h3 { font: 700 16px/1.2 var(--display); margin: 20px 0 8px; }
dialog p { color: var(--slate); font-size: 14px; margin: 0 0 14px; }
dialog label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
dialog label input, dialog label textarea { display: block; width: 100%; margin-top: 5px; font-weight: 400; font-size: 15px; }
dialog label.check { display: flex; }
dialog label.check input { width: auto; }
dialog textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
dialog input[readonly] { background: var(--paper); }
.row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.row.between { justify-content: space-between; align-items: center; margin: 0 0 6px; }
#shareDlg .danger { margin-right: auto; }
#shareMsg { min-height: 18px; }
#pasteDlg form { width: min(92vw, 640px); }
#playerDlg { background: var(--ink); color: #fff; width: min(94vw, 1100px); }
.dlgHead { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
#stage { display: block; width: 100%; height: auto; background: #0C1324; }
#playerStatus { margin: 0; padding: 10px 16px 14px; font-size: 14px; color: #C9D1E3; min-height: 44px; }
#adminDlg form { width: min(94vw, 980px); }
.tableWrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
#adminDlg table { width: 100%; border-collapse: collapse; font-size: 14px; }
#adminDlg th, #adminDlg td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
#adminDlg th { font-weight: 600; color: var(--slate); background: var(--paper); }
#adminDlg .num { text-align: right; font-variant-numeric: tabular-nums; }
#adminDlg tbody tr:last-child td { border-bottom: 0; }
#adminDlg td a { font-weight: 600; }

/* ---------- shared guide page ---------- */
.viewer { max-width: 920px; margin: 0 auto; padding: 32px 20px 80px; }
.viewer h1 { font: 700 clamp(30px, 4vw, 42px)/1.08 var(--display); letter-spacing: -.025em; margin: 0 0 10px; }
.viewer .lede { margin-bottom: 22px; }
.playerBox { position: relative; border-radius: 14px; overflow: hidden; background: var(--ink); line-height: 0; box-shadow: 0 30px 60px -34px rgba(20,27,45,.6); }
.playerBox canvas { width: 100%; height: auto; display: block; }
.playerBox .bigPlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--marker); color: var(--ink); border: 0; border-radius: 999px; padding: 14px 26px; font-size: 18px; font-weight: 700; line-height: 1.2; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.playerBox .bigPlay:hover { background: #F5C61F; }
.playerBar { display: flex; gap: 12px; align-items: center; margin: 12px 0 0; min-height: 40px; }
.playerBar p { margin: 0; flex: 1; color: var(--slate); font-size: 15px; }
.viewer ol { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 28px; counter-reset: step; }
.viewer ol > li { counter-increment: step; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 16px; }
.viewer ol > li::before { content: counter(step); grid-row: span 4; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--marker); font: 700 17px/1 var(--display); }
.viewer h2 { font: 700 20px/1.25 var(--display); margin: 4px 0 4px; }
.viewer li p { margin: 0 0 10px; color: var(--slate); max-width: 70ch; }
.viewer .shot { border: 1px solid var(--line); margin: 0; }
.viewer li button { justify-self: start; padding: 5px 11px; font-size: 13px; margin-top: 8px; }
.viewer .outro { color: var(--slate); font-size: 18px; margin-top: 32px; }
.viewer .made { margin-top: 48px; font-size: 13px; color: var(--slate); }
.viewer .made a { font-weight: 600; }
body.embed .top { display: none; }
body.embed .viewer { padding-top: 16px; }

/* ---------- legal pages ---------- */
.legal { max-width: 70ch; margin: 0 auto; padding: 36px 20px 80px; }
.legal h1 { font: 700 34px/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.legal h2 { font: 700 19px/1.25 var(--display); margin: 28px 0 6px; }
.legal .updated { color: var(--slate); font-size: 14px; margin: 0 0 20px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .panel > .danger { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; padding-top: 6vh; gap: 36px; }
  .layout { grid-template-columns: 1fr; }
  .library { border-right: 0; border-bottom: 1px solid var(--line); }
  .flow { grid-template-columns: 1fr; }
  .top { padding: 10px 16px; }
  .banner, .recLive { padding-left: 16px; padding-right: 16px; }
  .tools { margin-left: 0; }
}
@media print { .top, .playerBox, .playerBar, .viewer li button { display: none !important; } .viewer ol > li { break-inside: avoid; } }

/* ---------- refinements ---------- */
.guideHead input.title { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 2px 0; border-radius: 0; box-shadow: none; }
.guideHead input.title:hover { border-bottom-color: var(--line); }
.guideHead input.title:focus { border-bottom-color: var(--marker); }
.recordForm .fine:empty { display: none; }
.recordForm .fine { margin: 0; }
.flow li { align-content: start; }
.tools button { white-space: nowrap; }
.playerBox .bigPlay { top: auto; bottom: 9%; transform: translateX(-50%); }
@media (max-width: 860px) {
  .top { flex-wrap: wrap; }
  .topNav { gap: 6px 8px; }
  .navLink, .extOk { display: none; }
  .tools { width: 100%; flex-wrap: wrap; }
  .stepHead input { flex-basis: 160px; }
  .start h1 { font-size: 32px; }
}
