:root {
  --ink: #1F1F1F;
  --gold: #B9975B;
  --gold-2: #E8C27A;
  --beige: #E8DDD1;
  --taupe: #BFAE9A;
  --ivory: #FAF7F2;
  --paper: #FFFFFF;
  --muted: #7a7268;
  --line: #E6DED3;
  --bad: #C8543C;
  --good: #5E8C5A;
  --stage: #191817;
  --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--ivory); font-size: 14px; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 4px; letter-spacing: .2px; }
h3 { font-size: 13px; font-weight: 700; margin: 0 0 8px; letter-spacing: .3px; }
.sub { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0; }

/* header */
.top { height: 60px; display: flex; align-items: center; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.spark { width: 18px; height: 18px; fill: var(--gold); }
.spark.big { width: 46px; height: 46px; }
.brand-name { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.brand-name em { color: var(--gold); }
.brand-by { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.file-name { flex: 1; text-align: center; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* buttons & fields */
.btn { font: 600 13px var(--sans); border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: 9px 14px; border-radius: 999px; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--gold); }
.btn.gold { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.btn.gold:hover { background: #000; box-shadow: 0 0 0 3px rgba(185,151,91,.35); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 12px; }
.btn.big { width: 100%; padding: 13px; font-size: 14px; margin-top: 8px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input:not([type]), input[type=number], select, textarea {
  font: 14px var(--sans); color: var(--ink); width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,151,91,.18); }
textarea { resize: vertical; line-height: 1.45; }
input.num { width: 80px; }
input[type=color] { width: 100%; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
input[type=range] { width: 100%; accent-color: var(--gold); }
.field { margin: 10px 0; }
.field > label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: #4a453f; }
.field.full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; cursor: pointer; line-height: 1.4; }
.check input { accent-color: var(--gold); width: 16px; height: 16px; flex: none; }
.check.indent { margin-left: 24px; color: var(--muted); }
.inline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.row.tight { margin: 6px 0; }
.row.spread { justify-content: space-between; }
.row select { flex: 1; width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
details.card summary { list-style: none; cursor: pointer; }
details.card summary h3 { display: inline; }
details.card summary::after { content: '+'; float: right; color: var(--gold); font-size: 18px; line-height: 1; }
details[open].card summary::after { content: '–'; }
details.card textarea { margin: 10px 0; }

/* layout */
.shell { display: grid; grid-template-columns: 92px 400px 1fr; height: calc(100vh - 60px); }
.rail { border-right: 1px solid var(--line); background: var(--paper); padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.rail-btn { border: 0; background: transparent; padding: 10px 4px; border-radius: 12px; font: 600 11px var(--sans); color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-btn span { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; }
.rail-btn:hover { background: var(--ivory); color: var(--ink); }
.rail-btn.active { background: var(--ivory); color: var(--ink); }
.rail-btn.active span { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.rail-btn.done span { background: var(--gold); color: #fff; border-color: var(--gold); }
.panel { overflow-y: auto; padding: 22px 20px 40px; border-right: 1px solid var(--line); }

/* upload */
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 38px 16px; border: 1.5px dashed var(--taupe); border-radius: 18px; background: var(--paper); cursor: pointer; text-align: center; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--gold); background: #fffdf8; }
.drop-ic { width: 40px; height: 40px; color: var(--gold); }
.drop span { color: var(--muted); font-size: 12px; }
.tips { margin-top: 22px; }
.tips ul { padding-left: 18px; margin: 0; color: #4a453f; line-height: 1.7; }
.loading { margin: 14px 0; font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: var(--beige); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
.bar.indet i { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* clean */
.wave { width: 100%; height: 90px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; display: block; }
.stat { margin: 10px 0; font-size: 13px; }
.stat b { color: var(--gold); }

/* words */
.words { display: flex; flex-wrap: wrap; gap: 4px; max-height: 260px; overflow-y: auto; }
.word { padding: 3px 7px; border-radius: 7px; background: var(--ivory); border: 1px solid var(--line); font-size: 13px; outline: none; cursor: text; }
.word:focus { border-color: var(--gold); background: #fff; }
.word.cut { opacity: .35; text-decoration: line-through; }
.word.now { background: var(--gold); color: #fff; border-color: var(--gold); }

/* presets */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset { text-align: left; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); padding: 0; cursor: pointer; overflow: hidden; font: inherit; color: inherit; }
.preset.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,151,91,.2); }
.preset .sw { height: 92px; background: linear-gradient(160deg, #6b5a4a, #2a2420); display: grid; place-items: center; padding: 8px; text-align: center; color: #fff; line-height: 1.05; }
.preset .meta { padding: 9px 10px; }
.preset .meta b { display: block; font-size: 13px; }
.preset .meta span { font-size: 11px; color: var(--muted); line-height: 1.35; display: block; margin-top: 2px; }

/* kit */
.kit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kit-item { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px; cursor: pointer; font: inherit; color: inherit; display: grid; grid-template-columns: 32px 1fr; gap: 8px; align-items: start; transition: .15s; }
.kit-item:hover { border-color: var(--gold); transform: translateY(-1px); }
.kit-item i { font-style: normal; width: 32px; height: 32px; border-radius: 9px; background: var(--ivory); display: grid; place-items: center; font-size: 15px; color: var(--gold); font-weight: 800; }
.kit-item b { font-size: 12.5px; display: block; }
.kit-item small { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.inspector-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.xy-btn.picking { background: var(--gold); color: #fff; border-color: var(--gold); }

/* brief */
.seg { display: flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin: 10px 0 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 4px; border-radius: 999px; font: 600 12px var(--sans); color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--ink); color: var(--ivory); }
.checks { list-style: none; padding: 0; margin: 12px 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.checks li .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; }
.checks li.ok .ic { background: var(--good); }
.checks li.bad .ic { background: var(--bad); }
.checks li.warn .ic { background: #D79B2E; }
.checks li small { display: block; color: var(--muted); }
.checks li.jump { cursor: pointer; }
.hook-group h4 { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin: 16px 0 6px; }
.hook-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; margin: 5px 0; background: var(--paper); font-size: 13px; }
.hook-line button { flex: none; }
.beat { border-left: 3px solid var(--gold); background: var(--paper); border-radius: 0 10px 10px 0; padding: 9px 12px; margin: 8px 0; }
.beat b { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.beat p { margin: 4px 0; font-size: 14px; }
.beat small { color: var(--muted); display: block; line-height: 1.5; }

/* export */
.downloads { list-style: none; padding: 0; margin: 0 0 10px; }
.downloads li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.downloads a { color: var(--ink); font-weight: 600; }

/* stage */
.stage { background: var(--stage); display: grid; grid-template-rows: 1fr auto auto; min-width: 0; min-height: 0; }
.preview-wrap { display: grid; place-items: center; padding: 18px; min-height: 0; overflow: hidden; }
.phone { position: relative; height: 100%; max-height: calc(100vh - 290px); aspect-ratio: 9 / 16; border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 0 0 7px #2c2a27, 0 25px 60px rgba(0,0,0,.5); }
.phone canvas { width: 100%; height: 100%; display: block; }
.phone.picking canvas { cursor: crosshair; }
.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; color: #8d8478; gap: 6px; text-align: center; }
.pick-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.transport { display: flex; align-items: center; gap: 14px; padding: 8px 20px; color: #d9d1c6; }
.play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ivory); cursor: pointer; display: grid; place-items: center; }
.play svg { width: 20px; height: 20px; fill: var(--ink); }
.time { font-variant-numeric: tabular-nums; }
.time b { color: #fff; }

/* timeline */
.timeline { position: relative; background: #232120; border-top: 1px solid #333; padding: 4px 16px 12px 96px; user-select: none; }
.ruler { position: relative; height: 18px; margin-bottom: 4px; cursor: pointer; }
.ruler span { position: absolute; top: 2px; font-size: 10px; color: #8d8478; transform: translateX(-50%); }
.ruler span::after { content: ''; position: absolute; left: 50%; top: 13px; width: 1px; height: 4px; background: #555; }
.track { position: relative; height: 30px; margin: 4px 0; }
.track-label { position: absolute; left: -82px; top: 7px; font-size: 11px; color: #8d8478; font-weight: 600; }
.lane { position: relative; height: 100%; background: #2b2927; border-radius: 6px; cursor: pointer; overflow: hidden; }
.blk { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; font-size: 10.5px; color: #fff; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 24px; }
.blk.cap { background: #4a4440; color: #e7dfd4; }
.blk.hook { background: #6d5a3b; }
.blk.fx { background: var(--gold); cursor: grab; font-weight: 700; }
.blk.fx.sel { outline: 2px solid #fff; z-index: 2; }
.blk.fx .grip { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(0,0,0,.15); }
.playhead { position: absolute; top: 4px; bottom: 8px; width: 2px; background: #fff; pointer-events: none; left: 96px; box-shadow: 0 0 6px rgba(255,255,255,.6); }
.playhead::before { content: ''; position: absolute; top: -2px; left: -5px; border: 6px solid transparent; border-top-color: #fff; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--ivory); padding: 11px 18px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-btn { min-width: 70px; }
  .panel { border-right: 0; }
  .stage { order: -1; }
  .phone { max-height: 60vh; height: 60vh; }
  .brand-by, .file-name { display: none; }
  .top { justify-content: space-between; }
  .timeline { padding-left: 76px; }
  .track-label { left: -64px; }
}

/* members-only gate (js/access.js) */
.gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(25,24,23,.72); backdrop-filter: blur(6px); }
.gate-card { width: min(440px, 100%); background: var(--paper); border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; }
.gate-card .spark { width: 30px; height: 30px; margin-bottom: 10px; }
.gate-card .sub { margin: 8px 0 18px; }
.gate-card > .btn { width: 100%; padding: 13px; }
.gate-form { display: flex; gap: 8px; }
.gate-form input { flex: 1; min-width: 0; font: 400 15px var(--sans); padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px; }
.gate-form input:focus { outline: none; border-color: var(--gold); }
.gate-msg { min-height: 20px; margin: 10px 0 0; color: var(--bad); font-size: 13px; }
.gate-card a { color: var(--ink); font-weight: 600; }

/* glow kit groups, search, sounds */
.kit-tools { margin: 4px 0 10px; }
.kit-tools input[type=search] { flex: 1; min-width: 0; }
.kit-tools input[type=range] { width: 90px; }
.kit-group { margin: 16px 0 0; font-size: 13px; display: flex; align-items: baseline; gap: 6px; }
.kit-group small { color: var(--gold); font-weight: 700; }
.kit-group + .hint { margin: 2px 0 8px; }
.kit-item small { display: block; margin-top: 2px; }
.glow-auto { border-color: var(--gold); }
.auto-list, .um-list, .font-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.auto-list li { display: grid; gap: 2px; padding: 8px 10px; background: var(--ivory); border-radius: 10px; }
.auto-list small { color: var(--muted); font-size: 11px; padding-left: 22px; }
.um-list li { font-size: 12px; padding: 6px 10px; background: var(--ivory); border-radius: 8px; }
.um-list li.jump { cursor: pointer; }
.um-list li.jump:hover { outline: 1px solid var(--gold); }
.um-list .tag { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); font-weight: 700; margin-right: 4px; }
.font-list li { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
#font-upload-btn, .img-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.img-btn img { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; }
