/* ===========================================================================
   MURDOKU · estilos
   =========================================================================== */
:root {
  --ink: #14121a; --ink2: #1b1824; --panel: #252132; --panel2: #302b42; --line: #453e5e;
  --paper: #f2e9d3; --paper2: #e4d6b4; --paper-ink: #2b2418;
  --brass: #d9a441; --brass2: #f0c56a; --blood: #d9503f; --ok: #5cb86f;
  --text: #f0ead9; --muted: #a49cba;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ah: 100vh;
  --wall: #17141f;
  --board: max(280px, min(calc(100vw - 20px), calc(var(--ah) - 400px), 540px));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: var(--ink); color: var(--text);
  font-family: var(--sans); overscroll-behavior: none; overflow: hidden;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
img { -webkit-user-drag: none; }
.sp { image-rendering: pixelated; image-rendering: crisp-edges; }

#app { position: fixed; inset: 0; height: var(--ah); overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: none; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.on { display: flex; }

/* ------------------------------------------------------------------ HOME */
#screen-home {
  background:
    radial-gradient(120% 70% at 50% -10%, #3a2f52 0%, rgba(20,18,26,0) 60%),
    radial-gradient(90% 60% at 50% 120%, #3b1f26 0%, rgba(20,18,26,0) 65%), var(--ink);
  overflow-y: auto;
}
.home { width: 100%; max-width: 460px; margin: 0 auto; padding: 28px 18px 28px; display: flex; flex-direction: column; gap: 14px; }
.hero { text-align: center; padding: 18px 0 8px; }
.hero .eyebrow { font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: var(--brass); }
.hero h1 {
  margin: 8px 0 6px; font-family: var(--serif); font-weight: 700; font-size: 46px; letter-spacing: .14em;
  text-transform: uppercase; line-height: 1; text-shadow: 0 2px 0 #000a, 0 0 28px rgba(217,164,65,.25);
}
.hero .rule { height: 2px; width: 120px; margin: 12px auto; background: linear-gradient(90deg, transparent, var(--brass), transparent); }
.hero p { margin: 0; color: var(--muted); font-size: 14px; font-style: italic; font-family: var(--serif); }

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--ink2) 100%);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}
.card.daily { border-color: #6b5530; background: linear-gradient(180deg, #34293a 0%, #221d2d 100%); position: relative; overflow: hidden; }
.card.daily::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(217,164,65,.22), transparent 70%); }
.card h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 20px; letter-spacing: .02em; }
.card .meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; background: #ffffff12; color: var(--text); border: 1px solid #ffffff1c; }
.tag.brass { background: #d9a44122; border-color: #d9a44166; color: var(--brass2); }
.tag.ok { background: #5cb86f22; border-color: #5cb86f77; color: #9be3ab; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 48px; padding: 0 18px; border-radius: 12px; font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(180deg, var(--brass2), var(--brass)); color: #2a1f08;
  box-shadow: 0 2px 0 #7a5a1c, 0 6px 18px rgba(0,0,0,.35); transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 #7a5a1c, 0 3px 10px rgba(0,0,0,.35); }
.btn.ghost { background: var(--panel2); color: var(--text); box-shadow: 0 2px 0 #1a1624; border: 1px solid var(--line); }
.btn.danger { background: linear-gradient(180deg, #e8685a, var(--blood)); color: #fff; box-shadow: 0 2px 0 #7b2a21; }
.btn.small { min-height: 38px; font-size: 14px; width: auto; }

.diffgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diff {
  text-align: left; padding: 12px 12px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; min-height: 76px;
}
.diff:active { background: var(--panel2); }
.diff b { font-family: var(--serif); font-size: 18px; }
.diff span { font-size: 12px; color: var(--muted); }
.diff i { font-style: normal; font-size: 11px; color: var(--brass2); letter-spacing: .08em; }
.sectiontitle { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin: 6px 2px 0; }
.linkrow { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.link { padding: 10px 14px; color: var(--muted); font-size: 14px; border-radius: 10px; }
.link:active { background: #ffffff10; }
.fine { text-align: center; color: #6f6885; font-size: 12px; }

/* ------------------------------------------------------------------ JUEGO */
#screen-play { background: radial-gradient(130% 50% at 50% 0%, #2b2440 0%, var(--ink) 70%); }
.play { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 560px; margin: 0 auto; overflow-y: auto; overflow-x: hidden; }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; min-height: 46px; flex: none; }
.topbar .ttl { flex: 1; text-align: center; font-family: var(--serif); font-size: 15px; line-height: 1.15; }
.topbar .ttl small { display: block; font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.topbar .timer { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--brass2); font-size: 14px; font-weight: 700; }
.icon-btn { width: 36px; height: 40px; flex: none; border-radius: 12px; display: inline-grid; place-items: center; font-size: 18px; color: var(--text); }
.icon-btn:active { background: #ffffff14; }

.casestrip { display: flex; align-items: center; gap: 10px; padding: 4px 12px 8px; flex: none; }
.casestrip .vic { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.casestrip .vic .av { width: 30px; height: 30px; flex: none; }
.casestrip .vic span { font-size: 12.5px; line-height: 1.2; color: #e6dcc6; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.casestrip .vic b { color: #ff9c8f; }
.compass { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 11px; line-height: 1; background: #ffffff08; }
.compass b { display: block; color: var(--brass2); font-size: 13px; text-align: center; }

/* tablero */
.boardwrap { flex: none; display: flex; justify-content: center; padding: 0 10px; }
.board {
  --n: 6; --cell: calc(var(--board) / var(--n));
  display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  width: var(--board); height: var(--board); background: var(--wall); border-radius: 6px;
  outline: 3px solid var(--wall); box-shadow: 0 0 0 5px #3d3550, 0 14px 40px rgba(0,0,0,.55);
  position: relative; overflow: hidden;
}
.cell {
  position: relative; background-color: var(--fl, #ddd); background-size: 100% 100%; image-rendering: pixelated;
  border: 1px solid rgba(20, 16, 30, .16); overflow: hidden; cursor: pointer;
}
.cell.bt { border-top: 3px solid var(--wall); }
.cell.bb { border-bottom: 3px solid var(--wall); }
.cell.bl { border-left: 3px solid var(--wall); }
.cell.br { border-right: 3px solid var(--wall); }
.cell::before { /* sombra interior suave para dar volumen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(0,0,0,.06));
}
.cell > * { position: absolute; }
.board .rl {
  position: absolute; z-index: 4; pointer-events: none; font-size: clamp(6.5px, calc(var(--cell) * .15), 9.5px); letter-spacing: .04em; text-transform: uppercase; font-weight: 800;
  background: rgba(20,16,30,.8); color: #f4ecd8; padding: 1px 4px; border-radius: 4px; white-space: nowrap; line-height: 1.25;
}
.cell .ring { inset: 0; z-index: 7; pointer-events: none; }
.cell.hl .ring { box-shadow: inset 0 0 0 3px var(--brass2); animation: pulse 1.1s ease-in-out infinite; }
.cell.sel .ring { box-shadow: inset 0 0 0 3px #fff; }
.cell.badcell .ring { box-shadow: inset 0 0 0 3px var(--blood); background: rgba(217,80,63,.28); animation: shake .4s; }
.cell.conflict .ring { box-shadow: inset 0 0 0 3px var(--blood); }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shake { 20% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }

.tok { z-index: 6; inset: 6%; width: 88%; height: 88%; display: grid; place-items: center; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.tok .av, .tok .badge { width: 100%; height: 100%; }
.tok.vic .av { filter: grayscale(.8) brightness(.8); }
.tok .pin { position: absolute; left: -1px; bottom: -1px; font-size: calc(var(--cell) * .26); }
.av { object-fit: contain; display: block; }
.badge {
  display: grid; place-items: center; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-family: var(--serif);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), inset 0 -4px 0 rgba(0,0,0,.18); font-size: calc(var(--cell) * .42); line-height: 1;
}

/* bandeja de personajes */
.tray { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 6px; flex: none; scrollbar-width: none; }
.tray::-webkit-scrollbar { display: none; }
.chip {
  flex: none; width: 60px; padding: 5px 3px 4px; border-radius: 12px; background: var(--panel); border: 2px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative;
}
.chip .av, .chip .badge { width: 36px; height: 36px; font-size: 17px; }
.chip span { font-size: 10.5px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d9d2c4; }
.chip.sel { border-color: var(--brass2); background: #3a3150; box-shadow: 0 0 0 2px rgba(240,197,106,.25); }
.chip.placed::after { content: "✓"; position: absolute; right: 3px; top: 1px; font-size: 11px; color: var(--ok); font-weight: 900; }
.chip.vic span { color: #ff9c8f; }
.chip.vic::before { content: "💀"; position: absolute; left: 2px; top: 0; font-size: 11px; }
.chip.pulse { animation: pulse 1s ease-in-out infinite; }
.chip.bad { border-color: var(--blood); }

/* pistas */
.cluehead { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 16px 4px; flex: none; }
.cluehead b { font-family: var(--serif); font-size: 15px; letter-spacing: .03em; }
.cluehead span { font-size: 12px; color: var(--muted); }
.clues { flex: 1 1 auto; min-height: 130px; overflow-y: auto; padding: 0 12px 10px; list-style: none; margin: 0; -webkit-overflow-scrolling: touch; }
.clue {
  display: flex; align-items: center; gap: 10px; background: var(--paper); color: var(--paper-ink); border-radius: 10px;
  padding: 9px 8px 9px 12px; margin-bottom: 7px; font-size: 14px; line-height: 1.55; font-family: var(--serif); position: relative;
  box-shadow: 0 2px 0 #b9a77b, 0 4px 10px rgba(0,0,0,.25);
}
.clue::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--brass); border-radius: 3px; }
.clue .ctext { flex: 1; min-width: 0; }
.clue.done .ctext { opacity: .42; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.clue.active { outline: 2px solid var(--brass2); }
.chk { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #b9a77b; display: grid; place-items: center; color: transparent; font-weight: 900; }
.clue.done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.pc { display: inline-block; padding: 0 7px 1px; border-radius: 99px; background: var(--c); color: #fff; font-family: var(--sans); font-weight: 700; font-size: 12.5px; line-height: 1.5; margin: 0 1px; white-space: nowrap; box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.pc.v { box-shadow: 0 0 0 2px #fff0, inset 0 0 0 1.5px rgba(255,255,255,.55); }
.rc { display: inline-block; padding: 0 7px 1px; border-radius: 6px; background: var(--c); color: #2b2418; font-family: var(--sans); font-weight: 700; font-size: 12.5px; line-height: 1.5; margin: 0 1px; border: 1px solid rgba(0,0,0,.18); white-space: nowrap; }
.ic { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px 0 3px; border-radius: 6px; background: #d9cca8; font-family: var(--sans); font-size: 12.5px; font-weight: 600; line-height: 1.5; margin: 0 1px; white-space: nowrap; border: 1px solid rgba(0,0,0,.12); }
.ic .em { font-size: 14px; line-height: 1; } .ic img { width: 17px; height: 17px; object-fit: contain; }

/* barra inferior */
.bottombar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 8px 10px calc(8px + 2px); flex: none; background: linear-gradient(180deg, rgba(20,18,26,0), var(--ink) 30%); position: sticky; bottom: 0; }
.tbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 11px; color: #d9d2c4; min-height: 52px; justify-content: center; }
.tbtn i { font-style: normal; font-size: 19px; line-height: 1; }
.tbtn:active { background: var(--panel2); }
.tbtn.primary { background: linear-gradient(180deg, var(--brass2), var(--brass)); color: #2a1f08; border-color: #a97d27; font-weight: 800; }
.tbtn.glow { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(240,197,106,.35); } }
.tbtn[disabled] { opacity: .4; }

/* escritorio / apaisado */
@media (min-width: 880px) and (min-height: 560px) {
  :root { --board: min(calc(var(--ah) - 190px), 620px); }
  .play { max-width: 1060px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto auto auto 1fr auto; column-gap: 20px; padding: 0 20px; }
  .topbar { grid-column: 1 / 3; } .casestrip { grid-column: 1 / 3; }
  .boardwrap { grid-column: 1; grid-row: 3 / 8; align-items: flex-start; padding: 0; }
  .tray { grid-column: 2; grid-row: 4; flex-wrap: wrap; overflow: visible; }
  .modebar { grid-column: 2; grid-row: 3; text-align: left; padding: 0 4px; } .cluehead { grid-column: 2; grid-row: 5; }
  .clues { grid-column: 2; grid-row: 6; min-height: 0; }
  .bottombar { grid-column: 2; grid-row: 7; position: static; }
}

/* ------------------------------------------------------------ Carga / toasts */
.loading { position: fixed; inset: 0; background: rgba(12,10,18,.86); display: none; place-items: center; z-index: 50; backdrop-filter: blur(4px); }
.loading.on { display: grid; }
.loading-card { text-align: center; font-family: var(--serif); font-size: 17px; color: var(--paper); }
.magnifier { font-size: 54px; animation: sweep 1.6s ease-in-out infinite; display: inline-block; margin-bottom: 10px; }
@keyframes sweep { 0% { transform: translateX(-22px) rotate(-12deg); } 50% { transform: translateX(22px) rotate(12deg); } 100% { transform: translateX(-22px) rotate(-12deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #0d0b12ee; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 86%; text-align: center; z-index: 80; transition: .22s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ Hojas modales */
.sheet-bg { position: fixed; inset: 0; background: rgba(8,6,12,.62); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.sheet-bg.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; margin: 0 auto; max-width: 560px; max-height: calc(var(--ah) - 40px);
  background: linear-gradient(180deg, #2a253a, #1c1926); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
  transform: translateY(105%); transition: transform .26s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.on { transform: none; }
.sheet-grip { width: 44px; height: 4px; border-radius: 4px; background: #ffffff33; margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 0 18px; flex: none; }
.sheet-head h2 { margin: 0; font-family: var(--serif); font-size: 20px; }
.sheet-body { padding: 8px 18px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-body p { margin: 0 0 10px; line-height: 1.5; color: #ddd5c6; font-size: 15px; }
.sheet-body h4 { margin: 14px 0 6px; font-family: var(--serif); font-size: 16px; color: var(--brass2); }
.sheet-body ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.5; color: #ddd5c6; font-size: 14.5px; }
.sheet-body li { margin-bottom: 4px; }
.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: 12px; background: var(--panel); border: 2px solid transparent; font-size: 11px; text-align: center; }
.pick .av, .pick .badge { width: 40px; height: 40px; font-size: 18px; } .pick .em { font-size: 30px; line-height: 40px; height: 40px; }
.pick img.sp.wp { width: 40px; height: 40px; object-fit: contain; }
.pick.sel { border-color: var(--brass2); background: #3a3150; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #ffffff12; }
.row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.switch { flex: none; width: 50px; height: 30px; border-radius: 99px; background: #4a4360; position: relative; transition: .15s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .15s; }
.switch.on { background: var(--ok); } .switch.on::after { left: 23px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.reveal { text-align: center; }
.reveal .big { font-family: var(--serif); font-size: 26px; margin: 4px 0 10px; color: var(--brass2); }
.reveal .cast { display: flex; justify-content: center; gap: 14px; align-items: center; margin: 8px 0 12px; }
.reveal .cast .av, .reveal .cast .badge { width: 76px; height: 76px; font-size: 34px; }
.reveal .cast .em { font-size: 52px; }
.reveal .stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0 14px; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gal { background: var(--panel); border-radius: 10px; padding: 6px 2px; text-align: center; font-size: 10px; color: var(--muted); position: relative; word-break: break-all; }
.gal small { display: block; color: #8f87a6; font-size: 9.5px; word-break: normal; }
.gal .box { height: 44px; display: grid; place-items: center; font-size: 28px; } .gal .box img { width: 44px; height: 44px; object-fit: contain; }
.gal.ok { outline: 1px solid #5cb86f88; } .gal.ok::after { content: "✓"; position: absolute; right: 4px; top: 2px; color: var(--ok); font-weight: 900; font-size: 11px; }
.gal.miss .box { opacity: .5; filter: grayscale(1); }
.hint { font-size: 12.5px; color: var(--muted); }
.example { display: grid; grid-template-columns: repeat(4, 1fr); width: 176px; margin: 8px auto; border: 3px solid var(--wall); background: var(--wall); }
.example div { aspect-ratio: 1; display: grid; place-items: center; font-size: 20px; border: 1px solid rgba(0,0,0,.15); }

/* =================================================== Plano v2: muebles, muros, marcas */
.board[data-tool="sol"] { box-shadow: 0 0 0 5px #3d3550, 0 14px 40px rgba(0,0,0,.55); }
.board[data-tool="pen"] { box-shadow: 0 0 0 5px #3f6e9e, 0 14px 40px rgba(0,0,0,.55); }
.board[data-tool="erase"] { box-shadow: 0 0 0 5px #9e4a3f, 0 14px 40px rgba(0,0,0,.55); }
.board[data-tool="empty"] { box-shadow: 0 0 0 5px #5d5670, 0 14px 40px rgba(0,0,0,.55); }
.board .layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.board .layer > * { position: absolute; }
.board .layer.top { z-index: 4; }
.tok.vic .badge, .tok.vic .av { filter: grayscale(.7) brightness(.85); }
.tok.vic::after { content: "💀"; position: absolute; right: -4%; top: -6%; font-size: calc(var(--cell) * .28); }

/* muebles */
.obj { display: grid; place-items: center; }
.obj .em { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: calc(var(--cell) * .5); line-height: 1; filter: drop-shadow(0 2px 1px rgba(0,0,0,.35)); }
.obj img.sp { width: 100%; height: 100%; object-fit: fill; }
.obj img.sp.rot { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(90deg); max-width: none; }
.obj.one:not(.sprite) { padding: 8%; }
.obj.pair:not(.sprite) { margin: 0; }
.obj.pair:not(.sprite)::before {
  content: ""; position: absolute; inset: 12%; border-radius: 10px; z-index: -1;
  background: rgba(255,255,255,.35); border: 2px solid rgba(60,40,20,.28);
}
.obj.pair.walk:not(.sprite)::before { background: rgba(255,248,235,.55); border-color: rgba(90,60,120,.35); }
.obj.pair.t-cama:not(.sprite)::before { background: linear-gradient(90deg, #fbf6ee 0 22%, #9fb6d9 22% 100%); border-color: #6b7fa3; }
.obj.pair.vert.t-cama:not(.sprite)::before { background: linear-gradient(180deg, #fbf6ee 0 22%, #9fb6d9 22% 100%); }
.obj.pair.t-sofa:not(.sprite)::before { background: #b0505a; border: 3px solid #7d2f38; border-radius: 12px; }
.obj.pair.t-banco:not(.sprite)::before { background: #a87a4a; border: 2px solid #6e4a26; border-radius: 6px; inset: 30% 10%; }
.obj.pair.vert.t-banco:not(.sprite)::before { inset: 10% 30%; }
.obj.carpet { margin: 0; border-radius: 6px; inset: auto; }
.obj.carpet:not(.sprite) {
  transform: scale(.9);
  background:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(255,255,255,.08) 7px 9px),
    radial-gradient(circle at 50% 50%, var(--cb) 0 14%, transparent 15%),
    var(--ca);
  border: 3px double var(--cb); opacity: .9;
}
.obj.carpet.sprite, .obj.table.sprite { background-size: calc(100% / var(--w)) calc(100% / var(--h)); background-repeat: repeat; image-rendering: pixelated; }
.obj.table:not(.sprite) {
  transform: scale(.82); border-radius: 8px;
  background: linear-gradient(135deg, #b07a46, #8a5a30); border: 2px solid #5e3a1c;
  box-shadow: inset 0 0 0 3px rgba(255,230,190,.25), 0 3px 4px rgba(0,0,0,.35);
}
.obj.hl { outline: 3px solid var(--brass2); outline-offset: -2px; animation: pulse 1.1s ease-in-out infinite; border-radius: 6px; }

/* puertas y ventanas en los muros */
.opening { z-index: 3; border-radius: 2px; }
.opening.win { background: linear-gradient(var(--dirw, 0deg), #d8f1fb 0 40%, #6aa6c4 40% 60%, #d8f1fb 60%); box-shadow: 0 0 0 1.5px #2f5c75; }
.opening.win.v { --dirw: 90deg; }
.opening.door { background: #e6d6b6; box-shadow: 0 0 0 1.5px #7a4f2a, inset 0 0 0 2px #b88a58; }
.opening.hl { animation: pulse 1s ease-in-out infinite; box-shadow: 0 0 0 3px var(--brass2); }

/* casillas: bloqueadas, marcadas vacías, oscurecidas por fila/columna */
.cell .blk { inset: 0; z-index: 3; pointer-events: none; background: rgba(18,14,26,.40); }
.cell .emp { inset: 0; z-index: 3; pointer-events: none; background: rgba(18,14,26,.58); }
.cell .emp::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.35); font-weight: 900; font-size: calc(var(--cell) * .4); }
.cell .dim { inset: 0; z-index: 3; pointer-events: none; background: rgba(18,14,26,.30); }

/* marcas a lápiz */
.pm { inset: 3%; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); pointer-events: none; }
.pm i {
  font-style: normal; display: grid; place-items: center; font-weight: 800; font-family: var(--sans);
  font-size: calc(var(--cell) * .2); line-height: 1; color: #fff; background: var(--c); border-radius: 50%;
  margin: 8%; box-shadow: 0 1px 1px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.45);
}
.cell .tok { z-index: 5; }
.cell .tok .badge { font-family: var(--sans); }

/* barra de modo */
.modebar { flex: none; text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 12px 0; min-height: 24px; }
.modebar b { color: var(--text); }
.modebar .m-sol, .modebar .m-pen, .modebar .m-erase, .modebar .m-empty { display: inline-block; padding: 0 7px; border-radius: 99px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; margin-right: 4px; }
.modebar .m-sol { background: #d9a44133; color: var(--brass2); }
.modebar .m-pen { background: #3f6e9e55; color: #a8cdf2; }
.modebar .m-erase { background: #9e4a3f55; color: #ffb3a8; }
.modebar .m-empty { background: #5d567088; color: #ddd; }

.chip.dup { border-color: var(--blood); }
.chip.dup::after { content: "×2"; position: absolute; right: 3px; top: 1px; font-size: 10px; color: #ff8b7d; font-weight: 900; }
.tbtn.on { background: #3f6e9e; border-color: #7fb0e0; color: #fff; }
.tbtn.on[data-t="erase"] { background: #9e4a3f; border-color: #e08a7f; }
.tbtn.on[data-t="empty"] { background: #5d5670; border-color: #aaa3c0; }

/* fichas de las pistas */
.ic.walk { background: #e3d3f0; }
.ic.op { background: #d3e8f0; }
.ic.op.door { background: #ead9bf; }
.sw { display: inline-block; width: 14px; height: 12px; border-radius: 3px; vertical-align: middle; }
.carpet-sw { background: repeating-linear-gradient(45deg, #8e2f36 0 3px, #d6a54a 3px 5px); }
.table-sw { background: linear-gradient(135deg, #b07a46, #8a5a30); }
.win-sw { background: linear-gradient(0deg, #d8f1fb 0 40%, #6aa6c4 40% 60%, #d8f1fb 60%); box-shadow: 0 0 0 1px #2f5c75; height: 7px; }
.door-sw { background: #e6d6b6; box-shadow: 0 0 0 1px #7a4f2a; height: 7px; }
.gal .box .sw { width: 34px; height: 26px; }
.gal .box .win-sw, .gal .box .door-sw { height: 10px; }
.taburete-sw { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle, #c98f52 0 45%, #7a4f2a 46% 60%, #c98f52 61%); box-shadow: 0 0 0 1px #5e3a1c; }
.obj .sw.taburete-sw { width: calc(var(--cell) * .42); height: calc(var(--cell) * .42); }
.gal .box .taburete-sw { width: 30px; height: 30px; }
.clue.rule { background: #3a2a33; color: #f3dfe4; box-shadow: 0 2px 0 #241a20, 0 4px 10px rgba(0,0,0,.25); }
.clue.rule::before { background: var(--blood); }
.clue.rule .rule-ico { border: 0; color: inherit; font-size: 18px; }
