:root {
    color-scheme: light;
    --ink: #202522;
    --muted: #626965;
    --line: #d8ddda;
    --soft: #f4f6f5;
    --paper: #ffffff;
    --green: #145a46;
    --green-dark: #0d4133;
    --gold: #d7a82a;
    --gold-soft: #fff4c7;
    --red: #a6322b;
    --red-soft: #fbeceb;
    --blue: #245b91;
    --success: #176b3a;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

* { box-sizing: border-box; }
html { background: var(--soft); }
body { margin: 0; color: var(--ink); background: var(--soft); }
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }

.site-header { color: #fff; background: var(--green-dark); border-bottom: 5px solid var(--gold); }
.header-inner { width: min(1080px, calc(100% - 32px)); min-height: 92px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border: 2px solid var(--gold); border-radius: 50%; font-family: Georgia, serif; font-size: 30px; color: var(--gold-soft); }
.project-name { margin: 0 0 2px; color: #c9d9d3; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.site-header h1 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: 28px; font-weight: 600; letter-spacing: 0; }
.reviewer-identity { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 14px; }
.reviewer-identity form { margin: 0; }
.reviewer-identity .text-button { color: #fff; border-color: rgba(255,255,255,0.6); }

.welcome-main { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 64px; }
.welcome-intro { max-width: 760px; padding-bottom: 42px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 14px; font-weight: 800; text-transform: uppercase; }
.welcome-intro h2 { margin: 0 0 14px; font-family: Georgia, 'Times New Roman', serif; font-size: 38px; line-height: 1.14; letter-spacing: 0; }
.welcome-intro > p:not(.eyebrow):not(.alert):not(.field-help) { max-width: 720px; margin: 0; color: #414844; font-size: 19px; }
.start-form { margin-top: 30px; padding: 22px 0 0; border-top: 1px solid var(--line); }
.start-form label, .notes-label { display: block; margin-bottom: 7px; font-weight: 700; }
.start-row { display: flex; gap: 10px; max-width: 650px; }
.start-row input { flex: 1 1 auto; min-width: 0; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

input[type="text"], input[type="search"], .start-row input, textarea {
    width: 100%; border: 1px solid #aeb6b2; border-radius: 4px; padding: 11px 12px; color: var(--ink); background: #fff;
}
input:focus, textarea:focus { outline: 3px solid rgba(36,91,145,0.22); border-color: var(--blue); }

.primary-button, .secondary-button, .text-button, .close-button, .danger-button { min-height: 42px; border-radius: 4px; padding: 9px 15px; font-weight: 700; }
.primary-button { border: 1px solid var(--green); color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { border: 1px solid #8c9691; color: var(--ink); background: #fff; }
.secondary-button:hover { border-color: var(--green); color: var(--green-dark); background: #f5faf8; }
.text-button { min-height: 34px; border: 1px solid transparent; padding: 5px 8px; color: var(--blue); background: transparent; }
.text-button:hover { text-decoration: underline; }
.danger-button { border: 1px solid var(--red); color: #fff; background: var(--red); }
.danger-button:hover { background: #7e241f; }

.instructions, .examples { padding: 36px 0; border-top: 1px solid var(--line); }
.instructions h2, .examples h2 { margin: 0 0 22px; font-size: 24px; letter-spacing: 0; }
.plain-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; max-width: 880px; list-style: none; margin: 0; padding: 0; }
.plain-steps li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.plain-steps li > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--green); font-weight: 800; }
.plain-steps p { margin: 3px 0 0; }
.independence-note { margin: 26px 0 0; padding: 15px 18px; border-left: 5px solid var(--gold); background: var(--gold-soft); }
.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.example-grid article { min-height: 118px; padding: 20px; background: #fff; }
.example-grid article > bdi { display: block; margin-bottom: 7px; color: var(--green-dark); font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 27px; font-weight: 700; }
.example-grid p bdi { color: var(--green-dark); font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-weight: 700; }
.example-grid p { margin: 0; }
.example-warning { margin: 22px 0 0; color: #444b47; }

.review-main { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 72px; }
.progress-band { display: flex; align-items: center; gap: 42px; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.progress-band > div { min-width: 150px; }
.progress-band .secondary-button { margin-left: auto; }
.progress-label { display: block; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.progress-band strong { display: block; margin-top: 2px; font-size: 17px; }

.alert { margin: 18px 0; padding: 13px 16px; border-left: 5px solid; }
.alert.error { color: #7e241f; border-color: var(--red); background: var(--red-soft); }
.alert.success { color: #11542e; border-color: var(--success); background: #eaf6ee; }
.hidden { display: none !important; }
.state-panel { padding: 70px 20px; text-align: center; }
.state-panel h2 { margin: 0 0 8px; font-size: 25px; }
.state-panel p { max-width: 620px; margin: 0 auto 20px; color: var(--muted); }

.review-workspace { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.review-workspace > section { padding: 26px 30px; border-bottom: 1px solid var(--line); }
.review-workspace h2 { margin: 0 0 16px; font-size: 19px; letter-spacing: 0; }
.word-section { background: #fbfcfb; text-align: center; }
.word-meta { display: flex; justify-content: center; gap: 16px; margin-bottom: 15px; color: var(--muted); font-size: 13px; font-weight: 700; }
.target-word { min-height: 70px; max-width: 100%; overflow-wrap: anywhere; color: var(--green-dark); font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 48px; line-height: 1.35; }
.near-context { display: flex; justify-content: center; align-items: baseline; gap: 8px; min-height: 56px; margin: 14px auto 0; font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 25px; line-height: 1.8; }
.near-context span { color: #4d5551; }
mark { padding: 2px 5px; color: #171b19; background: var(--gold-soft); border-bottom: 3px solid var(--gold); }
.full-passage { max-width: 900px; margin: 15px auto 0; text-align: left; }
.full-passage summary { color: var(--blue); cursor: pointer; font-weight: 700; }
.full-passage p { margin: 14px 0 0; padding: 18px; background: #fff; border: 1px solid var(--line); font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 21px; line-height: 2; text-align: right; }

.choice-list { display: grid; gap: 9px; }
.answer-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.confidence-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 20px; }
.choice-list label { position: relative; min-width: 0; }
.choice-list input { position: absolute; opacity: 0; pointer-events: none; }
.choice-list span { display: flex; align-items: center; min-height: 48px; padding: 10px 12px 10px 40px; border: 1px solid #b7bfbb; border-radius: 4px; background: #fff; cursor: pointer; }
.choice-list span::before { content: ''; position: absolute; left: 14px; width: 16px; height: 16px; border: 2px solid #7d8882; border-radius: 50%; background: #fff; }
.choice-list input:checked + span { border-color: var(--green); background: #eaf4f0; box-shadow: inset 0 0 0 1px var(--green); }
.choice-list input:checked + span::before { border: 5px solid var(--green); }
.choice-list input:focus-visible + span { outline: 3px solid rgba(36,91,145,0.22); }

.search-section > p { margin: -8px 0 14px; color: var(--muted); }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.chosen-entry { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 14px; align-items: center; margin-top: 14px; padding: 13px 15px; border-left: 5px solid var(--success); background: #eaf6ee; }
.chosen-entry > span { color: var(--muted); font-size: 13px; }
.chosen-entry strong { font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 25px; }
.chosen-entry code, .result-title code { color: #5a625e; font-family: Consolas, monospace; font-size: 13px; }
.language-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border: 1px solid #6f9184; border-radius: 4px; color: var(--green-dark); background: #edf5f2; font-size: 12px; font-weight: 800; }
.language-badge.unknown { border-color: #aeb6b2; color: var(--muted); background: #f3f4f3; }
.search-results { margin-top: 14px; border-top: 1px solid var(--line); }
.search-result { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.result-title { display: flex; gap: 13px; align-items: baseline; }
.result-title strong { color: var(--green-dark); font-family: 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 25px; }
.search-result p { display: -webkit-box; overflow: hidden; margin: 4px 0 0; color: #4d5551; font-size: 14px; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.search-empty { margin: 0; padding: 18px 2px; color: var(--muted); }
.notes-label span { color: var(--muted); font-size: 13px; font-weight: 400; }
textarea { resize: vertical; }
.form-actions { display: flex; justify-content: space-between; align-items: center; padding: 20px 30px; background: #f7f8f7; }

dialog { width: min(700px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid #aeb6b2; border-radius: 6px; color: var(--ink); background: #fff; }
dialog::backdrop { background: rgba(20, 28, 24, 0.7); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; color: #fff; background: var(--green-dark); }
.dialog-header h2 { margin: 0; font-size: 21px; }
.close-button { min-width: 40px; padding: 3px 8px; border: 0; color: #fff; background: transparent; font-size: 28px; }
.dialog-steps { margin: 22px 34px; padding-left: 22px; }
.dialog-steps li { margin-bottom: 11px; }
.dialog-examples { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; margin: 0 22px; padding: 16px; background: var(--soft); }
.dialog-examples p { margin: 0; font-size: 19px; }
dialog > p { margin: 20px 22px 24px; }

.utility-main { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 72px; }
.utility-panel { max-width: 720px; padding: 28px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.utility-panel h2 { margin: 0 0 12px; font-size: 25px; }
.utility-panel form { display: grid; gap: 12px; margin-top: 22px; }
.utility-panel form label { font-weight: 700; }
.utility-panel input { width: 100%; border: 1px solid #aeb6b2; border-radius: 4px; padding: 11px 12px; }
.install-steps { margin: 24px 0; padding-left: 24px; }
.install-steps li { margin: 9px 0; color: var(--muted); }
.install-steps li.done { color: var(--success); font-weight: 700; }
.install-steps li.done::marker { content: '✓  '; }
.progress-track { height: 12px; overflow: hidden; border-radius: 4px; background: #e4e8e6; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width 150ms ease; }
.utility-status { min-height: 24px; color: var(--muted); }
.success-text { color: var(--success); font-weight: 700; }
.error-text { color: var(--red); font-weight: 700; }
.admin-logout { margin-left: auto; }
.admin-logout .text-button { color: #fff; border-color: rgba(255,255,255,0.6); }
.admin-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); background: #fff; }
.admin-summary div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.admin-summary div:last-child { border-right: 0; }
.admin-summary span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.admin-summary strong { display: block; margin-top: 4px; color: var(--green-dark); font-size: 29px; }
.admin-actions { display: flex; gap: 10px; align-items: center; padding: 24px 0; }
.admin-actions a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.delete-confirmation { margin-bottom: 24px; padding: 22px; border: 2px solid var(--red); border-radius: 6px; background: var(--red-soft); }
.delete-confirmation h2 { margin: 0 0 8px; font-size: 21px; }
.delete-confirmation p { margin: 0 0 16px; }
.delete-confirmation form { display: flex; gap: 10px; }
.delete-confirmation a { display: inline-flex; align-items: center; text-decoration: none; }
.admin-section { padding: 30px 0; border-top: 1px solid var(--line); }
.admin-section > h2 { margin: 0 0 18px; font-size: 23px; }
.empty-admin { padding: 24px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.adjudication-item { margin-bottom: 22px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.adjudication-item > header { padding: 18px 22px; border-bottom: 1px solid var(--line); background: #f7f8f7; }
.adjudication-item > header div { display: flex; align-items: baseline; gap: 15px; }
.adjudication-item > header bdi { color: var(--green-dark); font-family: 'Times New Roman', serif; font-size: 31px; font-weight: 700; }
.adjudication-item > header span { color: var(--muted); font-size: 13px; }
.admin-context { margin: 0; padding: 18px 22px; border-bottom: 1px solid var(--line); font-family: 'Times New Roman', serif; font-size: 21px; line-height: 1.8; }
.adjudication-item form { padding: 20px 22px; }
.adjudication-item fieldset { display: grid; gap: 9px; margin: 0 0 16px; padding: 0; border: 0; }
.adjudication-item legend { margin-bottom: 10px; font-weight: 800; }
.admin-review-choice { display: grid; grid-template-columns: 20px 1fr; gap: 9px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 4px; }
.admin-review-choice small { display: block; margin-top: 3px; color: var(--muted); }
.admin-language { color: var(--green-dark); font-size: 12px; font-style: normal; font-weight: 800; }
.adjudication-item input:not([type="radio"]), .adjudication-item textarea { width: 100%; margin-bottom: 10px; border: 1px solid #aeb6b2; border-radius: 4px; padding: 10px 12px; }
.adjudication-item form > label { display: block; margin-bottom: 5px; font-weight: 700; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: #fff; }
.admin-table-wrap table { width: 100%; border-collapse: collapse; }
.admin-table-wrap th, .admin-table-wrap td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table-wrap th { background: #f2f4f3; font-size: 13px; }

@media (max-width: 760px) {
    .header-inner { min-height: 78px; }
    .brand-mark { width: 44px; height: 44px; flex-basis: 44px; font-size: 25px; }
    .site-header h1 { font-size: 21px; }
    .project-name { font-size: 10px; }
    .header-inner { flex-wrap: wrap; padding: 10px 0; }
    .reviewer-identity { width: 100%; margin-left: 60px; justify-content: space-between; }
    .welcome-main { padding-top: 32px; }
    .welcome-intro h2 { font-size: 31px; }
    .plain-steps, .example-grid { grid-template-columns: 1fr; }
    .start-row { display: grid; }
    .progress-band { align-items: flex-start; gap: 18px; flex-wrap: wrap; }
    .progress-band .secondary-button { width: 100%; margin-left: 0; }
    .review-workspace > section { padding: 22px 18px; }
    .admin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-summary div { border-bottom: 1px solid var(--line); }
    .admin-actions { align-items: stretch; flex-direction: column; }
    .admin-actions a { width: 100%; }
    .answer-choices, .confidence-choices { grid-template-columns: 1fr; }
    .target-word { min-height: 62px; font-size: 41px; }
    .near-context { flex-wrap: wrap; min-height: 92px; font-size: 22px; }
    .chosen-entry { grid-template-columns: 1fr auto; }
    .chosen-entry > .selected-label { grid-column: 1 / -1; }
    .search-result { align-items: end; }
    .form-actions { padding: 18px; }
}

@media (max-width: 430px) {
    .header-inner { width: min(100% - 22px, 1080px); }
    .review-main, .welcome-main { width: min(100% - 20px, 1080px); }
    .search-row { grid-template-columns: 1fr; }
    .search-row button { width: 100%; }
    .search-result { grid-template-columns: 1fr; }
    .search-result button { width: 100%; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; gap: 8px; }
    .form-actions button { width: 100%; }
    .dialog-examples { grid-template-columns: 1fr; }
    .target-word { font-size: 36px; }
}
