/* Nono Cats — game board, reveal scene, and the interactive cat room. */

/* ---------------- game screen ---------------- */
.game-screen {
  background:
    radial-gradient(80% 60% at 20% 0%, rgba(255, 252, 246, 0.75), rgba(255, 252, 246, 0) 62%),
    var(--cream);
}

#game-overlay-root {
  display: contents;
}

.game-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + clamp(9px, 2vw, 20px))
    calc(var(--safe-bottom) + 7px) calc(var(--safe-left) + clamp(9px, 2vw, 20px));
  gap: 6px;
  overflow: hidden;
  background:
    radial-gradient(80% 55% at 100% 0%, var(--theme-soft, #f1e2d2) 0, rgba(255, 255, 255, 0) 65%),
    linear-gradient(180deg, #faf4ea 0%, #f5ede2 100%);
}

.game-screen.is-error .game-inner {
  animation: game-shake 0.24s ease;
}

.game-topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  position: relative;
  z-index: 4;
}

.game-heading {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.game-heading-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.game-heading .eyebrow {
  font-size: 8.5px;
  color: var(--theme-deep, var(--ink-soft));
  opacity: 0.8;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-heading .size-pill {
  font-size: 8px;
  font-weight: 800;
  color: var(--theme-deep, var(--ink-soft));
  background: rgba(255, 251, 243, 0.68);
  border-radius: 5px;
  padding: 2px 5px;
  flex: none;
}

.game-heading h1 {
  font-family: var(--font-pixel);
  font-size: clamp(19px, 2.1vw, 26px);
  line-height: 1;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-hud {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.hud-pill {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 9px;
  border-radius: 11px;
  background: rgba(255, 251, 243, 0.8);
  border: 1px solid rgba(85, 65, 48, 0.07);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.hud-pill .icon {
  width: 15px;
  height: 15px;
}

.hud-pill.timer .icon {
  color: #8a796c;
}

.hud-hearts {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-radius: 11px;
  background: rgba(255, 251, 243, 0.8);
  border: 1px solid rgba(85, 65, 48, 0.07);
}

.hud-hearts .heart {
  width: 17px;
  height: 17px;
  color: #d68474;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.hud-hearts .heart.lost {
  color: #cbbeb1;
  opacity: 0.55;
  transform: scale(0.82);
}

.hud-relax {
  background: #e8efe3;
  color: #637759;
  border-color: transparent;
}

.game-cluebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  position: relative;
  z-index: 3;
}

.live-clue {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  height: 29px;
  padding: 0 8px;
  border-radius: 9px;
  background: rgba(255, 251, 244, 0.58);
  border: 1px solid transparent;
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 800;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.live-clue.has {
  background: rgba(255, 252, 246, 0.9);
  border-color: rgba(85, 65, 48, 0.07);
  color: var(--ink-soft);
}

.live-clue .lc-label {
  color: var(--theme-deep, var(--ink-faint));
  opacity: 0.62;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 8px;
}

.live-clue .lc-number {
  color: var(--ink);
  font-size: 10.5px;
  min-width: 14px;
}

.live-clue .lc-values {
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 118px;
}

.live-clue .lc-values.done {
  color: var(--sage);
}

.cluebar-spacer {
  flex: 1;
  min-width: 2px;
}

.cluebar-progress {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.cluebar-progress .progress-track {
  width: 44px;
  height: 5px;
}

.game-fish {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 29px;
  padding: 0 8px;
  border-radius: 9px;
  background: rgba(255, 250, 241, 0.65);
  color: #9b7a3d;
  font-size: 10px;
  font-weight: 800;
  flex: none;
}

.game-fish .icon {
  width: 16px;
  height: 16px;
  color: var(--gold);
}

.game-board-area {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 2;
  display: flex;
}

.board-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: clamp(18px, 2.4vw, 28px);
  background:
    radial-gradient(90% 100% at 0 0, rgba(255, 255, 255, 0.65) 0, rgba(255, 255, 255, 0) 60%),
    var(--theme-soft, #f0e2d3);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 1px rgba(105, 79, 57, 0.04), 0 8px 26px rgba(96, 71, 51, 0.06);
  overflow: hidden;
  touch-action: none;
}

.board-canvas-wrap {
  position: absolute;
  inset: 0;
}

.board-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.board-shell.mode-cross .board-canvas { cursor: cell; }
.board-shell.mode-pan .board-canvas { cursor: grab; }
.board-shell.panning .board-canvas { cursor: grabbing; }

.board-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.zoom-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 251, 244, 0.82);
  color: var(--ink-soft);
  border: 1px solid rgba(83, 64, 47, 0.08);
  box-shadow: 0 2px 0 rgba(103, 79, 58, 0.05);
  transition: background-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.zoom-btn:hover {
  background: #fffdf9;
  color: var(--ink);
}

.zoom-btn:active { transform: scale(0.94); }
.zoom-btn .icon { width: 17px; height: 17px; }
.zoom-btn.is-active {
  background: var(--ink);
  color: #fff8e9;
}

.zoom-btn.is-hidden {
  display: none;
}

.board-live-pill {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(255, 251, 244, 0.64);
  color: var(--ink-faint);
  font-size: 8px;
  font-weight: 800;
  pointer-events: none;
}

.board-live-pill .icon { width: 11px; height: 11px; }

/* tutorial guide */
.tutorial-strip {
  flex: none;
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 0;
}

.tutorial-tip {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 5px 4px 10px;
  border-radius: 11px;
  background: rgba(54, 43, 34, 0.92);
  color: #fff8eb;
  box-shadow: 0 5px 14px rgba(58, 41, 27, 0.15);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: auto;
  animation: pop-in 0.25s ease both;
}

.tutorial-tip .tip-icon {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 248, 235, 0.12);
  color: #f4d49f;
}

.tutorial-tip .tip-icon .icon { width: 13px; height: 13px; }

.tutorial-tip .guide-skip {
  width: 25px;
  height: 25px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 248, 235, 0.1);
  color: rgba(255, 248, 235, 0.7);
  margin-left: 2px;
}

.tutorial-tip .guide-skip .icon { width: 11px; height: 11px; }

.tutorial-hand {
  position: absolute;
  z-index: 9;
  width: 64px;
  height: 64px;
  pointer-events: none;
  transform: translate(-50%, -32%);
  animation: hand-bob 1.2s ease-in-out infinite;
  filter: drop-shadow(0 5px 5px rgba(63, 47, 31, 0.3));
  color: #fffaf2;
  transition: left 0.22s ease, top 0.22s ease;
}

.tutorial-hand svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tutorial-hand .tap-ring {
  position: absolute;
  left: 50%;
  top: 53%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 234, 0.8);
  transform: translate(-50%, -50%);
  animation: tap-ring 1.2s ease-out infinite;
}

.tutorial-spotlight {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  border-radius: 9px;
  box-shadow: 0 0 0 2px rgba(246, 209, 148, 0.9), 0 0 0 7px rgba(246, 209, 148, 0.14);
  animation: guide-pulse 1.3s ease-in-out infinite;
}

/* game controls */
.game-controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 1px;
  position: relative;
  z-index: 5;
}

.mode-switch {
  flex: none;
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 251, 244, 0.72);
  border: 1px solid rgba(85, 65, 48, 0.07);
}

.mode-btn {
  min-width: 80px;
  height: 43px;
  padding: 0 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 800;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.13s ease;
}

.mode-btn .icon { width: 17px; height: 17px; }

.mode-btn:hover { color: var(--ink); }

.mode-btn.active {
  color: var(--ink);
  background: #fdf8f0;
  box-shadow: 0 2px 0 rgba(93, 69, 49, 0.08);
}

.mode-btn.active[data-mode="paint"] {
  background: #e3edf0;
  color: #4d6c7c;
}

.mode-btn.active[data-mode="cross"] {
  background: #f6e1d7;
  color: #a45d4b;
}

.mode-btn.guide-pulse {
  animation: guide-pulse 1.3s ease-in-out infinite;
  background: #f6e9d7;
  color: #8c6437;
}

.tool-row {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tool-btn {
  position: relative;
  width: 47px;
  height: 47px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(255, 251, 244, 0.74);
  border: 1px solid rgba(85, 65, 48, 0.07);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.13s ease;
}

.tool-btn:hover {
  color: var(--ink);
  background: rgba(255, 253, 249, 0.94);
}

.tool-btn:active { transform: scale(0.95); }
.tool-btn .icon { width: 20px; height: 20px; }

.tool-btn.hint-btn {
  width: auto;
  min-width: 64px;
  padding: 0 10px;
  display: inline-flex;
  gap: 5px;
  background: #f7edd8;
  color: #96743b;
  border-color: rgba(206, 172, 109, 0.16);
}

.tool-btn.hint-btn .hint-count {
  font-size: 9px;
  font-weight: 800;
  color: #a28144;
}

.tool-btn:disabled {
  opacity: 0.38;
  cursor: default;
  transform: none;
}

.tool-btn .tool-hotkey {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 7px;
  font-weight: 800;
  opacity: 0.4;
}

/* overlay pause / failure / confirm */
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(14px + var(--safe-top)) calc(14px + var(--safe-right))
    calc(14px + var(--safe-bottom)) calc(14px + var(--safe-left));
  background: rgba(62, 48, 36, 0.34);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade-in 0.2s ease both;
}

.overlay-card {
  width: min(390px, 100%);
  max-height: calc(100dvh - 28px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(49, 34, 23, 0.25);
  padding: 22px;
  text-align: center;
  animation: pop-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.overlay-icon {
  width: 58px;
  height: 58px;
  border-radius: 19px;
  margin: 0 auto 11px;
  display: grid;
  place-items: center;
  background: #f2e6d6;
  color: var(--ink);
}

.overlay-icon .icon { width: 28px; height: 28px; }
.overlay-icon.danger { background: #f6e3de; color: var(--danger); }
.overlay-icon.gold { background: var(--gold-soft); color: #9d7b36; }

.overlay-card h2 {
  font-family: var(--font-pixel);
  font-size: 30px;
  line-height: 0.98;
  color: var(--ink);
}

.overlay-card p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 700;
}

.overlay-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 14px 0;
  padding: 11px;
  background: #f7efe4;
  border-radius: 14px;
}

.overlay-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 54px;
}

.overlay-stat b {
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.overlay-stat span {
  color: var(--ink-faint);
  font-size: 8.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 800;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 16px;
}

.overlay-actions.row {
  flex-direction: row;
  flex-wrap: wrap;
}

.overlay-actions.row > * {
  flex: 1;
  min-width: 110px;
}

.overlay-actions .primary-btn,
.overlay-actions .secondary-btn {
  width: 100%;
  min-height: 46px;
}

.pause-fish {
  margin: 10px 0;
  font-size: 10px;
  color: var(--ink-faint);
  font-weight: 800;
}

.pause-sound-row {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 8px 0 2px;
}

.pause-sound-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  background: #f5ebde;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
}

.pause-sound-btn[aria-pressed="true"] {
  opacity: 0.55;
  background: #efe6da;
}

.pause-sound-btn .icon { width: 15px; height: 15px; }

.tool-btn.hint-btn .hint-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 800;
  color: #a28144;
}

.tool-btn.hint-btn .hint-count .icon {
  width: 12px;
  height: 12px;
  color: var(--gold);
}

/* result / reveal */
.result-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(11px + var(--safe-top)) calc(11px + var(--safe-right))
    calc(11px + var(--safe-bottom)) calc(11px + var(--safe-left));
  background:
    radial-gradient(80% 70% at 30% 10%, rgba(255, 251, 244, 0.8) 0, rgba(255, 251, 244, 0) 60%),
    linear-gradient(150deg, var(--theme-soft, #f0e4d4) 0%, #e9dccb 100%);
  animation: fade-in 0.28s ease both;
  overflow: hidden;
}

.result-overlay::before {
  content: '';
  position: absolute;
  width: 580px;
  height: 580px;
  border-radius: 50%;
  right: -220px;
  bottom: -300px;
  border: 50px solid rgba(255, 251, 244, 0.22);
  pointer-events: none;
}

.result-shell {
  position: relative;
  z-index: 2;
  width: min(940px, 94vw);
  max-height: calc(100dvh - 22px - var(--safe-top) - var(--safe-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
  border-radius: 29px;
  background: var(--card);
  box-shadow: 0 26px 80px rgba(54, 37, 24, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.4);
  overflow: hidden;
  animation: result-in 0.55s cubic-bezier(0.2, 0.9, 0.28, 1) both;
}

.result-art {
  position: relative;
  min-height: 300px;
  background: var(--theme-soft, #f1e4d4);
  overflow: hidden;
}

.result-art canvas {
  width: 100%;
  height: 100%;
}

.result-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 72%, rgba(255, 250, 242, 0.18));
}

.result-art-badge {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 251, 243, 0.76);
  color: var(--theme-deep, var(--ink));
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(5px);
}

.result-art-badge .icon { width: 12px; height: 12px; }

.result-info {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(18px, 3vw, 34px);
  overflow-y: auto;
  scrollbar-width: none;
}

.result-info::-webkit-scrollbar { display: none; }

.result-info .eyebrow {
  color: var(--theme-deep, var(--ink-soft));
  margin-bottom: 4px;
}

.result-title {
  font-family: var(--font-pixel);
  font-size: clamp(38px, 4.7vw, 52px);
  font-weight: 700;
  line-height: 0.9;
  color: var(--ink);
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.result-title.name-medium {
  font-size: clamp(33px, 4vw, 46px);
}

.result-title.name-long {
  font-size: clamp(26px, 3.3vw, 38px);
  letter-spacing: -0.01em;
}

.result-rarity-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.result-rarity {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--r-color, var(--sage));
  background: var(--r-soft, var(--sage-soft));
  padding: 4px 7px;
  border-radius: 6px;
  font-weight: 800;
  line-height: 1;
}

.result-personality {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-soft);
  background: #f7efe4;
  padding: 4px 7px;
  border-radius: 6px;
}

.result-bio {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 700;
  margin-top: 10px;
  max-width: 38ch;
}

.result-stats {
  display: flex;
  gap: 3px;
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-stat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 0 7px;
  border-right: 1px solid var(--line);
}

.result-stat:last-child { border-right: 0; }
.result-stat:first-child { padding-left: 0; }

.result-stat b {
  font-size: 17px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.result-stat span {
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 800;
}

.result-extra {
  margin-top: 10px;
}

.reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #faf0dc;
  color: #96743b;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 800;
  margin: 2px 3px 2px 0;
}

.reward-chip .icon { width: 13px; height: 13px; color: var(--gold); }

.result-milestone {
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  background: var(--gold-soft);
  color: #86692d;
  font-size: 10px;
  line-height: 1.45;
  font-weight: 800;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.result-milestone .icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.result-actions {
  display: flex;
  gap: 7px;
  margin-top: auto;
  padding-top: 15px;
  flex-wrap: wrap;
}

.result-actions .primary-btn {
  flex: 1.4;
  min-width: 135px;
}

.result-actions .secondary-btn {
  flex: 1;
  min-width: 100px;
}

.result-actions .share-btn {
  flex: none;
  width: 46px;
  min-width: 46px;
  padding: 0;
}

.result-daily-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 800;
  flex-wrap: wrap;
}

.result-daily-line .pill { font-size: 9px; }

.result-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--theme-deep, #94664f);
  font-weight: 800;
  margin-bottom: 2px;
}

