/* =============================================================================
   Bridoku · tema pixel art "Primavera silvestre"
   Se carga DESPUÉS de style.css (ver index.html). Solo sobrescribe estilos:
   la lógica del juego no se toca. Sprites: sprites/{floors,items,walls,ui}/
   ========================================================================== */

@font-face { font-family: 'Pixelify Sans'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Pixelify Sans'; font-weight: 700; font-style: normal; font-display: swap;
  src: url('fonts/pixelify-sans-latin-700-normal.woff2') format('woff2'); }

:root {
  --ink: #f6efdc; --ink2: #efe5cb; --panel: #fffaf0; --panel2: #f1e6cf; --line: #4a3550;
  --paper: #fff3d6; --paper2: #ecdcb4; --paper-ink: #4a3550;
  --brass: #9680cf; --brass2: #c0aee6; --blood: #b84a72; --ok: #4a7c59;
  --text: #4a3550; --muted: #6b5470;
  --serif: 'Pixelify Sans', ui-monospace, 'Courier New', monospace;
  --sans: 'Pixelify Sans', ui-monospace, 'Courier New', monospace;
  --wall: #4a3550;
  /* bordes pixel escalonados (sin esquinas redondas) */
  --px: 0 -3px 0 0 #4a3550, 0 3px 0 0 #4a3550, -3px 0 0 0 #4a3550, 3px 0 0 0 #4a3550;
  --px2: 0 -2px 0 0 #4a3550, 0 2px 0 0 #4a3550, -2px 0 0 0 #4a3550, 2px 0 0 0 #4a3550;
}
html, body { background: var(--ink); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: none; }
button { font-family: var(--sans); }
.sp, .av, img.ui, .obj img, .opening { image-rendering: pixelated; image-rendering: crisp-edges; }
img.ui { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }

