/* Loss Race — styles. Self-contained (no Material Design Lite dependency). */

* { box-sizing: border-box; }

:root {
  --p1: #e8710a;   /* orange */
  --p2: #1a73e8;   /* blue   */
  --ink: #202124;
  --muted: #5f6368;
  --line: #e0e0e0;
  --bg: #f7f8fa;
  --panel-bg: #ffffff;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: #1a2b45;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 34px; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: .3px; }
.tagline { margin: 2px 0 0; font-size: 13px; color: #b9c4d6; }

.setup-bar { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.setup-item { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #cdd6e5; }
.setup-item span em { color: #fff; font-style: normal; font-weight: 600; }
.setup-item select,
.setup-item input[type="number"] {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #3a4a63;
  background: #24344f;
  color: #fff;
  font-size: 13px;
}
.setup-item input[type="range"] { width: 120px; accent-color: #7aa7ff; }

.ghost-btn {
  align-self: flex-end;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #3a4a63;
  background: transparent;
  color: #cdd6e5;
  cursor: pointer;
  font-size: 13px;
}
.ghost-btn:hover { background: #24344f; color: #fff; }

/* ---------- Status banner ---------- */
.status-banner {
  text-align: center;
  padding: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  background: #eef1f6;
  border-bottom: 1px solid var(--line);
}

/* ---------- Arena / panels ---------- */
.arena {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px;
}
.vs {
  align-self: center;
  font-weight: 800;
  font-size: 22px;
  color: #9aa0a6;
}

.panel {
  flex: 1 1 480px;
  max-width: 560px;
  background: var(--panel-bg);
  border-radius: 12px;
  border: 2px solid var(--line);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 14px 16px;
}
.panel-p1 { border-top: 4px solid var(--p1); }
.panel-p2 { border-top: 4px solid var(--p2); }

.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-target { margin-left: auto; font-size: 12px; color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-p1 { background: var(--p1); }
.dot-p2 { background: var(--p2); }

/* ---------- Controls ---------- */
.control-group { margin-bottom: 10px; }
.control-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }

.feature-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.feature-btn {
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #fafafa;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.feature-btn.active { background: #e8f0fe; border-color: #4285f4; color: #1967d2; font-weight: 600; }

.arch-buttons { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.round-btn {
  min-width: 30px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fafafa;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}
.round-btn.wide { min-width: auto; padding: 0 8px; font-size: 12px; }
.round-btn:hover { background: #eef1f6; }

.select-wrap { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.select-wrap .control-label { margin-bottom: 0; }
.mini-select { padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line); font-size: 12px; background: #fff; }

/* ---------- Visualization ---------- */
.panel-viz { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
svg.diagram { width: 200px; height: 210px; flex: 0 0 auto; }
.output-wrap { flex: 0 0 auto; }
.heatmap-holder { width: 240px; height: 240px; }

.nn-node { fill: #fff; stroke: #9aa0a6; stroke-width: 1.5; }
.nn-node.input-node { fill: #d2d7de; stroke: #9aa0a6; }
.nn-node.output-node { fill: #fff; stroke: #444; stroke-width: 2; }
.node-label { font-size: 10px; fill: var(--muted); }
.nn-link { stroke: #ccc; stroke-opacity: .8; }

/* ---------- Stats ---------- */
.panel-stats { border-top: 1px solid var(--line); padding-top: 10px; }
.stat-nums { display: flex; gap: 24px; margin-bottom: 8px; }
.stat-box { }
.stat-caption { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.progress-track {
  height: 10px;
  background: #eceff3;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill { height: 100%; width: 0%; border-radius: 6px; transition: width .12s linear; }

.loss-chart { width: 100%; height: 55px; }
.loss-chart .line { fill: none; stroke-width: 1.5px; }
.loss-chart .axis line, .loss-chart .axis path { display: none; }

/* ---------- GO button ---------- */
.go-row { text-align: center; padding: 4px 0 30px; }
.go-btn {
  padding: 14px 46px;
  border: none;
  border-radius: 30px;
  background: #34a853;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(52,168,83,.35);
}
.go-btn:hover { background: #2c9247; }
.go-btn:disabled { background: #b7c0cc; box-shadow: none; cursor: default; }

/* ---------- Results overlay ---------- */
.results-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,28,44,.28);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  /* Let clicks pass through the dim backdrop so a moved dialog reveals the
     frozen networks behind it. The card itself re-enables pointer events. */
  pointer-events: none;
}
.results-overlay.visible { display: flex; }
.results-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 26px 36px 30px;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  pointer-events: auto;
  cursor: grab;
  user-select: none;
}
.drag-hint {
  font-size: 11px;
  color: #9aa0a6;
  margin-bottom: 10px;
  letter-spacing: .3px;
}
.results-card h2 { margin: 0 0 18px; font-size: 30px; }
.results-grid { text-align: left; margin: 0 auto 16px; display: inline-block; }
.result-line { font-size: 15px; margin: 6px 0; display: flex; align-items: center; gap: 8px; }
.teaching-line {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: #f1f6ff;
  border-left: 4px solid #4285f4;
  padding: 12px 14px;
  border-radius: 6px;
  text-align: left;
  margin: 0 0 22px;
}
