:root {
  --bg: #f5f1e8;
  --ink: #202124;
  --muted: #6f675f;
  --panel: #fffaf0;
  --line: #2b2824;
  --accent: #227c70;
  --accent-2: #d9553f;
  --valid: #dff3e6;
  --bad: #f7d8d4;
  --shadow: 0 14px 32px rgba(48, 38, 26, 0.16);
}
body.dark-mode {
  --bg: #18171d;
  --ink: #f4f0e8;
  --muted: #bbb2a4;
  --panel: #24222a;
  --line: #f0e7da;
  --accent: #55d5c5;
  --accent-2: #ff8b72;
  --valid: #203f33;
  --bad: #4a292b;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(34, 124, 112, 0.12), transparent 30%),
    linear-gradient(225deg, rgba(217, 85, 63, 0.11), transparent 26%), var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
button {
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.app-shell {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 18px;
}
.topbar,
.suspects-panel,
.board-panel,
.tools-panel {
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  line-height: 1;
}
h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}
.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.status-strip span {
  min-width: 84px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 800;
  text-align: center;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(420px, 1fr) minmax(
      220px,
      280px
    );
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}
.suspects-panel,
.tools-panel,
.board-panel {
  padding: 16px;
}
.panel-heading p,
.map-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.character-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.character-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  width: 100%;
  padding: 10px;
  text-align: left;
}
.character-card.active {
  background: var(--accent);
  color: #fff;
}
.character-card.placed:not(.active) {
  background: var(--valid);
}
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 72px;
  border: 3px solid currentColor;
  border-radius: 4px;
  background: #f7f0df;
  box-shadow: 3px 3px 0 rgba(43, 40, 36, 0.35);
  font-size: 1.15rem;
  font-weight: 900;
  overflow: hidden;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-initial {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  border: 2px solid #2b2824;
  background: rgba(255, 250, 240, 0.92);
  color: #2b2824;
  font-size: 0.72rem;
  line-height: 1;
}
.character-name {
  display: block;
  margin-bottom: 3px;
  font-weight: 900;
}
.clue {
  display: block;
  color: inherit;
  font-size: 0.82rem;
  line-height: 1.28;
}
.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  border: 2px solid var(--line);
  background: #fff;
}
.mode-button {
  border: 0;
  border-right: 2px solid var(--line);
  padding: 8px 12px;
  font-weight: 800;
}
.mode-button:last-child {
  border-right: 0;
}
.mode-button.active {
  background: var(--accent);
  color: #fff;
}
.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  aspect-ratio: 1;
  width: min(100%, 690px);
  margin: 0 auto;
  border: 3px solid var(--line);
  background: var(--line);
  gap: 0;
}
.cell {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0;
  border: 1px solid #17151f;
  background: var(--area-color, #f9f5eb);
  overflow: hidden;
}
.cell:hover {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.cell.blocked {
  background: color-mix(in srgb, var(--area-color, #ede4d6) 62%, #b9aa95);
}
.cell.correct {
  background: var(--valid);
}
.cell.wrong {
  background: var(--bad);
}
.cell-area {
  display: none;
}
.cell-object {
  display: none;
}
.cell-object-img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 72%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  z-index: 2;
  filter: drop-shadow(0 4px 0 rgba(23, 21, 31, 0.18));
}
.cell[data-object="shelf"] .cell-object-img,
.cell[data-object="door"] .cell-object-img,
.cell[data-object="table"] .cell-object-img {
  width: 88%;
  height: 88%;
}
.cell[data-object="plant"] .cell-object-img,
.cell[data-object="tree"] .cell-object-img {
  width: 66%;
  height: 66%;
}
.cell-person {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 950;
}
.blocked-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(43, 40, 36, 0.28);
  font-size: 2.2rem;
  font-weight: 950;
  pointer-events: none;
}
.notes {
  position: absolute;
  left: 5px;
  bottom: 5px;
  display: flex;
  max-width: calc(100% - 44px);
  flex-wrap: wrap;
  gap: 2px;
}
.note-chip {
  min-width: 16px;
  padding: 1px 3px;
  border: 1px solid rgba(43, 40, 36, 0.45);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}
.message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}
.message.bad {
  color: #9f2f23;
}
.message.good {
  color: #146d45;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.tool-grid button {
  min-height: 44px;
  padding: 9px;
  font-weight: 900;
}
#submitBtn {
  grid-column: span 2;
  background: var(--accent-2);
  color: #fff;
}
.rules-box,
.result-box {
  margin-top: 14px;
  padding: 12px;
  border: 2px solid var(--line);
  background: #fff;
}
.rules-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.result-box {
  min-height: 76px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}
