/* ============================================================
   VICTORY SOLMERA - game.css
   The gameplay screen: scoreboard HUD, the picross board with
   pinned clue gutters, the tool switch, boosters and pause.
   ============================================================ */

.screen--game {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------------- Scoreboard HUD ---------------- */

.hud {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + var(--safe-t)) 10px 12px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  box-shadow: var(--sh-2);
  z-index: 6;
}

.hud__btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
  color: #fff;
  flex: 0 0 auto;
}
.hud__btn:active { background: rgba(255,255,255,.2); }
.hud__btn svg { width: 20px; height: 20px; }

.hud__mid { flex: 1; min-width: 0; text-align: center; }
.hud__clock {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 1.5px;
  color: var(--aqua);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(22, 217, 198, .4);
}
.hud__clock.low { color: #FF8A78; text-shadow: 0 0 18px rgba(255,107,90,.45); animation: clockPulse 1s ease-in-out infinite; }
@keyframes clockPulse { 50% { opacity: .55; } }
.hud__where {
  font-size: 11px;
  color: #9FC2DE;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.hud__right { flex: 0 0 auto; text-align: right; min-width: 62px; }
.hud__lives { display: flex; gap: 3px; justify-content: flex-end; }
.life svg { width: 16px; height: 16px; }
.life.on svg  { color: var(--aqua); }
.life.off svg { color: rgba(255,255,255,.22); }
.life--shield svg { color: var(--amber); }
.hud__free {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 800; color: var(--mint);
}
.hud__free svg { width: 13px; height: 13px; }
.hud__size {
  font-size: 10.5px;
  color: #7FA6C8;
  font-weight: 700;
  letter-spacing: .6px;
  margin-top: 3px;
}

.hud__prog {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.12);
}
.hud__prog i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--aqua));
  transition: width .25s ease;
}

/* ---------------- Board zone ---------------- */

.boardzone {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 5px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  background:
    radial-gradient(circle at 50% 0%, rgba(22,217,198,.09), transparent 62%),
    var(--bg);
}
.boardzone.shake { animation: zoneShake .3s ease; }
@keyframes zoneShake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
#device.noanim .boardzone.shake { animation: none; }

/* The board is one grid: corner, column clues, row clues, cells. */
.board {
  --cell: 24px;
  --clue: 17px;
  --cfs: 11px;
  display: grid;
  grid-template-columns: calc(var(--gc) * var(--clue) + 4px) auto;
  grid-template-rows: calc(var(--gr) * var(--clue) + 4px) auto;
  margin: auto;
  position: relative;
}

.board__corner {
  position: sticky;
  top: 0; left: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: var(--bg);
  border-radius: 8px 0 0 0;
}
/* A neutral grid glyph, never the answer: the corner must not spoil the board. */
.board__mini { width: 18px; height: 18px; color: var(--ink-4); opacity: .5; }

/* Column clues: pinned to the top while the board scrolls. */
.board__ctop {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(var(--cw), var(--cell));
  background: var(--bg);
  padding-bottom: 3px;
}
.clue--col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0;
  line-height: 1.12;
  padding-bottom: 2px;
  border-radius: 4px 4px 0 0;
}
.clue--col.blk { box-shadow: inset 1px 0 0 var(--grid-blk); }

/* Row clues: pinned to the left. */
.board__cleft {
  position: sticky;
  left: 0;
  z-index: 3;
  display: grid;
  grid-template-rows: repeat(var(--ch), var(--cell));
  background: var(--bg);
  padding-right: 3px;
}
.clue--row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1px;
  padding-right: 3px;
  border-radius: 4px 0 0 4px;
}
.clue--row.blk { box-shadow: inset 0 1px 0 var(--grid-blk); }

.clue b {
  display: inline-block;
  min-width: calc(var(--clue) - 2px);
  text-align: center;
  font-size: var(--cfs);
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.clue b.z { color: var(--ink-4); }
.clue.done b { color: var(--ink-4); text-decoration: line-through; }
.clue.done { background: rgba(22, 217, 198, .10); }

#device.bigclue .board { --cfs: calc(var(--cell) * .58); }

/* The playable grid. */
.board__grid {
  display: grid;
  grid-template-columns: repeat(var(--cw), var(--cell));
  grid-template-rows: repeat(var(--ch), var(--cell));
  background: var(--grid-line);
  border: 2px solid var(--navy);
  border-radius: 4px;
  gap: 1px;
  padding: 1px;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}

.board__grid i {
  position: relative;
  background: var(--cell-blank);
  display: block;
}
/* Alternating 5x5 blocks, like the chalked squares on a pitch. */
.board__grid i.bx { box-shadow: inset 2px 0 0 -1px var(--grid-blk); }
.board__grid i.by { box-shadow: inset 0 2px 0 -1px var(--grid-blk); }
.board__grid i.bx.by { box-shadow: inset 2px 0 0 -1px var(--grid-blk), inset 0 2px 0 -1px var(--grid-blk); }

.c--fill {
  background: var(--cell-fill) !important;
  box-shadow: none !important;
}
.c--fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(255,255,255,.16), transparent 60%);
}

