@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/nunito-latin-800-normal.woff2") format("woff2");
}
@font-face {
  font-family: Fredoka;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/fredoka-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: Sora;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/sora-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: Sora;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sora-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  --floor: #124da5;
  --tile: #0b3a82;
  --panel: #0c3a8a;
  --play: #53e237;
  --play-hover: #38c41c;
  --play-active: #30aa19;
  --second: #2c8de7;
  --you: #ffe566;
  --text: #fff;
  --muted: #c5d8f5;
  --shadow: 3px 3px 0 rgba(0, 0, 0, 0.25);
  --ink: #111;
  --card: #fff6e8;
  --focus: 3px solid #fff;
}

::selection {
  background: #ffe566;
  color: #1a1020;
}

input,
textarea {
  caret-color: #124da5;
}

html {
  scrollbar-color: #2c8de7 #0b3a82;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: Sora, "Segoe UI", sans-serif;
  font-weight: 600;
}

html:has(body.board-page),
body.board-page {
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* —— door / lobby: measured skribbl home —— */
.door {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background-color: #124da5;
  color: #f0f0f0;
  font-family: Nunito, sans-serif;
  font-weight: 800;
}

.floor {
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  background-color: #124da5;
  background-image: url("/img/tile.gif?v=thin-3");
  background-size: 300px 300px;
  background-repeat: repeat;
  image-rendering: auto;
}

.stack {
  width: min(560px, 96vw);
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4vh, 14px);
}

.wordmark {
  margin: 0;
  line-height: 0;
  background: #124da5;
  padding: 6px 14px;
  border-radius: 4px;
}

.logo-gif {
  display: block;
  width: min(720px, 92vw, 34vh);
  height: auto;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.25));
}

.tiny-faces {
  display: flex;
  gap: 10px;
  margin-top: 2px;
  background: #fff6e8;
  padding: 8px 12px;
  border: 3px solid #111;
  border-radius: 8px 3px 9px 4px;
  box-shadow: 3px 3px 0 #111;
}

.tiny-faces img {
  width: 52px;
  height: 52px;
  image-rendering: auto;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.25));
}

.booth {
  width: min(520px, 96vw);
  max-width: 100%;
  background:
    repeating-linear-gradient(
      transparent,
      transparent 27px,
      rgba(18, 77, 165, 0.07) 27px,
      rgba(18, 77, 165, 0.07) 28px
    ),
    #fff6e8;
  color: #1a1020;
  border: 3px solid #111;
  border-radius: 8px 3px 10px 5px;
  padding: 16px;
  box-shadow: 4px 4px 0 #111;
  transform: rotate(-0.3deg);
}

.door-form {
  display: grid;
  gap: 10px;
}

.namelang {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
}

.namelang input[type="text"],
.namelang select {
  height: 48px;
  flex-shrink: 0;
  border: 3px solid #111;
  color: #1a1020;
  background: #fffdf6;
  box-shadow: 3px 3px 0 #111;
}

.namelang input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 8px 3px 10px 5px;
  padding: 0 12px;
  font: 800 16px Nunito, sans-serif;
}

.namelang select {
  flex: 0 0 132px;
  width: 132px;
  border-radius: 8px 3px 9px 4px;
  padding: 0 8px;
  font: 800 14px Nunito, sans-serif;
}

.namelang input:focus,
.namelang select:focus {
  border-color: #111;
  outline: 3px solid #56b2fd;
  outline-offset: 1px;
}

.namelang input::placeholder {
  color: #8a6a3a;
  opacity: 1;
}

.door-err {
  margin: 0;
  min-height: 1.1em;
  color: #8a1a1a;
  font: 800 14px Nunito, sans-serif;
  text-align: center;
}

.namelang input.shake {
  animation: shake 120ms linear;
}

@keyframes shake {
  0%,
  100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.well {
  position: relative;
  display: grid;
  grid-template-columns: 56px 168px 56px;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  background: #fffdf8;
  border: 2.5px solid #111;
  border-radius: 6px 3px 7px 4px;
  box-shadow: 2px 2px 0 #111;
}

.hit {
  width: 56px;
  height: 56px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 80ms linear, filter 80ms linear;
}

.hit img {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.28));
}

.hit-left:hover { transform: translateX(-4px) scale(1.08); }
.hit-right:hover { transform: translateX(4px) scale(1.08); }
.hit-left:active { transform: translateX(-1px) scale(0.94); }
.hit-right:active { transform: translateX(1px) scale(0.94); }

.face-hit {
  width: 168px;
  height: 168px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.25));
}

.face-hit img {
  width: 168px;
  height: 168px;
  image-rendering: auto;
  display: block;
}

.face-hit.pop {
  animation: face-pop 125ms ease;
}

@keyframes face-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.shuffle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 2.5px solid #111;
  border-radius: 6px 3px 7px 4px;
  padding: 0;
  background: #fffdf8;
  box-shadow: 2px 2px 0 #111;
  cursor: pointer;
  transition: transform 80ms linear;
}

.shuffle img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.28));
}

.shuffle:hover {
  transform: rotate(-20deg) scale(1.15);
}

.shuffle:active {
  transform: rotate(20deg) scale(0.95);
}

