/* Sudokuroom — puzzroom's landing language: dark table, one mint accent,
   pills for controls, 20px containers, 12px tiles. Player colours are state,
   never decoration. No emoji, no glow. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-400-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-400-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JBMono";
  src: url("/fonts/jetbrains-mono-500-latin-ext.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JBMono";
  src: url("/fonts/jetbrains-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #111311;
  --surface: #181b18;
  --table: #1d211d;
  --slot: #262b26;
  --ink: #eef1ec;
  --ink-2: #9ba49d;
  --ink-3: #6c756e;
  --line: #2a302b;
  --line-2: #3a423b;
  --mint: #2fd49c;
  --mint-ink: #03140d;
  --mint-soft: rgba(47, 212, 156, 0.14);
  --danger: #ff6b5e;
  --danger-soft: rgba(255, 107, 94, 0.16);
  --f-display: "Bricolage", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Bricolage", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JBMono", ui-monospace, Consolas, monospace;
  --r-box: 20px;
  --r-tile: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
@media (hover: none) and (pointer: coarse) {
  body {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  input {
    -webkit-user-select: text;
    user-select: text;
  }
}
h1,
h2,
h3 {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  text-wrap: balance;
  margin: 0;
}
p {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input {
  font: inherit;
  color: inherit;
}
::selection {
  background: var(--mint);
  color: var(--mint-ink);
}
:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 0;
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background-color 0.2s, box-shadow 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn-mint {
  background: var(--mint);
  color: var(--mint-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-mint:hover {
  background: #4ee0ae;
}
.btn-glass {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
}
.btn-sm {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.field {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--table);
  font-size: 17px;
  outline: none;
  transition: border-color 0.2s;
}
.field:focus {
  border-color: var(--mint);
}
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.mono {
  font-family: var(--f-mono);
  letter-spacing: 0.02em;
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: var(--table);
  border: 1px solid var(--line);
}
.seg button {
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.seg button[aria-pressed="true"] {
  background: var(--slot);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

/* ------------------------------------------------------------- toast */
.toasts {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s var(--ease);
  white-space: nowrap;
}
.toast.bad {
  background: var(--danger);
  color: #1a0502;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ========================================================== LANDING */
.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px max(20px, env(safe-area-inset-left));
  max-width: 1180px;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.04em;
}
.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.brand-mark i {
  border-radius: 2px;
  background: var(--slot);
}
.brand-mark i:nth-child(1),
.brand-mark i:nth-child(5),
.brand-mark i:nth-child(9) {
  background: var(--mint);
}

.lp-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px max(20px, env(safe-area-inset-left)) 64px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
.lp-hero h1 {
  font-size: clamp(44px, 6.4vw, 84px);
  line-height: 0.95;
  margin: 18px 0 20px;
}
.lp-hero h1 em {
  font-style: normal;
  color: var(--mint);
}
.lp-lede {
  font-size: 19px;
  color: var(--ink-2);
  max-width: 34ch;
}
.lp-card {
  margin-top: 34px;
  padding: 22px;
  border-radius: var(--r-box);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  max-width: 520px;
}
.lp-join {
  display: flex;
  gap: 8px;
}
.lp-join .field {
  text-transform: uppercase;
  font-family: var(--f-mono);
  letter-spacing: 0.2em;
}
.lp-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: 13px;
}
.lp-or::before,
.lp-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* hero demo board */
.demo {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 520px;
  justify-self: end;
  padding: 14px;
  border-radius: 28px;
  background: radial-gradient(120% 90% at 20% 0%, rgba(47, 212, 156, 0.16), transparent 60%), var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.demo .grid {
  pointer-events: none;
}

.lp-feats {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-left)) 80px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.feat {
  padding: 24px;
  border-radius: var(--r-box);
  background: var(--surface);
  border: 1px solid var(--line);
}
.feat h3 {
  font-size: 22px;
  margin: 10px 0 8px;
}
.feat p {
  color: var(--ink-2);
  font-size: 15px;
}
.recent {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-left)) 80px;
}
.recent h2 {
  font-size: 28px;
  margin-bottom: 14px;
}
.recent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}
.recent-item:hover {
  border-color: var(--mint);
}
.recent-item small {
  color: var(--ink-2);
}
footer.lp-foot {
  border-top: 1px solid var(--line);
  padding: 24px max(20px, env(safe-area-inset-left));
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}