.result-box strong {
  color: var(--ink);
}
@media (max-width: 1050px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .suspects-panel,
  .tools-panel {
    order: 2;
  }
  .board-panel {
    order: 1;
  }
  .character-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }
  .topbar,
  .map-header {
    align-items: stretch;
    flex-direction: column;
  }
  .status-strip {
    justify-content: stretch;
  }
  .status-strip span {
    flex: 1;
  }
  .character-list {
    grid-template-columns: 1fr;
  }
  .board {
    grid-template-columns: repeat(6, minmax(42px, 1fr));
    gap: 2px;
  }
  .cell {
    padding: 4px;
  }
  .cell-area {
    font-size: 0.5rem;
  }
  .cell-person {
    width: 27px;
    height: 27px;
    font-size: 0.82rem;
  }
}
.cell[data-area="market"] {
  --area-color: #f7dfb5;
}
.cell[data-area="house"] {
  --area-color: #dceecf;
}
.cell[data-area="library"] {
  --area-color: #d8e6fa;
}
.cell[data-area="cafe"] {
  --area-color: #f5d6cf;
}
.cell[data-area="garden"] {
  --area-color: #d4efd9;
}
.cell[data-area="clinic"] {
  --area-color: #eadcf8;
}
.cell[data-area="station"] {
  --area-color: #d9eceb;
}
.cell.correct {
  background: color-mix(in srgb, var(--area-color, #dff3e6) 48%, var(--valid));
}
.cell.wrong {
  background: color-mix(in srgb, var(--area-color, #f7d8d4) 38%, var(--bad));
}

.floor-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 2px, transparent 2px),
    linear-gradient(rgba(255, 255, 255, 0.25) 50%, transparent 50%);
  background-size:
    32px 100%,
    32px 32px;
}
.cell[data-area="garden"] .floor-shade,
.cell[data-area="clinic"] .floor-shade {
  background-image:
    linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.25) 25%,
      transparent 25%,
      transparent 75%,
      rgba(255, 255, 255, 0.25) 75%
    ),
    linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.25) 25%,
      transparent 25%,
      transparent 75%,
      rgba(255, 255, 255, 0.25) 75%
    );
  background-position:
    0 0,
    16px 16px;
  background-size: 32px 32px;
}
.cell[data-area="library"] .floor-shade,
.cell[data-area="station"] .floor-shade {
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.09) 2px, transparent 2px),
    linear-gradient(rgba(255, 255, 255, 0.2) 2px, transparent 2px);
  background-size: 34px 34px;
}
.room-label {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  z-index: 4;
  color: #fff;
  font-size: clamp(0.5rem, 0.9vw, 0.9rem);
  font-weight: 950;
  line-height: 0.95;
  text-align: center;
  text-shadow:
    -1.5px -1.5px 0 #17151f,
    1.5px -1.5px 0 #17151f,
    -1.5px 1.5px 0 #17151f,
    1.5px 1.5px 0 #17151f,
    0 3px 0 rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.cell-person {
  z-index: 6;
}
.blocked-mark {
  z-index: 5;
}
.notes {
  z-index: 7;
}
.cell:before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 1;
  pointer-events: none;
}

.cell.object-blocked {
  cursor: not-allowed;
}
.cell.object-blocked:hover {
  outline: 4px solid #d7261e;
  outline-offset: -4px;
}
.cell.object-blocked .cell-object-img {
  filter: drop-shadow(0 4px 0 rgba(23, 21, 31, 0.22)) saturate(0.92);
}
.cell.placeable-object:hover {
  outline-color: var(--accent);
}

