/* =================================================================
   SENTENCE EDITOR

   Sits in EditorFrame's three-pane shell, so `.de-frame`, `.de-topbar`,
   `.de-body`, `.de-rail`, `.de-list-pane` and `.de-inspector` come from
   deck-editor.css and are not restated here. This file is the rows, the
   rail's gap counters and the inspector — everything that is about
   sentences rather than about the frame.

   ENGLISH IS THE PROMOTED COLUMN. It is what the Spell It and Picture It
   reveal reads, and a sentence without one loses the line that does the
   teaching. It is marked in the header, it is the last text column the
   density ladder gives up, and a row missing it is amber — not red,
   because both rounds still run.
   ================================================================= */

.se-editor .de-topbar-left,
.se-editor .de-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.se-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.se-search {
    width: 230px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
}

.se-savestate {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.se-savestate[data-state="saving"],
.se-savestate[data-state="pending"] {
    color: var(--primary);
}

.se-savestate[data-state="error"] {
    color: var(--danger);
    font-weight: 700;
}

/* ─── Rail ─────────────────────────────────────────────────────── */

.se-editor .de-rail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 8px;
    overflow-y: auto;
}

.se-rail-head {
    padding: 4px 8px 6px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.se-rail-head-gaps {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.se-lesson,
.se-gap {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 9px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
}

.se-lesson:hover,
.se-gap:hover {
    background: var(--bg-tertiary);
}

.se-lesson-on {
    background: var(--primary-light);
    font-weight: 700;
}

.se-lesson-n {
    width: 26px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-weight: 800;
}

.se-lesson-name {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.se-lesson-total,
.se-gap-n {
    flex-shrink: 0;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 800;
}

/* A gap counter at zero is not a problem, so it stops shouting. */
.se-gap-n {
    background: var(--warning-light, #FEF3C7);
    color: #92400E;
}

.se-gap-clear .se-gap-n {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.se-gap-on {
    background: var(--primary-light);
    font-weight: 700;
}

.se-gap-label {
    flex-grow: 1;
    color: var(--text-secondary);
}

/* ─── List ─────────────────────────────────────────────────────── */

.se-editor .de-list-pane {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.se-head,
.se-row {
    display: grid;
    grid-template-columns:
        44px var(--se-thumb, 52px) minmax(0, 1.3fr)
        var(--se-eng, minmax(0, 1fr)) var(--se-audio, 56px)
        var(--se-pips, 104px) 28px;
    gap: 10px;
    align-items: center;
    padding: 9px 14px;
}

.se-head {
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* The one column this editor exists to surface. */
.se-col-promoted {
    color: var(--primary);
}

.se-row {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--bg-tertiary);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.se-row:hover {
    background: var(--bg-secondary);
}

.se-row-on {
    background: var(--primary-light);
}

/* Amber, not red: both card rounds still run without an English. */
.se-row-gap {
    box-shadow: inset 3px 0 0 var(--warning);
}

.se-col {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.se-col-num {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.se-col-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.se-col-eng {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.se-missing {
    color: var(--warning);
    font-style: italic;
}

/* Its own class, not `.se-missing`: counting "no translation" rows must
   not also count every silent one. */
.se-no-audio {
    color: var(--warning);
}

.se-col-open {
    color: var(--text-secondary);
    text-align: right;
}

.se-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 32px;
    border-radius: 5px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.se-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.se-thumb-none,
.se-thumb-backdrop {
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.se-pips {
    display: flex;
    gap: 3px;
}

.se-pips-none {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.se-pip {
    width: 16px;
    height: 7px;
    border-radius: 3px;
}

.se-pip-ok {
    background: var(--success);
}

.se-pip-no {
    background: var(--border-color);
}

/* ─── Inspector ────────────────────────────────────────────────── */

.se-editor .de-inspector {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 14px 16px;
    overflow-y: auto;
}

.se-insp-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.se-eyebrow {
    color: var(--text-secondary);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.se-insp-title {
    margin-top: 3px;
    font-size: 1.02rem;
    font-weight: 700;
}

.se-insp-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
}

.se-insp-media {
    display: flex;
    gap: 9px;
}

.se-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-grow: 1;
    padding: 12px 8px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.se-slot-empty {
    border-style: dashed;
}

.se-slot small {
    font-size: 0.68rem;
    opacity: 0.85;
}

.se-fieldwrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.se-fieldwrap-promoted {
    padding: 11px 12px;
    border: 2px solid var(--primary);
    border-radius: 10px;
    background: var(--primary-light);
}

.se-fieldlabel {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.se-badge {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--primary);
    color: #FFF;
    font-size: 0.6rem;
    letter-spacing: 0.04em;
}

.se-field {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    resize: vertical;
}

.se-fieldnote {
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.45;
}

.se-warn {
    color: #92400E;
}

.se-field-row {
    display: flex;
    gap: 9px;
}

.se-field-row .se-fieldwrap {
    flex-grow: 1;
}

.se-insp-block {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-top: 11px;
    border-top: 1px solid var(--border-color);
}

.se-reveal {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 11px 12px;
    border-radius: 9px;
    background: var(--bg-secondary);
}

.se-reveal-words {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.se-reveal-word {
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    font-size: 0.8rem;
    font-weight: 600;
}

.se-reveal-translation {
    padding: 7px 10px;
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    background: var(--bg-primary);
    font-size: 0.84rem;
}

.se-reveal-missing {
    padding: 7px 10px;
    border-left: 3px dashed var(--warning);
    border-radius: 6px;
    color: #92400E;
    font-size: 0.8rem;
    font-style: italic;
}

.se-usage {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.se-usage-chip {
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
}

.se-empty {
    padding: 26px 18px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    text-align: center;
}

.se-empty p {
    margin: 0;
    line-height: 1.55;
}

/* ─── The density ladder, through EditorFrame's tiers ──────────── */

.se-editor[data-tier="m"] {
    --se-pips: 0px;
}

.se-editor[data-tier="s"] {
    --se-pips: 0px;
    --se-audio: 0px;
}

.se-editor[data-tier="xs"] {
    --se-pips: 0px;
    --se-audio: 0px;
    --se-eng: 0px;
    --se-thumb: 0px;
}
