:root {
  color-scheme: light;
  --paper: #f6f4ef;
  --surface: #fffcf7;
  --ink: #242720;
  --muted: #5b655b;
  --line: #dfded3;
  --green: #254c3e;
  --mint: #e4eee1;
  --warm: #ffdd9f;
  --alert: #8a341d;
  --space: clamp(16px, 4vw, 28px);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #548976; outline-offset: 2px; }
.wrap { width: min(100%, 748px); margin: auto; padding-inline: max(var(--space), env(safe-area-inset-left)); }
.bar { padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid #e1dfd3; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 60px; font-size: .98rem; font-weight: 730; }
.mark { width: 31px; height: 31px; padding: 7px 6px 6px; border-radius: 10px; display: grid; gap: 2px; background: var(--green); transform: rotate(-6deg); }
.mark i { display: block; height: 4px; border-radius: 2px; background: #f1f0c8; }
.mark i:nth-child(2) { width: 73%; }
.mark i:nth-child(3) { width: 46%; background: var(--warm); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.1rem, 8vw, 3.5rem); font-weight: 760; letter-spacing: -.07em; line-height: 1; margin-bottom: 0; }
h2 { font-size: 1.55rem; line-height: 1.15; letter-spacing: -.045em; margin-bottom: 0; }
h3 { font-size: 1rem; margin: 0; letter-spacing: -.01em; }
.library-head, .editor-nav, .shots-head, .shot-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.library-head { padding-block: 30px 20px; }
.primary { min-height: 45px; border: 0; border-radius: 12px; padding: 9px 15px; background: var(--green); color: white; font-weight: 690; white-space: nowrap; }
.primary:disabled { background: #e4e8df; color: #506157; }
.primary span { margin-right: 4px; }
.drafts { display: grid; gap: 10px; padding-bottom: 28px; }
.draft { display: grid; grid-template-columns: 43px minmax(0, 1fr) 24px; align-items: center; text-align: left; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); }
.draft:hover { border-color: #709785; }
.draft strong, .draft small { display: block; overflow-wrap: anywhere; }
.draft strong { font-size: 1.06rem; }
.draft small { margin-top: 3px; color: var(--muted); }
.draft .arrow { color: var(--green); text-align: center; font-size: 1.25rem; }
.message { padding: 18px 0 2px; color: var(--muted); overflow-wrap: break-word; }
.message.error { color: var(--alert); }
.empty { border: 1px dashed #b8c1b5; border-radius: 15px; padding: 20px; color: var(--muted); line-height: 1.45; margin: 0; }
.editor-nav { min-height: 55px; }
.text-button { background: transparent; border: 0; padding: 10px 0; color: var(--green); font-weight: 700; min-height: 44px; }
.version { font-size: .82rem; color: var(--muted); text-align: right; }
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) 79px; gap: 14px 12px; padding: clamp(15px, 4vw, 24px); border: 1px solid #284f42; border-radius: 20px; color: #fcf8ea; background: #24483a; overflow: hidden; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0; background: repeating-linear-gradient(120deg, transparent 0 41px, #d9efca21 41px 42px, transparent 42px 63px); mask-image: linear-gradient(90deg, transparent 40%, black); pointer-events: none; }
.hero label { color: #e4efdf; }
.hero input, .hero textarea { border: 1px solid #ffffff40; background: #172d27eb; color: #fff9ec; }
.hero input::placeholder, .hero textarea::placeholder { color: #beccc0; }
.hero-title { grid-column: 1/-1; }
.hero-title input { font-size: clamp(1.2rem, 4.7vw, 1.75rem); font-weight: 730; letter-spacing: -.03em; padding: 8px 11px; }
.duration input { font-variant-numeric: tabular-nums; }
label { display: grid; gap: 5px; font-size: .84rem; font-weight: 680; color: #38483c; }
input, textarea, select { width: 100%; min-width: 0; min-height: 43px; border: 1px solid #d4dacd; border-radius: 9px; padding: 8px 9px; background: #f8f8f0; color: var(--ink); font-size: 1rem; font-weight: 450; }
textarea { resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #616b60; }
.shots-head { padding-top: 24px; }
#timing { font-size: .85rem; font-weight: 750; color: var(--green); background: var(--mint); border-radius: 999px; padding: 7px 10px; text-align: center; }
#timing.over { color: #6b3c10; background: #f5e6cb; }
.timeline { height: 5px; background: #e5e6dc; border-radius: 4px; margin: 10px 0 14px; overflow: hidden; }
.timeline div { height: 100%; width: 0; background: #537969; transition: width .18s ease-out; }
.timeline div.over { background: #a56428; }
#empty-shots { color: var(--muted); margin: 13px 0; }
#shots { display: grid; gap: 11px; }
.shot { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 13px; box-shadow: 0 2px 3px #27293006; }
.shot-title, .shot-controls { display: flex; align-items: center; gap: 8px; }
.shot-icon { display: grid; place-items: center; position: relative; width: 37px; height: 37px; flex: 0 0 auto; color: var(--green); background: var(--mint); border-radius: 11px; }
.shot-icon i:first-child { width: 19px; height: 13px; border: 2px solid currentColor; border-radius: 3px; }
.shot-icon i:nth-child(2) { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: absolute; }
.shot:nth-child(3n+2) .shot-icon { background: #f4e7d1; color: #825316; }
.shot:nth-child(3n+3) .shot-icon { background: #e9e7f2; color: #584b7a; }
.round { width: 40px; height: 42px; border: 1px solid var(--line); border-radius: 10px; color: var(--green); background: transparent; font-size: 1.17rem; }
.round:disabled { opacity: .36; }
.round.remove { font-size: 1.34rem; color: var(--alert); }
.shot-grid { display: grid; grid-template-columns: minmax(0, 1fr) 94px; gap: 9px 10px; margin-top: 10px; }
.shot-grid label i { display: inline-block; width: 15px; color: var(--green); font-style: normal; font-size: 1em; }
.full { grid-column: 1 / -1; }
.ai-card, .script-panel { display: grid; gap: 11px; margin-top: 14px; padding: clamp(14px, 4vw, 20px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.ai-card { background: #eef3e9; border-color: #d5e3d5; }
.ai-card h2 span { color: var(--green); }
.ai-card .primary, .revision-panel .primary { white-space: normal; }
.script-panel textarea { line-height: 1.5; background: var(--surface); }
.edit-hint, .action-status { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.action-status:empty { display: none; }
.action-status.error { color: var(--alert); }
.revision-panel { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: #eef3e9; }
.secondary { min-height: 40px; border: 1px solid #afc1b4; border-radius: 10px; padding: 6px 9px; color: var(--green); background: var(--surface); font-weight: 670; }
.shot-extra { background: #f4f4eb; border-radius: 9px; padding-inline: 10px; }
.shot-extra summary { padding-block: 10px; color: var(--green); cursor: pointer; font-size: .84rem; font-weight: 700; }
.shot-extra label { margin-bottom: 9px; }
.add-shot { width: 100%; min-height: 46px; background: transparent; color: var(--green); border: 1px dashed #8fa99b; font-weight: 705; border-radius: 13px; margin-block: 12px 17px; }
.add-shot:disabled { opacity: .5; }
.save-dock { position: sticky; z-index: 2; bottom: 0; min-height: 68px; margin-inline: calc(-1 * var(--space)); background: #f6f4effa; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.save-inner { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 10px; }
#editor { padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
#editor .save-dock { position: fixed; inset-inline: 0; margin: 0; }
#editor[aria-busy="true"] .save-dock { visibility: hidden; }
.ai-progress { position: fixed; z-index: 3; inset: auto 0 0; background: #f1f5ec; border-top: 1px solid #bfd0c2; box-shadow: 0 -4px 16px #24483a12; padding-bottom: env(safe-area-inset-bottom, 0px); }
.ai-progress-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 70px; gap: 12px; padding-block: 10px; }
.ai-spinner { width: 22px; height: 22px; border: 2px solid #adbfad; border-top-color: var(--green); border-radius: 50%; animation: ai-spin 1s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-progress p { margin: 0; }
#ai-progress-title { color: var(--green); font-weight: 740; }
#ai-progress-detail { margin-top: 2px; color: var(--muted); font-size: .82rem; }
#ai-elapsed { color: var(--green); font-size: .85rem; font-weight: 720; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .ai-spinner { animation: none; } }
.save-feedback { min-width: 0; }
#save-copy { margin-bottom: 5px; }
#save-state { margin: 0; padding-block: 5px; font-size: .81rem; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
#save-state.error { color: var(--alert); }
#save-state.saved { color: var(--green); }
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; } }
@media (max-width: 350px) { .shot-controls { gap: 4px; } .round { width: 37px; } }


.text-row { grid-template-columns: 41px minmax(0, 1fr) auto; }
.text-row small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: #f3e7cc; color: #744c17; font-size: 1.26rem; font-weight: 700; }
.language-summary { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.text-pad { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(13px, 4vw, 23px); }
.document-title input { font-size: 1.1rem; font-weight: 650; background: #fffaf0; }
.language-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: #eeeee6; border-radius: 13px; padding: 4px; margin-block: 15px; }
.language-choice button { min-height: 40px; padding: 5px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: .88rem; font-weight: 670; }
.language-choice button[aria-pressed="true"] { color: var(--green); background: var(--surface); border-color: #d8dfd2; box-shadow: 0 1px 3px #293e3320; }
.language-choice button:disabled:not([aria-pressed="true"]) { opacity: .56; }
.translation-hint { margin: 0 0 12px; }
.translation-progress { display: flex; align-items: center; gap: 8px; padding: 9px 10px; margin-bottom: 12px; border-radius: 9px; color: var(--green); background: var(--mint); }
.translation-progress .ai-spinner { flex: 0 0 18px; height: 18px; }
.translation-progress p { flex: 1; margin: 0; font-size: .85rem; font-weight: 700; }
#translation-elapsed { white-space: nowrap; font-size: .84rem; font-variant-numeric: tabular-nums; }
.translation-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.translation-actions button { margin-block: 6px; font-size: .86rem; }
.optional-title { margin-top: 13px; }
.document-body textarea { line-height: 1.58; background: #fffaf0; min-height: 195px; padding: 11px; }
.character-count { margin: 7px 2px 0; color: var(--muted); text-align: right; font-size: .78rem; }
.share-tools { margin-block: 19px 12px; }
.share-tools h2 { font-size: 1.15rem; margin-bottom: 9px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.share-buttons button { min-height: 43px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .86rem; font-weight: 680; }
.share-buttons span { color: var(--green); padding-right: 2px; }
#share-telegram span { color: #196a93; }
.share-buttons button:disabled { opacity: .5; }
#share-status, #text-state { margin: 0; padding-block: 5px; font-size: .82rem; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
#share-status:empty { display: none; }
#text-state.error { color: var(--alert); }
#text-state.saved { color: var(--green); }
.menu { padding-block: 32px; }
.menu-options { display: grid; gap: 12px; margin-top: 23px; }
.menu-option { display: grid; grid-template-columns: 42px minmax(0, 1fr) 22px; gap: 12px; align-items: center; padding: 17px 13px; min-height: 77px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--surface); text-decoration: none; }
.menu-option strong, .menu-option small { display: block; overflow-wrap: anywhere; }
.menu-option strong { font-size: 1.12rem; }
.menu-option small { margin-top: 4px; color: var(--muted); }
.menu-arrow { text-align: center; color: var(--green); font-size: 1.3rem; }
.menu-option:hover { border-color: #709785; }
.menu-option:focus-visible, .menu-back:focus-visible { outline: 3px solid #548976; outline-offset: 2px; }
.menu-back { display: inline-flex; align-items: center; min-height: 43px; padding-block: 7px; color: var(--green); font-weight: 690; text-decoration: none; }
@media (min-width: 620px) { .menu-options { grid-template-columns: 1fr 1fr; } }
