/* CRIMS A LA TERRETA — Dossier aesthetic (paper, ink, stamps) */

:root {
  --paper:       #F1E7CF;
  --paper-2:     #E7D9B6;
  --paper-shadow:#C9B98E;
  --ink:         #1A2238;
  --ink-soft:    #3A4258;
  --ink-faded:   #6c6b5a;
  --stamp-red:   #B23A2F;
  --stamp-red-2: #8B2A20;
  --gold:        #B68E3A;
  --olive:       #5d7048;
  --sepia:       #6E5535;
  --case-file:   #D9C58E;
  --case-file-2: #B89C58;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "EB Garamond", "Cormorant Garamond", Georgia, serif;
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Paper texture — layered noise + warm vignette */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  background-image:
    radial-gradient(circle at 12% 22%, rgba(170,140,80,0.08) 0%, transparent 35%),
    radial-gradient(circle at 88% 78%, rgba(120,90,40,0.10) 0%, transparent 40%),
    radial-gradient(circle at 60% 8%,  rgba(50,30,10,0.05)  0%, transparent 30%);
  mix-blend-mode: multiply;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(60,40,15,0.28) 100%);
}

::-webkit-scrollbar { width: 14px; }
::-webkit-scrollbar-track { background: var(--paper-2); border-left: 1px solid var(--paper-shadow); }
::-webkit-scrollbar-thumb { background: var(--ink-soft); border: 3px solid var(--paper-2); }

a { color: var(--stamp-red); text-decoration: none; }

/* Typography classes */
.serif    { font-family: "DM Serif Display", "Playfair Display", Georgia, serif; }
.type     { font-family: "Special Elite", "Courier Prime", "Courier New", monospace; letter-spacing: 0.02em; }
.hand     { font-family: "Caveat", "Kalam", cursive; }

/* ============ HEADER (masthead) ============ */
.dossier-header {
  position: relative;
  padding: 40px 32px 28px;
  padding-top: calc(40px + env(safe-area-inset-top));
  border-bottom: 3px double var(--ink);
  background: var(--paper);
  text-align: center;
}
.dossier-header::before {
  content: "ARXIU CRIMINAL · TERRETA · VOLUM I";
  position: absolute;
  top: 14px;
  left: 0; right: 0;
  text-align: center;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--ink-faded);
}
.dossier-header h1 {
  font-family: "DM Serif Display", serif;
  font-size: 76px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-top: 18px;
}
.dossier-header h1 .amp {
  font-style: italic;
  color: var(--stamp-red);
  margin: 0 6px;
}
.dossier-header .tagline {
  margin-top: 16px;
  font-family: "Special Elite", monospace;
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--sepia);
  text-transform: uppercase;
}
.dossier-header .tagline span { color: var(--stamp-red); }

/* Rubber stamp */
.stamp {
  position: absolute;
  top: 60px;
  right: 36px;
  font-family: "Special Elite", monospace;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--stamp-red);
  border: 3px solid var(--stamp-red);
  padding: 8px 14px;
  transform: rotate(-8deg);
  opacity: 0.85;
  background: rgba(178,58,47,0.04);
  text-transform: uppercase;
  font-weight: 700;
}
.stamp::before, .stamp::after {
  content: "★";
  margin: 0 8px;
  font-size: 10px;
}

/* ============ HOME ============ */
.home-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 32px 80px;
}

.section-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 48px;
}
.section-bar .num {
  font-family: "DM Serif Display", serif;
  font-size: 56px;
  color: var(--stamp-red);
  font-style: italic;
  line-height: 1;
}
.section-bar .title {
  font-family: "DM Serif Display", serif;
  font-size: 38px;
  letter-spacing: 0.02em;
}
.section-bar .rule {
  flex: 1;
  height: 0;
  border-top: 1px solid var(--ink);
  margin-top: 18px;
}
.section-bar .meta {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faded);
  text-transform: uppercase;
  margin-top: 14px;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 36px 28px;
}

