:root {
  color-scheme: light;
  --ink: #202d28;
  --muted: #54635b;
  --evergreen: #12352d;
  --green: #22523f;
  --line: #d8dfd7;
  --paper: #fffefa;
  --background: #f3f3eb;
  --accent: #efc87e;
  --highlight: #f7d98f;
  font: 16px/1.5 'Segoe UI', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
[hidden] { display: none !important; }
.shell { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.masthead { background: var(--evergreen); color: white; }
.masthead-inner { height: 72px; display: flex; justify-content: space-between; align-items: center; }
.masthead-actions { display: flex; align-items: center; gap: 14px; }
.masthead-actions .button { background: transparent; color: white; border-color: #78988a; }
.masthead-actions .button:hover:not(:disabled) { background: #2b5046; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 25px; font-weight: 650; letter-spacing: -.7px; }
.brand-mark { position: relative; width: 31px; height: 31px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-mark i, .document-icon { width: 13px; height: 17px; border: 1.5px solid currentColor; border-radius: 2px; position: relative; color: var(--evergreen); }
.brand-mark i::after, .document-icon::after { content: ''; position: absolute; inset: 4px 2px auto; height: 5px; border-block: 1px solid currentColor; }
.local-tag { color: #dbe9df; font-size: .875rem; display: flex; align-items: center; gap: 8px; }
.local-tag i { width: 7px; height: 7px; border-radius: 50%; background: #a8cf9e; }
.entry { display: grid; grid-template-columns: minmax(0,.85fr) minmax(380px,1.4fr); gap: clamp(25px, 4vw, 60px); align-items: center; padding: clamp(30px, 5vw, 65px) 0 32px; }
.intro h1 { font: 500 clamp(2.35rem, 4.7vw, 4.05rem)/1.03 Georgia, serif; letter-spacing: -.06em; max-width: 10.5em; margin: 0 0 18px; color: var(--evergreen); }
.intro p { color: var(--muted); max-width: 37ch; margin: 0; font-size: 1.06rem; }
.entry-actions { display: grid; gap: 9px; }
.language-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .9rem; }
.language-controls select { max-width: 65%; padding: 7px 10px; border: 1px solid #b9c8bc; border-radius: 7px; background: var(--paper); color: var(--evergreen); font: inherit; }
.import-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.import-card { display: flex; flex-direction: column; background: var(--paper); padding: 17px; border: 1px solid var(--line); border-radius: 13px; transition: background .15s, border-color .15s; }
.import-card.dragging { background: #e2eedf; border-color: var(--green); }
.import-card h2 { font-size: 1.08rem; margin: 4px 0 5px; color: var(--evergreen); line-height: 1.25; }
.import-card p { min-height: 3.15em; margin: 0 0 14px; color: var(--muted); font-size: .88rem; }
.import-actions { margin-top: auto; display: grid; gap: 6px; }
.entry-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 10px; row-gap: 7px; }
.identity-card .upload-icon { background: #f0e8d8; color: #715624; }
.identity-icon { display: inline-block; position: relative; width: 19px; height: 14px; border: 1.5px solid currentColor; border-radius: 2px; flex: none; }
.identity-icon::before { content: ''; position: absolute; width: 5px; height: 5px; top: 2px; left: 2px; border: 1px solid currentColor; border-radius: 50%; }
.identity-icon::after { content: ''; position: absolute; width: 5px; height: 5px; top: 3px; right: 2px; border-block: 1px solid currentColor; }
.upload-icon { display: grid; place-items: center; margin-bottom: 5px; width: 39px; height: 39px; border-radius: 9px; background: #e4ede1; color: var(--evergreen); font-size: 1.4rem; line-height: 1; }
.format { color: var(--muted); font-size: .82rem; }
.button { border: 1px solid #b9c8bc; border-radius: 7px; padding: 9px 14px; background: var(--paper); color: var(--evergreen); cursor: pointer; font: inherit; font-weight: 600; }
.button:hover:not(:disabled) { background: #e7eee3; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover:not(:disabled) { background: var(--evergreen); }
.button:disabled { opacity: .48; cursor: default; }
.button.small { font-size: .86rem; padding: 6px 10px; }
.button.clear { background: transparent; }
.button.danger { color: #9d3924; border-color: #d1a295; }
.button.icon { display: grid; place-items: center; aspect-ratio: 1; width: 35px; padding: 0; }
.button[aria-pressed="true"] { background: #e7eee3; border-color: var(--green); }
.camera-action { display: flex; align-items: center; justify-content: center; gap: 10px; }
.camera-icon { width: 17px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.camera-icon::before { content: ''; width: 6px; height: 6px; border-radius: 50%; border: 1px solid; position: absolute; top: 1.5px; left: 4px; }
.camera-icon::after { content: ''; width: 6px; height: 3px; border-radius: 2px; background: currentColor; position: absolute; top: -3px; left: 2px; }
.notice { margin: 0 0 14px; padding: 11px 14px; border-radius: 8px; border: 1px solid #bed0be; background: #e6efe3; }
.notice.error { border-color: #e4b9aa; background: #f9ebe4; color: #832d1c; }
.notice.busy::before { content: ''; display: inline-block; vertical-align: -.11em; width: .9em; height: .9em; margin-right: .55em; border-radius: 50%; border: 2px solid #adc5b2; border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.workspace { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 10px 32px #1933230b; overflow: hidden; }
.identity-panel { margin-bottom: 14px; }
.identity-body { padding: 15px 20px 17px; }
.identity-body > p { margin: 0 0 10px; }
.identity-warnings { padding: 8px 10px 8px 29px; border: 1px solid #dfc695; background: #faf3e3; border-radius: 6px; color: #5f4a24; font-size: .9rem; }
.identity-fields { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px 14px; margin: 12px 0; }
.identity-value { min-width: 0; display: grid; gap: 3px; font-size: .9rem; }
.identity-value input, .identity-type select, .identity-extra select { min-width: 0; border: 1px solid #afc1b3; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; padding: 7px 8px; }
.identity-type, .identity-extra { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .9rem; }
.identity-toolbar { margin: 13px 0 6px; }
.identity-preview { font-size: .9rem; }
.identity-preview summary { cursor: pointer; color: var(--green); }
.identity-preview ul { margin-block: 6px 0; padding-left: 19px; }
.account-form { display: grid; gap: 7px; }
.account-form .toolbar { margin-top: 7px; }
.dialog-error { color: #8b3521; }
.workspace-bar, .pane-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.workspace-bar { padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.explanation { padding: 13px 20px; border-bottom: 1px solid #d9c8e9; background: #f4eff8; }
.explanation h3, .explanation p { margin: 0 0 6px; }
.explanation-item { width: 100%; text-align: left; margin-top: 7px; border-color: #d9c8e9; color: #4d276e; }
.explained { background-color: #d8c2f273; border-color: #9465c0; }
.line.explained { background-color: #eee1f8; }
.line.explained.is-active { box-shadow: inset 3px 0 #8052ab; background-color: #e8d8f5; }
.document-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.document-heading h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.document-heading p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.document-icon { flex: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 7px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0,1.28fr) minmax(0,1fr); }
.pane { min-width: 0; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-bar { min-height: 58px; padding: 10px 15px; }
.pane h3 { font-size: .98rem; margin: 0; }
.pagination { display: flex; align-items: center; gap: 8px; font-size: .84rem; white-space: nowrap; }
.mark-toolbar { padding: 0 15px 11px; display: flex; flex-wrap: wrap; gap: 6px; }
.mark-toolbar span { margin-right: 3px; }
.mark-help { color: var(--green); margin: 0 15px 10px; font-size: .875rem; }
.preview-scroll { background: #e7eae2; overflow: auto; padding: 14px; max-height: 70vh; }
.page { position: relative; margin-inline: auto; max-width: 100%; background: white; box-shadow: 0 1px 6px #14251825; }
.page > img { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; }
.overlay .region { position: absolute; }
.hit { border: 1px solid transparent; background: transparent; padding: 0; cursor: pointer; }
.hit:hover, .hit.is-active { background: #ffd36d65; border-color: #ae731c; }
.hit:focus-visible { outline-offset: 1px; }
.adding .overlay { cursor: crosshair; }
.adding .hit, .adding .field { pointer-events: none; }
.field { z-index: 1; margin: 0; min-width: 0; padding: 0 2px; border-radius: 1px; border: 1px solid #286548aa; background: #ecf6eecf; color: #183b30; line-height: 1.12; font: inherit; }
.field[type="checkbox"], .field[type="radio"] { accent-color: var(--green); padding: 0; cursor: pointer; }
.field.is-guided { outline: 2px solid #4c9372; outline-offset: 1px; }
.field-guide { margin: 0 15px 10px; padding: 11px; border: 1px solid #b9d0bf; border-radius: 7px; background: #eaf2e9; }
.field-guide p { margin: 0 0 8px; }
.field-guide .guide-control { max-width: 100%; padding: 5px; margin-bottom: 8px; font: inherit; }
.field.multiline { resize: none; }
.mark { z-index: 2; pointer-events: none; transform: translateY(-50%); color: #173d6b; white-space: pre; line-height: 1; }
.mark.check { transform: translate(-50%,-50%); font-weight: 750; }
.text-hint { margin: 0; padding: 0 15px 11px; color: var(--muted); font-size: .875rem; }
.voice-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 0 15px 11px; font-size: .875rem; }
.voice-controls select { font: inherit; background: var(--paper); border: 1px solid #b9c8bc; border-radius: 6px; padding: 6px; color: var(--evergreen); }
.audio-player { display: block; width: calc(100% - 30px); height: 42px; margin: 0 15px 10px; }
.translated { margin: 0 10px 12px; padding: 9px 5px 0; background: #f2eef7; border-radius: 8px; }
.translated h3 { margin: 0 7px 4px; color: #4d276e; }
.translated .transcript { padding: 0 0 7px; max-height: 44vh; }
.translated .line { line-height: 1.65; }
.translation-region { background: #d8c2f279; border-color: #8052ab; }
.transcript { padding: 0 10px 13px; overflow: auto; max-height: 64vh; }
.line { display: block; width: 100%; border: 0; border-radius: 4px; background: transparent; color: var(--ink); text-align: start; font: inherit; padding: 4px 8px; cursor: pointer; overflow-wrap: anywhere; }
.line:hover { background: #eef1e8; }
.line.is-active { background: var(--highlight); }
.spoken-word { background: #ffdf4e; color: #1d251d; border-radius: 2px; }
.karaoke-region { z-index: 2; background: #ffda3c88; border: 1px solid #a88313; pointer-events: none; }
.edits { border-top: 1px solid var(--line); padding: 11px 15px; }
.edits ul { list-style: none; padding: 0; margin: 6px 0 0; }
.edits li { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-top: 5px; overflow-wrap: anywhere; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; margin-top: 27px; padding: 14px 0 24px; }
dialog { width: min(520px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 13px; padding: 0; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #0e231fa8; }
.dialog-inner { padding: 18px; display: grid; gap: 12px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; }
.dialog-inner h2, .dialog-inner p { margin: 0; }
.dialog-inner h2 { font-size: 1.25rem; }
.dialog-inner video { width: 100%; max-height: 55vh; background: var(--evergreen); border-radius: 6px; }
.dialog-inner input { padding: 9px; font: inherit; border: 1px solid #9cae9e; border-radius: 5px; width: 100%; }
:focus-visible { outline: 2px solid #986c28; outline-offset: 3px; }
@media (max-width: 750px) {
  .shell { width: calc(100% - 30px); }
  .masthead-inner { height: 58px; }
  .entry { grid-template-columns: 1fr; gap: 21px; padding-block: 27px 22px; }
  .masthead-actions { gap: 6px; }
  .masthead-actions .local-tag { display: none; }
  .import-card { padding: 12px; }
  .import-card p { min-height: 4em; }
  .import-actions .button { font-size: .86rem; padding-inline: 5px; min-height: 43px; }
  .identity-fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .intro h1 { margin-bottom: 11px; }
  .intro p { font-size: .98rem; }
  .workspace-grid { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  .workspace-bar { padding: 12px; }
  .preview-scroll { max-height: 60vh; padding: 8px; }
  .transcript { max-height: 45vh; }
}
@media (max-width: 370px) {
  .import-cards { grid-template-columns: 1fr; }
  .import-card p { min-height: 0; }
  .identity-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
