@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;400;600&display=swap');

:root {
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-dark: #8a6a2a;
  --gold-dim: #5a4a1a;
  --bg: #1a1208;
  --panel: linear-gradient(160deg, #3d2c0e, #251a06);
  --panel-border: #8a6a2a;
}


body {
  background: var(--bg);
  background-image: radial-gradient(ellipse at 30% 20%, #2a1a04 0%, #0a0800 70%);
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 12px 60px;
  font-family: 'Rajdhani', sans-serif;
  color: var(--gold-light);
}

h1 {
  font-family: 'Orbitron', monospace; font-weight: 900;
  font-size: clamp(1.3rem, 3.5vw, 2rem); letter-spacing: 0.15em;
  color: var(--gold-light); text-shadow: 0 0 20px rgba(201,168,76,0.6);
  margin-bottom: 4px; text-transform: uppercase;
}
.subtitle { font-size: 0.8rem; color: var(--gold-dark); letter-spacing: 0.2em; margin-bottom: 16px; text-transform: uppercase; }

/* ── TABS ── */
.tab-nav {
  display: flex; gap: 4px; margin-bottom: 18px;
  background: rgba(0,0,0,0.4); border-radius: 12px; padding: 4px;
  border: 1px solid var(--gold-dark); flex-wrap: wrap; justify-content: center;
}
.tab-btn {
  font-family: 'Orbitron', monospace; font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.1em; padding: 8px 14px; border-radius: 8px;
  border: none; cursor: pointer; text-transform: uppercase;
  background: transparent; color: var(--gold-dark);
  transition: all 0.25s;
}
.tab-btn:hover { color: var(--gold-light); background: rgba(201,168,76,0.08); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1005; box-shadow: 0 2px 10px rgba(201,168,76,0.3);
}
.tab-content { display: none; width: 100%; max-width: 1150px; }
.tab-content.active { display: flex; flex-direction: column; align-items: center; }

/* ── LAYOUT ── */
.main-layout { display: flex; gap: 16px; align-items: flex-start; width: 100%; }

.game-panel {
  flex: 0 0 auto; width: 360px;
  background: var(--panel); border: 2px solid var(--panel-border);
  border-radius: 18px; padding: 14px;
  box-shadow: 0 0 40px rgba(201,168,76,0.12), inset 0 0 30px rgba(0,0,0,0.4);
}

.prob-panel {
  flex: 1 1 auto; min-width: 340px;
  background: var(--panel); border: 2px solid var(--panel-border);
  border-radius: 18px; padding: 14px 12px;
  box-shadow: 0 0 40px rgba(201,168,76,0.1), inset 0 0 30px rgba(0,0,0,0.4);
}
.prob-panel.hidden { display: none; }

/* ── SECRET ROW ── */
.secret-row {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 12px; padding: 10px;
  background: #1a1005; border-radius: 10px; border: 1px solid var(--gold-dark);
}
.secret-peg {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid #444; background: #0d0a04;
  position: relative; overflow: hidden; transition: all 0.4s;
}
.secret-peg.revealed { border-color: var(--gold); }

/* ── BOARD ── */
.board { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.board-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px; border-radius: 8px;
  background: rgba(0,0,0,0.2); border: 1px solid transparent; transition: all 0.3s;
}
.board-row.active {
  border-color: var(--gold); background: rgba(201,168,76,0.07);
  box-shadow: 0 0 10px rgba(201,168,76,0.1);
}
.row-number {
  font-family: 'Orbitron', monospace; font-size: 0.65rem;
  color: var(--gold-dark); width: 16px; text-align: center; flex-shrink: 0;
}
.guess-pegs { display: flex; gap: 6px; flex: 1; }
.guess-peg {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid #444; background: #1a1005;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
  position: relative; overflow: hidden; flex-shrink: 0;
}
.guess-peg:hover:not(.locked) { transform: scale(1.1); border-color: var(--gold-dark); }
.guess-peg.filled { border-color: rgba(255,255,255,0.2); }
.guess-peg.locked { cursor: default; }

/* ── FEEDBACK PEGS ── */
.feedback { display: grid; grid-template-columns: repeat(2,1fr); gap: 3px; width: 38px; flex-shrink: 0; }
.fb-peg { width: 16px; height: 16px; border-radius: 50%; background: #1a1005; border: 1px solid #3a2a10; }
.fb-peg.hit { background: radial-gradient(circle at 35% 30%, #ff7070, #cc1515); border-color: #ff3333; box-shadow: 0 0 5px rgba(255,50,50,0.7); }
.fb-peg.near { background: radial-gradient(circle at 35% 30%, #ffffff, #cccccc); border-color: #aaaaaa; box-shadow: 0 0 4px rgba(255,255,255,0.5); }

/* ── PALETA ── */
.palette {
  display: flex; justify-content: center; flex-wrap: nowrap;
  gap: 5px; margin-bottom: 10px; padding: 8px 10px;
  background: rgba(0,0,0,0.3); border-radius: 10px; border: 1px solid var(--gold-dark);
}
.palette-color {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  cursor: pointer; border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
}
.palette-color:hover { transform: scale(1.12); }
.palette-color.selected {
  border-color: var(--gold-light) !important;
  box-shadow: 0 0 16px rgba(240,220,120,0.7); transform: scale(1.1);
}

/* ── SPHERE ── */
.sphere { position: absolute; inset: 0; border-radius: 50%; }
.sphere::after {
  content: ''; position: absolute; top: 14%; left: 18%;
  width: 36%; height: 28%; border-radius: 50%;
  background: rgba(255,255,255,0.38); filter: blur(3px);
}
.sphere.dark::after { background: rgba(255,255,255,0.65); filter: blur(2px); }

/* ── MENSAJE Y CONTROLES ── */
.message {
  text-align: center; font-family: 'Orbitron', monospace;
  font-size: 0.72rem; min-height: 24px; margin-bottom: 8px;
  letter-spacing: 0.07em; color: var(--gold-light);
}
.message.win { color: #60e060; text-shadow: 0 0 12px rgba(80,220,80,0.5); }
.message.lose { color: #e06060; text-shadow: 0 0 12px rgba(220,80,80,0.5); }

.options {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; margin-bottom: 10px;
  font-size: 0.75rem; color: var(--gold-dark); font-weight: 600; flex-wrap: wrap;
}
.options label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
select { background: #1a1005; color: var(--gold-light); border: 1px solid var(--gold-dark); border-radius: 4px; padding: 1px 5px; font-family: 'Rajdhani', sans-serif; font-size: 0.82rem; }
input[type=checkbox] { accent-color: var(--gold); }

.attempts-label { font-family: 'Orbitron', monospace; font-size: 0.6rem; color: var(--gold-dark); text-align: center; margin-bottom: 7px; letter-spacing: 0.12em; }

.feedback-legend {
  display: flex; justify-content: center; gap: 14px;
  margin-bottom: 10px; font-size: 0.7rem; color: var(--gold-dark); flex-wrap: wrap;
}
.feedback-legend span { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.legend-dot.hit { background: radial-gradient(circle at 35% 30%, #ff7070, #cc1515); border: 1px solid #ff3333; }
.legend-dot.near { background: radial-gradient(circle at 35% 30%, #fff, #ccc); border: 1px solid #aaa; }

.controls { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
button {
  font-family: 'Orbitron', monospace; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.08em; padding: 8px 13px; border-radius: 7px;
  border: none; cursor: pointer; text-transform: uppercase; transition: all 0.2s;
}
#btn-guess { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #1a1005; box-shadow: 0 3px 12px rgba(201,168,76,0.3); }
#btn-guess:hover:not(:disabled) { box-shadow: 0 3px 20px rgba(201,168,76,0.5); transform: translateY(-1px); }
#btn-guess:disabled { opacity: 0.4; cursor: not-allowed; }
#btn-clear { background: rgba(255,255,255,0.07); color: var(--gold-dark); border: 1px solid var(--gold-dark); }
#btn-clear:hover { background: rgba(255,255,255,0.12); }
#btn-new { background: rgba(200,60,60,0.2); color: #e08080; border: 1px solid #804040; }
#btn-new:hover { background: rgba(200,60,60,0.35); }
#btn-reveal { background: rgba(60,60,200,0.2); color: #8080e0; border: 1px solid #404080; }
#btn-reveal:hover { background: rgba(60,60,200,0.35); }
#btn-toggle-probs { background: rgba(80,140,200,0.15); color: #80b8e8; border: 1px solid #405880; }
#btn-toggle-probs:hover { background: rgba(80,140,200,0.28); }
#btn-toggle-probs.hidden-active { background: rgba(80,140,200,0.28); color: #a0d0ff; border-color: #6090c0; }

/* ══ PANEL DERECHO ══ */
.prob-title { font-family: 'Orbitron', monospace; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; color: var(--gold-light); text-align: center; margin-bottom: 3px; text-transform: uppercase; }
.prob-subtitle { font-size: 0.68rem; color: var(--gold-dark); text-align: center; margin-bottom: 12px; line-height: 1.4; }
.prob-table-wrap { overflow-x: auto; margin-bottom: 10px; }

table.prob-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
table.prob-table th {
  font-family: 'Orbitron', monospace; font-size: 0.55rem; font-weight: 700;
  letter-spacing: 0.08em; color: var(--gold-dark);
  padding: 6px 3px; text-align: center;
  border-bottom: 1px solid var(--gold-dark); background: rgba(0,0,0,0.3); white-space: nowrap;
}
table.prob-table td {
  padding: 4px 3px; text-align: center;
  border-bottom: 1px solid rgba(138,106,42,0.15);
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 0.78rem;
  position: relative; min-width: 46px;
}
td.color-cell { white-space: nowrap; text-align: left; padding-left: 5px; min-width: 72px; }
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; margin-right: 4px; border: 1px solid rgba(255,255,255,0.12); }
.color-swatch.dark-color { border: 1.5px solid #777; box-shadow: 0 0 4px rgba(200,200,200,0.2); }
td.total-cell { font-family: 'Orbitron', monospace; font-size: 0.62rem; color: var(--gold-light); min-width: 50px; border-left: 1px solid rgba(138,106,42,0.3); }
th.total-th { border-left: 1px solid rgba(138,106,42,0.3); color: var(--gold) !important; }
.cell-bar { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 2px; opacity: 0.22; pointer-events: none; transition: height 0.35s ease; }
table.prob-table td:hover .cell-bar { opacity: 0.4; }
.prob-val { position: relative; z-index: 1; }
table.prob-table tr.highlighted-row td { background: rgba(201,168,76,0.07); }
table.prob-table tr.highlighted-row td.color-cell { border-left: 2px solid var(--gold); }
table.prob-table tr.excluded-row { opacity: 0.3; }
table.prob-table tr.sum-row td { font-family: 'Orbitron', monospace; font-size: 0.54rem; color: var(--gold-dark); border-top: 1px solid var(--gold-dark); border-bottom: none; padding-top: 6px; }
table.prob-table tr.sum-row td.color-cell { text-align: left; padding-left: 5px; }
table.prob-table tr.sum-row td.total-cell { color: var(--gold-dark); }
.prob-legend { display: flex; justify-content: center; gap: 12px; margin-top: 8px; font-size: 0.65rem; color: var(--gold-dark); flex-wrap: wrap; }
.prob-legend span { display: flex; align-items: center; gap: 4px; }
.prob-legend-box { width: 12px; height: 12px; border-radius: 3px; }

/* ── SUGERENCIA ── */
.suggestion-section { margin-top: 12px; border-top: 1px solid rgba(138,106,42,0.3); padding-top: 10px; }
.suggestion-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.suggestion-label { font-family: 'Orbitron', monospace; font-size: 0.6rem; color: var(--gold); letter-spacing: 0.1em; text-transform: uppercase; }
#btn-toggle-suggestion {
  font-family: 'Orbitron', monospace; font-size: 0.54rem; font-weight: 700;
  letter-spacing: 0.07em; padding: 5px 10px; border-radius: 5px;
  border: 1px solid var(--gold-dark); background: rgba(201,168,76,0.1);
  color: var(--gold-dark); cursor: pointer; text-transform: uppercase; transition: all 0.2s;
}
#btn-toggle-suggestion:hover { background: rgba(201,168,76,0.2); color: var(--gold-light); }
#btn-toggle-suggestion.active { background: rgba(201,168,76,0.25); color: var(--gold-light); border-color: var(--gold); }
.suggestion-content { display: none; background: rgba(0,0,0,0.3); border-radius: 8px; padding: 8px 10px; border: 1px solid rgba(138,106,42,0.3); }
.suggestion-content.visible { display: block; }
.suggestion-pegs { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.sug-peg { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2); position: relative; overflow: hidden; }
.suggestion-text { font-size: 0.68rem; color: var(--gold-dark); text-align: center; line-height: 1.4; }
.suggestion-text strong { color: var(--gold-light); }

/* ── CALIFICACIÓN DE JUGADA ── */
.move-rating-section {
  margin-top: 10px; padding: 10px;
  background: rgba(0,0,0,0.25); border-radius: 8px;
  border: 1px solid rgba(138,106,42,0.25);
}
.move-rating-title { font-family: 'Orbitron', monospace; font-size: 0.58rem; color: var(--gold-dark); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; text-align: center; }
.move-rating-content { display: flex; align-items: center; gap: 12px; justify-content: center; }
.rating-score { font-family: 'Orbitron', monospace; font-size: 1.6rem; font-weight: 900; line-height: 1; min-width: 52px; text-align: center; }
.rating-bar-wrap { flex: 1; }
.rating-track { height: 8px; background: rgba(0,0,0,0.4); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.rating-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.rating-desc { font-size: 0.7rem; color: var(--gold-dark); text-align: center; }
.prob-note { font-size: 0.65rem; color: var(--gold-dark); text-align: center; margin-top: 6px; line-height: 1.6; }

/* ══ INFO PAGES ══ */
.info-page {
  width: 100%; max-width: 860px;
  background: var(--panel); border: 2px solid var(--panel-border);
  border-radius: 18px; padding: 32px 36px;
  box-shadow: 0 0 40px rgba(201,168,76,0.1), inset 0 0 30px rgba(0,0,0,0.4);
  line-height: 1.7;
}
.info-page h2 {
  font-family: 'Orbitron', monospace; font-size: 1.1rem; font-weight: 900;
  color: var(--gold-light); letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 6px; text-shadow: 0 0 14px rgba(201,168,76,0.4);
}
.info-page .section-divider {
  height: 1px; background: linear-gradient(to right, transparent, var(--gold-dark), transparent);
  margin: 20px 0;
}
.info-page h3 {
  font-family: 'Orbitron', monospace; font-size: 0.75rem; font-weight: 700;
  color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 10px; margin-top: 20px;
}
.info-page p {
  font-size: 0.92rem; color: #c4a85a; margin-bottom: 12px;
  font-family: 'Rajdhani', sans-serif; font-weight: 400;
}
.info-page strong { color: var(--gold-light); font-weight: 600; }
.info-page em { color: #a08040; font-style: italic; }

.info-subtitle {
  font-size: 0.72rem; color: var(--gold-dark); letter-spacing: 0.18em;
  text-transform: uppercase; margin-bottom: 24px; font-family: 'Rajdhani', sans-serif;
}

/* ── RULE CARDS ── */
.rule-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.rule-card {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(138,106,42,0.4);
  border-radius: 10px; padding: 14px; text-align: center;
}
.rule-card .icon { font-size: 1.8rem; margin-bottom: 8px; }
.rule-card .rule-title { font-family: 'Orbitron', monospace; font-size: 0.6rem; color: var(--gold); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.rule-card p { font-size: 0.82rem; margin: 0; }

/* ── EXAMPLE DEMO ── */
.example-demo {
  background: rgba(0,0,0,0.35); border: 1px solid rgba(138,106,42,0.35);
  border-radius: 12px; padding: 18px 20px; margin: 16px 0;
}
.ex-title { font-family: 'Orbitron', monospace; font-size: 0.62rem; color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 14px; text-align: center; }
.ex-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ex-label { font-family: 'Orbitron', monospace; font-size: 0.55rem; color: var(--gold-dark); letter-spacing: 0.08em; text-transform: uppercase; width: 80px; flex-shrink: 0; text-align: right; }
.ex-pegs { display: flex; gap: 5px; }
.ex-peg { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); position: relative; overflow: hidden; flex-shrink: 0; }
.ex-peg.hidden-peg { background: #0d0a04; border: 2px dashed #444; }
.ex-fb { display: flex; gap: 3px; align-items: center; }
.ex-fb-peg { width: 13px; height: 13px; border-radius: 50%; background: #1a1005; border: 1px solid #3a2a10; }
.ex-fb-peg.hit { background: radial-gradient(circle at 35% 30%, #ff7070, #cc1515); border-color: #ff3333; }
.ex-fb-peg.near { background: radial-gradient(circle at 35% 30%, #fff, #ccc); border-color: #aaa; }
.ex-annotation { font-size: 0.78rem; color: var(--gold-dark); margin-left: 8px; }

/* ── STRATEGY CARDS ── */
.strategy-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 16px 0; }
.strategy-card {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(138,106,42,0.4);
  border-radius: 12px; padding: 16px;
  border-top: 3px solid var(--gold-dark);
}
.strategy-card.highlight { border-top-color: var(--gold); }
.strat-num { font-family: 'Orbitron', monospace; font-size: 1.4rem; font-weight: 900; color: rgba(201,168,76,0.2); margin-bottom: 4px; }
.strat-title { font-family: 'Orbitron', monospace; font-size: 0.65rem; color: var(--gold-light); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.strat-body { font-size: 0.84rem; color: #b09848; }
.strat-body strong { color: var(--gold-light); }

/* ── MATH FORMULAS ── */
.math-box {
  background: rgba(0,0,0,0.45); border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0; padding: 14px 18px; margin: 14px 0;
  font-family: 'Courier New', monospace;
}
.math-formula { font-size: 0.95rem; color: var(--gold-light); text-align: center; padding: 8px 0; }
.math-label { font-family: 'Rajdhani', sans-serif; font-size: 0.72rem; color: var(--gold-dark); text-align: center; margin-top: 4px; letter-spacing: 0.08em; }

.highlight-box {
  background: rgba(201,168,76,0.07); border: 1px solid rgba(201,168,76,0.3);
  border-radius: 10px; padding: 14px 18px; margin: 14px 0;
}
.highlight-box p { color: var(--gold-light); font-size: 0.88rem; margin: 0; }

/* KaTeX-like inline math */
.km { color: #e8c97a; font-family: 'Courier New', monospace; font-size: 0.92em; }

/* ── TABLE STYLES INFO ── */
table.info-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin: 14px 0; }
table.info-table th { font-family: 'Orbitron', monospace; font-size: 0.55rem; letter-spacing: 0.08em; color: var(--gold-dark); padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--gold-dark); background: rgba(0,0,0,0.3); }
table.info-table td { padding: 6px 10px; text-align: center; border-bottom: 1px solid rgba(138,106,42,0.15); color: #c4a85a; }
table.info-table td:first-child { text-align: left; color: var(--gold-light); font-weight: 600; }
table.info-table tr:last-child td { border-bottom: none; }
table.info-table tr.highlight-row td { background: rgba(201,168,76,0.07); }

/* RESPONSIVE */
@media (max-width: 800px) {
  .main-layout { flex-direction: column; align-items: center; }
  .game-panel { width: 100%; max-width: 400px; }
  .prob-panel { width: 100%; }
  .info-page { padding: 20px 16px; }
}