/* Manila folder */
.case-folder {
  position: relative;
  background: var(--case-file);
  padding: 38px 26px 26px;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.06),
    0 1px 0 rgba(0,0,0,0.05),
    8px 12px 24px rgba(60,40,10,0.18);
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 200ms ease, box-shadow 200ms ease;
  border-top: 1px solid rgba(120,90,30,0.35);
}
.case-folder:nth-child(3n+1) { transform: rotate(-0.6deg); }
.case-folder:nth-child(3n+2) { transform: rotate(0.4deg); }
.case-folder:nth-child(3n+3) { transform: rotate(-0.2deg); }
.case-folder:hover {
  transform: rotate(0) translateY(-4px);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.06),
    12px 18px 32px rgba(60,40,10,0.28);
}

/* Folder tab */
.case-folder::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 22px;
  width: 130px;
  height: 22px;
  background: var(--case-file);
  border-top: 1px solid rgba(120,90,30,0.35);
  border-radius: 6px 6px 0 0;
}
.case-folder .tab-label {
  position: absolute;
  top: -11px;
  left: 38px;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--ink);
  z-index: 2;
}

.case-folder .photo {
  position: relative;
  height: 170px;
  background: var(--paper);
  border: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: sepia(0.45) contrast(0.95);
  box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
}
.case-folder .photo .big-emoji {
  font-size: 86px;
  filter: grayscale(0.5) contrast(0.9);
  opacity: 0.92;
}
.case-folder .photo::before {
  /* corner clip */
  content: "";
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 56px; height: 18px;
  background: rgba(178,58,47,0.65);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}
.case-folder .photo .corner-label {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-family: "Special Elite", monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--ink-faded);
  background: var(--paper);
  padding: 2px 6px;
  text-transform: uppercase;
}

.case-folder .case-title {
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
  margin-top: 4px;
}
.case-folder .case-loc {
  font-family: "Caveat", cursive;
  font-size: 20px;
  color: var(--stamp-red);
  line-height: 1.1;
}
.case-folder .case-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--ink-soft);
  padding-top: 14px;
  margin-top: 4px;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.case-folder .diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.case-folder .diff .stars { letter-spacing: 0.1em; }
.case-folder .diff.facil   .stars { color: var(--olive); }
.case-folder .diff.mitja   .stars { color: var(--gold); }
.case-folder .diff.dificil .stars { color: var(--stamp-red); }

.case-folder .open-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stamp-red);
  border: 2px solid var(--stamp-red);
  padding: 10px 14px;
  align-self: flex-start;
  transition: background 120ms, color 120ms;
}
.case-folder:hover .open-btn {
  background: var(--stamp-red);
  color: var(--paper);
}

/* Footer */
.dossier-footer {
  border-top: 1px solid var(--ink);
  padding: 22px 32px;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faded);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.dossier-footer span { color: var(--stamp-red); }

/* ============ BUTTONS ============ */
.btn {
  font-family: "Special Elite", monospace;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: transform 100ms, box-shadow 100ms, background 100ms, color 100ms;
  box-shadow: 3px 3px 0 var(--ink);
}
.btn:hover  { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.red    { background: var(--stamp-red); color: var(--paper); border-color: var(--stamp-red); box-shadow: 3px 3px 0 var(--stamp-red-2); }
.btn.green  { background: var(--olive);     color: var(--paper); border-color: var(--olive);     box-shadow: 3px 3px 0 #3d4a2e; }
.btn.gold   { background: var(--gold);      color: var(--ink);   border-color: var(--gold);      box-shadow: 3px 3px 0 #7d6024; }
.btn.ghost  { background: transparent; }
.btn.big    { font-size: 15px; padding: 16px 24px; }

/* ============ PUZZLE PAGE ============ */
.puzzle-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--paper);
  border-bottom: 3px double var(--ink);
  padding: 14px 28px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.puzzle-header .mini {
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  letter-spacing: 0.01em;
}
.puzzle-header .mini .amp { color: var(--stamp-red); font-style: italic; }
.puzzle-header .crumb {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faded);
  text-transform: uppercase;
}
.puzzle-header .back {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 2px solid var(--ink);
  padding: 8px 12px;
  color: var(--ink);
}
.puzzle-header .back:hover { background: var(--ink); color: var(--paper); }

.game-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 28px 110px;
}
@media (max-width: 1000px) {
  .game-layout { grid-template-columns: 1fr; }
}

