:root {
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #1b2434;
    background: #f4f5f8;
    --text: #1b2434;
    --muted: #536074;
    --line: #e1e5ee;
    --accent: #086855;
    --accent-light: #e7f3ed;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 270px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.35rem); letter-spacing: -.06em; line-height: 1.08; }
h2 { font-size: 1.13rem; letter-spacing: -.025em; line-height: 1.3; }
a { color: var(--accent); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.shell { max-width: 1200px; padding-inline: clamp(16px, 4vw, 44px); margin-inline: auto; }
.skip { position: absolute; background: white; padding: 10px; transform: translateY(-120%); z-index: 3; }
.skip:focus { transform: none; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-row { min-height: 62px; display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding-block: 9px; }
.site-row a { font-size: .9rem; text-decoration: none; }
.site-row a:hover, .site-footer a:hover { text-decoration: underline; }
.site-row .brand { color: var(--text); font-size: 1.1rem; font-weight: 760; display: inline-flex; align-items: center; gap: 8px; }
.site-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 14px; }
.mp-language-switch { display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.mp-language-switch a { padding: 5px 7px; border-radius: 5px; font-size: .78rem; }
.mp-language-switch a[aria-current="page"] { background: var(--accent-light); color: #075748; font-weight: 650; }
.brand img { object-fit: contain; }
.intro { padding-block: clamp(25px, 5vw, 49px) clamp(22px, 4vw, 32px); }
.intro p { margin-top: 9px; color: var(--muted); font-size: clamp(.95rem, 2vw, 1.07rem); }
.workspace { display: grid; grid-template-columns: minmax(0, .97fr) minmax(0, 1.03fr); align-items: start; gap: 18px; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 4px 15px #17283e09; }
.player-panel { padding: 16px; }
.panel-heading, .tools-heading { display: flex; justify-content: space-between; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.player-stage { display: grid; place-items: center; min-height: 326px; margin-top: 14px; overflow: hidden; background: #131d2d; border: 1px solid #1d2a3e; border-radius: 11px; }
.empty-player { display: grid; justify-items: center; text-align: center; color: #f1f5fc; gap: 9px; padding: 24px; }
.empty-player p { color: #bac7da; font-size: .85rem; }
.play-mark { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px; margin-bottom: 4px; background: #293950; color: #eaf2fd; padding-left: 2px; }
.frame { position: relative; width: min(100%, var(--frame-width, 260px)); aspect-ratio: var(--frame-ratio, .5625); background: #090d15; }
.frame video, .frame canvas { position: absolute; width: 100%; height: 100%; inset: 0; }
.frame canvas { pointer-events: none; }
.player-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; margin-top: 11px; }
.player-controls input { min-width: 0; width: 100%; accent-color: var(--accent); }
.time { color: var(--muted); font-size: .76rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.file-info, .muted { color: var(--muted); font-size: .87rem; line-height: 1.5; }
.file-info { margin-top: 9px; overflow-wrap: anywhere; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 12px; border: 1px solid #cdd5e1; border-radius: 9px; background: #fff; color: var(--text); font-size: .85rem; line-height: 1.2; font-weight: 650; text-align: center; text-decoration: none; }
.button:hover:not(:disabled) { background: #edf2f7; }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover:not(:disabled) { background: #075647; }
.button.small { min-height: 34px; padding: 5px 9px; font-size: .8rem; }
.button:disabled { opacity: .48; cursor: default; }
:focus-visible, .file-control input:focus-visible + label { outline: 2px solid #0d8069; outline-offset: 3px; }
.file-label { cursor: pointer; }
.file-control { display: flex; position: relative; }
.file-control input:disabled + label { cursor: default; opacity: .48; pointer-events: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.actions { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 40px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); padding: 8px 12px; font-size: .86rem; font-weight: 650; }
.tabs button:hover { background: #f0f3f7; }
.tabs button[aria-selected="true"] { background: var(--accent-light); color: #075748; }
.tab-panel { padding: 16px; min-height: 270px; }
.tab-panel > .muted { margin-top: 6px; }
.tools-heading p { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.empty-note { margin-top: 16px; border-radius: 11px; border: 1px dashed #c9d5e2; padding: 20px 17px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.captions { list-style: none; margin: 13px 0 0; padding: 0; display: grid; gap: 10px; max-height: 375px; overflow: auto; scrollbar-gutter: stable; }
.caption { border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: #f8fafd; }
.cue-actions, .timings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cue-actions .jump { justify-self: start; min-width: 45px; }
.cue-actions .remove { justify-self: end; }
.timings { margin-top: 6px; }
.timings input { font-variant-numeric: tabular-nums; }
.tab-panel label:not(.file-label) { display: block; color: var(--text); font-size: .82rem; font-weight: 650; }
.tab-panel label[for]:not(.file-label), .cue-label { margin-top: 12px; }
.tab-panel input:not([type="file"]), .tab-panel textarea { display: block; width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid #cbd5e2; border-radius: 7px; margin-top: 4px; background: #fff; color: var(--text); font-size: .9rem; }
.tab-panel textarea { resize: vertical; }
.tab-panel [aria-invalid="true"] { border-color: #ad3436 !important; }
.status { margin-top: 9px; color: #0a5c48; font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.status.error { color: #a12d33; }
.cover-actions, .copy-actions { margin-block: 11px; }
.cover-preview { margin-block: 10px; background: #131d2d; border-radius: 8px; display: grid; place-items: center; }
.cover-preview img { display: block; max-width: 100%; max-height: 245px; object-fit: contain; }
.ai-cover { border-top: 1px solid var(--line); }
.ai-cover button { margin-top: 8px; }
.small-text { font-size: .79rem; }
.ai-bar { background: #f7faf8; padding: 13px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 9px; align-items: center; border-radius: 0 0 17px 17px; border-top: 1px solid var(--line); }
.ai-bar strong { font-size: .86rem; }
.ai-bar p { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.ai-bar .status, .ai-disclosure { grid-column: 1 / -1; }
.ai-bar .status.error { color: #a12d33; }
.export-panel { margin-top: 16px; padding: 15px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: center; }
.export-panel p:not(.status) { color: var(--muted); font-size: .86rem; line-height: 1.45; margin-top: 3px; }
.export-panel .status { grid-column: 1 / -1; }
.draft-panel { border-top: 3px solid var(--accent); }
.draft-panel .draft-account { color: var(--accent); font-weight: 650; margin-top: 8px; }
.draft-actions { justify-content: flex-end; max-width: 320px; }
.site-footer { padding-block: 18px 23px; display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--muted); font-size: .82rem; text-decoration: none; }

@media (max-width: 760px) {
    .workspace { grid-template-columns: 1fr; }
    .player-stage { min-height: 240px; }
    .export-panel { grid-template-columns: 1fr; gap: 9px; }
    .draft-actions { justify-content: flex-start; max-width: none; }
}
@media (max-width: 370px) {
    .ai-bar { grid-template-columns: minmax(0, 1fr); }
    .tabs button { padding-inline: 7px; }
    .tab-panel, .player-panel { padding: 11px; }
    .button { padding-inline: 8px; }
}
