/* Word Predictor — styles. Self-contained. */

* { box-sizing: border-box; }

:root {
  --ink: #202124;
  --muted: #5f6368;
  --line: #e0e0e0;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #8430ce;   /* purple, distinct from the other games */
}

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: #241a45; 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: #c3b9e0; max-width: 720px; }

.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;
}
.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: #6f27ad; }
.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; }
.corpus-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.ghost-btn:hover { background: #eef1f6; }

.stats { display: flex; gap: 10px; margin-bottom: 6px; }
.stat { flex: 1; }
.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; }
#wp-chart {
  width: 100%; height: 90px;
  border: 1px solid var(--line); border-radius: 8px;
}
#wp-chart .line { fill: none; stroke-width: 1.5px; }
#wp-chart .axis line, #wp-chart .axis path { display: none; }

/* ---- Predict stage ---- */
.predict-stage { flex: 1 1 380px; max-width: 460px; }
.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; }
.inputs-box { flex: 0 0 auto; }
.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: #f0eef6; border-radius: 5px; overflow: hidden; height: 16px; }
.pred-bar { display: block; height: 100%; width: 0%; background: #c9b3e6; 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; }

.coach-hint {
  margin-top: 18px; padding: 14px 16px;
  background: #f5f0fb; border-left: 4px solid var(--accent); border-radius: 8px;
  font-size: 14px; line-height: 1.5; min-height: 70px;
}

/* ---- Test-a-prediction box ---- */
.guess-box {
  margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: #fbfaff;
}
.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; color: var(--ink); }

/* ---- Network diagram (full width) ---- */
.net-panel { flex-basis: 100%; width: 100%; }
.net-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
#net-holder { overflow-x: auto; }
#net-holder svg { display: block; }
.nn-node2 { fill: #fff; stroke: #aaa; stroke-width: 1; }
.nn-link2 { stroke: #ccc; }
.in-word-label { font-size: 12px; fill: #202124; font-weight: 600; }
.out-word-label { font-size: 11px; fill: #5f6368; }
.out-word-label.is-top { fill: #4a148c; font-weight: 700; }
.layer-cap { font-size: 11px; fill: #9aa0a6; text-transform: uppercase; letter-spacing: .4px; }

/* ---- Embedding map ---- */
.emb-panel { flex: 0 0 340px; }
.emb-note { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
#emb-map svg { border: 1px solid var(--line); border-radius: 8px; background: #fbfaff; }
.emb-dot { fill: var(--accent); opacity: .85; }
.emb-label { font-size: 11px; fill: #3c4043; }
