:root {
  --bg: #071F18; --card: #0E3328; --card2: #13402F; --line: #1F5A44; --tx: #F3FFF8; --mut: #A9CBBB;
  --gold: #F5C542; --gold2: #FFDE7A; --green: #25D366; --red: #EF4444;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--tx); font-family: 'Poppins', system-ui, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: rgba(7,31,24,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand .logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--gold); color: #1b1b1b; font-size: 13px; align-self: center; }
.brand small { color: var(--gold); font-weight: 600; }
.quota { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--card2); color: var(--gold2); border: 1px solid var(--line); }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 120px; }
.screen { display: none; }
.screen.on { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h1 { font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: clamp(30px, 8vw, 40px); line-height: 1.1; margin: 18px 0 10px; }
h1 span { color: var(--gold); }
h2 { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 22px; margin: 22px 0 10px; }
.sub { color: var(--mut); line-height: 1.55; margin: 0 0 18px; }
.bigbtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px; margin: 10px 0; padding: 14px 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 17px; cursor: pointer; text-align: center; }
.bigbtn.primary, button.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1d1600; border: 0; box-shadow: 0 6px 20px rgba(245,197,66,.25); }
.bigbtn.small { min-height: 48px; font-size: 15px; }
.ticks { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; }
.ticks li { padding-left: 28px; position: relative; color: var(--mut); font-size: 14px; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: -1px; width: 20px; height: 20px; border-radius: 50%; background: var(--card2); color: var(--green); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.opts { margin: 14px 0; padding: 12px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.opts summary { cursor: pointer; font-weight: 600; color: var(--gold2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; font-size: 14px; color: var(--mut); }
.row.col { flex-direction: column; align-items: stretch; }
select, .txt, textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #0A2A20; color: var(--tx); font-size: 16px; }
select { width: auto; min-width: 140px; }
textarea { resize: vertical; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 0; min-height: 42px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--gold); color: #1d1600; border-color: var(--gold); }
.note { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #3A2A06; color: #FFE7A3; font-size: 14px; line-height: 1.5; }
.note.err { background: #3B0D0D; color: #FFC9C9; }
.privacy, .hint { font-size: 13px; color: var(--mut); line-height: 1.5; }
.hint code { background: var(--card2); padding: 1px 6px; border-radius: 6px; }
.tip { font-size: 13px; color: var(--gold2); background: var(--card); padding: 10px 12px; border-radius: 12px; }
.bar { height: 12px; border-radius: 99px; background: var(--card); overflow: hidden; border: 1px solid var(--line); margin: 16px 0; }
.bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .25s; }
.rec-dot { width: 90px; height: 90px; border-radius: 50%; margin: 30px auto 10px; background: var(--red); box-shadow: 0 0 0 0 rgba(239,68,68,.6); animation: pulse 1.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 26px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
.rec-time { text-align: center; font-size: 34px; font-weight: 800; margin-bottom: 18px; font-variant-numeric: tabular-nums; }
.linkbtn { display: block; margin: 8px auto; background: none; border: 0; color: var(--mut); text-decoration: underline; cursor: pointer; }

.stage-wrap { display: flex; justify-content: center; }
.stage { position: relative; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.stage canvas { display: block; width: 100%; height: 100%; }
.play { position: absolute; inset: 0; margin: auto; width: 70px; height: 70px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 28px; cursor: pointer; transition: opacity .2s; }
.play.hide { opacity: 0; }
.seekrow { display: flex; align-items: center; gap: 10px; margin: 10px 2px; font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; }
.seekrow input { flex: 1; accent-color: var(--gold); }
input[type=range] { accent-color: var(--gold); width: 100%; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; position: sticky; top: 52px; z-index: 4; background: var(--bg); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; padding: 9px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--tx); color: #062018; }
.panel { display: none; padding: 6px 0 10px; }
.panel.on { display: block; }
.styles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.styles button { padding: 0; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: #000; cursor: pointer; position: relative; }
.styles button.on { border-color: var(--gold); }
.styles canvas { display: block; width: 100%; }
.styles span { position: absolute; left: 6px; bottom: 5px; font-size: 11px; background: rgba(0,0,0,.6); padding: 2px 7px; border-radius: 99px; }
.words { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); max-height: 46vh; overflow-y: auto; }
.words button { padding: 6px 9px; border-radius: 9px; border: 1px solid var(--line); background: #0A2A20; font-size: 15px; cursor: pointer; }
.words button.kw { background: var(--gold); color: #1d1600; border-color: var(--gold); font-weight: 700; }
.words button.del { text-decoration: line-through; opacity: .45; }
.words button.fill { opacity: .55; font-style: italic; }
.words button.now { outline: 2px solid var(--green); }
.smallbtn { margin-top: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); cursor: pointer; font-weight: 600; }
.switch { display: flex; align-items: center; gap: 12px; margin: 14px 0; font-size: 15px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 99px; background: #2b4c40; position: relative; flex: 0 0 auto; cursor: pointer; transition: background .2s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(20px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chips button { padding: 7px 11px; border-radius: 99px; border: 1px dashed var(--line); background: transparent; font-size: 12.5px; color: var(--mut); cursor: pointer; text-align: left; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.thumbs div { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 13px; }
.ratios { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.ratios button { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; font-size: 12px; color: var(--mut); }
.ratios button b { display: block; color: var(--tx); font-size: 15px; }
.ratios button i { display: block; flex: 0 0 auto; border: 2px solid var(--mut); border-radius: 3px; }
.ratios button.on { border-color: var(--gold); background: var(--card2); }
.ratios button.on i { border-color: var(--gold); }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(7,31,24,.96); border-top: 1px solid var(--line); justify-content: center; }
.bottom-bar button, .ex-actions button { min-height: 52px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 16px; cursor: pointer; }
.bottom-bar .primary { flex: 1; max-width: 360px; }
.ghost { background: var(--card); border: 1px solid var(--line); }
.ex-actions { display: flex; gap: 10px; margin-top: 16px; }
.ex-actions button { flex: 1; }
.result { margin: 14px 0; padding: 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.result video { display: block; width: 100%; max-height: 60vh; border-radius: 10px; background: #000; }
.result .btns { display: flex; gap: 8px; margin-top: 10px; }
.result .btns a, .result .btns button { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 50px; border-radius: 12px; font-weight: 700; text-decoration: none; cursor: pointer; border: 0; }
.result .btns a { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1d1600; }
.result .btns button { background: var(--green); color: #062b15; }
.result small { display: block; color: var(--mut); margin-top: 6px; }
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-box { width: 100%; max-width: 560px; background: var(--card); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-box h3 { margin: 0 0 10px; }
.sheet-btns { display: flex; gap: 8px; margin-top: 10px; }
.sheet-btns button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-weight: 600; cursor: pointer; }
.sheet-btns button.on { background: var(--gold); color: #1d1600; }
.hidden-media { position: fixed; left: -9999px; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