.object-caption {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  z-index: 3;
  padding: 0;
  color: #17151f;
  font-size: clamp(0.46rem, 0.85vw, 0.68rem);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8),
    0 -1px 0 rgba(255, 255, 255, 0.65);
  pointer-events: none;
}
.cell:has(.room-label) .object-caption {
  display: none;
}
.cell-person + .notes,
.notes {
  z-index: 7;
}
@media (max-width: 640px) {
  .object-caption {
    font-size: 0.46rem;
  }
}

@media (min-width: 1200px) {
  .room-label {
    font-size: 0.78rem;
  }
}

.area-edge-top {
  border-top-width: 5px;
}
.area-edge-right {
  border-right-width: 5px;
}
.area-edge-bottom {
  border-bottom-width: 5px;
}
.area-edge-left {
  border-left-width: 5px;
}
@media (max-width: 640px) {
  .area-edge-top {
    border-top-width: 4px;
  }
  .area-edge-right {
    border-right-width: 4px;
  }
  .area-edge-bottom {
    border-bottom-width: 4px;
  }
  .area-edge-left {
    border-left-width: 4px;
  }
}

.victim-card .avatar {
  background: #f7d8d4;
}
.victim-card:not(.active) {
  border-color: #9f2f23;
}

.hidden {
  display: none !important;
}
.home-view {
  padding: 4px 0 24px;
}
.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  padding: 10px 4px 18px;
  border-bottom: 1px solid rgba(43, 40, 36, 0.18);
}
.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
}
.brand-main,
.brand-accent {
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 950;
  line-height: 1;
}
.brand-accent {
  color: var(--accent-2);
}
.home-settings {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.setting-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}
.setting-control select,
.dark-toggle {
  min-height: 34px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}
.setting-control select {
  min-width: 124px;
  padding: 5px 30px 5px 10px;
}
.dark-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
}
.dark-toggle-icon {
  display: grid;
  place-items: center;
  width: 17px;
  font-size: 1rem;
  line-height: 1;
}
.home-header {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.home-header h1 {
  margin-bottom: 16px;
  font-size: clamp(1.45rem, 3.6vw, 2.35rem);
  line-height: 1.08;
}
.home-header p {
  max-width: 620px;
  margin-bottom: 0;
  margin-right: auto;
  margin-left: auto;
  color: var(--muted);
  font-weight: 700;
}
.puzzle-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.puzzle-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  min-height: 348px;
  padding: 26px 26px 22px;
  border: 3px solid #121212;
  border-radius: 14px;
  background:
    radial-gradient(
      circle at 22% 8%,
      rgba(32, 33, 36, 0.08) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 58% 86%,
      rgba(32, 33, 36, 0.12) 0 3px,
      transparent 4px
    ),
    linear-gradient(
      115deg,
      transparent 0 64%,
      rgba(255, 255, 255, 0.42) 64% 68%,
      transparent 68%
    ),
    #ebe3d2;
  box-shadow:
    3px 4px 0 rgba(18, 18, 18, 0.88),
    0 16px 28px rgba(48, 38, 26, 0.18);
  overflow: hidden;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}
