/* Tesserae — Simulador Phaser. Estilos del DOM (overlays y modales). */
:root {
  --bg: #0b101d;
  --panel: #16213a;
  --panel2: #1b2b52;
  --ink: #efe6d2;
  --muted: #b9b09a;
  --gold: #d4b277;
  --gold-dark: #9d5a17;
  --red: #b3352b;
  --green: #3fb59c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cinzel', Georgia, serif;
  overflow: hidden;
}

#wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game { width: 100%; height: 100%; }
#game canvas { display: block; margin: 0 auto; }

h1, h2 { margin: 0 0 8px; color: var(--gold); }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
.sub { color: var(--muted); margin: 4px 0 12px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
p { line-height: 1.5; }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 16, 0.82);
  z-index: 1000;
  padding: 12px;
}

.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 18px 20px;
  max-width: 460px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
.panel.wide { max-width: 640px; text-align: left; }
.panel.wide h2 { text-align: center; }

label {
  display: block;
  margin: 10px 0;
  font-size: 14px;
  text-align: left;
}

select, input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--gold);
  border-radius: 6px;
}
input[type="text"] { text-transform: uppercase; letter-spacing: 2px; }

button {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 10px 16px;
  margin: 6px 4px 0;
  cursor: pointer;
}
button.primary { background: var(--gold-dark); }
button:disabled { opacity: 0.4; cursor: default; }

hr { border: none; border-top: 1px solid var(--gold); opacity: 0.4; margin: 16px 0; }

.row { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }

/* Modal de carta */
.card-panel { text-align: center; }
#cm-stats {
  margin: 10px auto;
  border-collapse: collapse;
  font-size: 16px;
}
#cm-stats th, #cm-stats td {
  border: 1px solid var(--gold);
  padding: 6px 14px;
}
#cm-stats th { color: var(--muted); font-size: 13px; }
#cm-text { font-size: 15px; white-space: pre-line; }

/* Dado */
#dice-face {
  font-size: 84px;
  line-height: 1;
  margin: 8px 0;
}
#dice-face.rolling { animation: shake 0.12s infinite alternate; }
@keyframes shake { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }

/* Mulligan */
.mg-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.mg-card {
  width: 96px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 8px 6px;
  background: var(--panel2);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
}
.mg-card .mg-el { font-size: 22px; }
.mg-card .mg-name { font-weight: bold; margin: 4px 0; min-height: 32px; }
.mg-card .mg-stats { color: var(--muted); font-size: 12px; }
.mg-card.picked { border-color: var(--red); background: #4a1f1c; opacity: 0.85; }

/* Registro */
.log-body {
  max-height: 55vh;
  overflow-y: auto;
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
}
.log-body .log-line { border-bottom: 1px solid rgba(212, 178, 119, 0.2); padding: 2px 0; }

/* Ayuda */
#help-body { font-size: 14px; }
#help-body h3 { color: var(--gold); margin: 14px 0 4px; font-size: 15px; }
#help-body ul { margin: 4px 0; padding-left: 20px; }
#help-body li { margin: 2px 0; }

/* Resumen de fin de partida */
#go-summary {
  text-align: left;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  background: var(--panel2);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 10px;
}

/* Aviso breve */
#toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--gold-dark);
  color: var(--ink);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  z-index: 2000;
  max-width: 90vw;
  text-align: center;
}
