:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8f8f8;
  color: #222;
}
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  height: 100%;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.app-shell {
  width: min(980px, 100%);
}
.game-panel {
  background: linear-gradient(180deg, #fff 0%, #e7e7e7 100%);
  border: 1px solid #c1c1c1;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.08);
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.header h1 {
  font-size: 1.2rem;
  margin: 0;
}
.back-link {
  font-size: 0.85rem;
  color: #555;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  white-space: nowrap;
}
.back-link:hover { background: #f0f0f0; color: #111; }
.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .95rem;
}
.hint {
  font-size: .95rem;
  margin-bottom: 12px;
  color: #4d4d4d;
}
.canvas-wrapper {
  width: 100%;
  aspect-ratio: 2.8 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #f2f2f2;
  position: relative;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.action-btn {
  margin-top: 14px;
  width: 100%;
  border: none;
  border-radius: 999px;
  background: #222;
  color: #fff;
  font-size: 1rem;
  padding: 14px 16px;
  cursor: pointer;
}
.action-btn:hover,
.action-btn:focus {
  background: #111;
}
/* ── Móvil: pantalla completa ── */
@media (max-width: 768px) {
  html, body {
    height: 100dvh;      /* altura real del viewport en móvil */
    overflow: hidden;
    padding: 0;
  }
  body {
    align-items: stretch;
  }
  .app-shell {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .game-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 12px 12px 8px;
    overflow: hidden;
  }
  .header {
    flex-wrap: wrap;
    margin-bottom: 8px;
  }
  .hint {
    font-size: 0.82rem;
    margin-bottom: 8px;
  }
  .canvas-wrapper {
    aspect-ratio: unset; /* elimina ratio fijo */
    flex: 1;             /* ocupa todo el espacio disponible */
    min-height: 0;
  }
  .action-btn {
    margin-top: 8px;
    padding: 12px 16px;
    border-radius: 14px;
  }
}

/* ── Game Over Overlay ── */
.hidden { display: none !important; }

.game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 16, 24, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.overlay-card {
  background: #fff;
  border-radius: 18px;
  padding: 26px 30px;
  text-align: center;
  width: min(340px, 100%);
  box-shadow: 0 16px 48px rgba(0,0,0,0.28);
}

.overlay-title {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.overlay-score {
  margin: 0 0 20px;
  font-size: 1.1rem;
  color: #333;
}

.overlay-label {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: #555;
}

.name-input {
  width: 100%;
  border: 2px solid #ccc;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1.15rem;
  text-align: center;
  margin-bottom: 12px;
  outline: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: inherit;
  box-sizing: border-box;
}

.name-input:focus {
  border-color: #222;
}

.overlay-btn {
  margin-top: 6px;
}

.skip-btn {
  background: transparent;
  color: #666;
  border: 1.5px solid #ccc;
  margin-top: 8px;
}

.skip-btn:hover,
.skip-btn:focus {
  background: #f2f2f2;
  color: #222;
  border-color: #999;
}

.lb-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
}

.lb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  text-align: left;
}

.lb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.lb-list li:nth-child(odd) {
  background: #f4f4f4;
}

.lb-list li.lb-me {
  background: #d4edda;
  font-weight: 700;
  border: 1.5px solid #a8d5b5;
}

.lb-rank {
  color: #888;
  width: 22px;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.lb-name {
  flex: 1;
  letter-spacing: 0.05em;
}

.lb-score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Character select ── */
.char-select-card {
  width: min(480px, 100%);
}

.char-options {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 16px 0 4px;
}

.char-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid #ddd;
  border-radius: 14px;
  background: #f8f8f8;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.12s;
}

.char-option:hover {
  border-color: #999;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.char-option.selected {
  border-color: #111;
  border-width: 3px;
  background: #e6e6e6;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transform: translateY(-3px);
}

.char-preview {
  border-radius: 10px;
  display: block;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.char-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #222;
}

.char-desc {
  font-size: 0.75rem;
  color: #888;
}

.start-btn {
  margin-top: 8px;
}

@media (max-width: 380px) {
  .char-options { gap: 6px; }
  .char-option { padding: 8px 4px; }
  .char-preview { width: 64px; height: 64px; }
}
