/* HyperCut: dark, phone-first. Black and charcoal, burnt orange, white type. */
:root {
  --bg: #0b0a09;
  --panel: #161310;
  --panel-2: #1d1914;
  --line: #2c261e;
  --text: #ffffff;
  --muted: #a89d90;
  --orange: #e8661f;
  --orange-hi: #ff8a3d;
  --danger: #ff6b5e;
  --ok: #7bd88f;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13.5px; }
a { color: var(--orange-hi); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }

/* sign-in / blocked */
#gate, #blocked { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.gate-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 24px 20px; }
.gate-card h1 { color: var(--orange-hi); }
.gate-card p { margin: 0; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg);
  color: var(--text); font-size: 16px; outline: none; font-family: inherit;   /* 16px stops iOS zooming in */
}
input:focus-visible { border-color: var(--orange); }
.msg { min-height: 20px; color: var(--danger); font-size: 14px; font-weight: 600; }

/* buttons: big touch targets */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 20px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--panel-2); color: var(--text);
  font-family: inherit; font-weight: 700; font-size: 16px; line-height: 1; cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--orange-hi), var(--orange)); border-color: transparent; color: #1a0d02; }
.btn.danger { color: var(--danger); border-color: rgba(255,107,94,.4); background: transparent; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; color: var(--muted); font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1; min-height: 44px; padding: 0 4px; cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange-hi); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; max-width: 760px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.01em; min-height: 44px; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: linear-gradient(135deg, var(--orange-hi), var(--orange)); display: inline-block; }
#app > section { max-width: 760px; margin: 0 auto; padding: 4px 16px 40px; }