.result-new .icon { width: 12px; height: 12px; }

.result-locked {
  color: var(--ink-faint);
  font-size: 10px;
  margin-top: 6px;
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(22px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tap-ring {
  0% { transform: translate(-50%, -50%) scale(0.55); opacity: 0.8; }
  80% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
  100% { opacity: 0; }
}

@keyframes game-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* game responsive */
@media (max-width: 760px) {
  .game-inner {
    padding-left: calc(var(--safe-left) + 8px);
    padding-right: calc(var(--safe-right) + 8px);
    gap: 5px;
  }
  .game-topbar {
    min-height: 44px;
  }
  .game-heading h1 {
    font-size: 19px;
  }
  .hud-pill {
    height: 31px;
    padding: 0 7px;
    font-size: 10px;
  }
  .hud-hearts {
    height: 31px;
    padding: 0 7px;
  }
  .hud-hearts .heart { width: 14px; height: 14px; }
  .live-clue {
    height: 27px;
    padding: 0 6px;
    gap: 4px;
  }
  .live-clue .lc-values { max-width: 76px; }
  .live-clue .lc-label { font-size: 7px; }
  .cluebar-progress .progress-track { width: 32px; }
  .cluebar-progress span { display: none; }
  .game-fish {
    height: 27px;
    padding: 0 6px;
    font-size: 9px;
  }
  .game-controls {
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 2px;
  }
  .mode-switch {
    width: 100%;
    padding: 3px;
    border-radius: 14px;
  }
  .mode-btn {
    flex: 1;
    min-width: 0;
    height: 40px;
    border-radius: 11px;
  }
  .tool-row {
    width: 100%;
    margin-left: 0;
    gap: 5px;
  }
  .tool-btn {
    flex: 1;
    width: auto;
    height: 44px;
    border-radius: 13px;
  }
  .tool-btn.hint-btn {
    flex: 1.2;
    min-width: 0;
    padding: 0 7px;
  }
  .tool-btn .tool-hotkey { display: none; }
  .board-zoom {
    top: 5px;
    right: 5px;
    gap: 4px;
  }
  .zoom-btn {
    width: 35px;
    height: 35px;
    border-radius: 10px;
  }
  .zoom-btn .icon { width: 15px; height: 15px; }
  .board-live-pill { display: none; }
  .tutorial-tip {
    top: auto;
    max-width: calc(100% - 18px);
    font-size: 9px;
    min-height: 27px;
  }
  .tutorial-strip {
    margin-top: -2px;
  }
  .tutorial-hand {
    width: 46px;
    height: 46px;
  }
  .result-shell {
    width: 100%;
    max-height: calc(100dvh - 16px - var(--safe-top) - var(--safe-bottom));
    grid-template-columns: 1fr;
    grid-template-rows: minmax(210px, 42vh) minmax(0, 1fr);
    border-radius: 24px;
  }
  .result-art {
    min-height: 210px;
  }
  .result-info {
    padding: 17px;
  }
  .result-title { font-size: 35px; }
  .result-bio {
    font-size: 11px;
    margin-top: 7px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .result-stats {
    margin-top: 9px;
    padding: 8px 0;
  }
  .result-actions {
    padding-top: 11px;
  }
  .result-actions .primary-btn,
  .result-actions .secondary-btn {
    min-height: 44px;
  }
  .overlay-card {
    padding: 18px;
  }
  .overlay-card h2 { font-size: 27px; }
  .overlay-actions .primary-btn,
  .overlay-actions .secondary-btn { min-height: 44px; }
  .game-overlay {
    align-items: flex-end;
    padding-bottom: calc(10px + var(--safe-bottom));
  }
  .overlay-card {
    border-radius: 24px;
  }
}

@media (max-width: 380px) {
  .game-heading .eyebrow { display: none; }
  .game-heading h1 { font-size: 18px; }
  .hud-pill.timer {
    padding: 0 6px;
    font-size: 9px;
  }
  .game-cluebar .live-clue:first-child { max-width: 43%; }
  .game-cluebar .live-clue:nth-child(2) { max-width: 43%; }
  .cluebar-progress { display: none; }
  .game-fish { margin-left: auto; }
  .mode-btn { font-size: 10px; }
  .result-info { padding: 14px; }
  .result-title { font-size: 31px; }
  .result-actions .share-btn { width: 42px; min-width: 42px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .game-inner {
    padding-top: calc(var(--safe-top) + 4px);
    padding-bottom: calc(var(--safe-bottom) + 4px);
    gap: 4px;
  }
  .game-topbar { min-height: 36px; }
  .game-heading h1 { font-size: 18px; }
  .game-heading .eyebrow { font-size: 7.5px; }
  .hud-pill, .hud-hearts { height: 29px; }
  .game-cluebar { min-height: 25px; }
  .live-clue { height: 24px; }
  .game-fish { height: 24px; }
  .game-controls { padding-top: 0; }
  .mode-switch { padding: 3px; border-radius: 13px; width: auto; }
  .mode-btn { height: 34px; min-width: 73px; border-radius: 10px; }
  .tool-row { margin-left: auto; width: auto; }
  .tool-btn { width: 39px; height: 39px; flex: none; border-radius: 11px; }
  .tool-btn.hint-btn { min-width: 56px; flex: none; }
  .result-shell {
    width: min(940px, 96vw);
    max-height: calc(100dvh - 10px);
    grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.9fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .result-art { min-height: 0; }
  .result-info { padding: 16px 19px; }
  .result-title { font-size: 33px; }
  .result-bio {
    font-size: 10.5px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 6px;
  }
  .result-stats { padding: 7px 0; margin-top: 8px; }
  .result-stat b { font-size: 14px; }
  .result-actions { padding-top: 9px; }
  .result-actions .primary-btn, .result-actions .secondary-btn { min-height: 38px; }
  .overlay-card { padding: 16px; max-width: 380px; }
  .overlay-card h2 { font-size: 26px; }
  .overlay-icon { width: 44px; height: 44px; margin-bottom: 7px; }
  .overlay-icon .icon { width: 23px; height: 23px; }
  .overlay-actions { margin-top: 10px; }
  .overlay-stats { margin: 8px 0; padding: 7px; }
}

/* ---------------- cat room ---------------- */
.room-screen {
  display: none;
  background: #eadfce;
}

.room-screen.active {
  display: block;
  animation: screen-in 0.32s ease both;
}

.room-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.room-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.room-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + var(--page-pad))
    calc(var(--safe-bottom) + var(--nav-h) + 14px) calc(var(--safe-left) + var(--page-pad));
  background:
    linear-gradient(180deg, rgba(246, 238, 226, 0.68) 0%, rgba(246, 238, 226, 0) 22%),
    linear-gradient(0deg, rgba(68, 48, 34, 0.2) 0%, rgba(68, 48, 34, 0) 30%);
}

.room-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.room-topbar > * {
  pointer-events: auto;
}

.room-title-block {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.room-title {
  font-family: var(--font-pixel);
  font-size: clamp(24px, 3vw, 32px);
  line-height: 0.95;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 249, 240, 0.4);
  white-space: nowrap;
}

.room-title-sub {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(64, 48, 37, 0.52);
  font-weight: 800;
}

.room-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.room-actions > * {
  pointer-events: auto;
}

.room-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.room-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(255, 251, 243, 0.94);
  color: rgba(65, 51, 40, 0.7);
  font-size: 9.5px;
  font-weight: 800;
}

.room-count-pill .icon { width: 14px; height: 14px; }

.decorate-btn {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(180deg, #504033 0%, #3d3027 100%);
  color: #fff6e8;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(44, 31, 21, 0.22), 0 10px 20px rgba(60, 42, 28, 0.15);
}

.decorate-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(44, 31, 21, 0.22);
}

.decorate-btn .icon { width: 18px; height: 18px; }

.room-hint-banner {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--nav-h) + 74px);
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(55, 42, 32, 0.84);
  color: #fff8eb;
  border-radius: 11px;
  padding: 7px 11px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  max-width: calc(100% - 30px);
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.room-hint-banner .icon {
  width: 13px;
  height: 13px;
  color: #f0d49c;
  flex: none;
}

.room-empty {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: min(330px, calc(100% - 40px));
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.91);
  box-shadow: 0 18px 40px rgba(75, 54, 37, 0.15);
  text-align: center;
  backdrop-filter: blur(8px);
}

