:root {
  --felt: #0e1a12;
  --felt-2: #173322;
  --gold: #e0c36a;
  --gold-deep: #a8842a;
  --cream: #f3ead6;
  --ink: #f6efe2;
  --muted: #cbbba0;
  --cell: 36px;
  --coord: 18px;
  --frame: 16px;
  --inset-top: max(env(safe-area-inset-top, 0px), 16px);
  --inset-bottom: max(env(safe-area-inset-bottom, 0px), 12px);
  --ad-banner-height: 0px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  min-height: 100dvh;
  background: var(--felt);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.is-play { overflow: hidden; }
body.is-home { overflow-y: auto; }

.felt {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 50% -8%, rgba(224, 195, 106, 0.22), transparent 38%),
    radial-gradient(ellipse at 50% 42%, rgba(46, 92, 62, 0.28), transparent 58%),
    radial-gradient(ellipse at 80% 110%, rgba(8, 22, 14, 0.95), #07110b 72%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 2px, transparent 2px 7px);
}
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}
.screen {
  position: relative;
  z-index: 1;
}
#ad-slot {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  height: calc(50px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
html.ads-live #ad-slot { display: block; }
html.ads-live #screen-home {
  padding-bottom: calc(var(--inset-bottom) + var(--ad-banner-height) + 1rem);
}
html.ads-live #screen-play {
  padding-bottom: calc(var(--inset-bottom) + var(--ad-banner-height));
}
.screen[hidden], [hidden] { display: none !important; }

#screen-home {
  min-height: 100dvh;
  padding: var(--inset-top) 1rem calc(var(--inset-bottom) + 1rem);
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
}
.home-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.home-audio {
  display: none;
  align-items: center;
  gap: 0.4rem;
}
.home-audio .icon-btn.off {
  opacity: 0.45;
}
.home-audio .icon-btn svg,
.play-audio .icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}
.langs button, .icon-btn, .chip, .play-toolbar button, .time-pick, .size-pick, .mode-card, .lang-menu button {
  font-family: inherit; border: 0; cursor: pointer;
}
.lang-wrap { position: relative; z-index: 5; }
.lang-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 8;
  min-width: 156px;
  padding: 0.35rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #173322, #0e1a12);
  border: 1px solid rgba(224,195,106,0.4);
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}
.lang-menu button {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 42px;
  padding: 0 0.85rem;
  border-radius: 10px;
  background: transparent;
  color: var(--cream);
  font-weight: 700;
  font-size: 0.92rem;
}
.lang-menu button.active,
.lang-menu button:active { background: var(--gold); color: #1a1208; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: var(--gold);
  font-size: 1.35rem; font-weight: 700;
  display: grid;
  place-items: center;
  overflow: visible;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
}

