/* ──────────────────────────────────────────────
   O Que Você Manda a IA Otimizar?
   função objetivo · recompensa · consequências
   ────────────────────────────────────────────── */

*, *::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;
  --pink:     #ff7b9c;
  --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.yellow { background: rgba(227,179,65,0.08);  border-color: rgba(227,179,65,0.3); }
#highlight-box.purple { background: rgba(210,168,255,0.08); border-color: rgba(210,168,255,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.0rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.5;
}

/* ── Sim genérico ── */
.sim-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}
.sim-note {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #b1bac4;
  background: rgba(88,166,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  min-height: 48px;
  transition: background 0.3s, border-color 0.3s;
}
.sim-note.good   { background: rgba(86,211,100,0.08);  border-color: rgba(86,211,100,0.3); }
.sim-note.bad    { background: rgba(248,81,73,0.08);   border-color: rgba(248,81,73,0.3); }
.sim-note.warn   { background: rgba(255,166,87,0.08);  border-color: rgba(255,166,87,0.3); }

/* ── Radio group (Sim 1) ── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.radio-opt:hover {
  background: rgba(88,166,255,0.06);
  border-color: var(--accent);
}
.radio-opt input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.radio-text {
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--text);
}

/* ── Slider (Sim 2) ── */
.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.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.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;
}

/* ── Quiz (step 9) ── */
#quiz-cases {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.quiz-case {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.quiz-case-desc {
  font-size: 0.8rem;
  color: #b1bac4;
  margin-bottom: 8px;
  line-height: 1.4;
}
.quiz-case-opts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.quiz-opt-btn {
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.quiz-opt-btn:hover:not(:disabled) {
  background: rgba(88,166,255,0.1);
  border-color: var(--accent);
}
.quiz-opt-btn.correct  { background: rgba(86,211,100,0.15);  border-color: var(--green);  color: var(--green); }
.quiz-opt-btn.wrong    { background: rgba(248,81,73,0.12);   border-color: var(--red);    color: var(--red); }
#quiz-feedback {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #b1bac4;
  background: rgba(88,166,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
}
#quiz-feedback.hidden { display: none; }
#quiz-feedback.done-good { background: rgba(86,211,100,0.08); border-color: rgba(86,211,100,0.3); }

/* ── Boxes ocultas ── */
#sim1-box.hidden,
#sim2-box.hidden,
#quiz-box.hidden { display: none; }

/* ── 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 ── */
#canvas-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(22,27,34,0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#canvas-legend.hidden { display: none; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── 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);
    max-height: 45vh;
  }
}

/* ── Platform cards (step 8) ── */
.platform-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.platform-card {
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(22,27,34,0.8);
  border-left: 4px solid;
}

.platform-card.red  { border-color: var(--red);    background: rgba(248,81,73,0.06); }
.platform-card.blue { border-color: var(--accent);  background: rgba(88,166,255,0.06); }
.platform-card.pink { border-color: var(--pink);    background: rgba(255,123,156,0.06); }

.platform-header {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-card.red  .platform-header { color: var(--red); }
.platform-card.blue .platform-header { color: var(--accent); }
.platform-card.pink .platform-header { color: var(--pink); }

.platform-year {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: auto;
}

.platform-obj {
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 4px;
}

.platform-conseq {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}
