:root {
    color-scheme: light;
    --bg: #f5f6f3;
    --surface: #ffffff;
    --surface-2: #eef3f0;
    --text: #202421;
    --muted: #606b65;
    --border: #d9dfda;
    --accent: #28635a;
    --accent-2: #7b4d28;
    --danger: #9d2f2f;
    --shadow: 0 14px 34px rgba(30, 37, 33, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    background: #e8ece7;
    border-radius: 4px;
    padding: 1px 5px;
}

.shell {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.passage-shell {
    width: min(1320px, calc(100vw - 28px));
}

.masthead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.masthead h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.04;
    letter-spacing: 0;
}

.passage-masthead h1 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.breadcrumb {
    margin: 0 0 8px;
    font-size: 0.92rem;
}

.muted {
    color: var(--muted);
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    font: 700 0.95rem/1 ui-sans-serif, system-ui, sans-serif;
    cursor: pointer;
}

.button.secondary {
    background: transparent;
    color: var(--accent);
}

.button:hover {
    text-decoration: none;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.metric {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    padding: 18px;
}

.metric span {
    display: block;
    font-size: 2rem;
    font-weight: 800;
}

.metric strong {
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.panel,
.source-block,
.translation-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface-2);
    font-size: 0.84rem;
    text-transform: uppercase;
}

.passage-list {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.set-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.set-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.set-card h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}

.passage-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.passage-row a {
    display: grid;
    gap: 4px;
}

.passage-name {
    color: var(--text);
    font-weight: 800;
}

.tier-chip {
    width: fit-content;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    color: var(--accent);
    background: var(--surface-2);
    font-weight: 800;
    font-size: 0.78rem;
}

.passage-preview {
    color: var(--muted);
}

.count,
.profile-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--accent-2);
    background: #fbf8f1;
    font-weight: 700;
    font-size: 0.86rem;
}

.source-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}

.source-block {
    padding: 18px;
}

.source-block h2,
.source-block summary {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 800;
}

.source-block summary {
    cursor: pointer;
}

.source-text {
    white-space: normal;
    font-size: 1.05rem;
}

.greek .source-text {
    font-family: "New Athena Unicode", "Gentium Plus", "Times New Roman", serif;
    font-size: 1.24rem;
    line-height: 1.65;
}

.review-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.review-form > * {
    min-width: 0;
}

.form-status {
    min-height: 0;
    color: var(--accent);
    font-weight: 700;
}

.form-status:not(:empty) {
    border: 1px solid #b9d4ca;
    border-radius: 7px;
    background: #eef8f4;
    padding: 10px 12px;
}

.translation-card {
    padding: 18px;
}

.focal-card {
    position: sticky;
    top: 10px;
    align-self: start;
    z-index: 4;
    max-height: min(46vh, 430px);
    overflow: auto;
    border: 2px solid var(--accent);
    background: #fbfdf9;
    box-shadow: 0 18px 38px rgba(25, 48, 40, 0.18);
}

.context-section {
    padding: 4px 0 0;
}

.scroll-prompt {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px 16px;
    background: #eef5f1;
    color: var(--accent);
    font-weight: 800;
}

.scroll-prompt p {
    margin: 0;
}

body:not(.js-enabled) .scroll-prompt,
body.helpers-visible .scroll-prompt {
    display: none;
}

.helper-region {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
}

.helper-region > * {
    min-width: 0;
}

body.js-enabled:not(.helpers-visible) .helper-region {
    display: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px);
}

.greek-source .source-text,
.greek-text {
    font-family: "New Athena Unicode", "Gentium Plus", "Times New Roman", serif;
    font-size: 1.18rem;
    line-height: 1.62;
}

.context-section h2 {
    margin: 0;
    font-size: 1.15rem;
}

.translation-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: start;
    margin-bottom: 12px;
}

.translation-header h2 {
    margin: 0 0 4px;
    font-size: 1.18rem;
}

.prompt-aim {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
}

.translation-text {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 12px 0;
    padding: 14px 0;
    min-width: 0;
    overflow-x: auto;
    white-space: normal;
}

.markdown-body > :first-child {
    margin-top: 0;
}

.markdown-body > :last-child {
    margin-bottom: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
    margin: 0 0 12px;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 22px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 14px 0 8px;
    font-size: 1.02rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 12px;
    color: var(--muted);
}

.markdown-body pre {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 12px;
    background: #f7f8f5;
}

.warning {
    border-left: 3px solid var(--danger);
    padding-left: 10px;
    color: var(--danger);
}

.rating-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 0;
    min-inline-size: 0;
}

.rating-fieldset legend,
.notes-label {
    max-width: 100%;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
    text-transform: uppercase;
}

.rating-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.rating-grid-11 {
    position: relative;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 0;
    align-items: center;
    overflow: hidden;
    padding: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #b54848 0%, #c99235 48%, var(--accent) 100%);
    box-shadow: inset 0 0 0 1px rgba(32, 36, 33, 0.18);
}

.scale-ends {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.88rem;
}

.rating-option {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px;
    background: #fafbf9;
    font-weight: 700;
    text-align: center;
}

.rating-grid-11 .rating-option {
    position: relative;
    z-index: 1;
    min-height: 36px;
    min-width: 0;
    gap: 0;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: none;
    cursor: pointer;
}

.rating-grid-11 .rating-option:first-child {
    border-left: 0;
}

.rating-grid-11 .rating-option input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.rating-option span {
    position: relative;
    z-index: 1;
    pointer-events: none;
    white-space: nowrap;
}

.rating-option:has(input:checked) {
    border-color: var(--accent);
    background: #e7f2ee;
    color: var(--accent);
}

.rating-grid-11 .rating-option:has(input:checked) {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    box-shadow: inset 0 0 0 2px var(--text);
}

.rating-grid-11 .rating-option:has(input:focus-visible) {
    outline: 3px solid #e3b34f;
    outline-offset: 2px;
}

.trust-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 12px 0;
    color: var(--muted);
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 10px;
    color: var(--text);
    font: 0.98rem/1.45 ui-sans-serif, system-ui, sans-serif;
}

.empty-state {
    padding: 22px;
}

@media (max-width: 820px) {
    .masthead,
    .source-layout {
        grid-template-columns: 1fr;
        display: grid;
    }

    .summary-grid,
    .set-grid {
        grid-template-columns: 1fr;
    }

    .rating-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .rating-grid-11 {
        grid-template-columns: repeat(11, minmax(0, 1fr));
        min-width: 0;
    }

    .focal-card {
        top: 8px;
        max-height: 52vh;
    }

    .translation-header {
        display: grid;
    }
}