.case-banner {
  display: flex;
  gap: 18px;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.case-banner .label {
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--stamp-red);
  text-transform: uppercase;
  border: 2px solid var(--stamp-red);
  padding: 4px 10px;
}
.case-banner .name {
  font-family: "DM Serif Display", serif;
  font-size: 38px;
  line-height: 1.1;
  color: var(--ink);
  flex: 1;
  min-width: 280px;
}
.case-banner .loc {
  font-family: "Caveat", cursive;
  font-size: 22px;
  color: var(--ink-faded);
}

.victim-card {
  margin: 18px 0 28px;
  padding: 14px 18px;
  background: rgba(178,58,47,0.08);
  border-left: 4px solid var(--stamp-red);
  font-family: "Special Elite", monospace;
  font-size: 16px;
  letter-spacing: 0.1em;
  color: var(--stamp-red-2);
  text-transform: uppercase;
}
.victim-card .skull { margin-right: 10px; }

/* Corkboard / evidence wall */
.board-wrap { display: flex; flex-direction: column; gap: 24px; }
.board-label {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--ink-faded);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
}
.board-label::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--ink-soft);
  margin-top: 2px;
}

.board {
  display: grid;
  gap: 14px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(120,90,40,0.10), transparent 60%),
    var(--paper-2);
  border: 1px solid var(--paper-shadow);
  box-shadow: inset 0 0 60px rgba(120,90,30,0.18), 4px 4px 0 rgba(0,0,0,0.07);
  width: fit-content;
  max-width: 100%;
}
.board.size-3 { grid-template-columns: repeat(3, 130px); }
.board.size-4 { grid-template-columns: repeat(4, 110px); }
.board.size-5 { grid-template-columns: repeat(5, 96px); }

/* Polaroid cells */
.cell {
  aspect-ratio: 1 / 1.18;
  background: #FBF5E4;
  padding: 8px 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  box-shadow: 2px 3px 8px rgba(60,40,10,0.22);
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform 120ms, box-shadow 120ms;
}
.cell:nth-child(2n)    { transform: rotate(-1deg); }
.cell:nth-child(3n)    { transform: rotate(1.2deg); }
.cell:nth-child(5n+1)  { transform: rotate(-0.5deg); }

.cell .photo {
  width: 100%;
  flex: 1;
  background: #2E2A22;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: sepia(0.5) contrast(0.9) brightness(0.95);
  position: relative;
}
.cell .photo .obj {
  font-size: 44px;
  line-height: 1;
  filter: grayscale(0.4);
}
.cell .photo::after {
  /* faint texture */
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.08) 0px, rgba(0,0,0,0.08) 1px, transparent 1px, transparent 2px);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.cell .lbl {
  margin-top: 6px;
  font-family: "Caveat", cursive;
  font-size: 20px;
  color: var(--ink);
  line-height: 1;
}
.board.size-4 .cell .photo .obj { font-size: 38px; }
.board.size-5 .cell .photo .obj { font-size: 32px; }
.board.size-5 .cell .lbl { font-size: 14px; }

/* pin (thumbtack) */
.cell::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f25c52, #8a1a12 75%);
  box-shadow: 1px 2px 3px rgba(0,0,0,0.35);
  z-index: 3;
}

.cell.target {
  outline: 3px dashed var(--stamp-red);
  outline-offset: 2px;
  cursor: pointer;
}
.cell.target:hover {
  transform: translate(-1px,-2px) rotate(0);
  box-shadow: 4px 6px 12px rgba(60,40,10,0.3);
}
.cell.placed { cursor: pointer; }
.cell.placed .photo { filter: sepia(0.35) contrast(1.0); }
.cell.correct .photo {
  box-shadow: inset 0 0 0 4px var(--olive);
}
.cell.wrong   .photo {
  box-shadow: inset 0 0 0 4px var(--stamp-red);
}

