/* ──────────────────────────────────────────────
   Treinamento na Prática — Overfitting/Underfitting
   ────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --border:   #21262d;
  --text:     #e6edf3;
  --muted:    #6e7681;
  --accent:   #58a6ff;
  --green:    #56d364;
  --red:      #f85149;
  --orange:   #ffa657;
  --yellow:   #e3b341;
  --purple:   #d2a8ff;
  --header-h: 54px;
  --nav-h:    68px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header ── */
#header {
  height: var(--header-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  z-index: 10;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

#back-btn {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: color 0.15s;
}
#back-btn:hover { color: var(--text); }

#header-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

#header-badge {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#step-box {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}
#step-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 2px;
}
#step-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
#step-total {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Main ── */
#main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Painel de texto ── */
#text-panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  transition: opacity 0.25s;
}
#text-panel.fading { opacity: 0; }

#step-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

#step-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
}

#step-desc {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #b1bac4;
  white-space: pre-line;
}

/* ── Highlight box ── */
#highlight-box {
  background: rgba(88,166,255,0.08);
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#highlight-box.green  { background: rgba(86,211,100,0.08);  border-color: rgba(86,211,100,0.3); }
#highlight-box.red    { background: rgba(248,81,73,0.08);   border-color: rgba(248,81,73,0.3); }
#highlight-box.orange { background: rgba(255,166,87,0.08);  border-color: rgba(255,166,87,0.3); }
#highlight-box.hidden { display: none; }

#highlight-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
#highlight-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.4;
}

/* ── Sliders ── */
#sliders-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
#sliders-box.hidden { display: none; }

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.slider-readout {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  background: #79b8ff;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: var(--muted);
  padding: 0 2px;
}

/* ── Diagnóstico ── */
#diagnosis-box {
  background: rgba(88,166,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  transition: background 0.3s, border-color 0.3s;
}
#diagnosis-box.under  { background: rgba(255,166,87,0.1);  border-color: rgba(255,166,87,0.3); }
#diagnosis-box.good   { background: rgba(86,211,100,0.1);  border-color: rgba(86,211,100,0.3); }
#diagnosis-box.over   { background: rgba(248,81,73,0.1);   border-color: rgba(248,81,73,0.3); }

#diagnosis-icon { font-size: 1.4rem; flex-shrink: 0; }
#diagnosis-text { font-size: 0.8rem; line-height: 1.45; color: #b1bac4; }

/* ── Canvas ── */
#canvas-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#main-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* ── Legenda ── */
#legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(22,27,34,0.88);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}
.legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-line.train { background: var(--accent); }
.legend-line.val   { background: var(--orange); }

/* ── Navegação ── */
#nav {
  height: var(--nav-h);
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

#nav button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
#nav button:hover:not(:disabled) {
  background: #21262d;
  border-color: var(--accent);
}
#nav button:disabled { opacity: 0.3; cursor: default; }

#btn-next {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
}
#btn-next:hover:not(:disabled) { background: #79b8ff; border-color: #79b8ff; }
#btn-next:disabled {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

/* Bolinhas de progresso */
#progress-track {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}
.prog-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}
.prog-dot.visited { background: rgba(88,166,255,0.4); }
.prog-dot.active  { background: var(--accent); transform: scale(1.4); }

/* ── Keyboard hint ── */
#keyboard-hint {
  position: fixed;
  bottom: calc(var(--nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.6;
}
kbd {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.68rem;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  #main { flex-direction: column; }
  #text-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    max-height: 220px;
  }
  #header-badge { display: none; }
  #legend { display: none; }
}