.hero { text-align: center; padding: 0.6rem 0 1rem; }
.crest {
  width: 92px;
  height: 92px;
  margin: 0.2rem auto 0.15rem;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.45));
}
.crest img { width: 100%; height: 100%; object-fit: contain; }
.mode-ico img {
  width: 2rem; height: 2rem; object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4));
}
#logo, .hero h1 {
  font-family: Rubik, Inter, sans-serif;
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  letter-spacing: 0.06em;
  color: var(--cream);
  text-shadow: 0 3px 0 #0a120c, 0 10px 24px rgba(0,0,0,0.4);
}
.tag { display: none; }
.how-banner {
  width: 100%;
  min-height: 86px;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: 0.75rem;
  background: linear-gradient(160deg, #6a4e1c 0%, #2a1e0c 100%);
}
.how-banner .mode-name {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  width: 100%;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  flex: 1;
  align-content: start;
}
.mode-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
  text-align: center;
  min-height: 118px;
  padding: 0.95rem 0.95rem 0.85rem;
  border-radius: 18px;
  color: var(--cream);
  background: linear-gradient(160deg, #3a5f44 0%, #1c3d2a 100%);
  border: 1px solid rgba(224,195,106,0.45);
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}
.mode-card.gold { background: linear-gradient(160deg, #7a5a20 0%, #3a2a10 100%); }
.mode-card.purple { background: linear-gradient(160deg, #5c2e78 0%, #2e1844 100%); }
.mode-card.teal { background: linear-gradient(160deg, #2a6a64 0%, #16403c 100%); }
.mode-card:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .mode-card:hover { filter: brightness(1.08); }
  .icon-btn:hover, .chip:hover, .size-pick:hover, .time-pick:hover {
    filter: brightness(1.08);
  }
}
.mode-ico { font-size: 1.55rem; line-height: 1; }
.mode-card.gold .mode-ico {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-name { font-family: Rubik, sans-serif; font-size: 1.12rem; }
.mode-sub { color: var(--muted); font-size: 0.8rem; }
.mode-sub:empty { display: none; }

.home-foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.7rem;
}

#screen-play {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--inset-top) 0.28rem 0.2rem;
}
.hud {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.15rem 0.15rem 0.35rem;
}
.hud .icon-btn { flex-shrink: 0; }
.play-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  width: 100%;
}
.play-toolbar button {
  min-height: 40px; padding: 0 1.15rem; border-radius: 999px;
  font-weight: 800;
}
#cronometro {
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #2a1e0c, #161008);
  color: var(--gold);
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(224,195,106,0.55);
  box-shadow: 0 6px 14px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,230,160,0.18);
  min-width: 5.4rem;
  text-align: center;
}
#cronometro.danger {
  background: linear-gradient(180deg, #6b1c1c, #3a1010);
  color: #ffd0d0;
  border-color: rgba(255,180,180,0.45);
}
#contador {
  background: linear-gradient(180deg, #f6edd8, #e4d4b0);
  color: #1a1208;
  font-weight: 800;
  font-family: Rubik, Inter, sans-serif;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  font-size: 0.95rem;
  min-width: 4.4rem;
  text-align: center;
  border: 1px solid rgba(224,195,106,0.7);
  box-shadow: 0 6px 14px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.55);
}
#contador.ok {
  background: linear-gradient(180deg, #d5efd2, #b7e0b4);
  border-color: #7cbc78;
}
#contador.bad {
  background: linear-gradient(180deg, #f8d0d0, #f5b4b4);
  border-color: #d37a7a;
}
#tablerosResueltos { font-size: 0.78rem; color: var(--gold); text-align: center; }
.play-label { display: none; }
#mensaje, #resultado {
  text-align: center; font-weight: 700; font-size: 0.82rem; padding: 0 0.4rem;
}
#mensaje:empty, #resultado:empty { display: none; }
#resultado { color: #b7e0b4; }
#mensaje { color: #ffb4b4; }

.board-stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
}
.board-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  max-width: min(920px, 100%);
  margin: 0 auto;
}
.size-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  width: 100%;
}
.play-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 0.05rem;
}
.play-audio {
  display: none;
  align-items: center;
  gap: 0.35rem;
}
.play-audio .icon-btn.off {
  opacity: 0.45;
}

/* Web: one compact control row above the board. */
html.is-web .play-actions-bar { order: 1; }
html.is-web #tablerosResueltos { order: 2; }
html.is-web #tablero-container { order: 3; }
html.is-web .size-row { order: 4; }
html.is-web .play-actions-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}
html.is-web .play-audio {
  display: flex;
}