@media (max-width: 900px) {
  .lp-hero {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .demo {
    justify-self: center;
    max-width: 420px;
  }
  .lp-feats {
    grid-template-columns: 1fr;
  }
}

/* ============================================================ GRID */
.grid {
  --cell: calc(100% / 9);
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--table);
  border: 2px solid var(--line-2);
  container-type: inline-size;
}
.cell {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--f-display);
  font-size: 6.2cqw;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.cell:nth-child(9n) {
  border-right: 0;
}
.cell:nth-child(n + 73) {
  border-bottom: 0;
}
.cell.br {
  border-right: 2px solid var(--line-2);
}
.cell.bb {
  border-bottom: 2px solid var(--line-2);
}
.cell.given {
  color: var(--ink);
  font-weight: 700;
}
.cell.filled {
  color: var(--who, var(--mint));
}
.cell.peer {
  background: rgba(255, 255, 255, 0.035);
}
.cell.same {
  background: var(--mint-soft);
}
.cell.sel {
  background: rgba(47, 212, 156, 0.28);
}
.cell.wrong {
  animation: shake 0.42s;
  background: var(--danger-soft);
}
.cell.wrong::after {
  content: attr(data-wrong);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--danger);
  font-weight: 700;
}
.cell.pop {
  animation: pop 0.45s var(--ease);
}
.cell.flash {
  animation: flash 0.9s var(--ease);
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-3px);
  }
  40%,
  80% {
    transform: translateX(3px);
  }
}
@keyframes pop {
  from {
    transform: scale(0.6);
  }
}
@keyframes flash {
  0% {
    background: rgba(47, 212, 156, 0.45);
  }
}
.notes {
  position: absolute;
  inset: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font-family: var(--f-mono);
  font-size: 2.1cqw;
  font-weight: 500;
  color: var(--ink-2);
  line-height: 1;
}
.notes span {
  display: grid;
  place-items: center;
}
.notes span.hl {
  color: var(--mint);
}
/* other players' selection */
.ring {
  position: absolute;
  inset: 1px;
  border: 2px solid var(--c);
  border-radius: 4px;
  pointer-events: none;
}
.ring b {
  position: absolute;
  top: -2px;
  left: -2px;
  transform: translateY(-100%);
  padding: 1px 5px;
  border-radius: 4px 4px 4px 0;
  background: var(--c);
  color: #0b0d0b;
  font: 600 10px/1.3 var(--f-body);
  white-space: nowrap;
  z-index: 3;
}
.cell:nth-child(-n + 9) .ring b {
  top: auto;
  bottom: -2px;
  transform: translateY(100%);
  border-radius: 0 4px 4px 4px;
}
.mine-ring {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px var(--mint);
  pointer-events: none;
}

/* ============================================================ ROOM */
html[data-view="room"],
html[data-view="room"] body {
  overscroll-behavior: none;
}
.room {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.rm-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.rm-top .brand {
  font-size: 17px;
}
.rm-top .grow {
  flex: 1;
}
.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--table);
  border: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  cursor: pointer;
}
.code-chip:hover {
  border-color: var(--mint);
}
.rm-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-left));
  align-items: start;
}
.board-wrap {
  width: min(100%, calc(100dvh - 210px));
  justify-self: center;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat {
  padding: 10px 14px;
  border-radius: var(--r-tile);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat small {
  display: block;
  font-size: 11px;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}
.stat b {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 20px;
}
.stat.bad b {
  color: var(--danger);
}
.progress {
  height: 4px;
  border-radius: 4px;
  background: var(--slot);
  margin-top: 14px;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mint);
  transition: width 0.4s var(--ease);
}
.side {
  display: grid;
  gap: 14px;
}
.panel {
  padding: 16px;
  border-radius: var(--r-box);
  background: var(--surface);
  border: 1px solid var(--line);
}
.panel-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pad button {
  position: relative;
  height: 62px;
  border: 0;
  border-radius: var(--r-tile);
  background: var(--table);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s var(--ease);
}
.pad button:hover {
  background: var(--slot);
}
.pad button:active {
  transform: scale(0.95);
}
.pad button small {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font: 500 10px var(--f-mono);
  color: var(--ink-3);
}
.pad button.done {
  opacity: 0.25;
  pointer-events: none;
}
.pad.noting button {
  font-size: 20px;
  color: var(--ink-2);
}
.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.tools .btn {
  width: 100%;
}
.tools .btn[aria-pressed="true"] {
  background: var(--mint-soft);
  box-shadow: inset 0 0 0 1px var(--mint);
  color: var(--mint);
}
.players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: var(--table);
  font-size: 14px;
}
.player::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}
.player.me {
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.chat-log {
  height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 10px;
  scrollbar-width: thin;
}
.chat-log .msg b {
  color: var(--c);
  font-weight: 650;
}
.chat-log .sys {
  color: var(--ink-3);
  font-size: 13px;
}
.chat-form {
  display: flex;
  gap: 6px;
}
.chat-form .field {
  height: 42px;
  font-size: 15px;
  border-radius: 999px;
}
.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.conn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.conn.on::before {
  background: var(--mint);
}
.hint {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 10px;
}

@media (max-width: 860px) {
  .rm-main {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-top: 14px;
  }
  .board-wrap {
    width: 100%;
    max-width: 560px;
  }
  .side {
    max-width: 560px;
    width: 100%;
    justify-self: center;
  }
  .pad {
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
  }
  .pad button {
    height: 52px;
    font-size: 22px;
  }
  .pad button small {
    right: 3px;
    bottom: 2px;
    font-size: 9px;
  }
  .rm-top .brand-text {
    display: none;
  }
  .side .panel:first-child {
    padding: 10px;
  }
  .hint {
    display: none;
  }
}

/* ============================================================ MODAL */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 5, 0.72);
  backdrop-filter: blur(6px);
  z-index: 50;
  animation: fade 0.3s;
}
.modal[hidden] {
  display: none;
}
.sheet {
  width: min(100%, 440px);
  padding: 26px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  animation: rise 0.45s var(--ease);
}
.sheet h2 {
  font-size: 30px;
}
.sheet p {
  color: var(--ink-2);
}
.sheet .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.big-time {
  font-family: var(--f-mono);
  font-size: 54px;
  color: var(--mint);
  letter-spacing: -0.02em;
  line-height: 1;
}
.score {
  display: grid;
  gap: 6px;
}
.score div {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
}
.score i {
  font-style: normal;
  color: var(--c);
  font-weight: 650;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
