/* Línea de Frente · versión web. Mismos colores que la app: verde oliva, arena y dorado sobre fondo oscuro. */
:root {
  --k: 1;
  --bg: #1e1f1a;
  --bg2: #28291f;
  --panel: #23241d;
  --fg: #ede6d6;
  --muted: #b9b09c;
  --gold: #e8c050;
  --btn: #3a3c30;
  --btn-hi: #4a4c3d;
  --line: #44463a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: calc(15px * var(--k)) / 1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app { min-height: 100%; }
.loading { display: grid; place-items: center; height: 100vh; color: var(--gold); font-weight: 700; letter-spacing: .08em; }

/* ---------- botones ---------- */
.btn {
  font: inherit; color: var(--fg); background: var(--btn); border: 1px solid var(--line);
  border-radius: 8px; padding: .55em .8em; cursor: pointer; min-height: 2.6em;
  transition: background .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--btn-hi); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: #5e7f3a; border-color: #6e8f4a; }
.btn.primary:hover { background: #6e8f4a; }
.btn.big { display: block; width: 100%; margin: .45em 0; font-size: 1.05em; padding: .75em; }
.btn.small { min-height: 2.2em; padding: .3em .7em; font-size: .85em; white-space: nowrap; }
.btn.active { outline: 2px solid var(--gold); font-weight: 700; }

/* ---------- menú ---------- */
.menu {
  max-width: 560px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}
.langs { display: flex; justify-content: flex-end; gap: 6px; }
.btn.lang { min-height: 2.2em; padding: .25em .8em; opacity: .6; }
.btn.lang.on { opacity: 1; border-color: var(--gold); font-weight: 700; }
.title { color: var(--gold); text-align: center; font-size: calc(30px * var(--k)); letter-spacing: .06em; margin: .6em 0 .1em; }
.subtitle { text-align: center; color: var(--muted); white-space: pre-line; margin-bottom: 1.2em; }
.label { color: var(--muted); font-size: .9em; margin: 1em 0 .35em; }
.section { color: var(--gold); font-weight: 700; margin: 1.5em 0 .2em; font-size: .95em; }
.modes { display: grid; gap: 8px; }
.mode { display: flex; gap: .7em; align-items: flex-start; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: .6em .8em; cursor: pointer; }
.mode input { margin-top: .3em; accent-color: var(--gold); }
.mode .desc { display: block; color: var(--muted); font-size: .9em; }
.select, input.text {
  font: inherit; width: 100%; color: var(--fg); background: var(--bg2);
  border: 1px solid var(--line); border-radius: 8px; padding: .55em .6em;
}
.note { color: var(--muted); font-size: .85em; margin-top: 1.8em; text-align: center; }

/* ---------- partida ---------- */
.game {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "top" "tut" "board" "panel";
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px; background: #28241f; transition: background .3s;
}
.topbar .back {
  font: inherit; font-size: 1.6em; line-height: 1; width: 1.6em; height: 1.6em; border-radius: 8px;
  background: rgba(0,0,0,.25); color: #fff; border: 0; cursor: pointer;
}
.toptext { flex: 1; color: #fff; font-weight: 700; white-space: pre-line; font-size: .95em; min-width: 0; }
.tutorial { grid-area: tut; display: none; background: #fad250; color: #1e1a0a; padding: .5em .8em; font-size: .95em; }
.boardwrap { grid-area: board; position: relative; min-height: 0; background: #1e2216; }
canvas.board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; }
.overlay.curtain { background: #141612; cursor: pointer; border-top: 6px solid var(--side, var(--gold)); }
.curtain-text { white-space: pre-line; font-size: 1.25em; padding: 1em; max-width: 26em; }
.panel {
  grid-area: panel; background: var(--panel); border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.info { white-space: pre-line; font-size: .88em; min-height: 4.2em; color: var(--fg); margin-bottom: 6px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.btn.act { min-height: 2.4em; padding: .3em .2em; font-size: .85em; line-height: 1.15; }
.log { white-space: pre-line; color: var(--muted); font-size: .82em; margin-top: 6px; min-height: 2.4em; }

/* Pantalla ancha: tablero a la izquierda, panel a la derecha. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .game {
    grid-template-columns: 1fr minmax(320px, 380px);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "top top" "tut tut" "board panel";
  }
  .panel { border-top: 0; border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
  .info { min-height: 9em; }
  .actions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) { .actions { grid-template-columns: repeat(3, 1fr); } .btn.act { font-size: .8em; } }

/* ---------- diálogos y avisos ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(560px, 100%);
  max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.modal h2 { margin: 0; padding: 14px 16px 6px; color: var(--gold); font-size: 1.15em; }
.modal-body { padding: 6px 16px; overflow-y: auto; }
.modal-body.pre, .modal-body .pre, .pre { white-space: pre-line; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; flex-wrap: wrap; }
.settings .toggle { display: flex; gap: .6em; align-items: center; padding: .35em 0; cursor: pointer; }
.settings .toggle input { width: 1.2em; height: 1.2em; accent-color: var(--gold); }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #000c; color: #fff; padding: .6em 1em; border-radius: 8px; z-index: 20; max-width: 90vw;
  transition: opacity .4s;
}
.toast.gone { opacity: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- en línea ---------- */
.overlay.info-overlay { background: rgba(20, 22, 18, .9); cursor: default; }
input.text.code { text-transform: uppercase; letter-spacing: .3em; font-size: 1.4em; text-align: center; font-weight: 700; }