.puzzle-card:hover,
.puzzle-card:focus-within {
  transform: translateY(-3px);
  box-shadow:
    5px 7px 0 rgba(18, 18, 18, 0.88),
    0 20px 34px rgba(48, 38, 26, 0.22);
}
.puzzle-card:before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(32, 33, 36, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 33, 36, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.puzzle-map-frame {
  position: relative;
  z-index: 2;
  width: min(100%, 220px);
  justify-self: center;
}
.puzzle-tape {
  position: absolute;
  z-index: 5;
  width: 48px;
  height: 24px;
  border: 2px solid rgba(18, 18, 18, 0.12);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 2px 3px rgba(48, 38, 26, 0.08);
  pointer-events: none;
}
.tape-top {
  right: -10px;
  top: -9px;
  transform: rotate(38deg);
}
.tape-bottom {
  left: -10px;
  bottom: -9px;
  transform: rotate(35deg);
}
.puzzle-map-preview {
  position: relative;
  display: grid;
  aspect-ratio: 1 / 1;
  width: 100%;
  border: 2px solid rgba(18, 18, 18, 0.72);
  background: var(--line);
  box-shadow: 0 2px 0 rgba(18, 18, 18, 0.18);
  overflow: hidden;
}
.puzzle-map-preview.solved-preview:before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 250, 240, 0.28);
  z-index: 8;
  pointer-events: none;
}
.solved-stamp {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 9;
  min-width: 190px;
  padding: 9px 16px;
  border: 5px solid #b62020;
  color: #b62020;
  background: rgba(255, 250, 240, 0.72);
  font-size: 2rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%) rotate(-24deg);
  box-shadow: 0 3px 0 rgba(23, 21, 31, 0.18);
  pointer-events: none;
}
.mini-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--mini-area-color, #efe7d9);
  border: 1px solid rgba(23, 21, 31, 0.42);
  overflow: hidden;
}
.mini-cell:before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.22) 50%, transparent 50%);
  background-size:
    12px 100%,
    12px 12px;
  opacity: 0.48;
}
.mini-cell img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 74%;
  height: 74%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 0 rgba(23, 21, 31, 0.3));
  z-index: 2;
}
.mini-cell.mini-blocked:after {
  content: "";
  position: absolute;
  inset: 22%;
  border: 2px solid rgba(23, 21, 31, 0.64);
  background: rgba(255, 255, 255, 0.22);
  z-index: 1;
}
.mini-edge-top {
  border-top-width: 3px;
}
.mini-edge-right {
  border-right-width: 3px;
}
.mini-edge-bottom {
  border-bottom-width: 3px;
}
.mini-edge-left {
  border-left-width: 3px;
}
.puzzle-card h2 {
  position: relative;
  z-index: 2;
  margin: 2px 0 0;
  color: #27221a;
  font-size: 1.05rem;
  line-height: 1.12;
  text-align: center;
}
.puzzle-card-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
  justify-items: center;
}
.puzzle-card-copy .eyebrow {
  margin: 0;
  color: rgba(39, 34, 26, 0.62);
  font-size: 0.68rem;
}
.puzzle-best {
  margin: 0;
  color: #7c735f;
  font-size: 0.76rem;
  font-weight: 850;
}
.puzzle-meta {
  position: relative;
  z-index: 2;
  grid-row: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #766f61;
  font-size: 0.86rem;
  font-weight: 900;
  align-self: end;
  min-height: 40px;
}
.puzzle-badge {
  padding: 4px 9px;
  border: 2px solid #62d8c7;
  border-radius: 6px;
  color: #42c9b8;
  background: rgba(236, 255, 251, 0.72);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}
.puzzle-badge.difficulty-medium {
  border-color: #e3b341;
  color: #b87900;
  background: rgba(255, 241, 174, 0.76);
}
.puzzle-badge.difficulty-hard,
.puzzle-badge.difficulty-expert {
  border-color: #e56b5f;
  color: #c2372d;
  background: rgba(255, 223, 218, 0.78);
}
.puzzle-card-action {
  position: absolute;
  inset: 0;
  z-index: 10;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
}
.puzzle-card-action:focus-visible {
  outline: 4px solid var(--accent);
  outline-offset: -8px;
}
.dark-mode .home-topbar {
  border-bottom-color: rgba(240, 231, 218, 0.18);
}
.dark-mode .puzzle-card {
  border-color: #f0e7da;
  background:
    radial-gradient(
      circle at 22% 8%,
      rgba(255, 255, 255, 0.08) 0 2px,
      transparent 3px
    ),
    radial-gradient(
      circle at 58% 86%,
      rgba(255, 255, 255, 0.1) 0 3px,
      transparent 4px
    ),
    linear-gradient(
      115deg,
      transparent 0 64%,
      rgba(255, 255, 255, 0.08) 64% 68%,
      transparent 68%
    ),
    #2f2b33;
  box-shadow:
    3px 4px 0 rgba(240, 231, 218, 0.58),
    0 16px 28px rgba(0, 0, 0, 0.26);
}
.dark-mode .puzzle-card h2 {
  color: #f4f0e8;
}
.dark-mode .puzzle-best,
.dark-mode .puzzle-meta,
.dark-mode .puzzle-card-copy .eyebrow {
  color: #c6bdae;
}
.dark-mode .puzzle-tape {
  background: rgba(244, 240, 232, 0.7);
}
.small-nav {
  min-height: 38px;
  padding: 7px 11px;
  font-weight: 900;
}
.small-nav {
  background: #fff;
}

