/* Loteria Languages — mobile-first solo board */
:root {
  --paper: #f4e6c8;
  --paper-2: #efe0b8;
  --ink: #2a1a12;
  --muted: #6a5344;
  --red: #9b1b30;
  --red-deep: #6e1020;
  --gold: #c9a227;
  --gold-soft: #e8d48a;
  --green: #1f4d3a;
  --cream: #fff8ea;
  --line: #d4bc8a;
  --wrong: #9b1b30;
  --ok: #1f4d3a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; }
.app {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 44px;
}
.bar h1, .bar .title {
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
  font-family: Georgia, "Palatino Linotype", Palatino, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--red);
  line-height: 1.2;
}
.icon-btn, .text-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:active, .text-btn:active, .primary:active, .skip-btn:active, .lang-btn:active { transform: scale(0.98); }
.score-chip {
  min-width: 72px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}
.setup {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
.setup p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  user-select: text;
  -webkit-user-select: text;
}
.label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.lang-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lang-btn {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  font-weight: 650;
  cursor: pointer;
}
.lang-btn.on {
  border-color: var(--red);
  background: var(--red);
  color: #fff8ea;
}
.primary {
  appearance: none;
  border: 0;
  background: var(--red);
  color: #fff8ea;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  border-radius: 14px;
  min-height: 52px;
  padding: 12px 18px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 3px 0 var(--red-deep);
}
.ghost {
  appearance: none;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  border-radius: 14px;
  min-height: 48px;
  padding: 10px 16px;
  cursor: pointer;
  width: 100%;
}
.call {
  text-align: center;
  padding: 6px 8px 8px;
}
.call-word {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  font-family: Georgia, "Palatino Linotype", Palatino, serif;
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 700;
  color: var(--red);
  line-height: 1.1;
  padding: 4px 0;
  cursor: pointer;
  min-height: 56px;
}
.call-meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.timer {
  height: 10px;
  border-radius: 999px;
  background: #e4d2a4;
  overflow: hidden;
  margin: 4px 0 10px;
}
.timer > span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--gold);
  transition: none;
}
.timer.low > span { background: var(--red); }
.board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  min-height: 0;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  max-height: min(100vw - 24px, 62dvh);
}
.cell {
  appearance: none;
  border: 3px solid var(--red-deep);
  background: var(--cream);
  border-radius: 10px;
  padding: 4px;
  cursor: pointer;
  position: relative;
  min-width: 0;
  min-height: 0;
  box-shadow: inset 0 0 0 2px var(--gold-soft);
}
.cell .draw { width: 100%; height: 100%; display: block; }
.cell.marked { background: #f3e7c0; }
.cell.marked::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c45c3a, #6b2416 70%);
  box-shadow: 0 2px 0 #3a120c88;
  pointer-events: none;
  opacity: 0.92;
}
.cell.flash-wrong { animation: flashWrong 0.45s ease; }
@keyframes flashWrong {
  0%, 100% { background: var(--cream); }
  40% { background: #f3c4c4; }
}
.board.feedback-wrong { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.skip-btn {
  appearance: none;
  width: 100%;
  max-width: 520px;
  margin: 12px auto 0;
  display: block;
  border: 3px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 14px;
  min-height: 56px;
  padding: 12px 16px;
  cursor: pointer;
}
.skip-btn:disabled, .cell:disabled { opacity: 0.55; cursor: default; }
.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
.panel h2 {
  font-family: Georgia, "Palatino Linotype", Palatino, serif;
  font-size: clamp(2rem, 8vw, 3rem);
  color: var(--red);
  margin: 0;
}
.panel .big-score {
  font-size: 2rem;
  font-weight: 800;
  margin: 0;
}
.stats {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
}
.stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
}
.ad-frame {
  width: 100%;
  border: 2px dashed var(--line);
  background: var(--cream);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
}
.ad-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.house-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0;
  background: #fff;
  min-height: 44px;
}
.house-link strong { display: block; color: var(--red); }
.house-link span { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.toast {
  font-weight: 800;
  min-height: 1.2em;
  text-align: center;
  margin: 2px 0 0;
}
.toast.ok { color: var(--ok); }
.toast.bad { color: var(--wrong); }
.toast.neutral { color: var(--muted); }
@media (max-height: 560px) {
  .call-word { font-size: 1.7rem; min-height: 40px; }
  .board { max-height: 48dvh; gap: 6px; }
  .skip-btn { min-height: 48px; margin-top: 8px; }
}
