/* ==========================================================================
   styles.css — Interfaz del prototipo (el juego en sí se dibuja en canvas)
   ========================================================================== */
:root {
  --bg: #2b2118;
  --bg-2: #3a2d21;
  --panel: #f4e6c8;
  --panel-2: #e8d5ab;
  --ink: #3b2a1a;
  --ink-soft: #7a5d3c;
  --accent: #d8433b;
  --accent-dark: #8f2620;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 30% 20%, var(--bg-2), var(--bg));
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
}

/* ---------- Barra superior ---------- */
.topbar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 20px;
  color: var(--panel);
}
.topbar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.topbar h1 span { color: var(--accent); }
.subtitle { margin: 0; opacity: 0.7; font-size: 13px; }
.fps {
  margin-left: auto;
  font: 600 12px ui-monospace, monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ---------- Distribución ---------- */
.layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 56px);
  padding: 0 16px 16px;
}

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  display: block;
  border-radius: var(--radius);
  box-shadow: 0 0 0 4px #5a4029, 0 14px 40px rgba(0, 0, 0, 0.55);
  cursor: none;                    /* la mira se dibuja en el canvas */
  background: #ead6a9;
  image-rendering: auto;
}

/* ---------- Menú ---------- */
.menu {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 20, 10, 0.55);
  backdrop-filter: blur(3px);
  z-index: 10;
}
.menu.hidden { display: none; }
.menu-card.notice { text-align: center; }
.menu-card.notice p { margin: 0 0 4px; color: var(--ink-soft); }

/* ---------- Aviso breve ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 10px);
  margin: 0;
  max-width: 90%;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(30, 20, 10, 0.85);
  color: #fff8e6;
  font: 500 14px system-ui, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.menu-card {
  width: min(380px, 92%);
  background: var(--panel);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 0 0 4px #5a4029, 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.menu-card h2 { margin: 0 0 4px; font-size: 22px; }
.menu-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.menu-card input[type='text'], .menu-card select {
  font: inherit;
  font-weight: 400;
  padding: 7px 9px;
  border: 2px solid #c9ad79;
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
}
.menu-card .row { display: flex; gap: 12px; }
.menu-card .row label:first-child { flex: 1; }
.mode { border: 2px solid #c9ad79; border-radius: 8px; padding: 6px 10px 8px; margin: 0; }
.mode legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.mode label { flex-direction: row; align-items: center; font-weight: 500; }
.menu-card input:disabled, .menu-card select:disabled { opacity: 0.5; }
.hint { margin: 0; text-align: center; font-size: 12px; color: var(--ink-soft); }

/* ---------- Botones ---------- */
.btn {
  font: 600 13px system-ui, sans-serif;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid #b8955a;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.05s, background 0.15s;
}
.btn:hover { background: #f0dfb8; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
  font-size: 16px;
  padding: 10px;
  box-shadow: 0 3px 0 var(--accent-dark);
}
.btn.primary:hover { background: #e4554d; }

/* ---------- Panel lateral ---------- */
.panel {
  width: 290px;
  flex-shrink: 0;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 0 0 4px #5a4029;
  padding: 12px 14px;
  overflow-y: auto;
  font-size: 13px;
}
.panel section + section { border-top: 2px dashed #d6bd8c; margin-top: 10px; padding-top: 8px; }
.panel h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.panel h3 small { font-weight: 500; color: var(--ink-soft); }
.panel .legend { margin-left: auto; display: flex; gap: 10px; font-size: 11px; }
.panel .small { margin: 8px 0 0; font-size: 12px; }
.buttons { display: flex; gap: 8px; }
.buttons .btn { flex: 1; }

.scoreboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.scoreboard li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.35);
}
.scoreboard li.me { background: rgba(255, 255, 255, 0.8); font-weight: 700; }
.scoreboard li.dead { opacity: 0.45; }
.scoreboard li.dead .name { text-decoration: line-through; }
.scoreboard li.empty { justify-content: center; color: var(--ink-soft); }
.scoreboard .swatch { width: 14px; height: 14px; border-radius: 4px; border: 2px solid; flex-shrink: 0; }
.scoreboard .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreboard .name em { font-weight: 400; font-style: normal; color: var(--ink-soft); }
.scoreboard .name small { font-size: 9px; background: #c9ad79; color: #fff; padding: 1px 4px; border-radius: 4px; vertical-align: 1px; }
.scoreboard .stat { width: 30px; text-align: center; font: 700 13px ui-monospace, monospace; }
.scoreboard .stat.wins { color: var(--accent-dark); }

.net-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0 0 8px;
  font-size: 12px;
}
.net-stats dt { color: var(--ink-soft); }
.net-stats dd { margin: 0; font-family: ui-monospace, monospace; text-align: right; overflow-wrap: anywhere; }
#btn-mirror { width: 100%; }

.controls ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  margin-right: 2px;
  font: 600 11px ui-monospace, monospace;
  text-align: center;
  background: #fffaf0;
  border: 1px solid #c9ad79;
  border-bottom-width: 3px;
  border-radius: 5px;
}

/* ---------- Pantallas estrechas ---------- */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  .layout { flex-direction: column; height: auto; }
  .stage { height: 70vh; }
  .panel { width: 100%; }
}

