:root {
  --bg-1: #fff7fb; --bg-2: #fff1f7; --surface: #fff; --surface-soft: #fff7fb;
  --text: #3b2142; --muted: #7a5a74; --accent: #b11f8f; --accent-2: #d94bb3;
  --accent-soft: #ffd8ef; --chip: #ffe7f3; --border: #f3cfe3; --success: #39805c;
  --shadow: 0 18px 40px rgba(177,31,143,.12); --radius-xl: 30px; --radius-lg: 24px; --radius-pill: 999px;
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; color: var(--text); font-family: "Comic Sans MS", "Comic Sans", "Trebuchet MS", Arial, sans-serif; background: radial-gradient(circle at top left,#ffe5f4 0%,transparent 34%),radial-gradient(circle at top right,#ffd9f0 0%,transparent 30%),linear-gradient(180deg,var(--bg-1),var(--bg-2)); }
button { font: inherit; } a { color: inherit; text-decoration: none; }
.game-header { width: min(1220px,calc(100% - 28px)); min-height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 700; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 18px; color: white; background: linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow: var(--shadow); font-size: .85rem; letter-spacing: -.04em; }
.brand-mark img,.blueprint-tile img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: contain; image-rendering: auto; }
.level-label,.eyebrow { display: inline-flex; align-items: center; padding: 9px 14px; border-radius: var(--radius-pill); color: var(--accent); background: var(--chip); font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.game-shell { width: min(1180px,calc(100% - 28px)); margin: 0 auto; padding: 12px 0 50px; }
.screen { display: none; } .screen.active { display: block; animation: reveal .4s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.start-screen { min-height: min(690px,calc(100vh - 110px)); position: relative; overflow: hidden; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 40px; padding: clamp(34px,7vw,78px); border: 1px solid var(--border); border-radius: 36px; background: radial-gradient(circle at 12% 16%,#ffe2f4,transparent 25%),rgba(255,255,255,.92); box-shadow: var(--shadow); }
.start-screen.active { display: grid; } .start-copy { position: relative; z-index: 2; }
h1 { max-width: 760px; margin: 18px 0 14px; font-size: clamp(3rem,7vw,5.7rem); line-height: .96; letter-spacing: -.05em; }
.start-copy > p { max-width: 590px; margin: 0 0 28px; color: var(--muted); font-size: clamp(1.05rem,2vw,1.25rem); line-height: 1.65; }
.button-stack,.action-row { display: flex; flex-wrap: wrap; gap: 12px; }
.button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; padding: 12px 22px; border: 0; border-radius: var(--radius-pill); cursor: pointer; font-weight: 700; transition: transform .16s ease,box-shadow .16s ease,opacity .16s ease; }
.button:hover,.button:focus-visible { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(177,31,143,.2); }
.button:focus-visible,.object-tile:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
.button-primary { color: white; background: linear-gradient(135deg,var(--accent),var(--accent-2)); } .button-secondary { color: var(--accent); background: var(--chip); } .button-ghost { border: 1px solid var(--border); background: white; }
.start-art { min-height: 390px; display: grid; place-items: center; }
.architect-orbit { width: min(100%,340px); aspect-ratio: 1; position: relative; display: grid; place-items: center; border: 1px dashed rgba(177,31,143,.25); border-radius: 50%; background: rgba(255,255,255,.45); animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }
.blueprint-tile { width: 150px; height: 150px; display: grid; border: 9px solid white; border-radius: 38px; background: linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow: 0 26px 50px rgba(177,31,143,.28); transform: rotate(-7deg); }
.blueprint-tile i { display: block; border: 3px solid rgba(255,255,255,.9); border-radius: 8px; }
.mini-block { position: absolute; width: 58px; height: 58px; border: 5px solid white; border-radius: 18px; background: var(--chip); box-shadow: 0 12px 24px rgba(177,31,143,.15); }
.block-one { top: 32px; right: 36px; transform: rotate(9deg); } .block-two { left: 16px; top: 105px; transform: rotate(-10deg); } .block-three { right: 35px; bottom: 30px; transform: rotate(12deg); }
.stage-heading { max-width: 760px; margin: 8px auto 25px; text-align: center; } .stage-heading h2,.complete-screen h2,.modal-card h2 { margin: 12px 0 8px; font-size: clamp(1.8rem,4vw,2.7rem); } .stage-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.play-layout { display: grid; grid-template-columns: minmax(210px,.8fr) minmax(360px,1.45fr) minmax(220px,.85fr); gap: 18px; align-items: start; }
.rules-card,.tray-card,.workspace { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.rules-card h3,.tray-card h3 { margin: 0; font-size: 1.15rem; } .rules-card ol { margin: 16px 0 0; padding-left: 23px; color: var(--muted); line-height: 1.55; } .rules-card li + li { margin-top: 10px; }
.board { width: 100%; display: grid; gap: 5px; padding: 7px; border-radius: 19px; background: #efd7e5; touch-action: none; }
.board-cell { position: relative; aspect-ratio: 1; min-width: 0; display: grid; place-items: center; border: 1px solid rgba(177,31,143,.12); border-radius: 10px; background: var(--surface-soft); }
.board-cell.drop-target,.tile-tray.drop-target { outline: 3px solid var(--accent); outline-offset: -3px; background: var(--chip); }
.object-tile { width: 100%; min-width: 0; display: grid; justify-items: center; gap: 5px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: white; box-shadow: 0 5px 12px rgba(59,33,66,.1); cursor: grab; user-select: none; touch-action: none; }
.object-tile:active { cursor: grabbing; } .object-tile.drag-source { opacity: .35; }
.object-image { width: 100%; max-width: 62px; aspect-ratio: 1; display: block; border-radius: 9px; object-fit: contain; background: #f3edf1; pointer-events: none; }
.object-tile span { max-width: 100%; overflow: hidden; font-size: .7rem; font-weight: 700; text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap; pointer-events: none; }
.board-cell .object-tile { height: 100%; padding: 3px; border: 0; } .board-cell .object-tile span { display: none; } .board-cell .object-image { max-width: 100%; max-height: 100%; }
.tray-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; } .tray-heading span { color: var(--accent); font-size: .85rem; font-weight: 700; }
.tile-tray { min-height: 190px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; gap: 9px; margin-top: 15px; padding: 8px; border-radius: 16px; background: var(--surface-soft); touch-action: none; }
.tray-card > p { margin: 13px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.action-row { justify-content: center; margin-top: 18px; } .feedback { min-height: 48px; margin: 14px 0 0; color: #a84e70; font-weight: 700; line-height: 1.45; text-align: center; } .feedback.success { color: var(--success); }
.complete-screen { min-height: min(650px,calc(100vh - 110px)); padding: clamp(40px,8vw,90px) 24px; border: 1px solid var(--border); border-radius: 36px; background: radial-gradient(circle at 50% 10%,#ffe2f4,transparent 36%),rgba(255,255,255,.94); box-shadow: var(--shadow); text-align: center; }
.complete-screen p { max-width: 650px; margin: 0 auto 20px; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }.complete-mark { width: 90px; height: 90px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 30px; color: white; background: linear-gradient(135deg,var(--success),#65b58a); box-shadow: var(--shadow); font-size: 2.5rem; }.master-mark { background: linear-gradient(135deg,var(--accent),var(--accent-2)); }.centered-actions { justify-content: center; }
.modal { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: 18px; background: rgba(59,33,66,.46); backdrop-filter: blur(8px); }.modal.active { display: grid; }.modal-card { width: min(100%,560px); max-height: calc(100vh - 36px); overflow-y: auto; position: relative; padding: clamp(28px,6vw,46px); border: 1px solid var(--border); border-radius: var(--radius-xl); background: white; box-shadow: 0 28px 70px rgba(59,33,66,.25); }.modal-card > p { color: var(--muted); line-height: 1.6; }.modal-card ol { margin: 18px 0; padding-left: 25px; color: var(--muted); line-height: 1.8; }.modal-close { position: absolute; top: 15px; right: 15px; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 50%; color: var(--text); background: var(--surface-soft); cursor: pointer; font-size: 1.5rem; }
.drag-ghost { width: 78px; position: fixed; z-index: 100; pointer-events: none; opacity: .9; transform: translate(-50%,-50%) rotate(3deg); }
@media (max-width: 980px) { .play-layout { grid-template-columns: 1fr 1fr; } .workspace { grid-column: 1 / -1; grid-row: 1; max-width: 620px; width: 100%; justify-self: center; } }
@media (max-width: 800px) { .start-screen { grid-template-columns: 1fr; } .start-art { display: none; } }
@media (max-width: 600px) { .play-layout { grid-template-columns: 1fr; } .workspace { grid-column: auto; } .rules-card { grid-row: auto; } .tile-tray { grid-template-columns: repeat(3,minmax(0,1fr)); } }

/* Case-file theme, scoped to the landing screen and its notes dialog. */
body:has(#startScreen.active) { --bg-1:#f3ead6; --bg-2:#e7dac0; --surface:#fbf5e8; --surface-soft:#f4ead6; --text:#3d2b20; --muted:#725f4e; --accent:#7b2935; --accent-2:#963b47; --accent-soft:#ddc2b8; --chip:#eadcc4; --border:#c8b494; --shadow:0 16px 34px rgba(61,43,32,.16); background-color:var(--bg-1); background-image:repeating-linear-gradient(0deg,rgba(86,62,42,.025) 0,rgba(86,62,42,.025) 1px,transparent 1px,transparent 4px),linear-gradient(180deg,var(--bg-1),var(--bg-2)); }
body:has(#startScreen.active) .brand,body:has(#startScreen.active) .level-label,#startScreen h1,#startScreen .eyebrow,#startScreen .button,body:has(#startScreen.active) .modal-card h2,body:has(#startScreen.active) .modal-card .eyebrow,body:has(#startScreen.active) .modal-card .button { font-family:"Special Elite",cursive; letter-spacing:0; }
#startScreen { border-radius:8px; background-color:rgba(251,245,232,.94); background-image:repeating-linear-gradient(0deg,rgba(86,62,42,.022) 0,rgba(86,62,42,.022) 1px,transparent 1px,transparent 5px); }
#startScreen .eyebrow,body:has(#startScreen.active) .level-label { border:1px solid rgba(123,41,53,.55); border-radius:3px; background:transparent; transform:rotate(-1deg); }
#startScreen .button,body:has(#startScreen.active) .modal-card .button { border-radius:4px; }
body:has(#startScreen.active) .button-ghost { background:#fbf5e8; }
body:has(#startScreen.active) .modal-card { border-radius:8px; background:#fbf5e8; }
@media (max-width: 540px) { .game-header { align-items: flex-start; }.brand { font-size: 1rem; }.start-screen,.complete-screen { border-radius: 25px; }.start-screen { min-height: calc(100vh - 110px); padding: 28px 22px; }.button-stack,.button-stack .button { width: 100%; }.workspace { padding: 10px; }.board { gap: 3px; padding: 4px; }.object-tile { padding: 3px; }.action-row .button { flex: 1; padding-inline: 12px; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms!important; animation-iteration-count: 1!important; transition-duration: .01ms!important; } }

/* Detective Case Archive: shared treatment for every internal game screen. */
body { --bg-1:#f3ead6; --bg-2:#e7dac0; --surface:#fbf5e8; --surface-soft:#f4ead6; --text:#3d2b20; --muted:#725f4e; --accent:#7b2935; --accent-2:#963b47; --accent-soft:#ddc2b8; --chip:#eadcc4; --border:#c8b494; --shadow:0 14px 30px rgba(61,43,32,.14); background-color:var(--bg-1); background-image:repeating-linear-gradient(0deg,rgba(86,62,42,.025) 0,rgba(86,62,42,.025) 1px,transparent 1px,transparent 4px),linear-gradient(180deg,var(--bg-1),var(--bg-2)); }
.brand,.level-label,.eyebrow,.stage-heading h2,.complete-screen h2,.modal-card h2,.rules-card h3,.tray-card h3,.tray-heading span,.object-tile span,.button { font-family:"Special Elite",cursive; letter-spacing:0; }
.brand-mark { border-radius:6px; background:var(--accent); box-shadow:0 7px 16px rgba(61,43,32,.18); }
.level-label,.eyebrow { border:1px solid rgba(123,41,53,.55); border-radius:3px; background:#f5ead4; }
.level-label { transform:rotate(-1deg); }
.button { border-radius:4px; }
.button-primary { color:#fff8e8; background:var(--accent); }
.button-secondary,.button-ghost { color:var(--accent); border:1px solid var(--border); background:#fbf5e8; }
.button:hover,.button:focus-visible { box-shadow:0 8px 18px rgba(61,43,32,.2); }
.rules-card,.tray-card,.workspace,.complete-screen,.modal-card { border-color:#bda98b; border-radius:8px; background-color:rgba(251,245,232,.96); background-image:repeating-linear-gradient(0deg,rgba(86,62,42,.02) 0,rgba(86,62,42,.02) 1px,transparent 1px,transparent 5px); box-shadow:var(--shadow); }
.board { border:1px solid #9f8064; border-radius:6px; background:#cbb691; }
.board-cell { border-color:#c5b18f; border-radius:3px; background:#f7efdd; }
.board-cell.drop-target,.tile-tray.drop-target { outline-color:var(--accent); background:#eadcc4; }
.tile-tray { border:1px solid #cfbfa3; border-radius:5px; background:#efe3cc; }
.object-tile { border-color:#bda98b; border-radius:4px; background:#fbf5e8; box-shadow:0 4px 10px rgba(61,43,32,.12); }
.object-image { border-radius:3px; background:#eee2cf; }
.complete-mark { border-radius:6px; }
.master-mark { background:var(--accent); }
.modal { background:rgba(61,43,32,.48); }