.play {
  width: 100%;
  height: 58px;
  border: 3px solid #111;
  border-radius: 8px 3px 9px 4px;
  background: #53e237;
  color: #fff;
  font-family: Nunito, sans-serif;
  font-weight: 800;
  font-size: 2em;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
  text-shadow: 2px 2px 0 #0000002b;
  box-shadow: 3px 3px 0 #111;
  transition: background-color 80ms linear;
}

.play:hover:not(:disabled) {
  background: #38c41c;
}

.play:active:not(:disabled) {
  background: #30aa19;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #111;
  padding-top: 2px;
}

.play:disabled {
  background: #bdbdbd;
  color: #3d3d3d;
  text-shadow: none;
  cursor: not-allowed;
}

.play.is-wait {
  background: #38c41c;
  color: #fff;
  cursor: wait;
}

.board-btn {
  display: grid;
  place-items: center;
  width: 100%;
  height: 48px;
  border: 3px solid #111;
  border-radius: 8px 3px 9px 4px;
  background: #2c8de7;
  color: #fff;
  font-family: Nunito, sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  text-shadow: 2px 2px 0 #0000002b;
  box-shadow: 3px 3px 0 #111;
  transition: background-color 80ms linear;
}

.board-btn:hover {
  background: #1f7ad0;
}

.board-btn:active {
  background: #1a6bb8;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 #111;
  padding-top: 2px;
}

/* —— play / board (shared sheet; grape, not cream) —— */
.table,
.room,
.room-board {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.room,
.room-board {
  width: min(640px, calc(100% - 28px));
}

body:not(.door) {
  background-color: var(--floor);
  background-image: url("/img/tile.gif?v=thin-3");
  background-size: 300px 300px;
  image-rendering: auto;
}

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.logo,
.logo-sm,
.board-title {
  font-family: Fredoka, sans-serif;
  font-weight: 700;
  color: var(--play);
  text-decoration: none;
  filter: drop-shadow(var(--shadow));
}

.logo-sm {
  font-size: 1.5rem;
}

.board-title {
  font-size: clamp(2rem, 7vw, 3rem);
}

.you-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--you);
  color: var(--ink);
  border-radius: 3px;
  padding: 6px 12px 6px 6px;
  filter: drop-shadow(var(--shadow));
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.round-pip {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--second);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 600;
  filter: drop-shadow(var(--shadow));
}

.topic,
.hint {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}

.cut-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: min(62vh, 640px);
  isolation: isolate;
}

.col {
  appearance: none;
  border: 0;
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  padding: 16px 18px 22px;
  font: inherit;
  cursor: pointer;
  overflow-wrap: anywhere;
  min-width: 0;
  filter: drop-shadow(var(--shadow));
}

.col-kicker {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--play);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  margin-bottom: 10px;
}

.col-body {
  font-size: clamp(0.98rem, 1.5vw, 1.12rem);
  line-height: 1.4;
}

.cut {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  background: var(--play);
  will-change: left, width, top, height;
}

.empty {
  background: var(--panel);
  border-radius: 3px;
  padding: 22px;
  margin-top: 18px;
}

.play-sm {
  display: inline-block;
  text-decoration: none;
  font-family: Fredoka, sans-serif;
  background: var(--play);
  color: #143300;
  border-radius: 3px;
  padding: 8px 16px;
  filter: drop-shadow(var(--shadow));
}

.board-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.board-list li {
  display: grid;
  grid-template-columns: 2.2rem 44px 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border-radius: 3px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.board-list li.you {
  background: var(--you);
  color: var(--ink);
}

.board-link {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  background: var(--second);
  color: var(--ink);
  border-radius: 3px;
  padding: 6px 12px;
  text-decoration: none;
  filter: drop-shadow(var(--shadow));
}

@media (max-width: 720px) {
  .cut-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .namelang input[type="text"],
  .namelang select {
    height: 46px;
  }

  .namelang input[type="text"] {
    font-size: 14px;
    padding: 0 10px;
  }

  .namelang select {
    flex-basis: 108px;
    width: 108px;
    font-size: 13px;
  }

  .door .logo-gif {
    width: min(92vw, 28vh, 420px);
  }

  .tiny-faces {
    gap: 6px;
    padding: 6px 8px;
  }

  .tiny-faces img {
    width: 36px;
    height: 36px;
  }

  .booth {
    width: min(520px, 96vw);
    padding: 12px;
  }

  .well {
    grid-template-columns: 44px 112px 44px;
    gap: 8px;
    padding: 10px 8px;
  }

  .face-hit,
  .face-hit img {
    width: 112px;
    height: 112px;
  }

  .hit,
  .hit img {
    width: 44px;
    height: 44px;
  }

  .play {
    height: 52px;
    font-size: 1.7em;
  }
}

@media (max-height: 700px) {
  .tiny-faces {
    display: none;
  }

  .door .logo-gif {
    width: min(88vw, 22vh, 360px);
  }

  .well {
    grid-template-columns: 40px 96px 40px;
    padding: 8px 6px;
  }

  .face-hit,
  .face-hit img {
    width: 96px;
    height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floor {
    animation: none;
  }

  .face-hit.pop,
  .namelang input.shake {
    animation: none;
  }
}