/* suspect placed overlay */
.placed-overlay {
  position: absolute;
  inset: 8px 8px 28px;
  background: rgba(20, 25, 50, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--paper);
}
.placed-overlay .pe { font-size: 38px; filter: grayscale(1) contrast(1.1); }
.placed-overlay .pn {
  font-family: "Special Elite", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 4px;
}
.board.size-5 .placed-overlay .pe { font-size: 28px; }
.board.size-5 .placed-overlay .pn { font-size: 9px; }

/* Action bar */
.action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ============ SIDEBAR ============ */
.sidebar { display: flex; flex-direction: column; gap: 28px; }

.dossier-panel {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 0;
  box-shadow: 4px 5px 0 rgba(0,0,0,0.08);
  position: relative;
}
.panel-header {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.3em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
}
.panel-header .count {
  background: var(--paper);
  color: var(--ink);
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.15em;
}
.panel-body { padding: 16px; }

/* suspect mugshot card */
.suspect {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--ink-soft);
  background: var(--paper-2);
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 100ms, background 120ms, border-color 120ms;
  position: relative;
}
.suspect:last-child { margin-bottom: 0; }
.suspect:hover { transform: translateX(-2px); border-color: var(--stamp-red); background: var(--paper); }
.suspect.selected {
  border-color: var(--stamp-red);
  background: rgba(178,58,47,0.10);
  box-shadow: inset 0 0 0 1px var(--stamp-red);
}
.suspect.selected::before {
  content: "▶";
  position: absolute;
  left: -22px; top: 50%;
  transform: translateY(-50%);
  color: var(--stamp-red);
  font-size: 14px;
}
.suspect.placed {
  opacity: 0.42;
  pointer-events: none;
  text-decoration: line-through;
  text-decoration-color: var(--stamp-red);
}

.suspect .mug {
  width: 52px; height: 52px;
  background: var(--ink);
  color: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  filter: grayscale(1) contrast(1.05);
  border: 2px solid var(--ink);
  flex-shrink: 0;
  position: relative;
}
.suspect .mug::after {
  content: attr(data-id);
  position: absolute;
  bottom: -1px;
  right: -1px;
  background: var(--gold);
  color: var(--ink);
  font-family: "Special Elite", monospace;
  font-size: 8px;
  padding: 1px 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.suspect .info { flex: 1; }
.suspect .sn {
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  line-height: 1.1;
  color: var(--ink);
}
.suspect .sr {
  font-family: "Special Elite", monospace;
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--ink-faded);
  text-transform: uppercase;
  margin-top: 4px;
}

/* clues — typewritten notes */
.clue {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--paper-2);
  border-left: 3px solid var(--ink-soft);
  font-family: "Special Elite", monospace;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.clue:last-child { margin-bottom: 0; }
.clue:hover { border-left-color: var(--stamp-red); }
.clue.hi {
  background: rgba(182,142,58,0.20);
  border-left-color: var(--stamp-red);
  transform: translateX(-2px);
  box-shadow: 3px 3px 0 rgba(178,58,47,0.15);
}
.clue.hi::after {
  content: "← REVISA";
  font-family: "Caveat", cursive;
  font-size: 16px;
  color: var(--stamp-red);
  margin-left: 4px;
  text-transform: none;
  letter-spacing: normal;
}
.clue .num {
  font-family: "DM Serif Display", serif;
  font-size: 18px;
  font-style: italic;
  color: var(--stamp-red);
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
}
.clue .text { flex: 1; }

/* Status bar */
.status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 14px 28px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  z-index: 50;
  border-top: 3px double var(--paper);
}
.status-bar .left {
  font-family: "Caveat", cursive;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.status-bar .right {
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--gold);
  text-transform: uppercase;
}