.room-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  margin: 0 auto 9px;
  display: grid;
  place-items: center;
  background: #f3e7d8;
  color: #a18368;
}

.room-empty-icon .icon { width: 26px; height: 26px; }

.room-empty h2 {
  font-family: var(--font-pixel);
  font-size: 27px;
  line-height: 0.98;
  color: var(--ink);
}

.room-empty p {
  font-size: 11px;
  color: var(--ink-soft);
  margin: 5px 0 13px;
  line-height: 1.45;
}

.room-empty .primary-btn {
  min-height: 44px;
  width: 100%;
  font-size: 13px;
}

.room-toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--nav-h) + 84px);
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(56, 43, 32, 0.9);
  color: #fff7e8;
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
  animation: toast-in 0.2s ease both;
}

.room-mode-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 33px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(255, 251, 244, 0.76);
  color: #705c4c;
  font-size: 9px;
  font-weight: 800;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}

.room-mode-tip .icon { width: 13px; height: 13px; }

.room-decor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-done-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: #f9f2e7;
  color: var(--ink);
  font-weight: 800;
  font-size: 11px;
  box-shadow: 0 2px 0 rgba(103, 78, 55, 0.08);
}

/* decor placement cursor label */
.room-ghost-label {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(55, 43, 32, 0.8);
  color: #fff8ea;
  font-size: 8px;
  font-weight: 800;
  transform: translate(-50%, -150%);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .room-ui {
    padding-top: calc(var(--safe-top) + 7px);
    padding-bottom: calc(var(--safe-bottom) + var(--nav-h) + 12px);
    padding-left: calc(var(--safe-left) + 11px);
    padding-right: calc(var(--safe-right) + 11px);
  }
  .room-title { font-size: 25px; }
  .room-title-sub { display: none; }
  .decorate-btn {
    min-height: 42px;
    padding: 0 12px;
    font-size: 11px;
    border-radius: 13px;
  }
  .room-count-pill {
    min-height: 28px;
    font-size: 8.5px;
  }
  .room-hint-banner {
    bottom: calc(var(--safe-bottom) + var(--nav-h) + 60px);
    font-size: 9px;
  }
  .room-empty {
    top: 42%;
    padding: 17px;
    border-radius: 21px;
  }
  .room-empty h2 { font-size: 24px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .room-ui {
    padding-top: calc(var(--safe-top) + 5px);
    padding-bottom: calc(var(--safe-bottom) + var(--nav-h) + 5px);
  }
  .room-title { font-size: 22px; }
  .room-title-sub { display: none; }
  .decorate-btn { min-height: 38px; font-size: 10px; }
  .room-count-pill { min-height: 26px; }
  .room-hint-banner {
    bottom: calc(var(--safe-bottom) + var(--nav-h) + 44px);
    font-size: 8.5px;
  }
  .room-empty {
    top: 43%;
    width: min(300px, calc(100% - 40px));
    padding: 13px;
  }
  .room-empty h2 { font-size: 21px; }
  .room-empty p { display: none; }
  .room-empty .primary-btn { min-height: 38px; }
}

/* Landscape game: controls move to a side rail so the board keeps a large
   touch-target area even on short screens. */
@media (orientation: landscape) and (max-height: 560px) {
  .game-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 94px;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "game-top game-top"
      "game-clues game-clues"
      "game-tips game-tips"
      "game-board game-controls";
    column-gap: 7px;
    row-gap: 3px;
    padding-top: calc(var(--safe-top) + 4px);
    padding-bottom: calc(var(--safe-bottom) + 4px);
    padding-left: calc(var(--safe-left) + 8px);
    padding-right: calc(var(--safe-right) + 8px);
  }
  .game-topbar { grid-area: game-top; min-height: 31px; gap: 6px; }
  .game-heading h1 { font-size: 16px; }
  .game-heading .eyebrow { font-size: 7px; }
  .game-heading .size-pill { font-size: 7px; padding: 1px 4px; }
  .game-topbar .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .game-topbar .icon-btn .icon { width: 17px; height: 17px; }
  .game-hud { gap: 4px; }
  .hud-pill, .hud-hearts { height: 27px; padding: 0 7px; font-size: 9px; border-radius: 8px; }
  .hud-hearts .heart { width: 13px; height: 13px; }
  .game-cluebar { grid-area: game-clues; min-height: 22px; gap: 4px; }
  .live-clue { height: 21px; padding: 0 5px; gap: 3px; border-radius: 6px; font-size: 8px; }
  .live-clue .lc-label { font-size: 6.5px; }
  .live-clue .lc-number { font-size: 8.5px; min-width: 11px; }
  .live-clue .lc-values { font-size: 8px; max-width: 84px; }
  .game-fish { height: 21px; padding: 0 5px; font-size: 8.5px; border-radius: 6px; }
  .game-fish .icon { width: 13px; height: 13px; }
  .cluebar-progress .progress-track { width: 34px; height: 4px; }
  .cluebar-progress { font-size: 8px; }
  .tutorial-strip { grid-area: game-tips; }
  .tutorial-tip { min-height: 23px; padding: 2px 4px 2px 7px; font-size: 8.5px; border-radius: 8px; }
  .tutorial-tip .tip-icon { width: 16px; height: 16px; }
  .tutorial-tip .tip-icon .icon { width: 11px; height: 11px; }
  .tutorial-tip .guide-skip { width: 20px; height: 20px; border-radius: 6px; }
  .game-board-area { grid-area: game-board; min-height: 0; }
  .board-shell { border-radius: 17px; }
  .game-controls {
    grid-area: game-controls;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 5px;
    width: 100%;
    padding-top: 0;
    z-index: 6;
  }
  .mode-switch {
    width: 100%;
    flex-direction: column;
    gap: 3px;
    padding: 3px;
    border-radius: 12px;
  }
  .mode-btn {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 4px;
    font-size: 9.5px;
    gap: 4px;
    border-radius: 9px;
  }
  .mode-btn .icon { width: 15px; height: 15px; }
  .tool-row {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .tool-btn {
    width: 100%;
    height: 40px;
    min-width: 0;
    border-radius: 10px;
    flex: none;
  }
  .tool-btn .icon { width: 17px; height: 17px; }
  .tool-btn.hint-btn {
    flex: none;
    min-width: 0;
    padding: 0 3px;
    gap: 2px;
    font-size: 8px;
    border-radius: 10px;
  }
  .tool-btn.hint-btn .hint-count { font-size: 8px; }
  .tool-btn.hint-btn .hint-count .icon { width: 10px; height: 10px; }
  .board-zoom { top: 4px; right: 4px; gap: 3px; }
  .zoom-btn { width: 32px; height: 32px; border-radius: 9px; }
  .zoom-btn .icon { width: 14px; height: 14px; }
  .board-live-pill { display: none; }
  .tutorial-hand { width: 48px; height: 48px; }
}

/* Phones hide the floating zoom rail until it is requested from the toolbar. */
.zoom-tool-btn { display: none; }
.zoom-menu-enabled .zoom-tool-btn { display: grid; }
.zoom-menu-enabled .zoom-tool-btn.is-active {
  color: #4d6c7c;
  background: #e3edf0;
}
.zoom-menu-enabled .board-zoom.is-collapsed { display: none; }