@media (max-width: 700px) {
  .home-topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .home-settings {
    justify-content: space-between;
  }
  .setting-control {
    flex: 1;
  }
  .setting-control select {
    width: 100%;
    min-width: 0;
  }
}

/* extra area palette */
.cell[data-area*="kitchen"],
.cell[data-area*="counter"],
.cell[data-area*="bar"] {
  --area-color: #f3d7bd;
}
.cell[data-area*="dining"],
.cell[data-area*="lounge"],
.cell[data-area*="booth"] {
  --area-color: #d7ead5;
}
.cell[data-area*="hotel"],
.cell[data-area*="villa"],
.cell[data-area*="suite"],
.cell[data-area*="apartment"] {
  --area-color: #e2d7f2;
}
.cell[data-area*="beach"],
.cell[data-area*="shore"],
.cell[data-area*="pool"] {
  --area-color: #cbe9ef;
}
.cell[data-area*="garden"],
.cell[data-area*="dunes"],
.cell[data-area*="patio"],
.cell[data-area*="terrace"] {
  --area-color: #d4efd9;
}
.cell[data-area*="office"],
.cell[data-area*="study"],
.cell[data-area*="archive"],
.cell[data-area*="reading"] {
  --area-color: #d8e6fa;
}
.cell[data-area*="garage"],
.cell[data-area*="parking"],
.cell[data-area*="storage"],
.cell[data-area*="laundry"] {
  --area-color: #e0e0dc;
}
.cell[data-area*="roof"],
.cell[data-area*="pier"],
.cell[data-area*="hall"] {
  --area-color: #d9eceb;
}
.cell[data-area*="spa"],
.cell[data-area*="bedroom"],
.cell[data-area*="gym"] {
  --area-color: #eadcf8;
}
.cell[data-area*="cafe"],
.cell[data-area*="entry"],
.cell[data-area*="entrance"],
.cell[data-area*="lobby"] {
  --area-color: #f5d6cf;
}

