:root{
  --purple:#7861dc;--deep:#372765;--ink:#302448;--paper:#f5f1ff;--coral:#ff907f;
  --sans:Arial,Helvetica,sans-serif;--serif:var(--sans);
  --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:24px;
  --page-gutter:12px;--coordinate-gutter:12px;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
body{font-family:var(--sans);font-size:14px;background:var(--purple);color:var(--ink);-webkit-text-size-adjust:100%}
button,a{-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation;user-select:none;border:0}
button:disabled{opacity:.45;cursor:default}
button:focus-visible,a:focus-visible{outline:3px solid #ffb944;outline-offset:2px}
[hidden]{display:none!important}
.app-shell{height:100%;height:100dvh;max-width:600px;margin:auto;display:flex;flex-direction:column;gap:var(--space-2);padding:calc(env(safe-area-inset-top) + var(--space-1)) max(var(--page-gutter),env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--space-2)) max(var(--page-gutter),env(safe-area-inset-left));overflow:hidden}
.icon{display:inline-flex;width:20px;height:20px;flex-shrink:0;align-items:center;justify-content:center}
.icon svg{width:100%;height:100%;stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
.icon-button{display:inline-flex;align-items:center;justify-content:center;background:transparent;border-radius:12px;width:40px;height:40px;padding:0;flex-shrink:0}
.topbar{display:flex;align-items:center;justify-content:space-between;flex:0 0 48px;gap:var(--space-3);color:white}
.topbar #story-button{flex:1;min-width:0;display:flex;align-items:flex-start;justify-content:center;flex-direction:column;gap:var(--space-1);padding:0;background:transparent;border-radius:0;text-align:left;color:white}
.header-meta{display:flex;align-items:center;gap:var(--space-2);font-size:9px;font-weight:600;color:#e6deff;line-height:12px}
.header-meta .brand{font-size:14px;line-height:14px;letter-spacing:-.4px;font-weight:900;color:white}
.header-case-title{font-size:18px;font-weight:800;line-height:22px;letter-spacing:-.3px;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.topbar nav{display:flex;gap:var(--space-1);align-items:center}
.topbar .icon-button{background:#ffffff1b}
#game{min-height:0;flex:1;display:flex;flex-direction:column;gap:var(--space-2)}
.suspect-panel{flex:0 0 auto;min-width:0;min-height:0;overflow:visible}
.suspect-tools{display:flex;align-items:center;justify-content:space-between;min-height:28px;margin-bottom:var(--space-1);color:#eee8ff;font-size:12px;line-height:16px;font-weight:700}
#suspect-view-button{color:white;background:#ffffff26;border-radius:8px;font-size:10px;font-weight:700;padding:var(--space-1) var(--space-2);min-height:28px}
.suspects{position:relative;display:flex;gap:var(--space-2);overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:none;scroll-snap-type:x proximity;scroll-padding-inline:0;padding:0;touch-action:pan-x}
.suspects::-webkit-scrollbar{display:none}
.suspect{position:relative;flex:0 0 176px;min-width:0;min-height:108px;height:auto;border-radius:12px;padding:10px;text-align:left;scroll-snap-align:start;transform-origin:top left;display:flex;align-items:stretch;justify-content:flex-start;flex-direction:column;gap:3px;background:#9480e9;color:white}
.suspect.active{background:#ffcc70;color:var(--deep);box-shadow:inset 0 0 0 2px #fff3d6}
.suspect.victim-card:not(.active){background:#e991a5;color:#472137}
.person-card-header{display:flex;align-items:center;gap:var(--space-2);min-width:0;padding-right:var(--space-3)}
.avatar{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--person-color);flex-shrink:0}
.avatar img{width:32px;height:32px;image-rendering:auto}
.person-identity{display:flex;flex-direction:column;gap:1px;min-width:0}
.person-name{font-size:12px;font-weight:800;line-height:16px;overflow-wrap:anywhere}
.card-role{font-size:9px;line-height:12px;opacity:.7}
.card-clues{display:flex;flex-direction:column;gap:3px}
.clue{display:block;font-size:11px;line-height:14px;font-weight:500;margin:0}
.card-clues .victim-rule{color:inherit;font-size:10px;line-height:14px;font-weight:700;margin:0}
.person-status{position:absolute;right:var(--space-2);top:var(--space-2);font-size:8px;line-height:12px;width:12px;height:12px;border-radius:50%;background:#ffffffb0;color:var(--deep);font-weight:800;text-align:center}
.person-status:not(.placed){display:none}
.suspect-panel.expanded{flex:0 0 auto;min-height:0;max-height:none;overflow:visible}
.expanded .suspects{display:grid;grid-template-columns:repeat(var(--suspect-columns,3),minmax(0,1fr));overflow:visible;gap:var(--space-2);scroll-snap-type:none;touch-action:pan-y}
.expanded .suspect{flex:none;width:100%;padding:var(--space-2);min-height:104px}
.expanded .person-card-header{gap:var(--space-1);padding-right:var(--space-3)}
.expanded .avatar{width:24px;height:24px}
.expanded .avatar img{width:24px;height:24px}
.expanded .person-name{font-size:10px;line-height:12px}
.expanded .card-role{font-size:8px;line-height:10px}
.expanded .clue{font-size:10px;line-height:12px}
.expanded .person-status{right:var(--space-1);top:var(--space-1)}
/* The labels and legend belong to the board frame, rather than the page. */
.scene-panel{flex:1;min-height:0;display:flex;flex-direction:column;background:transparent;padding:0}
.scene-meta{display:none}
.scene-wrap{flex:1;min-height:0;display:flex;justify-content:center;align-items:center;container-type:size}
.board-area{width:min(100cqw,calc(100cqh - 16px),620px);display:grid;grid-template-columns:var(--coordinate-gutter) minmax(0,1fr) var(--coordinate-gutter);grid-template-rows:16px auto 16px;row-gap:var(--space-1);flex-shrink:0;position:relative}
.board{grid-column:2;grid-row:2;display:grid;grid-template-columns:repeat(var(--size),1fr);aspect-ratio:1;min-width:0;border:3px solid #5a4878;border-radius:4px;overflow:hidden;background:#5a4878;isolation:isolate}
.col-labels{grid-column:2;grid-row:1;display:grid;grid-template-columns:repeat(var(--size),1fr);align-items:center;text-align:center;color:#eee6ff;font-size:9px;line-height:12px;font-weight:700}
.row-labels{grid-column:1;grid-row:2;display:grid;grid-template-rows:repeat(var(--size),1fr);align-items:center;text-align:left;font-size:9px;font-weight:700;color:#eee6ff}
.room-legend{grid-column:2;grid-row:3;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-2);align-items:center;font-size:9px;line-height:12px;font-weight:600;color:#eee6ff;min-width:0}
.room-key{display:flex;align-items:center;gap:var(--space-1);min-width:0}
.room-key span:first-child{height:8px;width:8px;border-radius:2px;flex-shrink:0}
.room-key span:last-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cell{position:relative;display:flex;justify-content:center;align-items:center;min-width:0;min-height:0;padding:0;aspect-ratio:1;background:var(--room);border-right:1px solid #5a487821;border-bottom:1px solid #5a487821;border-radius:0}
.cell.wall-east{border-right:3px solid #5a4878}
.cell.wall-south{border-bottom:3px solid #5a4878}
.cell.rug::before{content:'';position:absolute;inset:4px;background:#de826d;border:2px solid #f5b09a;pointer-events:none}
.cell.rug.room-1::before{background:#83a870;border-color:#aecb97}
.cell.rug.room-3::before{background:#7f9ecb;border-color:#abc4e7}
.cell .object{position:relative;width:91%;height:91%;object-fit:contain;pointer-events:none}
.cell.blocked{cursor:default}
.cell.assist::after{content:'';position:absolute;inset:1px;border:2px dashed #526945;background:#ffffff33;pointer-events:none}
.cell.taken-line{background-image:linear-gradient(#39274a18,#39274a18)}
.cell.selected-cell{box-shadow:inset 0 0 0 3px #fff6c8;z-index:1}
.cell.conflict{box-shadow:inset 0 0 0 3px #ec405a}
.person-token{position:relative;display:flex;align-items:center;justify-content:center;width:76%;height:76%;background:var(--person-color);border:2px solid #fff6dc;border-radius:30%;z-index:2;pointer-events:none}
.person-token img{width:100%;height:100%;image-rendering:auto;pointer-events:none;-webkit-user-drag:none}
.draggable-person .person-token{pointer-events:auto;touch-action:none;cursor:grab}
.drag-source .person-token{opacity:.3}
.cell.drop-target{outline:3px solid #fff6c8;outline-offset:-3px}
.person-token.drag-ghost{position:fixed;transform:translate(-50%,-50%);z-index:10000;pointer-events:none;cursor:grabbing;box-shadow:0 5px 15px #0006}
.person-token.victim{border-color:#e85773;background:#edb9c7}
.token-initial{position:absolute;bottom:-3px;right:-3px;border-radius:50%;height:13px;width:13px;line-height:13px;background:var(--deep);color:#fff;font-size:8px;font-weight:800;text-align:center}
.notes-grid{display:grid;grid-template-columns:repeat(3,1fr);position:absolute;inset:3px;z-index:2;align-content:center;pointer-events:none}
.note-letter{font-size:10px;font-weight:800;text-align:center;color:var(--deep)}
.toolbar{flex-shrink:0;display:flex;justify-content:space-between;align-items:center;gap:var(--space-1);height:48px;background:#9580e9;border-radius:12px;padding:var(--space-1);color:white}
.tool-group{display:flex;gap:var(--space-1);align-items:center}
.tool-button{display:flex;align-items:center;gap:var(--space-1);height:40px;padding:0 var(--space-2);background:transparent;border-radius:8px;font-size:11px;font-weight:700;color:inherit}
.tool-button .icon{width:16px;height:16px}
.tool-button.active{background:white;color:var(--deep)}
.toolbar .icon-button{height:40px;width:36px;border-radius:8px}
.bottom-bar{height:48px;display:flex;flex-shrink:0;gap:var(--space-2)}
.assist-button{background:#ffcc70;color:var(--deep);border-radius:12px;width:48px;flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0}
.assist-button[aria-pressed=true]{background:#a4e3b2;box-shadow:inset 0 0 0 2px white}
.primary-button{border-radius:12px;display:flex;align-items:center;justify-content:center;gap:var(--space-2);min-height:48px;padding:var(--space-3) var(--space-4);background:#ff907f;color:#4f2545;font-size:13px;font-weight:800;width:100%}
.primary-button>span:last-child{margin-left:auto}
#check-button{flex:1;min-width:0}
#progress-label{font-size:11px;background:#ffffff55;border-radius:8px;padding:var(--space-1) var(--space-2)}
.board-message{flex-shrink:0;height:12px;line-height:12px;margin:0;font-size:9px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#e6deff}
dialog{border:0;border-radius:20px;background:var(--paper);color:var(--ink);padding:var(--space-5);width:calc(100% - 32px);max-width:500px;max-height:calc(100dvh - 32px);overflow:auto}
dialog::backdrop{background:#302448a0}
.dialog-header{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);margin-bottom:var(--space-2)}
.eyebrow{font-size:10px;font-weight:800;letter-spacing:1px;color:#8a77a6}
dialog h2{font-size:27px;letter-spacing:-.6px;line-height:1.15;margin:0 0 var(--space-4);font-weight:850}
dialog p{font-size:13px;line-height:1.6;color:#7c688e;margin:var(--space-4) 0}
dialog strong{color:var(--ink)}
.help-step{display:flex;gap:var(--space-3);margin:var(--space-4) 0}
.step-number{font-size:24px;font-weight:900;color:var(--purple)}
.help-step p{margin:0}
.dialog-actions{display:flex;gap:var(--space-2);margin-top:var(--space-5)}
.dialog-actions>*{flex:1}
.secondary-button{border:0;border-radius:12px;padding:var(--space-3) var(--space-4);min-height:48px;background:#e5dcfa;color:#5b4281;font-size:12px;font-weight:700}
.difficulty-easy{background:#bce0a6}.difficulty-intermediate{background:#ffd290}.difficulty-challenging{background:#ff907f}
.difficulty-key{display:flex;justify-content:center;gap:8px;margin:16px 0;font-size:11px;font-weight:700;color:var(--ink)}.difficulty-key span{padding:6px 8px;border-radius:8px}
.case-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.case-tile{position:relative;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:8px;border-radius:12px;padding:12px;min-height:88px;color:var(--ink);text-align:left}.case-tile-number{font-size:22px;font-weight:900;line-height:24px}.case-tile strong{font-size:12px;line-height:15px;max-width:100%;font-weight:700}.case-tile.current-case{box-shadow:inset 0 0 0 2px var(--deep)}.case-tile-status{position:absolute;right:10px;top:10px;font-size:14px;font-weight:900;line-height:18px}.case-guided-button{display:block;width:100%;min-height:40px;margin-top:12px;border-radius:10px;background:#e5dcfa;color:var(--deep);font-size:12px;font-weight:700}
@media(max-width:350px){.case-tile{padding:10px;gap:6px}.case-tile strong{font-size:11px;line-height:14px}.difficulty-key{gap:6px;font-size:10px}}
.suspect-choices{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-2);margin:var(--space-4) 0}
.accuse-button{background:#e5dcfa;border-radius:12px;padding:var(--space-3);display:flex;align-items:center;gap:var(--space-2);font-size:14px;font-weight:800;text-align:left}
.solved-mark{text-align:center;font-size:48px;color:#8ecba4;margin:var(--space-4) 0}
.solution-room,.hint-callout{padding:var(--space-4);background:#cdebd5;border-radius:12px}
.menu-item{display:flex;align-items:center;gap:var(--space-3);width:100%;padding:var(--space-3);min-height:48px;border-radius:12px;margin-bottom:var(--space-2);text-align:left;font-size:13px;text-decoration:none;color:inherit;background:#e5dcfa}
.credits{font-size:10px!important}
.source-link{color:#6740a8}
.keycap{display:inline-block;padding:0 var(--space-1);background:#e5dcfa;border-radius:4px;font-size:11px}
.furniture-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-3)}
.furniture-item{display:flex;flex-direction:column;align-items:center;gap:var(--space-2);background:#e5dcfa;border-radius:12px;padding:var(--space-4)}
.furniture-item img{width:64px;height:64px}
.furniture-item strong{font-size:14px}
.furniture-item>span{font-size:10px;color:#7c688e}
#toast{position:fixed;bottom:calc(16px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);max-width:90%;width:max-content;pointer-events:none;background:var(--deep);color:white;padding:var(--space-3) var(--space-4);border-radius:12px;font-size:12px;text-align:center;opacity:0;z-index:100}
#toast.visible{opacity:1}
@media(min-width:700px){:root{--page-gutter:16px}}
@media(max-height:700px){
  .app-shell{gap:var(--space-1)}#game{gap:var(--space-1)}.topbar{flex-basis:44px}
  .header-case-title{font-size:17px;line-height:20px}
  .suspect-tools{min-height:24px;margin-bottom:var(--space-1)}#suspect-view-button{min-height:24px}
  .suspect{flex-basis:164px;min-height:96px;padding:var(--space-2)}
  .card-clues .clue{font-size:10px;line-height:13px}
  .expanded .suspect{min-height:92px}.expanded .clue{font-size:9px;line-height:11px}
  .toolbar,.bottom-bar{height:44px}.tool-button{height:36px}.toolbar .icon-button{height:36px;width:32px}
  .assist-button{width:44px}.primary-button{min-height:44px;padding:var(--space-2) var(--space-3)}
}
@media(max-width:350px){
  .topbar{gap:var(--space-2)}.topbar .icon-button{width:36px;height:40px}
  .header-case-title{font-size:16px}.tool-button{padding:0 var(--space-1);font-size:10px}
  .room-legend{gap:var(--space-1);font-size:8px}
}
@media(max-height:480px) and (orientation:landscape){
  .app-shell{max-width:900px}.topbar{flex-basis:40px}
  #game{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) 44px 44px;gap:var(--space-2) var(--space-4)}
  .suspect-panel,.suspect-panel.expanded{grid-column:1;grid-row:1;min-height:0;max-height:none;overflow-y:auto;flex:initial}
  .suspect-panel.expanded{overflow:visible}
  .toolbar{grid-column:1;grid-row:2}.bottom-bar{grid-column:1;grid-row:3}
  .scene-panel{grid-column:2;grid-row:1/4;height:auto;align-self:stretch}.board-message{display:none}
  .room-legend{font-size:8px;gap:var(--space-1)}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}


.main-menu{flex:1;min-height:0;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:20px;color:white;padding:12px 16px;text-align:center}
.home-brand h1{font-size:clamp(64px,13vh,96px);font-weight:900;letter-spacing:-6px;line-height:.95;margin:12px 0 16px}.home-eyebrow{font-size:10px;font-weight:800;letter-spacing:2px;color:#ebe4ff}.home-brand p{font-size:18px;line-height:1.3;margin:0;color:#f8edff;font-weight:600}
.home-cast{display:flex;justify-content:center;gap:12px}.home-cast>span{width:80px;height:80px;border-radius:20px;display:flex;align-items:center;justify-content:center;background:#ffcf76}.home-cast>span:nth-child(2){background:#ff907f}.home-cast>span:nth-child(3){background:#bce0a6}.home-cast img{width:72px;height:72px}
.home-actions{display:flex;flex-direction:column;gap:10px}.home-button{position:relative;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:5px;min-height:76px;border-radius:16px;padding:14px 56px 14px 20px;text-align:left;background:#9782e9;color:white}.home-button>span:first-child{font-size:20px;font-weight:800}.home-button small{font-size:12px;line-height:1.3;font-weight:600;opacity:.8}.home-primary{background:#ffd290;color:#372765}.home-tertiary{background:#ff907f;color:#472137}.home-arrow{position:absolute;right:20px;top:50%;transform:translateY(-50%);font-size:25px;font-weight:700}.home-notebook{display:flex;gap:8px;align-items:center;justify-content:center;background:transparent;color:white;min-height:44px;border-radius:12px;font-weight:700;font-size:13px}.home-footer{font-size:11px;line-height:1.3;color:#e8defb;margin:0}
.tutorial-bar{display:flex;flex-direction:column;gap:6px;background:#ffd290;color:#302448;border-radius:12px;padding:10px 12px;flex-shrink:0}.tutorial-copy strong{display:block;font-size:11px;line-height:14px;margin-bottom:4px}.tutorial-copy p{margin:0;font-size:13px;line-height:17px;font-weight:500}.tutorial-actions{display:flex;justify-content:space-between;gap:8px}.tutorial-actions button{border-radius:8px;background:#fff7;padding:6px 10px;font-weight:700;font-size:11px;min-height:32px}.tutorial-actions button[aria-pressed=true]{background:#372765;color:white}.suspect.tutorial-person{box-shadow:inset 0 0 0 3px #ffcc70}.suspect.active.tutorial-person{box-shadow:inset 0 0 0 3px #fff3d6}
@media(max-height:740px){.main-menu{gap:12px;padding-block:4px}.home-brand h1{font-size:64px;margin:8px 0 10px}.home-brand p{font-size:16px}.home-cast>span{width:64px;height:64px}.home-cast img{width:60px;height:60px}.home-button{min-height:68px;padding-top:10px;padding-bottom:10px}.tutorial-copy p{font-size:12px;line-height:15px}.tutorial-bar{padding:8px 10px}}
@media(max-height:580px){.main-menu{gap:8px}.home-eyebrow,.home-brand p,.home-cast,.home-footer{display:none}.home-brand h1{font-size:48px;margin:4px 0 8px}.home-button{min-height:58px}.home-button>span:first-child{font-size:18px}.home-actions{gap:8px}}
@media(orientation:landscape) and (max-height:480px){.main-menu{display:grid;grid-template-columns:1fr 1.5fr;grid-template-rows:1fr auto;align-content:center;gap:12px 24px}.home-brand{grid-column:1;grid-row:1;align-self:center}.home-brand h1{font-size:64px}.home-actions{grid-column:2;grid-row:1}.home-notebook{grid-column:1 / -1;grid-row:2}.home-cast{display:none}#game.guided-game{grid-template-rows:auto minmax(0,1fr) 44px 44px}.guided-game .tutorial-bar{grid-column:1;grid-row:1}.guided-game .suspect-panel{grid-row:2}.guided-game .toolbar{grid-row:3}.guided-game .bottom-bar{grid-row:4}.guided-game .scene-panel{grid-row:1 / 5}}

.tutorial-copy .tutorial-task{font-size:14px;line-height:18px;font-weight:800;margin:6px 0}.tutorial-copy .tutorial-feedback{background:#fff7;padding:8px;border-radius:8px;margin-top:6px;font-size:12px;line-height:16px;font-weight:600}.tutorial-feedback.guide-error{background:#ffe1dc;color:#772a35}.tutorial-bar.step-complete{background:#bce0a6}.tutorial-actions{flex-wrap:wrap;align-items:center}.tutorial-actions #tutorial-next{background:#372765;color:white;flex:1;min-height:40px;font-size:12px}.tutorial-actions #tutorial-next:disabled{opacity:.55}.tutorial-actions #tutorial-skip{background:transparent;font-size:10px;color:#534356}.tutorial-target{outline:3px solid white!important;outline-offset:-3px}.tutorial-actions .tutorial-target{outline-color:#372765!important}.guide-pause-link{display:block;min-height:40px;background:transparent;font-size:12px;margin:12px auto 0;color:#6d597e}.guided-game .board-message{display:none}
@media(max-height:740px){.tutorial-copy .tutorial-task{font-size:13px;line-height:16px}.tutorial-copy .tutorial-feedback{font-size:11px;line-height:14px;padding:6px}.tutorial-actions #tutorial-next{min-height:36px}}

/* The guide reserves the same space in every step, success and error state. */
.tutorial-bar{height:150px;min-height:150px;max-height:150px;flex:0 0 150px;padding:8px 10px;gap:6px;overflow:hidden}
.tutorial-copy{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:14px 36px 34px;row-gap:4px;min-height:0;flex:0 0 92px}
.tutorial-copy strong{grid-row:1;margin:0;font-size:11px;line-height:14px}
.tutorial-copy .tutorial-task{grid-row:2;margin:0;font-size:13px;line-height:18px;font-weight:800}
.tutorial-copy #tutorial-text,.tutorial-copy .tutorial-feedback{grid-row:3;grid-column:1;margin:0;padding:0;background:transparent;font-size:12px;line-height:17px;font-weight:500;border-radius:0}
.tutorial-copy .tutorial-feedback.guide-error{color:#772a35}
.tutorial-actions{flex:0 0 36px;height:36px;flex-wrap:nowrap;gap:6px;min-width:0}
.tutorial-actions button,.tutorial-actions #tutorial-next{height:36px;min-height:36px;padding:6px 8px;white-space:nowrap}
.tutorial-actions #tutorial-next{min-width:0;font-size:12px}

/* A muted background only for the case-selection dialog. */
dialog.case-picker{background:#c7b5dc}
dialog.case-picker .eyebrow{color:#5b4272}

.brand-lockup{display:flex;align-items:center;justify-content:center;gap:12px}.detective-logo{display:block;width:112px;height:112px;object-fit:contain}.home-brand .brand-lockup h1{margin:12px 0 16px}.wall-window{position:absolute;z-index:3;background:#adcbea;border:1px solid #506c89;pointer-events:none}.window-north,.window-south{left:26%;width:48%;height:10%;min-height:4px}.window-north{top:0}.window-south{bottom:0}.window-west,.window-east{top:26%;height:48%;width:10%;min-width:4px}.window-west{left:0}.window-east{right:0}.wall-window::after{content:'';position:absolute;background:#f5eddc;left:46%;top:0;width:8%;height:100%}.window-west::after,.window-east::after{left:0;top:46%;width:100%;height:8%}
@media(max-height:740px){.detective-logo{width:88px;height:88px}}@media(max-height:580px){.detective-logo{width:64px;height:64px}.brand-lockup{gap:8px}}

.scene-rich .cell{background-size:100% 100%;border-color:#5a48782c}.scene-rich .cell .object{width:86%;height:86%;filter:none;transform:none}.scene-rich .cell.water{box-shadow:inset 0 0 0 1px #b6dde055}.scene-rich .cell.wall-east{border-right:3px solid #5a4878}.scene-rich .cell.wall-south{border-bottom:3px solid #5a4878}.scene-rich .person-token{box-shadow:1px 3px 2px #30244845}.hint-options{margin-top:12px}.notebook-section{margin:16px 0 24px}.notebook-section h3{font-size:13px;color:#6740a8;margin:0 0 10px}.notebook-home{width:100%}.concise-rules{padding-left:20px;line-height:1.6;font-size:13px}.concise-rules li{margin:12px 0}.style-options{display:flex;gap:8px;margin:8px 0}.style-options button{flex:1;min-height:40px;border-radius:8px;background:#e5dcfa;font-size:12px;font-weight:700}.style-options button[aria-pressed=true]{background:#7861dc;color:white}.tile-comparison{display:grid;grid-template-columns:1fr 1fr;gap:12px}.tile-comparison h3{margin:0 0 8px}.classic-swatches{display:grid;grid-template-columns:1fr 1fr;aspect-ratio:1;max-width:180px;border:2px solid #5a4878}.classic-swatches span{background-size:100% 100%;border:1px solid #5a487844}.tile-comparison small{display:block;margin-top:8px;font-size:11px}.material-gallery{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.material-gallery figure,.prop-comparison figure{margin:0}.material-patch{display:grid;grid-template-columns:1fr 1fr;border-radius:8px;overflow:hidden;aspect-ratio:1;border:1px solid #5a487840}.material-patch img{width:100%;display:block}.material-gallery figcaption,.prop-comparison figcaption{font-size:11px;font-weight:700;margin-top:8px;line-height:1.3}.prop-comparison{display:grid;grid-template-columns:1fr 1fr;gap:12px}.prop-comparison figure>div{display:flex;gap:8px;background:#d8cbb1;border-radius:10px;padding:10px}.prop-comparison img{width:calc(50% - 4px);height:80px;object-fit:contain;filter:drop-shadow(2px 3px 1px #30244855)}.trial-grid{grid-template-columns:1fr 1fr}.trial-label{font-size:14px;margin:16px 0 0}.trial-description{font-size:12px!important;margin:8px 0 12px!important}.case-archive{margin-top:20px}.case-archive summary{font-size:12px;font-weight:700;padding:10px 0;cursor:pointer}.case-archive .case-grid{margin-top:8px}.header-meta .brand{font-size:10px;letter-spacing:.2px}

.board-area{width:min(100cqw,calc(100cqh - var(--legend-height,16px)),620px);grid-template-rows:16px auto var(--legend-height,16px)}.room-legend{grid-template-columns:repeat(var(--legend-columns,4),minmax(0,1fr));row-gap:2px}.scene-rich .cell.blocked{cursor:default}.scene-rich .cell.water .object{display:none}

/* Room names live on the board, independent of placement and notes. */
.board{position:relative}.room-legend{display:none}.board-area{width:min(100cqw,calc(100cqh - 16px),620px);grid-template-rows:16px auto;row-gap:4px}.board-room-title{position:absolute;z-index:5;pointer-events:none;padding:3px 5px 0;box-sizing:border-box;font-size:clamp(8px,2.2vw,11px);line-height:1.1;font-weight:700;text-align:left;color:#46364f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 1px #ffffffb0}.cell .person-token{width:70%;height:70%;transform:translateY(7%)}.cell .object{max-height:75%;transform:translateY(7%)}.scene-rich .cell .object{height:75%;transform:translateY(7%)}

/* Solid room colors with restrained transparent material marks. */
.cell.water{background-color:var(--room)}.toolbar>.tool-group:first-child{flex:1;min-width:0}.toolbar>.tool-group:last-child{flex:0 0 auto}.tool-button{flex:1;justify-content:center;font-size:12px;padding:0 4px}.tool-button .icon{width:18px;height:18px}.scene-rich .cell .object{filter:drop-shadow(0 2px 1px #30244822)}

.scene-object{position:absolute;z-index:1;pointer-events:none;object-fit:fill;padding:5px;box-sizing:border-box}.cell.selected-cell{z-index:auto}.person-token,.notes-grid{z-index:3}.texture-toggle{display:flex;align-items:center;justify-content:space-between;gap:16px}.texture-toggle strong{border-radius:8px;padding:4px 10px;background:#e4dcf5;font-size:12px}.texture-toggle[aria-pressed=true] strong{background:#a4e3b2}.furniture-item img{object-fit:contain}

/* Halloween night desk. Flat surfaces, readable material-led floors. */
:root[data-theme=halloween]{color-scheme:dark;--purple:#17121e;--deep:#271c37;--ink:#f2e9fa;--paper:#261e31;--coral:#ffa24b;--lime:#c4ee56;--pumpkin:#ffa24b;--violet:#ac8be9;--blood:#bd3949;--muted:#c1b3ce;--surface:#352940}
[data-theme=halloween] body{background:#17121e}
[data-theme=halloween] .header-meta,[data-theme=halloween] .suspect-tools,[data-theme=halloween] .col-labels,[data-theme=halloween] .row-labels,[data-theme=halloween] .board-message,[data-theme=halloween] .home-footer{color:var(--muted)}
[data-theme=halloween] .header-meta .brand,[data-theme=halloween] .home-eyebrow{color:var(--lime)}
[data-theme=halloween] .home-brand h1{color:var(--lime);position:relative}
[data-theme=halloween] .home-brand h1::after{content:'';position:absolute;width:9px;height:12px;border-radius:1px 1px 6px 6px;background:var(--blood);left:38%;bottom:-8px;box-shadow:20px -5px 0 -2px var(--blood)}
[data-theme=halloween] .home-brand p{color:#e3d7ed}
[data-theme=halloween] .topbar .icon-button,[data-theme=halloween] #suspect-view-button,[data-theme=halloween] .toolbar,[data-theme=halloween] .home-button{background:var(--surface);color:var(--ink)}
[data-theme=halloween] .home-primary,[data-theme=halloween] .tool-button.active{background:var(--lime);color:#22300d}
[data-theme=halloween] .home-tertiary,[data-theme=halloween] .primary-button{background:var(--pumpkin);color:#321d0a}
[data-theme=halloween] .home-notebook{color:var(--violet)}
[data-theme=halloween] .suspect{background:#49355d;color:#f7efff}
[data-theme=halloween] .suspect.active{background:var(--lime);color:#22300d;box-shadow:inset 0 0 0 2px #e8ffb7}
[data-theme=halloween] .suspect.victim-card:not(.active){background:#612d3a;color:#ffe3e5}
[data-theme=halloween] .victim-card .person-name{color:inherit}
[data-theme=halloween] .victim-card::after{content:'';position:absolute;right:12px;bottom:10px;width:7px;height:10px;border-radius:6px 6px 6px 0;transform:rotate(-35deg);background:#eb6773;pointer-events:none}
[data-theme=halloween] .assist-button{background:var(--violet);color:#251435}
[data-theme=halloween] .assist-button[aria-pressed=true]{background:var(--lime);box-shadow:inset 0 0 0 2px #e8ffb7}
[data-theme=halloween] #progress-label{background:#321d0a22}
[data-theme=halloween] .board{border-color:#352b40;background:#352b40}
[data-theme=halloween] .scene-rich .cell{border-color:#21192830}
[data-theme=halloween] .scene-rich .cell.wall-east{border-right-color:#352b40}
[data-theme=halloween] .scene-rich .cell.wall-south{border-bottom-color:#352b40}
[data-theme=halloween] .board-room-title{color:#fff5de;text-shadow:0 1px 2px #17121ee6}
[data-theme=halloween] .note-letter{color:#fff5de;text-shadow:0 1px 2px #17121e}
[data-theme=halloween] .cell.assist::after{border-color:#e0ff89;background:#c4ee5620}
[data-theme=halloween] .cell.selected-cell{box-shadow:inset 0 0 0 3px var(--lime)}
[data-theme=halloween] .cell.conflict{box-shadow:inset 0 0 0 3px #ff697d}
[data-theme=halloween] .person-token{border-color:#efdbb7}
[data-theme=halloween] .person-token.victim{border-color:#e94d65;background:#9c4253}
[data-theme=halloween] dialog,[data-theme=halloween] dialog.case-picker{background:var(--paper)}
[data-theme=halloween] dialog::backdrop{background:#0c0814c9}
[data-theme=halloween] dialog p,[data-theme=halloween] .furniture-item>span{color:var(--muted)}
[data-theme=halloween] .eyebrow,[data-theme=halloween] dialog.case-picker .eyebrow,[data-theme=halloween] .notebook-section h3,[data-theme=halloween] .source-link,[data-theme=halloween] .step-number{color:var(--violet)}
[data-theme=halloween] .secondary-button,[data-theme=halloween] .menu-item,[data-theme=halloween] .accuse-button,[data-theme=halloween] .furniture-item,[data-theme=halloween] .case-guided-button,[data-theme=halloween] .keycap{background:var(--surface);color:var(--ink)}
[data-theme=halloween] .theme-toggle strong{color:var(--lime)}
[data-theme=halloween] .difficulty-easy{background:#c4ee56;color:#22300d}
[data-theme=halloween] .difficulty-intermediate{background:#ffa24b;color:#321d0a}
[data-theme=halloween] .difficulty-challenging{background:#ac8be9;color:#251435}
[data-theme=halloween] .case-tile strong{color:inherit}
[data-theme=halloween] .case-tile.current-case{box-shadow:inset 0 0 0 3px #f2e9fa}
[data-theme=halloween] .solution-room,[data-theme=halloween] .hint-callout{background:#344126;color:#f0f8e3}
[data-theme=halloween] .solved-mark{color:var(--lime)}
[data-theme=halloween] .tutorial-bar{background:#352940;color:#f2e9fa}
[data-theme=halloween] .tutorial-bar.step-complete{background:#344126}
[data-theme=halloween] .tutorial-actions button{background:#574664;color:#f2e9fa}
[data-theme=halloween] .tutorial-actions #tutorial-next{background:var(--lime);color:#22300d}
[data-theme=halloween] .tutorial-actions #tutorial-skip,[data-theme=halloween] .guide-pause-link{color:var(--muted)}
[data-theme=halloween] .tutorial-copy .tutorial-feedback.guide-error{color:#ffa6af}
[data-theme=halloween] .tutorial-actions button[aria-pressed=true]{background:var(--violet);color:#251435}
[data-theme=halloween] .tutorial-actions .tutorial-target{outline-color:var(--lime)!important}
[data-theme=halloween] .tutorial-target{outline-color:var(--lime)!important}
[data-theme=halloween] #toast{background:#49355d;color:#f7efff}
[data-theme=halloween] button:focus-visible,[data-theme=halloween] a:focus-visible{outline-color:var(--lime)}
.theme-toggle{justify-content:space-between}.theme-toggle strong{font-size:12px}

/* Claims are distinct from the reliable evidence, without hiding either. */
.alibi-claim{--bubble:#b6a3f0;position:relative;display:block;margin-top:4px;padding:5px 7px;border-radius:8px;background:var(--bubble);font-size:11px;line-height:14px;font-weight:700}
.alibi-claim::before{content:"";position:absolute;top:-4px;left:12px;width:8px;height:8px;background:var(--bubble);transform:rotate(45deg)}
.active .alibi-claim{--bubble:#efb956}
.evidence-label{display:block;font-size:inherit;line-height:inherit;font-weight:750;opacity:.85}
[data-theme=halloween] .alibi-claim{--bubble:#614455;color:#ffcb90}
[data-theme=halloween] .active .alibi-claim{--bubble:#a5c953;color:#22300d}
[data-theme=halloween] .evidence-label{color:#dfcff4}
[data-theme=halloween] .active .evidence-label{color:#22300d}
.expanded .alibi-claim{font-size:10px;line-height:12px;padding:4px 5px}
.case-mode-label{font-size:8px;line-height:10px;font-weight:800;letter-spacing:.4px}

/* Disabled cells must not create a faded stacking context below furniture. */
.cell:disabled{opacity:1;cursor:default}
.story-section h3{font-size:11px;text-transform:uppercase;letter-spacing:.7px;margin:16px 0 6px;color:#6740a8}.story-section p{margin:6px 0 16px}[data-theme=halloween] .story-section h3{color:var(--violet)}

/* Three short briefing steps in a fixed, centered card with its own footer. */
dialog.case-brief,[data-theme=halloween] dialog.case-brief{position:fixed;inset:auto;top:50%;left:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);margin:0;width:calc(100vw - 40px);max-width:400px;height:390px;max-height:calc(100dvh - 112px);background:#efd58a;color:#57472e;border-radius:18px;padding:18px;overflow:hidden}
dialog.case-brief[open]{display:flex;flex-direction:column}.case-brief .dialog-header{flex:0 0 auto;margin:0 0 8px;min-height:32px}.case-brief .eyebrow{color:#695638;font-size:10px;letter-spacing:.3px}.case-brief .icon-button{color:#695638;width:32px;height:32px}
.case-brief #dialog-content{flex:1;min-height:0;display:flex;flex-direction:column}.case-brief h2{flex:0 0 auto;font-size:24px;margin:0 0 14px;line-height:1.2;letter-spacing:-.3px;outline:none}
.brief-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}.case-brief p.brief-intro{font-size:16px;line-height:1.55;color:#57472e;margin:0 0 12px}
.brief-victim{display:flex;align-items:center;gap:16px;margin-bottom:12px}.brief-victim img{width:96px;height:96px;flex:0 0 96px;object-fit:contain;border-radius:16px;background:#dfbd70}.brief-victim>span{display:flex;flex-direction:column;gap:4px}.brief-victim small{font-size:11px;color:#695638}.case-brief .brief-victim strong{font-size:17px;color:#57472e}
.brief-actions{flex:0 0 auto;display:flex;gap:10px;padding-top:12px;min-height:58px}.brief-actions>.secondary-button{flex:0 0 76px;padding:10px;min-height:46px;background:#e1c16f;color:#57472e}.brief-actions>.primary-button{flex:1;min-height:46px;padding:10px;font-size:13px;background:#85612f;color:#fff0c4}
@media(max-height:480px){dialog.case-brief,[data-theme=halloween] dialog.case-brief{max-height:calc(100dvh - 56px);height:330px;padding:14px}.case-brief h2{font-size:21px;margin-bottom:10px}.case-brief p.brief-intro{font-size:14px;line-height:1.45}.brief-actions{padding-top:8px}}
dialog.case-summary,[data-theme=halloween] dialog.case-summary{max-width:400px;background:#efd58a;color:#57472e}.case-summary p{color:#57472e}.case-summary .eyebrow{color:#695638}.case-summary p.brief-rule{font-size:12px;color:#695638}

/* First-launch prologue, separate from the compact case briefings. */
dialog.opening-story,[data-theme=halloween] dialog.opening-story{position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:none;border-radius:0;background:#efd58a;color:#57472e;padding:max(22px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));overflow:hidden}
dialog.opening-story[open]{display:flex;flex-direction:column}.opening-story .dialog-header,.opening-story #dialog-content{width:100%;max-width:440px;margin-left:auto;margin-right:auto}.opening-story .dialog-header{flex:0 0 auto}.opening-story .eyebrow,.opening-story .icon-button{color:#695638}.opening-story #dialog-content{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center}.opening-story h2{font-size:34px;line-height:1.15;margin:0 0 18px;color:#57472e}.opening-copy{min-height:0;overflow-y:auto}.opening-copy p{font-size:19px;line-height:1.6;color:#57472e;margin:18px 0 28px}.opening-seal{display:block;font-size:64px;line-height:1;color:#a94539}.opening-tabs{display:flex;gap:6px;margin-top:auto;padding-top:24px}.opening-tabs button{flex:1;min-height:44px;border-radius:10px;background:#dfbd70;color:#57472e;font-size:11px;font-weight:750;padding:8px 4px}.opening-tabs button[aria-selected=true]{background:#85612f;color:#fff0c4}.opening-actions{display:flex;gap:10px;margin-top:12px}.opening-actions .secondary-button{background:#e1c16f;color:#57472e;min-width:76px}.opening-actions .primary-button{flex:1;background:#85612f;color:#fff0c4}.thread-note{border-left:3px solid #b95450;padding-left:12px}
@media(max-height:540px){.opening-story h2{font-size:25px;margin-bottom:8px}.opening-copy p{font-size:15px;line-height:1.45;margin:8px 0}.opening-seal{font-size:32px}.opening-tabs{padding-top:12px}}

/* The square board gets the same breathing room above and below, without coordinate gutters. */
.board-area{width:min(100cqw,100cqh,620px);display:block;flex-shrink:0}
.board{grid-column:auto;grid-row:auto;width:100%}
.col-labels,.row-labels{display:none}
/* Paint the underlying viewport too: mobile system bars may sample it beneath a dialog. */
:root[data-screen=opening]{color-scheme:light;background:#efd58a}
:root[data-screen=opening] body,:root[data-screen=opening] .app-shell{background:#efd58a}

/* One highlight travels between the three editing modes. */
.mode-tools{position:relative;isolation:isolate;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.mode-tools::before{content:"";position:absolute;z-index:-1;top:0;bottom:0;left:0;width:calc((100% - 8px)/3);border-radius:8px;background:white;transform:translateX(calc(var(--mode-index,0) * (100% + 4px)));transition:transform 220ms cubic-bezier(.2,.8,.2,1);pointer-events:none}
.mode-tools .tool-button{min-width:0;transition:color 150ms ease}
.mode-tools .tool-button.active,[data-theme=halloween] .mode-tools .tool-button.active{background:transparent}
[data-theme=halloween] .mode-tools::before{background:var(--lime)}
@media(prefers-reduced-motion:reduce){.mode-tools::before,.mode-tools .tool-button{transition:none}}

/* Placed people stay visibly marked in swipe and grid views. */
.suspect.placed-card::after{content:"";position:absolute;inset:0;border:2px solid #ffffffa8;border-radius:inherit;pointer-events:none}
.suspect.placed-card.active::after{border-color:#534127}
.suspect.placed-card .person-status{width:18px;height:18px;line-height:18px;font-size:12px;background:#f4edda;color:#453456;top:5px;right:5px;box-shadow:0 0 0 2px #ffffff35}
[data-theme=halloween] .suspect.placed-card::after{border-color:#c4ee568f}
[data-theme=halloween] .suspect.placed-card.active::after{border-color:#4c641e}
[data-theme=halloween] .suspect.placed-card .person-status{background:#c4ee56;color:#22300d}
/* Chapter progress and the collected red-thread notes stay outside the board. */
.chapter-strip{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:11px;line-height:1.4;letter-spacing:.5px}.chapter-strip strong{font-size:12px;letter-spacing:0;white-space:nowrap}
.chapter-thread-button{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px;width:100%;min-height:48px;padding:12px 14px;border-radius:12px;background:#dfc28a;color:#57472e;font-size:14px;font-weight:800;text-align:left}.chapter-thread-button span{font-size:11px;font-weight:600}.case-picker .case-archive{margin-top:10px}
.thread-note>small{font-size:10px;font-weight:800;letter-spacing:1px}.thread-note p{margin:8px 0}.thread-revisit{display:inline-flex;align-items:center;min-height:44px;background:transparent;color:inherit;font-size:12px;font-weight:800;text-align:left;padding:4px 0;text-decoration:underline;text-underline-offset:3px}
.story-notebook,[data-theme=halloween] dialog.story-notebook{background:#efd58a;color:#57472e}.story-notebook .eyebrow,.story-notebook .icon-button,.story-notebook p{color:#695638}.story-notebook h2{color:#57472e}.story-notebook .thread-caption{font-size:12px;line-height:1.5;margin:12px 0}.thread-letter{margin:20px 0;padding:16px 18px;border-left:4px solid #ad5147;background:#e5c579;border-radius:0 12px 12px 0;font-size:19px;line-height:1.45;font-weight:750}.thread-letter small{display:block;font-size:11px;font-weight:600;margin-top:8px;opacity:.8}.thread-entries{list-style:none;padding:0 0 0 16px;margin:24px 0;border-left:2px solid #b85849}.thread-entries li{position:relative;padding:0 0 22px 5px}.thread-entries li:last-child{padding-bottom:0}.thread-entries li:before{content:'';position:absolute;left:-22px;top:4px;width:8px;height:8px;border-radius:50%;background:#b85849;border:2px solid #efd58a}.thread-entries li>span{font-size:10px;font-weight:800;letter-spacing:1px;color:#865741}.thread-entries h3{font-size:17px;margin:5px 0 8px}.thread-entries p{font-size:14px;line-height:1.55;margin:0}.story-notebook .primary-button{background:#85612f;color:#fff0c4}