/* App: board higher, Help/Clear below, compact & centered. */
html.is-native .home-help-btn { display: none !important; }
html.is-native .home-audio { display: flex; }
html.is-native #screen-home {
  max-width: 460px;
  margin: 0 auto;
  padding-top: max(var(--inset-top), 10px);
}
html.is-native #screen-play {
  align-items: center;
  justify-content: flex-start;
  padding: max(var(--inset-top), 8px) 0.45rem max(var(--inset-bottom), 8px);
}
html.is-native .hud {
  width: min(460px, 100%);
  min-height: 44px;
  padding: 0 0.1rem 0.55rem;
  margin-bottom: 0.25rem;
}
html.is-native .board-stage {
  width: min(460px, 100%);
  place-items: start center;
  padding-top: 0.55rem;
  align-content: start;
}
html.is-native .board-stack {
  gap: 0.55rem;
  max-width: 100%;
}
html.is-native .play-meters { order: 1; }
html.is-native #tablerosResueltos { order: 2; }
html.is-native #tablero-container { order: 3; }
html.is-native .play-actions-bar { order: 4; }
html.is-native .size-row { order: 5; }
html.is-native .play-meters {
  margin-bottom: 0.35rem;
}
html.is-native .play-actions-bar {
  margin-top: 0.4rem;
  margin-bottom: 0.1rem;
}
html.is-native .play-actions-bar button {
  min-height: 38px;
  padding: 0 1rem;
  font-size: 0.92rem;
}
html.is-native #cronometro,
html.is-native #contador {
  padding: 0.3rem 0.75rem;
  font-size: 0.92rem;
  min-width: 4.6rem;
}
html.is-native .mode-grid {
  gap: 0.65rem;
}
html.is-native .mode-card {
  min-height: 108px;
}
#tablero-container {
  background:
    radial-gradient(ellipse at 30% 12%, rgba(232,204,106,0.22), transparent 36%),
    linear-gradient(180deg, #7a5530 0%, #3d2918 46%, #1c1008 100%);
  padding: var(--frame);
  border-radius: 12px;
  border: 4px solid #120a06;
  box-shadow:
    0 0 0 1px #e0c36a,
    0 0 0 4px #5a3d1c,
    0 14px 28px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,230,160,0.35);
}
#tablero {
  display: grid;
  width: max-content;
  background: #1a120c;
}
.coord-num, .coord-esquina, .coord-letra {
  display: flex; align-items: center; justify-content: center;
  background: #1a120c; color: #e0c36a; font-weight: 700;
  font-size: 10px;
  font-family: Rubik, sans-serif;
  line-height: 1;
}
.casilla {
  width: var(--cell); height: var(--cell);
  display: flex; align-items: center; justify-content: center;
  user-select: none;
  position: relative;
  touch-action: none;
  background-size: 140% 140%;
  background-position: center;
}
.casilla.dragging { opacity: 0.28; }
.queen-ghost {
  position: fixed;
  z-index: 40;
  width: var(--cell);
  height: var(--cell);
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -58%);
  filter: drop-shadow(0 10px 8px rgba(0,0,0,0.5));
}
.blanca {
  background-color: #ecd3a4;
  background-image:
    linear-gradient(145deg, rgba(255,255,255,0.38) 0%, transparent 46%, rgba(90,60,20,0.14) 100%),
    repeating-linear-gradient(92deg, rgba(120,80,30,0.07) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 0 0 1px rgba(90,60,20,0.12);
}
.negra {
  background-color: #7a4a28;
  background-image:
    linear-gradient(145deg, rgba(255,210,140,0.16) 0%, transparent 44%, rgba(0,0,0,0.28) 100%),
    repeating-linear-gradient(88deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 6px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.22);
}
.queen-piece {
  width: 88%;
  height: 88%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,0.42));
  display: block;
  margin: auto;
}
.queen-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: calc(var(--cell) * 0.72);
  line-height: 1;
  color: #f8efd8;
  text-shadow: 0 2px 3px rgba(0,0,0,0.55);
  filter: none;
}
.casilla.fija {
  box-shadow:
    inset 0 0 0 3px #d4af37,
    inset 0 0 12px rgba(212, 175, 55, 0.28);
}
.queen-piece.queen-fixed {
  filter: sepia(0.62) saturate(1.7) hue-rotate(-14deg) drop-shadow(0 0 3px #e0c36a) drop-shadow(0 3px 2px rgba(0,0,0,0.45));
}
.queen-fallback.queen-fixed {
  color: #ffe08a;
  text-shadow: 0 0 6px #d4af37, 0 2px 3px rgba(0,0,0,0.55);
}
.casilla.en-conflicto {
  box-shadow:
    inset 0 0 0 3px #e23a3a,
    inset 0 0 18px rgba(180, 30, 30, 0.32);
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(220, 60, 60, 0.32), transparent 62%),
    linear-gradient(145deg, rgba(255,255,255,0.06), transparent 48%);
}
.casilla.en-conflicto .queen-piece:not(.queen-fixed) {
  filter: sepia(1) hue-rotate(-52deg) saturate(5.2) brightness(0.88) drop-shadow(0 0 7px #ff3b3b) drop-shadow(0 3px 2px rgba(0,0,0,0.4));
}
.casilla.en-conflicto .queen-piece.queen-fixed {
  filter: sepia(0.62) saturate(1.7) hue-rotate(-14deg) drop-shadow(0 0 6px #ff2a2a) drop-shadow(0 0 2px #e0c36a);
}
.casilla.fija.en-conflicto {
  box-shadow:
    inset 0 0 0 3px #e23a3a,
    inset 0 0 0 7px #d4af37,
    inset 0 0 16px rgba(180, 30, 30, 0.28);
}
html.is-web .casilla.en-conflicto:not(.fija) {
  animation: conflictPulse 1.35s ease-in-out infinite;
}
@keyframes conflictPulse {
  0%, 100% {
    box-shadow:
      inset 0 0 0 2.5px rgba(220, 70, 70, 0.88),
      inset 0 0 14px rgba(180, 30, 30, 0.22);
  }
  50% {
    box-shadow:
      inset 0 0 0 3px rgba(255, 110, 110, 0.98),
      inset 0 0 22px rgba(200, 40, 40, 0.34);
  }
}

.play-bar { padding: 0.15rem 0.15rem calc(0.2rem + env(safe-area-inset-bottom, 0px)); }
.play-credit {
  display: none;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}
.size-picks { display: flex; gap: 0.45rem; }
.size-pick {
  flex: 1;
  min-height: 52px;
  border-radius: 14px;
  background: linear-gradient(160deg, #3a5f44 0%, #1c3d2a 100%);
  color: var(--cream);
  font-weight: 800;
  font-size: 1.02rem;
  border: 1px solid rgba(224,195,106,0.35);
}
.size-pick:active { transform: scale(0.97); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.chip {
  min-height: 34px; padding: 0 0.7rem; border-radius: 999px;
  background: rgba(255,255,255,0.08); color: var(--cream);
  border: 1px solid rgba(224,195,106,0.25); font-weight: 700; font-size: 0.82rem;
}
.chip.on { background: var(--gold); color: #1a1208; }
#btn-ayuda {
  background: rgba(255,255,255,0.08);
  color: var(--cream);
  border: 1px solid rgba(224,195,106,0.25);
  font-weight: 700;
}
#btn-ayuda.on {
  background: var(--gold);
  color: #1a1208;
}
#reset { background: #7dcea0; color: #1a1208; }
#reiniciarContrarreloj { background: #d7a1ea; }
#btn-share-result { background: var(--gold); }

.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0,0,0,0.55);
  display: grid; place-items: end center;
}
.sheet-card {
  width: min(560px, 100%);
  background: linear-gradient(180deg, #173322, #0e1a12 55%, #0a140e);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  padding: 1.2rem 1.15rem calc(1.2rem + var(--inset-bottom));
  max-height: 86dvh; overflow: auto;
  position: relative;
  border: 1px solid rgba(224,195,106,0.28);
  box-shadow: 0 -12px 40px rgba(0,0,0,0.45);
}
.sheet-x {
  position: absolute; right: 0.8rem; top: 0.7rem;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: var(--gold); font-size: 1.4rem;
}
.sheet-card h2 {
  font-family: Rubik, sans-serif;
  margin-bottom: 0.85rem;
  padding-right: 2.4rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.sheet-card p, .sheet-card li { line-height: 1.5; color: var(--cream); }
.how-hero {
  padding: 1rem 1.05rem;
  border-radius: 16px;
  margin-bottom: 0.75rem;
  background: linear-gradient(160deg, #2a4a34 0%, #163224 100%);
  border: 1px solid rgba(224,195,106,0.28);
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}
.how-hero h3 {
  font-family: Rubik, sans-serif;
  font-size: 1.12rem;
  color: var(--gold);
  margin-bottom: 0.45rem;
}
.how-modes { display: grid; gap: 0.65rem; }
.how-mode {
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: linear-gradient(160deg, #2a4a34 0%, #163224 100%);
  border: 1px solid rgba(224,195,106,0.28);
}
.how-mode.gold { background: linear-gradient(160deg, #5a4318 0%, #2c210e 100%); }
.how-mode.purple { background: linear-gradient(160deg, #4a2360 0%, #241334 100%); }
.how-mode h4 {
  font-family: Rubik, sans-serif;
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
  color: var(--cream);
}
.how-mode p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.rank-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.8rem; }
.rank-filters label { color: var(--muted); font-size: 0.82rem; }
.rank-filters select, .sheet-card input {
  width: 100%; min-height: 42px; border-radius: 10px;
  border: 1px solid rgba(224,195,106,0.28);
  padding: 0.35rem 0.5rem; font-size: 1rem; margin-top: 0.25rem;
  background: rgba(0,0,0,0.28); color: var(--cream);
}
#rankingLista { color: var(--cream); }
#rankingLista ol { padding-left: 1.3rem; }
.time-picks { display: grid; gap: 0.55rem; }
.time-pick {
  min-height: 52px; border-radius: 14px;
  background: linear-gradient(160deg, #4a2360 0%, #241334 100%);
  color: #fff; font-weight: 800; font-size: 1.05rem;
  border: 1px solid rgba(224,195,106,0.25);
}
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.8rem; }
#name-save { background: var(--gold); color: #1a1208; min-height: 44px; border-radius: 12px; border: 0; font-weight: 800; }
#name-skip { background: rgba(255,255,255,0.1); color: var(--cream); min-height: 44px; border-radius: 12px; border: 0; font-weight: 700; }

@media (min-width: 768px) {
  .sheet { place-items: center; }
  .sheet-card {
    border-radius: 22px;
    width: min(540px, 92%);
    max-height: 82dvh;
    padding: 1.25rem 1.2rem 1.3rem;
  }
}

@media (min-width: 768px) and (orientation: portrait) {
  html:not(.is-web) .mode-card { min-height: 140px; }
  html:not(.is-web) #logo, html:not(.is-web) .hero h1 { font-size: 4rem; }
  html:not(.is-web) .crest { width: 120px; height: 120px; }
  html:not(.is-web) #screen-home { max-width: 820px; }
}

@media (min-width: 900px) and (orientation: landscape) {
  html:not(.is-web) #screen-play {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    padding: 0.35rem 0.7rem 0.35rem 0.5rem;
    gap: 0.2rem 0.85rem;
  }
  html:not(.is-web) .hud { grid-column: 1 / -1; }
  html:not(.is-web) .play-label,
  html:not(.is-web) #mensaje,
  html:not(.is-web) #resultado { grid-column: 1; }
  html:not(.is-web) .board-stage {
    grid-column: 2;
    grid-row: 2 / 5;
  }
  html:not(.is-web) .play-bar { grid-column: 1; }
  html:not(.is-web) .size-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  html:not(.is-web) .size-row .chip { min-height: 44px; width: 100%; }
}

@media (hover: hover) and (pointer: fine) {
  html.is-web,
  html.is-web body {
    cursor: url("img/cursor.svg") 4 2, auto;
  }
  html.is-web button,
  html.is-web a,
  html.is-web select,
  html.is-web .casilla,
  html.is-web .icon-btn,
  html.is-web .mode-card,
  html.is-web .chip,
  html.is-web .size-pick,
  html.is-web .time-pick,
  html.is-web .lang-menu button,
  html.is-web .sheet-x {
    cursor: url("img/cursor-pointer.svg") 8 2, pointer;
  }
}

@media (min-width: 900px) {
  html.is-web .app-shell {
    min-height: 100dvh;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  html.is-web #screen-home {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
    padding: 0.35rem 1rem 1.1rem;
    align-items: center;
  }
  html.is-web .home-top {
    width: 100%;
    max-width: 520px;
  }
  html.is-web .hero {
    padding: 0.05rem 0 0.45rem;
  }
  html.is-web .crest {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 10px 16px rgba(0,0,0,0.55));
  }
  html.is-web #logo,
  html.is-web .hero h1 {
    font-size: clamp(2.5rem, 4.4vw, 3.15rem);
    text-shadow: 0 2px 0 #0a120c, 0 12px 28px rgba(0,0,0,0.5);
  }
  html.is-web .mode-grid {
    width: min(340px, 100%);
    gap: 0.5rem;
    flex: 0 0 auto;
    margin: 0 auto;
  }
  html.is-web .mode-card {
    min-height: 78px;
    padding: 0.45rem 0.4rem 0.4rem;
    border-radius: 14px;
    border: 0;
    box-shadow:
      inset 0 1px 0 rgba(255, 230, 160, 0.28),
      inset 0 -10px 18px rgba(0, 0, 0, 0.38),
      0 10px 18px rgba(0, 0, 0, 0.42),
      0 2px 0 #08140c;
  }
  html.is-web .mode-name { font-size: 0.95rem; }
  html.is-web .mode-sub { font-size: 0.7rem; }
  html.is-web .mode-ico { font-size: 1.2rem; }
  html.is-web .mode-ico img { width: 1.45rem; height: 1.45rem; }
  html.is-web .mode-card.gold .mode-ico {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.85rem;
  }
  html.is-web .how-banner {
    width: min(460px, 100%);
    min-height: 38px;
    margin-top: 0.7rem;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    border: 0;
    box-shadow:
      inset 0 1px 0 rgba(255, 230, 160, 0.32),
      inset 0 -8px 14px rgba(0, 0, 0, 0.4),
      0 10px 18px rgba(0, 0, 0, 0.4);
  }
  html.is-web .how-banner .mode-name { font-size: 0.9rem; }
  html.is-web .home-foot { margin-top: 0.55rem; font-size: 0.72rem; }

  html.is-web #screen-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100dvh;
    padding: 0.45rem 0.8rem 0.5rem;
  }
  html.is-web .hud,
  html.is-web .play-bar,
  html.is-web #mensaje,
  html.is-web #resultado {
    width: min(640px, 100%);
  }
  html.is-web .board-stage {
    width: 100%;
    place-items: center;
  }
  html.is-web .board-stack { gap: 0.55rem; }
  html.is-web #tablero-container {
    box-shadow:
      0 0 0 1px #c9a24a,
      0 18px 36px rgba(0, 0, 0, 0.55),
      inset 0 1px 0 rgba(255, 230, 160, 0.4);
  }
  html.is-web .size-row {
    flex-direction: row;
    justify-content: center;
    gap: 0.4rem;
  }
  html.is-web .size-row .chip {
    width: auto;
    min-height: 34px;
  }
}

@media (hover: hover) and (pointer: fine) {
  html.is-web .mode-card:hover {
    transform: translateY(-3px);
    filter: none;
    box-shadow:
      inset 0 1px 0 rgba(255, 230, 160, 0.38),
      inset 0 -10px 18px rgba(0, 0, 0, 0.32),
      0 16px 26px rgba(0, 0, 0, 0.5),
      0 3px 0 #08140c;
  }
}

.play-brand {
  display: none;
}

/* On web, show the title/logo bar also in the play screen. */
html.is-web #screen-play .play-brand {
  display: grid !important;
  grid-template-columns: 88px 1fr 88px;
  align-items: center;
  width: 100%;
  min-height: 96px;
  padding: 0.15rem 0.2rem 0.1rem;
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}
html.is-web #screen-play .play-brand .lang-wrap {
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
  justify-self: start;
}
html.is-web #screen-play .play-audio {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  z-index: 2;
}
html.is-web #screen-play .hero-compact {
  grid-column: 2;
  grid-row: 1;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border: 0;
  background: transparent;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  margin: 0;
}
html.is-web #screen-play .play-logo {
  display: block;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-family: Rubik, Inter, sans-serif;
  font-weight: 700;
  color: var(--cream);
  text-shadow: 0 2px 0 #0a120c, 0 8px 18px rgba(0,0,0,0.4);
  line-height: 1.05;
  font-size: clamp(2rem, 6.5vw, 2.55rem);
  letter-spacing: 0.06em;
}
html.is-web #screen-play .crest-compact {
  display: block;
  width: 78px;
  height: 78px;
  margin: 0;
  overflow: visible;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
}
html.is-web .play-credit {
  display: block;
}