/* ============ MODALS ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 50, 0.78);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--paper);
  border: 1px solid var(--ink);
  max-width: 680px;
  width: 100%;
  padding: 40px 44px;
  position: relative;
  box-shadow:
    inset 0 0 80px rgba(120,90,40,0.18),
    14px 14px 0 rgba(0,0,0,0.18);
  max-height: 90vh;
  overflow-y: auto;
}
.modal::before {
  /* top tape */
  content: "";
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 130px; height: 22px;
  background: rgba(212,180,90,0.55);
  border: 1px dashed rgba(120,90,30,0.35);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.modal .case-label {
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--stamp-red);
  text-transform: uppercase;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--stamp-red);
  padding-bottom: 8px;
  display: inline-block;
}
.modal .m-title {
  font-family: "DM Serif Display", serif;
  font-size: 38px;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 18px;
}
.modal .m-victim {
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--stamp-red-2);
  background: rgba(178,58,47,0.08);
  padding: 10px 14px;
  border-left: 3px solid var(--stamp-red);
  margin-bottom: 22px;
  text-transform: uppercase;
}
.modal .m-narr {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 24px;
}
.modal .m-narr::first-letter {
  font-family: "DM Serif Display", serif;
  font-size: 56px;
  float: left;
  line-height: 0.85;
  padding: 4px 8px 0 0;
  color: var(--stamp-red);
}
.modal .m-obj {
  font-family: "Caveat", cursive;
  font-size: 22px;
  color: var(--ink);
  border: 2px solid var(--gold);
  padding: 14px 18px;
  margin-bottom: 30px;
  background: rgba(182,142,58,0.08);
  line-height: 1.4;
}
.modal .m-obj::before {
  content: "OBJECTIU: ";
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--stamp-red);
  margin-right: 8px;
}
.modal .m-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* stamp on intro */
.modal .top-stamp {
  position: absolute;
  top: 30px; right: 36px;
  font-family: "Special Elite", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--stamp-red);
  border: 3px solid var(--stamp-red);
  padding: 6px 12px;
  transform: rotate(8deg);
  text-transform: uppercase;
  opacity: 0.85;
}

/* WRONG modal */
.modal.wrong {
  max-width: 460px;
  text-align: center;
}
.modal.wrong .big-x {
  font-family: "DM Serif Display", serif;
  font-size: 80px;
  color: var(--stamp-red);
  line-height: 1;
  margin-bottom: 14px;
}
.modal.wrong .m-title { font-size: 28px; color: var(--stamp-red); }
.modal.wrong .m-actions { justify-content: center; margin-top: 8px; }

/* VICTORY modal */
.modal.victory {
  text-align: center;
  border-top: 6px solid var(--gold);
}
.modal.victory .v-banner {
  font-family: "Special Elite", monospace;
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--olive);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.modal.victory .m-title {
  font-size: 44px;
  color: var(--stamp-red);
  font-style: italic;
}
.modal.victory .v-mug {
  width: 130px; height: 130px;
  margin: 22px auto 18px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  filter: grayscale(1) contrast(1.1);
  border: 3px solid var(--ink);
  position: relative;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.15);
}
.modal.victory .v-mug::after {
  content: "EVIDÈNCIA #" attr(data-num);
  position: absolute;
  bottom: -22px; left: 50%;
  transform: translateX(-50%);
  font-family: "Special Elite", monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--paper);
  background: var(--stamp-red);
  padding: 3px 8px;
  white-space: nowrap;
}
.modal.victory .v-name {
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  color: var(--ink);
  margin: 30px 0 18px;
}
.modal.victory .v-name strong {
  color: var(--stamp-red);
  font-style: italic;
  font-weight: 400;
}
.modal.victory .m-narr { text-align: left; }
.modal.victory .m-actions { justify-content: center; }

.hidden { display: none !important; }