.c--mark::after, .c--auto::after, .c--miss::after {
  content: "";
  position: absolute;
  inset: 26%;
  background:
    linear-gradient(45deg, transparent 43%, currentColor 43%, currentColor 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, currentColor 43%, currentColor 57%, transparent 57%);
}
.c--mark { color: var(--cell-mark); }
.c--auto { color: var(--ink-4); background: var(--cell-alt); }
.c--miss { color: var(--cell-miss); background: var(--coral-l); }

.c--flash { animation: cellFlash .42s ease; }
@keyframes cellFlash {
  0%   { background: var(--coral); }
  100% { background: var(--coral-l); }
}
.c--pulse { animation: cellPulse .38s ease; }
@keyframes cellPulse {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(1.9); }
  100% { filter: brightness(1); }
}
#device.noanim .c--flash, #device.noanim .c--pulse { animation: none; }

.board--picking .board__grid { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------------- Pick bar ---------------- */

.pickbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px 6px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--amber-l);
  border: 1px solid #F5DCAE;
  color: #8A5600;
  font-size: 12.8px;
  font-weight: 700;
}
.pickbar svg { width: 17px; height: 17px; flex: 0 0 auto; }
.pickbar span { flex: 1; }
.pickbar__x { width: 26px; height: 26px; display: grid; place-items: center; color: #8A5600; }

/* ---------------- Tools ---------------- */

.tools {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px 8px;
}
#device.lefty .tools { flex-direction: row-reverse; }

.toolsw {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--r-md);
}
.toolsw--single { grid-template-columns: 1fr; }
.toolsw__b {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-3);
  transition: background .16s ease, color .16s ease;
}
.toolsw__b svg { width: 19px; height: 19px; }
.toolsw__b.is-on {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--sh-1);
}
.toolsw__b.is-on svg { color: var(--aqua); }

.tools__zoom {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  flex: 0 0 auto;
}
.tools__z {
  width: 40px; height: 42px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--ink-2);
}
.tools__z:active { background: var(--surface); }
.tools__z svg { width: 19px; height: 19px; }

/* ---------------- Boosters ---------------- */

.boosters {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 0 10px calc(10px + var(--safe-b));
}
.bst {
  flex: 1;
  position: relative;
  min-height: 56px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 6px 2px 4px;
  color: var(--teal-d);
}
.bst svg { width: 20px; height: 20px; }
.bst__n {
  position: absolute;
  top: 3px; right: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.bst__t {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .2px;
  line-height: 1;
}
.bst:active { background: var(--teal-l); }
.bst--empty { opacity: .55; }
.bst--empty .bst__n { background: var(--ink-4); }

.boosters--off {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  margin: 0 10px calc(10px + var(--safe-b));
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 700;
  padding: 0;
}
.boosters--off svg { width: 17px; height: 17px; }

/* ---------------- Pause ---------------- */

.pause-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
}
.pause-layer.show { display: block; }

.pause {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 56, .72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  animation: fadeIn .18s ease both;
}
.pause__card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: var(--sh-3);
  animation: sheetIn .26s cubic-bezier(.2,.9,.3,1.2) both;
  max-height: 92%;
  overflow-y: auto;
}
.pause__mark {
  width: 58px; height: 58px;
  margin: 0 auto 10px;
  border-radius: 19px;
  display: grid; place-items: center;
  background: var(--navy-l);
  color: var(--navy-3);
}
.pause__mark svg { width: 28px; height: 28px; }
.pause__card h2 { font-size: 19px; font-weight: 800; }
.pause__card p { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 0; }
.pause__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.pause__stats .stat { padding: 8px 3px; }
.pause__stats .stat__v { font-size: 14px; }
.pause__stats .stat__l { font-size: 9.5px; }