.pc-mode-grid {
  display: none;
}
.pc-how-banner {
  display: none;
}

body.web-pc #screen-home {
  display: none !important;
}
body.web-pc #screen-play {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.08rem;
  height: 100dvh;
  padding: 0.12rem 0.8rem 0.28rem;
  max-width: 1100px;
  margin: 0 auto;
  overflow: hidden;
}
body.web-pc #screen-play .play-brand,
body.web-pc #screen-play .board-stage,
body.web-pc #screen-play .play-bar,
body.web-pc #screen-play #mensaje,
body.web-pc #screen-play #resultado {
  width: min(980px, 100%);
}
body.web-pc .play-brand {
  display: grid !important;
  grid-template-columns: 88px 1fr 88px;
  align-items: center;
  flex-shrink: 0;
  min-height: 88px;
  padding: 0.08rem 0.1rem 0.08rem;
}
body.web-pc .play-brand .lang-wrap {
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
  justify-self: start;
}
body.web-pc .play-audio {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  z-index: 2;
}
body.web-pc .hero-compact {
  grid-column: 2;
  grid-row: 1;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.06rem;
  padding: 0.05rem 0.4rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
  margin: 0;
}
body.web-pc .crest-compact {
  display: block;
  width: 78px;
  height: 78px;
  margin: 0;
  overflow: visible;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
}
body.web-pc .play-logo {
  display: block;
  font-family: Rubik, Inter, sans-serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 4vw, 2.55rem);
  letter-spacing: 0.06em;
  color: var(--cream);
  text-shadow: 0 2px 0 #0a120c, 0 8px 18px rgba(0,0,0,0.4);
  line-height: 1.05;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
}
body.web-pc #btn-home {
  display: none;
}
body.web-pc .hud {
  display: none;
}
body.web-pc #mensaje,
body.web-pc #resultado {
  text-align: center;
  min-height: 0;
  flex-shrink: 0;
}
body.web-pc .board-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}
body.web-pc .board-stack {
  gap: 0.28rem;
  max-width: 100%;
  align-items: center;
}
body.web-pc #size-row {
  display: flex !important;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.1rem;
  margin-bottom: 0;
  flex-shrink: 0;
}
body.web-pc #size-row .chip {
  min-height: 44px;
  padding: 0 1.05rem;
  font-size: 0.98rem;
  font-weight: 800;
}
body.web-pc .play-toolbar {
  gap: 0.45rem;
  margin-bottom: 0.08rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
  justify-content: center;
}
body.web-pc .play-toolbar button,
body.web-pc .play-toolbar #cronometro,
body.web-pc .play-toolbar #contador {
  min-height: 44px;
  border-radius: 999px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.web-pc .play-toolbar button {
  padding: 0 1.15rem;
  font-size: 0.95rem;
}
body.web-pc .play-toolbar #cronometro {
  font-size: 1.12rem;
  padding: 0 1rem;
  min-width: 5.4rem;
}
body.web-pc .play-toolbar #contador {
  font-size: 1.02rem;
  padding: 0 1rem;
  min-width: 4.6rem;
}
body.web-pc #tablero-container {
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px #c9a24a,
    0 22px 44px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 230, 160, 0.42);
}
body.web-pc #play-bar {
  display: grid !important;
  gap: 0.4rem;
  padding-top: 0.18rem;
  padding-bottom: 0.08rem;
  flex-shrink: 0;
}
body.web-pc .pc-mode-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
body.web-pc .pc-mode-btn {
  min-height: 92px;
  padding: 0.58rem 0.4rem 0.5rem;
  border-radius: 16px;
  border: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 160, 0.3),
    inset 0 -8px 14px rgba(0, 0, 0, 0.36),
    0 10px 18px rgba(0, 0, 0, 0.42);
}
body.web-pc .pc-mode-btn .mode-name { font-size: 1.12rem; }
body.web-pc .pc-mode-btn .mode-sub { font-size: 0.8rem; }
body.web-pc .pc-mode-btn .mode-ico { font-size: 1.25rem; }
body.web-pc .pc-mode-btn .mode-ico-timed {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f3e6c2;
}
body.web-pc .pc-mode-btn .mode-ico-timed svg {
  display: block;
}
body.web-pc .pc-how-banner {
  display: flex !important;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(160deg, #6a4e1c 0%, #2a1e0c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 160, 0.32),
    inset 0 -8px 14px rgba(0, 0, 0, 0.4),
    0 10px 18px rgba(0, 0, 0, 0.4);
}
body.web-pc .pc-how-banner .mode-name {
  font-size: 1.02rem;
  color: var(--gold);
  width: 100%;
  text-align: center;
}
body.web-pc .play-credit {
  display: block !important;
  margin-top: 0.05rem;
  font-size: 0.76rem;
}

@media (max-width: 899px) {
  body.web-pc #screen-play {
    padding: 0.2rem 0.4rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
  }
  body.web-pc .crest-compact {
    width: 56px;
    height: 56px;
  }
  body.web-pc .play-logo {
    font-size: clamp(1.55rem, 6vw, 2rem);
  }
  body.web-pc .pc-mode-btn {
    min-height: 78px;
    padding: 0.45rem 0.25rem 0.4rem;
  }
  body.web-pc .pc-mode-btn .mode-name { font-size: 0.95rem; }
  body.web-pc .pc-mode-btn .mode-sub { font-size: 0.68rem; }
  body.web-pc #size-row .chip {
    min-height: 40px;
    padding: 0 0.85rem;
    font-size: 0.9rem;
  }
}