/* ============ RESPONSIVE MOBILE ============ */
@media (max-width: 700px) {
  /* Header */
  .dossier-header { padding: 30px 16px 20px; }
  .dossier-header h1 { font-size: 40px; margin-top: 18px; }
  .dossier-header .tagline { font-size: 11px; letter-spacing: 0.15em; }
  .stamp { display: none; }

  /* Home */
  .home-main { padding: 32px 16px 60px; }
  .section-bar { flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
  .section-bar .num { font-size: 40px; }
  .section-bar .title { font-size: 26px; }
  .section-bar .rule { display: none; }
  .section-bar .meta { width: 100%; margin-top: 0; }

  .case-grid { grid-template-columns: 1fr; gap: 28px; }
  .case-folder:nth-child(n) { transform: none; }
  .case-folder:hover { transform: translateY(-3px); }

  /* Puzzle page */
  .puzzle-header { padding: 10px 14px; }
  .puzzle-header .crumb { display: none; }
  .puzzle-header .mini { font-size: 18px; }
  .game-layout { padding: 16px 12px 90px; gap: 20px; }
  .case-banner .name { font-size: 26px; min-width: 0; }

  /* Board: 1fr adapta les caselles a l'amplada disponible.
     min-width:0 en .cell és clau: sense ell, el contingut (emoji+text)
     impedeix que les columnes encogeixin per davall del seu min-content. */
  .board { padding: 10px; gap: 6px; width: 100%; max-width: 100%; }
  .board.size-3 { grid-template-columns: repeat(3, 1fr); }
  .board.size-4 { grid-template-columns: repeat(4, 1fr); }
  .board.size-5 { grid-template-columns: repeat(5, 1fr); }

  .cell { min-width: 0; }
  .cell .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }

  /* Emojis escalen amb la mida del tauler */
  .board.size-3 .cell .photo .obj { font-size: 44px; }
  .board.size-4 .cell .photo .obj { font-size: 32px; }
  .board.size-5 .cell .photo .obj { font-size: 22px; }
  .board.size-5 .cell .lbl        { font-size: 11px; }
  .board.size-5 .placed-overlay .pe { font-size: 20px; }
  .board.size-5 .placed-overlay .pn { font-size: 8px; }

  /* Sidebar i pistes: mida llegible en mòbil */
  .panel-header { font-size: 15px; letter-spacing: 0.2em; }
  .panel-body { padding: 12px; }
  .victim-card { font-size: 16px; }
  .board-label { font-size: 14px; letter-spacing: 0.2em; }
  .suspect .sn { font-size: 20px; }
  .suspect .sr { font-size: 14px; letter-spacing: 0.1em; }
  .clue { font-size: 16px; line-height: 1.8; padding: 12px; }
  .clue .num { font-size: 20px; }
  .status-bar .left { font-size: 18px; }
  .status-bar .right { font-size: 14px; letter-spacing: 0.15em; }
  .btn { font-size: 15px; }

  /* Modal: l'overlay fa l'scroll (evita el bug iOS amb overflow dins de fixed) */
  .modal-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }
  .modal { max-height: none; padding: 28px 20px; margin: auto; }
  .modal .m-title { font-size: 28px; }
  .modal .m-narr { font-size: 16px; }
  .modal .m-narr::first-letter { font-size: 40px; }
  .modal .m-obj { font-size: 18px; }
  .modal .top-stamp { display: none; }
  .modal.victory .m-title { font-size: 32px; }
  .modal.victory .v-mug { width: 100px; height: 100px; font-size: 60px; }

  /* Footer */
  .dossier-footer { flex-direction: column; text-align: center; padding: 16px; gap: 8px; }
}

@media (max-width: 400px) {
  .dossier-header h1 { font-size: 30px; }
  .game-layout { padding: 12px 8px 90px; }

  .board { padding: 8px; gap: 6px; }
  .board.size-4 .cell .photo .obj { font-size: 28px; }
  .board.size-5 .cell .photo .obj { font-size: 20px; }
  .board.size-5 .placed-overlay .pe { font-size: 18px; }

  .modal { padding: 20px 16px; }
  .modal .m-title { font-size: 22px; }
  .modal .m-narr { font-size: 15px; }
  .modal .m-narr::first-letter { font-size: 34px; }
  .modal .m-obj { font-size: 16px; }

  .btn { font-size: 12px; padding: 10px 14px; }
}