/* list */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 4px; }
.add-btn { white-space: nowrap; }
.project-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.project-list a {
  display: block; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; min-height: 64px;
}
.project-list a:active { background: var(--panel-2); }
.p-title { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.p-meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 12px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.pill.complete { color: var(--ok); border-color: rgba(123,216,143,.35); }
.pill.processing { color: var(--orange-hi); border-color: rgba(255,138,61,.4); }
.pill.failed { color: var(--danger); border-color: rgba(255,107,94,.4); }

/* upload progress */
.upload-title { font-weight: 700; margin-bottom: 10px; overflow-wrap: anywhere; }
.bar { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
#upload-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--orange-hi)); transition: width .15s linear; }
.upload-err { color: var(--danger); font-weight: 600; }

/* project */
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--orange-hi); font-weight: 700; text-decoration: none; margin-left: -4px; }
.title-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.title-input { font-size: 22px; font-weight: 800; padding: 10px 12px; background: transparent; border-color: transparent; letter-spacing: -.01em; }
.title-input:hover { border-color: var(--line); }
.save-state { font-size: 13px; color: var(--muted); min-width: 64px; text-align: right; }
.save-state.ok { color: var(--ok); } .save-state.err { color: var(--danger); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; overflow-wrap: anywhere; letter-spacing: -.01em; }
.stat .v.dim { color: var(--muted); font-weight: 600; }
.stat .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.wide { grid-column: 1 / -1; }
audio { width: 100%; margin: 6px 0; color-scheme: dark; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.section-gap { margin-top: 26px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #26201a; border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: min(92vw, 420px);
  transition: opacity .2s, transform .2s; z-index: 10; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } .stat.wide { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* analysis results */
.small-btn { min-height: 44px; padding: 10px 16px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--panel-2); color: var(--text); font-family: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; touch-action: manipulation; }
.chip.on { border-color: var(--orange); color: var(--orange-hi); background: rgba(232,102,31,.14); }
.inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
input.bpm-input { width: 110px; flex: 0 0 auto; }
.k-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin: 0 0 4px; }
.section-gap-sm { margin-top: 16px !important; }
.offset-val { min-width: 74px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.wf-card { padding: 12px; }
.wf-host { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #100d0a; }
.wf-scroll { position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.wf-spacer { position: absolute; left: 0; top: 0; pointer-events: none; }
.wf-canvas { position: sticky; left: 0; top: 0; display: block; }
.wf-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event-row { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 14px; min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-family: inherit; font-size: 15px; cursor: pointer; }
.event-row:active { background: var(--panel-2); }
.event-time { font-weight: 800; color: var(--orange-hi); font-variant-numeric: tabular-nums; min-width: 52px; }
.event-main { display: flex; flex-direction: column; min-width: 0; }
.event-main b { font-size: 15px; }
.warn-list { margin: 0 0 10px; padding-left: 20px; color: var(--orange-hi); font-size: 14px; }

/* clip plan */
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 12px; }
.mode-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px; padding: 10px 6px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--panel-2); color: var(--text); font-family: inherit; font-weight: 800; font-size: 15px; cursor: pointer; touch-action: manipulation; text-align: center; }
.mode-btn small { font-weight: 600; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.mode-btn.on { border-color: var(--orange); background: rgba(232,102,31,.14); color: var(--orange-hi); }
.big-count { font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--orange-hi); }
.big-count small { font-size: 16px; font-weight: 700; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.clip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.clip-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.clip-main { text-align: left; padding: 12px 14px; min-height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-family: inherit; font-size: 15px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.clip-main:active { background: var(--panel-2); }
.clip-main.is-locked { border-color: rgba(232,102,31,.55); }
.clip-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.clip-num { font-weight: 800; color: var(--orange-hi); min-width: 34px; }
.clip-len { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.clip-times { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.clip-why { color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.clip-meta { color: var(--muted); font-size: 12.5px; }
.lock-btn { min-width: 62px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--panel-2); color: var(--muted); font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; touch-action: manipulation; }
.lock-btn.on { border-color: var(--orange); color: var(--orange-hi); background: rgba(232,102,31,.14); }
.section-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.section-item { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.section-item b { font-size: 16px; } .section-item .clip-meta { display: block; margin-top: 2px; }

/* lyrics */
.ly-paste { width: 100%; box-sizing: border-box; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); font: 16px/1.5 inherit; font-family: inherit; resize: vertical; margin: 10px 0 6px; }
.ly-paste:focus-visible { border-color: var(--orange); outline: none; }
.ly-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ly-sum { margin: 0; }
.ly-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ly-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.ly-row { border-radius: 14px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.ly-row.open { border-color: rgba(232,102,31,.5); }
.ly-line { display: grid; grid-template-columns: auto 1fr; align-items: stretch; }
.ly-time { min-width: 84px; padding: 0 10px; background: var(--panel-2); border: 0; border-right: 1px solid var(--line); color: var(--orange-hi); font-family: inherit; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; min-height: 52px; }
.ly-time.none { color: var(--muted); font-weight: 600; } .ly-time.warn { color: var(--danger); }
.ly-text { text-align: left; padding: 12px 14px; background: none; border: 0; color: var(--text); font-family: inherit; font-size: 15.5px; cursor: pointer; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 52px; overflow-wrap: anywhere; }
.ly-text.ly-inst { color: var(--muted); font-style: italic; }
.ly-text.ly-stanza { box-shadow: inset 0 3px 0 -1px rgba(232,102,31,.35); }
.ly-tag { font-size: 11.5px; font-weight: 700; color: var(--orange-hi); background: rgba(232,102,31,.12); border-radius: 999px; padding: 2px 8px; }
.ly-tag.warnline { color: var(--danger); background: rgba(255,107,94,.12); }
.ly-panel { padding: 10px 12px 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.ly-input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); font-size: 16px; font-family: inherit; box-sizing: border-box; }
.ly-select { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 15px; font-family: inherit; }
.ly-sync-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ly-transport { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 6px; }
.ly-clock { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--orange-hi); font-size: 18px; }
.ly-ctx { min-height: 20px; margin: 10px 0 4px; }
.ly-prev { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; } .ly-prev span:first-child { color: var(--orange-hi); font-variant-numeric: tabular-nums; }
.ly-now { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; margin: 6px 0; min-height: 64px; overflow-wrap: anywhere; }
.ly-now.ly-inst { color: var(--muted); font-style: italic; }
.ly-next { color: var(--muted); font-size: 15px; margin-bottom: 10px; overflow-wrap: anywhere; }
.ly-tap { display: block; width: 100%; min-height: 120px; margin: 10px 0 12px; border-radius: 22px; border: 0; background: linear-gradient(180deg, var(--orange-hi), var(--orange)); color: #1a0d02; font-family: inherit; font-weight: 900; font-size: 34px; letter-spacing: .08em; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.ly-tap:active { transform: scale(.985); filter: brightness(1.1); }
.ly-notice { border: 1px solid rgba(232,102,31,.5); background: rgba(232,102,31,.1); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; }
.ly-notice p { margin: 0 0 10px; }
.clip-lyric { color: var(--orange-hi); font-size: 14px; font-style: italic; overflow-wrap: anywhere; }

/* timeline (four tracks) and clip editor */
.tl-scroll { position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-x; background: #100d0a; }
.tl-spacer { position: absolute; left: 0; top: 0; pointer-events: none; }
.tl-canvas { position: sticky; left: 0; top: 0; display: block; }
.tl-handles { position: absolute; left: 0; top: 0; pointer-events: none; }
.tl-handle { position: absolute; width: 30px; pointer-events: auto; touch-action: none; cursor: ew-resize; display: none; border-radius: 8px; }
.tl-handle:hover, .tl-handle.active { background: rgba(255,255,255,0.12); }
.clip-main.is-selected { border-color: var(--orange-hi); background: rgba(232,102,31,.1); }
.ed-card { border-color: rgba(232,102,31,.4); }
.ed-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ed-head b { font-size: 18px; }
.ed-edge { margin: 10px 0; }
.ed-label { display: inline-block; min-width: 46px; } .ed-time { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--orange-hi); margin-left: 6px; }
.btn.small-btn.primary { color: #1a0d02; }
