/* Tiny Transformer — styles. Self-contained. */
* { box-sizing: border-box; }
:root {
  --ink: #202124; --muted: #5f6368; --line: #e0e0e0; --bg: #f7f8fa; --panel: #fff;
  --accent: #0b8043;   /* green */
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: #133a24; color: #fff; }
.brand-mark { font-size: 32px; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 600; }
.tagline { margin: 2px 0 0; font-size: 13px; color: #b7d8c5; max-width: 740px; }

.lm { display: flex; gap: 18px; align-items: flex-start; padding: 20px; flex-wrap: wrap; justify-content: center; }
.lm section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.lm h2 { margin: 0 0 12px; font-size: 16px; }

/* Training panel */
.train-panel { flex: 0 0 280px; }
#corpus { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.corpus-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.knob label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.knob select { width: 100%; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.btn-row { display: flex; gap: 8px; margin-bottom: 14px; }
.primary-btn { flex: 1; padding: 11px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.primary-btn:hover { background: #096b38; }
.ghost-btn { padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; font-size: 14px; }
.ghost-btn.small { padding: 6px 10px; font-size: 12px; }
.ghost-btn:hover { background: #eef1f6; }
.stats { display: flex; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.stat { flex: 1 1 60px; }
.cap { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-caption { font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
#tx-chart { width: 100%; height: 90px; border: 1px solid var(--line); border-radius: 8px; }
#tx-chart .line { fill: none; stroke-width: 1.5px; }
#tx-chart .axis line, #tx-chart .axis path { display: none; }

/* Predict stage */
.predict-stage { flex: 1 1 360px; max-width: 440px; }
.io-row { display: flex; align-items: center; gap: 14px; }
.io-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 8px; }
.context-inputs { display: flex; flex-direction: column; gap: 8px; }
.word-slot { display: flex; align-items: center; gap: 8px; }
.slot-label { font-size: 10px; color: var(--muted); width: 42px; }
.word-select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: #fff; min-width: 96px; }
.arrow { font-size: 28px; color: #bbb; }
.output-box { flex: 1 1 auto; }
.predictions { display: flex; flex-direction: column; gap: 5px; }
.pred-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pred-word { width: 66px; text-align: right; color: var(--muted); }
.pred-bar-wrap { flex: 1; background: #eaf4ee; border-radius: 5px; overflow: hidden; height: 16px; }
.pred-bar { display: block; height: 100%; width: 0%; background: #a9d8bd; transition: width .15s linear; }
.pred-pct { width: 36px; font-variant-numeric: tabular-nums; color: var(--muted); }
.pred-row.top1 .pred-word { color: var(--ink); font-weight: 700; }
.pred-row.top1 .pred-bar { background: var(--accent); }
.pred-row.top1 .pred-pct { color: var(--ink); font-weight: 700; }
.guess-box { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f6fbf8; }
.guess-box label { font-size: 13px; color: var(--muted); margin-right: 8px; }
.guess-box select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.guess-metrics { margin-top: 10px; font-size: 13px; line-height: 1.5; }
.coach-hint { margin-top: 18px; padding: 14px 16px; background: #eef8f1; border-left: 4px solid var(--accent); border-radius: 8px; font-size: 14px; line-height: 1.5; min-height: 70px; }

/* Attention panel */
.attn-panel { flex: 0 0 480px; }
.attn-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
#attn-holder svg { border: 1px solid var(--line); border-radius: 8px; background: #fbfefc; }
.aw-word { font-size: 14px; fill: #202124; font-weight: 600; }
.aw-pct { font-size: 10px; fill: var(--accent); font-weight: 600; }
.legend-txt { font-size: 11px; fill: var(--muted); font-weight: 600; }
.pred-node { fill: #0b8043; fill-opacity: .12; stroke: var(--accent); stroke-width: 2; }
.pred-node-label { font-size: 15px; fill: #0b5a2f; font-weight: 700; }
.pred-node-cap { font-size: 10px; fill: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
