/* ============================================================
   Lab 01 · BPE Visualizer — tool-spezifische Styles,
   Grundgerüst kommt aus lab.css
   ============================================================ */

/* ---------- Eingabe ---------- */

.input-row {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.text-input {
    flex: 1 1 320px;
    min-height: 100px;
    resize: vertical;
    background: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--trace);
    box-shadow: 0 0 0 3px var(--trace-soft);
}

.input-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 200px;
}

.button-group {
    display: flex;
    gap: 0.6rem;
}

.button-group > * {
    flex: 1;
}

.kbd {
    font-family: var(--font-mono);
    font-size: 0.82em;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 0.3em;
    background: var(--panel-deep);
}

/* ---------- Token-Stream ---------- */

.tokens {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 420px;
    overflow-y: auto;
}

.line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tok,
.chip {
    display: inline-flex;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.16rem 0.45rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--trace-line);
    background: var(--trace-soft);
    color: var(--trace);
    white-space: nowrap;
}

.tok .tok-char,
.chip .chip-sub {
    color: var(--grey);
    margin-left: 0.45em;
    font-size: 0.85em;
}

/* Einzige Hervorhebung im Stream: das Paar, das als Nächstes gemerged wird */
.tok.highlight {
    border-color: var(--amber);
    background: var(--amber-soft);
    color: var(--amber);
}

.chip.muted {
    opacity: 0.4;
}

/* ---------- Paar-Liste ---------- */

.pairs {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 420px;
    overflow-y: auto;
}

.pair-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 3rem;
    gap: 0.8rem;
    align-items: center;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.pair-row.active {
    background: var(--amber-soft);
    border-color: var(--amber);
}

.pair-key {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    min-width: 0;
}

.pair-count {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--grey);
}

.pair-row.active .pair-count {
    color: var(--amber);
    font-weight: 500;
}

/* ---------- Vokabular & Verlauf ---------- */

.vocab {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: 330px;
    overflow-y: auto;
    align-content: flex-start;
}

.history {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 330px;
    overflow-y: auto;
}

.hrow {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.hrow .id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--grey);
    min-width: 2em;
    text-align: right;
}

/* Der jüngste Merge ist dezent markiert */
.hrow.latest .id {
    color: var(--trace);
    font-weight: 500;
}

/* ---------- Byte-Tabelle ---------- */

.table-wrap {
    max-height: 300px;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--grey);
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--line-strong);
    position: sticky;
    top: 0;
    background: var(--panel);
}

.data-table td {
    padding: 0.32rem 0.6rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
}

.data-table code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.char-display {
    font-family: var(--font-mono);
    color: var(--ink);
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .input-actions {
        min-width: 100%;
    }
}
