/* Futoshiki — Playnesta original (MIT). Grid, signs, pad, buttons. */
:root {
  --pn-vh: 1vh;
  --cell: 48px;
  --gap: 20px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  background: radial-gradient(circle at 50% 8%, #322a4d, #1b1626 76%);
  color: #f3effb;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: calc(var(--pn-vh, 1vh) * 100);
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  gap: 8px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.brand small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
  margin-left: 6px;
  text-transform: lowercase;
}
.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hud {
  font-size: 13px;
  opacity: 0.95;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
}
.hud b {
  color: #ffd166;
}
.levels {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid #6f5ba8;
  background: #34285c;
  color: #f3effb;
  cursor: pointer;
}
.btn.primary {
  background: #ffd166;
  color: #3a2c05;
  border-color: #ffe7a8;
}
.btn.on {
  background: #6f5ba8;
  border-color: #b9a8e8;
}
.btn:active {
  transform: scale(0.97);
}
.btn.lvl {
  font-size: 13px;
  padding: 8px 10px;
}
.boardwrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board {
  display: grid;
  gap: 0;
  background: #251d3d;
  border: 1px solid #4a3b78;
  border-radius: 14px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 10px 30px rgba(0, 0, 0, 0.35);
}
.cell {
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.52);
  font-weight: 700;
  background: #170f2b;
  border: 1px solid #4a3b78;
  color: #fdf7e3;
  cursor: pointer;
  touch-action: manipulation;
}
.cell.given {
  background: #3a2f5e;
  color: #b9a8e8;
  cursor: default;
}
.cell.user {
  color: #9fe870;
}
.cell.bad {
  background: #5c1f24;
  border-color: #d95560;
  color: #ffb3b8;
}
.cell.sel {
  outline: 3px solid #ffd166;
  outline-offset: -3px;
  z-index: 2;
}
.sign {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.44);
  font-weight: 800;
  color: #ffd166;
  background: transparent;
}
.sign.empty {
  visibility: hidden;
}
.pad {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.pad .btn {
  width: 48px;
  padding: 8px 0;
  font-size: 18px;
}
.pad .btn.erase {
  width: 88px;
  font-size: 15px;
}
.msg {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  min-height: 22px;
}
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 22, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.overlay.hidden {
  display: none;
}
.panel {
  background: #201737;
  border: 1px solid #6f5ba8;
  border-radius: 16px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}
.panel p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.5;
}
.panel-wide {
  max-width: 520px;
}
.rules-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
}
.rules-list li {
  margin-bottom: 8px;
}
.rules-list b {
  color: #ffd166;
}
@media (max-width: 420px) {
  :root {
    --cell: 38px;
    --gap: 16px;
  }
}
@media (max-height: 640px) {
  :root {
    --cell: 36px;
  }
  .levels .btn.lvl {
    padding: 6px 8px;
    font-size: 12px;
  }
  .pad .btn {
    width: 42px;
  }
}