.solved-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 33, 36, 0.48);
  backdrop-filter: blur(3px);
}
.solved-dialog {
  position: relative;
  width: min(94vw, 430px);
  padding: 26px 24px 22px;
  border: 3px solid var(--line);
  background: #ead9ea;
  box-shadow: 0 24px 60px rgba(23, 21, 31, 0.32);
  text-align: center;
}
.solved-dialog h2 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  line-height: 1.05;
}
.solved-case-text {
  margin: 0 auto 14px;
  max-width: 340px;
  color: #3d343d;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.35;
}
.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1;
}
.arrest-illustration {
  display: grid;
  place-items: center;
  margin: 10px 0 12px;
}
.arrest-circle {
  display: grid;
  place-items: center;
  width: 230px;
  height: 230px;
  border: 7px solid #87443f;
  border-radius: 50%;
  background: #eadde8;
}
.mugshot-card {
  position: relative;
  width: 142px;
  height: 166px;
  border: 4px solid #2b2824;
  background: #f8f3ec;
  box-shadow: 7px 7px 0 rgba(32, 33, 36, 0.18);
  overflow: hidden;
}
.mugshot-face {
  position: absolute;
  left: 21px;
  right: 21px;
  top: 24px;
  height: 92px;
  border-radius: 46px 46px 18px 18px;
  background: #2f3038;
}
.mugshot-face:before {
  content: "";
  position: absolute;
  left: 27px;
  top: 21px;
  width: 46px;
  height: 72px;
  border-radius: 26px 26px 18px 18px;
  background: #efc78d;
}
.mugshot-face:after {
  content: "";
  position: absolute;
  left: 31px;
  top: 53px;
  width: 38px;
  height: 8px;
  border-top: 3px solid rgba(255, 255, 255, 0.9);
  border-bottom: 3px solid rgba(255, 255, 255, 0.9);
}
.mugshot-face i {
  position: absolute;
  left: -9px;
  right: -9px;
  bottom: 2px;
  height: 24px;
  background: #f0c083;
  border-radius: 10px 10px 0 0;
}
.mugshot-face span {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 3;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.6rem;
  font-weight: 950;
  transform: translate(-50%, -50%);
}
.mugshot-bars {
  position: absolute;
  inset: 0 10px 42px 10px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.mugshot-bars span {
  width: 10px;
  background: #5c5270;
  border: 2px solid #2b2824;
  border-top: 0;
  border-bottom: 0;
}
.mugshot-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: 42px;
  border-top: 3px solid #2b2824;
  background: #fff;
  color: #2b2824;
  font-family: Georgia, serif;
  font-size: 1.28rem;
  font-style: italic;
  font-weight: 850;
  line-height: 38px;
}
.solved-best-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 850;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.modal-actions button {
  min-height: 42px;
  padding: 8px 10px;
  font-weight: 950;
}
.modal-actions #modalHomeBtn {
  background: var(--accent);
  color: #fff;
}
@media (max-width: 420px) {
  .solved-dialog {
    padding: 22px 16px 18px;
  }
  .arrest-circle {
    width: 200px;
    height: 200px;
  }
  .mugshot-card {
    width: 126px;
    height: 150px;
  }
  .solved-case-text {
    font-size: 0.98rem;
  }
  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@keyframes wrongPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(183, 32, 32, 0.45);
  }
  50% {
    transform: scale(1.035);
    box-shadow: inset 0 0 0 7px rgba(183, 32, 32, 0.28);
  }
}
.cell.wrong {
  z-index: 10;
  background: #f4b0a8 !important;
  animation: wrongPulse 0.82s ease-in-out infinite;
  outline: 4px solid #b62020;
  outline-offset: -4px;
}
.cell.wrong .cell-person {
  background: #b62020;
  color: #fff;
  border-color: #6d1111;
  animation: wrongPulse 0.82s ease-in-out infinite;
}
.failed-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 33, 36, 0.52);
  backdrop-filter: blur(3px);
}
.failed-dialog {
  position: relative;
  width: min(92vw, 390px);
  padding: 28px 24px 22px;
  border: 3px solid #681919;
  background: #fff2ef;
  box-shadow: 0 24px 60px rgba(23, 21, 31, 0.34);
  text-align: center;
}
.failed-dialog .eyebrow {
  color: #b62020;
}
.failed-dialog h2 {
  margin: 0 0 8px;
  color: #b62020;
  font-size: 2.45rem;
  letter-spacing: 0.08em;
  line-height: 1;
}
.failed-text {
  margin: 0 auto 16px;
  max-width: 300px;
  color: #4a2727;
  font-weight: 850;
  line-height: 1.35;
}
.failed-mark {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  margin: 0 auto 18px;
  border: 8px solid #b62020;
  border-radius: 50%;
  color: #b62020;
  font-size: 5.5rem;
  font-weight: 950;
  line-height: 1;
  transform: rotate(-8deg);
}
.modal-actions.single {
  grid-template-columns: 1fr;
}
.failed-close-btn {
  background: #b62020;
  color: #fff;
}
@media (max-width: 420px) {
  .failed-dialog {
    padding: 24px 16px 18px;
  }
  .failed-dialog h2 {
    font-size: 2.1rem;
  }
  .failed-mark {
    width: 100px;
    height: 100px;
    font-size: 4.6rem;
  }
}