/* ------------------------------------------------------------------ inicio */
#screen-home { background: linear-gradient(180deg, #d6ecf6 0, #e9f3df 26%, var(--ink) 52%); }
.hero .eyebrow { color: var(--brass); }
.hero h1 { font-family: var(--serif); text-shadow: 3px 3px 0 #f4a9bd, 5px 5px 0 #4a3550; letter-spacing: .1em; }
.hero .rule { height: 6px; background: repeating-linear-gradient(90deg, #f4a9bd 0 6px, #f7d66a 6px 12px, #a7c99b 12px 18px, #c0aee6 18px 24px); }
.hero p { font-style: normal; }
.card { background: var(--panel); border: 0; border-radius: 0; box-shadow: var(--px), inset 0 -4px 0 0 var(--panel2); }
.card.daily { background: #fdf0b0; box-shadow: var(--px), inset 0 -4px 0 0 #f7d66a; }
.card.daily::after { display: none; }
.tag { border-radius: 0; background: var(--panel2); color: var(--text); border: 0; box-shadow: var(--px2); margin: 2px; }
.tag.brass { background: #e9e0f5; color: #4a3550; }
.tag.ok { background: #d9ecd0; color: #2f5a42; }
.btn { border-radius: 0; background: #f4a9bd; color: #4a3550; box-shadow: var(--px), inset 0 -4px 0 0 #e07a9a; }
.btn:active { transform: translateY(2px); box-shadow: var(--px), inset 0 -2px 0 0 #e07a9a; }
.btn.ghost { background: var(--panel); border: 0; box-shadow: var(--px), inset 0 -4px 0 0 var(--panel2); color: var(--text); }
.btn.danger { background: #e07a9a; color: #fffdf6; box-shadow: var(--px), inset 0 -4px 0 0 #b84a72; }
.diff { border-radius: 0; background: var(--panel); border: 0; box-shadow: var(--px), inset 0 -4px 0 0 var(--panel2); }
.diff:active { background: #fdf0b0; }
.diff i { color: #b84a72; }
.link:active { background: #4a355018; }
.fine { color: var(--muted); }

/* ------------------------------------------------------------------ juego */
#screen-play { background: linear-gradient(180deg, #e9f3df 0, var(--ink) 38%); }
.icon-btn { border-radius: 0; color: var(--text); font-size: 20px; }
.icon-btn:active { background: #4a355020; }
.icon-btn img.ui { width: 28px; height: 28px; }
.topbar .ttl small { color: var(--muted); }
.topbar .timer { color: #b84a72; }
.casestrip .vic span { color: var(--text); }
.casestrip .vic b { color: #b84a72; }
.casestrip .vic .av, .casestrip .vic .badge { width: 34px; height: 34px; font-size: 18px; }
.compass { border-radius: 0; border: 0; background: var(--panel); box-shadow: var(--px2); color: var(--muted); }
.compass b { color: #b84a72; }

/* tablero: marco de hierba + doble contorno ciruela */
.board { border-radius: 0; background: var(--wall); outline: 3px solid var(--wall);
  box-shadow: 0 0 0 6px #a7c99b, 0 0 0 9px #4a3550, 0 9px 0 9px rgba(74,53,80,.25); }
.board[data-tool="pen"]   { box-shadow: 0 0 0 6px #a3d1ea, 0 0 0 9px #4a3550, 0 9px 0 9px rgba(74,53,80,.25); }
.board[data-tool="erase"] { box-shadow: 0 0 0 6px #f4a9bd, 0 0 0 9px #4a3550, 0 9px 0 9px rgba(74,53,80,.25); }
.board[data-tool="empty"] { box-shadow: 0 0 0 6px #c0aee6, 0 0 0 9px #4a3550, 0 9px 0 9px rgba(74,53,80,.25); }
/* retícula muy sutil entre casillas de una misma habitación */
.cell { border: 1px solid rgba(74,53,80,.26); background-size: 100% 100%; }
.cell.bt { border-top: 4px solid var(--wall); }
.cell.bb { border-bottom: 4px solid var(--wall); }
.cell.bl { border-left: 4px solid var(--wall); }
.cell.br { border-right: 4px solid var(--wall); }
.cell::before { display: none; }
.board .rl { border-radius: 0; background: #fffaf0; color: #4a3550; box-shadow: var(--px2); font-weight: 700; letter-spacing: .02em; padding: 1px 4px; }
.cell.hl .ring { box-shadow: inset 0 0 0 3px #f7d66a, inset 0 0 0 5px #4a3550; }
.cell.sel .ring { box-shadow: inset 0 0 0 3px #fffdf6, inset 0 0 0 5px #4a3550; }
.cell.badcell .ring, .cell.conflict .ring { box-shadow: inset 0 0 0 3px #b84a72; }
.cell.badcell .ring { background: rgba(184,74,114,.28); }
.cell .blk { background: rgba(74,53,80,.30); }
.cell .emp { background: rgba(74,53,80,.52); }
.cell .emp::after { color: rgba(255,253,246,.6); }
.cell .dim { background: rgba(74,53,80,.20); }

/* fichas con inicial: cuadradas, color del personaje, letra legible (--fg) */
.badge { border-radius: 0; background: var(--c); color: var(--fg, #fffdf6); font-family: var(--sans); font-weight: 700;
  box-shadow: var(--px), inset 0 -4px 0 0 rgba(0,0,0,.2), inset 0 4px 0 0 rgba(255,255,255,.25); }
.tok { inset: 8%; width: 84%; height: 84%; filter: none; }
.tok .badge { font-size: calc(var(--cell) * .46); }
.tok.vic .badge, .tok.vic .av { filter: none; box-shadow: var(--px), inset 0 -4px 0 0 rgba(0,0,0,.2); outline: 2px dashed #f4a9bd; outline-offset: 4px; }
.tok.vic::after { content: ""; width: calc(var(--cell) * .34); height: calc(var(--cell) * .34); right: -10%; top: -12%;
  background: url('sprites/ui/icon_calavera.png') center / contain no-repeat; image-rendering: pixelated; z-index: 2; }
.tok .pin { left: -6%; bottom: -6%; width: calc(var(--cell) * .32); height: calc(var(--cell) * .32); }
.tok .pin img.ui { width: 100%; height: 100%; }

/* notas a lápiz: inicial de cada personaje, su color, 40 % de opacidad */
.pm { inset: 4%; }
.pm i { border-radius: 0; background: var(--c); color: var(--fg, #fffdf6); opacity: .4; margin: 7%;
  font-family: var(--sans); font-weight: 700; font-size: calc(var(--cell) * .21); box-shadow: 0 0 0 2px #4a3550; }

/* bandeja de personajes */
.chip { border-radius: 0; background: var(--panel); border: 0; box-shadow: var(--px2), inset 0 -3px 0 0 var(--panel2); width: 64px; margin: 3px 2px 5px; }
.chip .av, .chip .badge { width: 36px; height: 36px; font-size: 22px; }
.chip .badge { box-shadow: var(--px2), inset 0 -3px 0 0 rgba(0,0,0,.2); margin-top: 2px; }
.chip span { color: var(--text); font-size: 11px; }
.chip.sel { background: #fdf0b0; box-shadow: var(--px), inset 0 -3px 0 0 #f7d66a; }
.chip.placed::after { color: #4a7c59; }
.chip.vic span { color: #b84a72; }
.chip.vic::before { content: ""; width: 14px; height: 14px; left: 3px; top: 1px; background: url('sprites/ui/icon_calavera.png') center / contain no-repeat; image-rendering: pixelated; }
.chip.dup { box-shadow: var(--px2), 0 0 0 5px #b84a72; }
.chip.dup::after { color: #b84a72; }

/* pistas: nombres con el color de cada personaje, estancias y objetos resaltados */
.cluehead b { font-family: var(--serif); }
.cluehead span { color: var(--muted); }
.clue { background: #fff3d6; color: #4a3550; border-radius: 0; box-shadow: var(--px2), inset 0 -3px 0 0 #ecdcb4; line-height: 2.05; font-family: var(--sans); font-size: 15px; margin: 0 3px 10px; padding: 8px 8px 8px 14px; }
.clue::before { display: none; }
.clue.active { outline: 0; box-shadow: var(--px), 0 0 0 6px #f7d66a, inset 0 -3px 0 0 #ecdcb4; }
.clue.done .ctext { opacity: .45; }
.chk { border-radius: 0; border: 0; background: #fffaf0; box-shadow: var(--px2); color: transparent; font-size: 18px; }
.clue.done .chk { background: #a7c99b; color: #2f5a42; }
.pc { border-radius: 0; background: var(--c); color: var(--fg, #fffdf6); font-family: var(--sans); font-weight: 700; font-size: 14px; line-height: 1.35; padding: 0 6px; margin: 0 3px;
  box-shadow: var(--px2), inset 0 -3px 0 0 rgba(0,0,0,.18); }
.pc.v { box-shadow: var(--px2), inset 0 -3px 0 0 rgba(0,0,0,.18), 0 0 0 4px #f4a9bd; }
.rc { border-radius: 0; border: 0; background: var(--c); color: #4a3550; font-family: var(--sans); font-weight: 700; font-size: 14px; line-height: 1.35; padding: 0 6px; margin: 0 3px;
  box-shadow: var(--px2), inset 0 -3px 0 0 rgba(74,53,80,.16); }
.ic { border-radius: 0; border: 0; background: #e2b989; color: #4a3550; font-family: var(--sans); font-weight: 700; font-size: 14px; line-height: 1.35; padding: 0 6px 0 2px; margin: 0 3px; gap: 4px;
  box-shadow: var(--px2), inset 0 -3px 0 0 rgba(74,53,80,.18); }
.ic img { width: 24px; height: 24px; margin: -4px 0; image-rendering: pixelated; }
.ic .em { font-size: 15px; }
.ic.walk { background: #e9e0f5; }
.ic.op { background: #d6ecf6; }
.ic.op.door { background: #f6cdae; }
.clue.rule { background: #fbd9e0; color: #4a3550; box-shadow: var(--px2), inset 0 -3px 0 0 #f4a9bd; }
.clue.rule .rule-ico { background: none; box-shadow: none; }
.clue.rule .rule-ico img.ui { width: 30px; height: 30px; }
.win-sw { background: linear-gradient(0deg, #d6ecf6 0 40%, #6aa9d0 40% 60%, #d6ecf6 60%); box-shadow: 0 0 0 1px #4a3550; }
.door-sw { background: #c58f5c; box-shadow: 0 0 0 1px #4a3550; }

/* barra de modo y de herramientas */
.modebar { color: var(--muted); }
.modebar b { color: var(--text); }
.modebar .m-sol, .modebar .m-pen, .modebar .m-erase, .modebar .m-empty { border-radius: 0; box-shadow: var(--px2); margin: 0 6px 0 2px; }
.modebar .m-sol { background: #fdf0b0; color: #4a3550; }
.modebar .m-pen { background: #d6ecf6; color: #4a3550; }
.modebar .m-erase { background: #fbd9e0; color: #4a3550; }
.modebar .m-empty { background: #e9e0f5; color: #4a3550; }
.bottombar { gap: 8px; padding: 10px 12px 12px; background: linear-gradient(180deg, rgba(246,239,220,0), var(--ink) 30%); }
.tbtn { border-radius: 0; background: var(--panel); border: 0; box-shadow: var(--px2), inset 0 -3px 0 0 var(--panel2); color: var(--text); font-size: 12px; min-height: 58px; }
.tbtn i img.ui { width: 28px; height: 28px; display: block; }
.tbtn:active { background: var(--panel2); transform: translateY(2px); }
.tbtn.primary { background: #f7d66a; color: #4a3550; box-shadow: var(--px2), inset 0 -3px 0 0 #e0a93a; }
.tbtn.on { background: #c0aee6; color: #4a3550; box-shadow: var(--px2), inset 0 -3px 0 0 #9680cf; }
.tbtn.on[data-t="erase"] { background: #f4a9bd; box-shadow: var(--px2), inset 0 -3px 0 0 #e07a9a; }
.tbtn.on[data-t="empty"] { background: #e9e0f5; box-shadow: var(--px2), inset 0 -3px 0 0 #c0aee6; }
@keyframes glow { 50% { box-shadow: var(--px2), 0 0 0 6px #f7d66a, inset 0 -3px 0 0 #e0a93a; } }

/* muebles y aberturas con sprites */
.obj .em { filter: none; }
.obj.hl { outline: 3px solid #f7d66a; box-shadow: 0 0 0 5px #4a3550; border-radius: 0; }
.opening { border-radius: 0; background-size: 100% 100%; background-repeat: no-repeat; box-shadow: none; z-index: 3; }
.opening.door.h { background-image: url('sprites/walls/door_h.png'); }
.opening.door.v { background-image: url('sprites/walls/door_v.png'); }
.opening.win.h  { background-image: url('sprites/walls/window_h.png'); }
.opening.win.v  { background-image: url('sprites/walls/window_v.png'); }
.opening.hl { box-shadow: 0 0 0 3px #f7d66a, 0 0 0 5px #4a3550; }

/* carga, avisos y hojas */
.loading { background: rgba(246,239,220,.92); backdrop-filter: none; }
.loading-card { color: #4a3550; font-family: var(--sans); }
.magnifier img { width: 64px; height: 64px; image-rendering: pixelated; }
.toast { background: #fffaf0; color: #4a3550; border: 0; border-radius: 0; box-shadow: var(--px); }
.sheet-bg { background: rgba(74,53,80,.45); }
.sheet { background: #fffaf0; border: 0; border-radius: 0; box-shadow: 0 -3px 0 0 #4a3550, -3px 0 0 0 #4a3550, 3px 0 0 0 #4a3550; }
.sheet-grip { border-radius: 0; background: #c0aee6; }
.sheet-body p, .sheet-body ul { color: #4a3550; }
.sheet-body h4 { color: #6c58a8; }
.sheet-body img.ui { width: 20px; height: 20px; }
.pick { border-radius: 0; background: var(--panel2); border: 0; box-shadow: var(--px2); }
.pick.sel { background: #fdf0b0; box-shadow: var(--px); }
.row { border-bottom: 2px dotted #4a355033; }
.switch { border-radius: 0; background: #c9bfae; box-shadow: var(--px2); }
.switch::after { border-radius: 0; background: #fffdf6; box-shadow: 0 0 0 2px #4a3550; }
.switch.on { background: #a7c99b; }
.reveal .big { color: #b84a72; }
.gal { border-radius: 0; background: var(--panel2); color: var(--muted); }
.gal small { color: var(--muted); }
.example { border: 3px solid var(--wall); }

@media (min-width: 880px) and (min-height: 560px) {
  .play { padding: 0 24px; }
}

/* ajustes de holgura para que no se recorten los bordes pixel */
.casestrip { padding: 8px 18px 14px; }
.casestrip .vic { gap: 12px; }
.topbar { padding: 8px 12px 4px; }
.tray { padding: 10px 14px 8px; }
.clues { padding: 0 14px 12px; }


/* mesas y alfombras: baldosas fundidas, con 8 px de suelo visible alrededor del conjunto
   (borde transparente) y un contorno + ribete dibujado por dentro (sombras inset) */
.obj.table.sprite, .obj.carpet.sprite {
  --rim: #e07a9a;
  box-sizing: border-box; border: 8px solid transparent; border-radius: 0; transform: none; opacity: 1;
  background-clip: padding-box; background-origin: border-box;
  box-shadow: inset 0 0 0 3px #4a3550, inset 0 0 0 8px var(--rim), inset 0 0 0 11px #4a3550;
}
.obj.t-mesa_larga.sprite { --rim: #c0aee6; }
.obj.t-mesa_regalos.sprite { --rim: #c58f5c; }
.obj.t-alfombra.sprite { --rim: #e07a9a; }
.obj.table.sprite.hl, .obj.carpet.sprite.hl { outline: 3px solid #f7d66a; outline-offset: 0; }

/* ---- Novia caminante en la portada ---- */
/* Franja a todo el ancho de la pantalla: entra y sale por los bordes; sus pies pisan el borde de la tarjeta. */
#screen-home { overflow-x: hidden; }
.walker-stage { position: relative; width: 100vw; margin: 0 0 -11px calc(50% - 50vw); }
.walker-lane { position: relative; width: 100%; height: 112px; overflow: hidden; pointer-events: none; }

/* ---------------------------------------------- app instalada (iPhone y Android) */
/* Con "black-translucent" el juego ocupa también la zona de la barra de estado:
   esta franja hace legible la hora y la batería (texto blanco del sistema). */
.statusbar { position: fixed; left: 0; right: 0; top: 0; height: env(safe-area-inset-top); background: #4a3550; z-index: 90; pointer-events: none; }
.steps { margin: 4px 0 14px; padding-left: 22px; line-height: 1.5; }
.steps li { margin-bottom: 8px; }
.ios-share { display: inline-block; width: 14px; height: 16px; vertical-align: -2px; margin: 0 2px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 18' fill='none' stroke='%234a3550' stroke-width='1.6'%3E%3Cpath d='M7 1v10M3.5 4.5 7 1l3.5 3.5'/%3E%3Cpath d='M4.5 7H2v10h10V7H9.5'/%3E%3C/svg%3E"); }

/* ------------------------------------------------ casos diarios y archivo */
.card.daily .diffgrid { margin-top: 10px; }
.diff.solved { background: #d9ecd0; box-shadow: var(--px), inset 0 -4px 0 0 #a7c99b; }
.diff.solved i { color: #2f5a42; }
.diff.playing { background: #e9e0f5; box-shadow: var(--px), inset 0 -4px 0 0 #c0aee6; }
.diff.playing i { color: #4a3550; }
.home > .btn.ghost { margin-top: 2px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-nav b { font-size: 18px; }
.cal-nav .icon-btn[disabled] { opacity: .25; }
.cal-head, .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head span { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--panel); box-shadow: var(--px2), inset 0 -3px 0 0 var(--panel2); color: var(--text); font-size: 15px;
}
.cal-day:active { background: #fdf0b0; }
.cal-day[disabled] { opacity: .3; box-shadow: none; background: transparent; }
.cal-day.today { background: #fdf0b0; box-shadow: var(--px2), inset 0 -3px 0 0 #f7d66a; }
.cal-day.full { background: #d9ecd0; box-shadow: var(--px2), inset 0 -3px 0 0 #a7c99b; }
.cal-day .pips { display: flex; gap: 2px; height: 6px; }
.cal-day .pips i { width: 6px; height: 6px; background: transparent; box-shadow: inset 0 0 0 1px #4a355066; }
.cal-day .pips i.playing { background: linear-gradient(90deg, #9680cf 50%, transparent 50%); box-shadow: inset 0 0 0 1px #9680cf; }
.cal-day .pips i.solved { background: #4a7c59; box-shadow: none; }

/* Botón de idioma en la esquina del inicio */
#screen-home { position: relative; }
.lang-btn { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 12px; z-index: 5;
  font: 700 13px var(--sans, inherit); letter-spacing: .04em; color: #4a3550; background: #f6efdc;
  border: 2px solid #4a3550; border-radius: 0; padding: 6px 10px; box-shadow: 2px 2px 0 #4a3550; cursor: pointer; }
.lang-btn:active { transform: translate(2px, 2px); box-shadow: none; }

/* Móviles bajos: la portada cabe sin scroll */
@media (max-height: 740px) {
  .home { padding: 12px 18px 12px; gap: 8px; }
  .hero { padding: 8px 0 0; }
  .hero .rule { margin: 8px auto; }
  .card.daily .diffgrid { margin-top: 6px; }
  .fine { display: none; }
}

/* ---- Pantalla de puzle: todos los personajes en una fila y ventana inicial del caso ---- */
.tray { display: flex; flex-wrap: nowrap; overflow: visible; gap: 4px; justify-content: center; padding: 8px 10px 4px; }
.tray .chip { flex: 1 1 0; width: auto; min-width: 0; max-width: 64px; margin: 3px 0 5px; padding: 4px 0 5px; container-type: inline-size; }
.tray .chip .av, .tray .chip .badge { width: min(36px, 72cqw); height: min(36px, 72cqw); font-size: min(22px, 44cqw); }
.tray .chip span { font-size: clamp(7px, 17cqw, 11px); }
.tray .chip.vic::before { width: 12px; height: 12px; left: 1px; top: 0; }
.topbar .ttl { cursor: pointer; }
.intro-bg { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(74,53,80,.55); }
.intro-card { width: 100%; max-width: 340px; background: #fdf6e3; color: #4a3550; text-align: center; padding: 22px 20px 20px;
  box-shadow: var(--px), inset 0 -4px 0 0 #efe3c4; font-family: var(--sans); }
.intro-card .intro-av .av, .intro-card .intro-av .badge { width: 72px; height: 72px; font-size: 40px; margin: 0 auto; }
.intro-card h2 { margin: 10px 0 0; font-family: var(--serif); font-size: 22px; }
.intro-card small { display: block; color: var(--muted); letter-spacing: .04em; margin-bottom: 12px; }
.intro-card p { margin: 0 0 16px; font-size: 16px; line-height: 1.5; }
.intro-card b { color: #b84a72; }
