/* Clueprint in the browser. Colours from MurdleApp/Shared/Theme.swift; the app is light-only, and so is this. */
:root {
  color-scheme: light;
  --ink: #23211f;
  --paper: #fbf6ec;
  --card: #fffdf8;
  --red: #e5473b;
  --purple: #5d3a9b;
  --lavender: #efe9f8;
  --blue: #3d9ad6;
  --cross: #d8423a;
  --muted: rgba(35, 33, 31, 0.6);
  --line: rgba(35, 33, 31, 0.12);
  --serif: 'New York', ui-serif, Georgia, 'Times New Roman', serif;
  --display: ui-rounded, 'SF Pro Rounded', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 16px/1.45 var(--sans); background: var(--paper); overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: inherit; font-weight: 700; }
h1, h2, h3, p { margin: 0; }
h2 { font: 700 22px/1.25 var(--serif); margin-bottom: 8px; }

/* A faint blueprint grid over the base colour: fine lines every 16px, bold every 80px. */
.blueprint {
  background:
    linear-gradient(rgba(61, 154, 214, 0.24) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, rgba(61, 154, 214, 0.24) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(rgba(61, 154, 214, 0.12) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(61, 154, 214, 0.12) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--base, var(--paper));
}
.screen { min-height: 100vh; min-height: 100dvh; }
.content { max-width: 720px; margin: 0 auto; padding: 16px 16px 120px; display: flex; flex-direction: column; gap: 18px; }
.content.home { padding-bottom: 32px; gap: 22px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.section-title { font: 900 12px var(--display); letter-spacing: 1.2px; color: var(--muted); margin: 0 0 8px; }
.small { font-size: 13px; }
.caption { font-size: 12.5px; display: block; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spacer { flex: 1; }
.stars { font-size: 11px; letter-spacing: 1px; }
.stars .dim { opacity: 0.3; }
.capsule { color: #fff; font: 900 11px var(--display); padding: 3px 8px; border-radius: 99px; letter-spacing: 0.5px; }
.link { background: none; border: 0; padding: 4px; color: var(--red); font-weight: 700; }
.plain { background: none; border: 0; padding: 0; text-align: left; display: flex; width: 100%; }
.emoji-lg { font: 28px/1 var(--emoji); }
.emoji-xl { font: 72px/1 var(--emoji); }

.pill {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border: 0;
  border-radius: 99px; color: #fff; font-weight: 700; font-size: 17px; margin-top: 16px;
}
.pill:disabled { opacity: 0.5; }
.button { border: 0; border-radius: 10px; color: #fff; font-weight: 700; padding: 8px 14px; }
.round {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(35, 33, 31, 0.2);
  background: var(--card); font-size: 22px; font-weight: 700; display: grid; place-items: center;
}
.round:disabled { opacity: 0.35; }
.small-round { width: 34px; height: 34px; font-size: 18px; }

/* Home */
.masthead { text-align: center; padding-top: 8px; }
.mast-icon { font: 34px/1 var(--emoji); }
.masthead h1 { font: 900 30px var(--display); letter-spacing: 2px; margin-top: 4px; }
.masthead p { font: italic 16px var(--serif); color: rgba(35, 33, 31, 0.7); }
.allowance { display: flex; align-items: center; gap: 12px; }
.allowance b { font: 700 15px var(--serif); }
.allowance-icon { font: 700 22px/1 var(--emoji); color: var(--red); }

.folder { position: relative; padding-top: 36px; }
.folder-tab {
  position: absolute; top: 0; left: 18px; padding: 8px 16px 10px; border-radius: 12px 12px 0 0;
  background: var(--folder); color: #fff; font: 900 15px var(--display); letter-spacing: 1.5px;
}
.folder-body { border: 3px solid var(--folder); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.folder-head { display: flex; gap: 10px; align-items: flex-start; }
.folder-head p { flex: 1; font: 16px/1.4 var(--serif); color: rgba(35, 33, 31, 0.85); }
.folder-head .round { color: var(--folder); border-color: var(--folder); }
.folder-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.folder-stats b { font: 900 20px var(--display); color: var(--folder); margin-right: 3px; }
.daily {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; border: 0; border-radius: 12px;
  background: var(--folder); color: #fff; font-weight: 700; font-size: 17px; text-align: left;
}
.daily .grow { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue {
  height: 44px; padding: 0 16px; border: 0; border-radius: 12px; font-weight: 700; text-align: left;
  background: color-mix(in srgb, var(--folder) 12%, transparent); color: var(--folder);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder .section-title { margin: 0; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.difficulty {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-align: left;
  background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(35, 33, 31, 0.1);
}
.row-title b { font: 700 15px var(--serif); }
.plus { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid; place-items: center; font: 900 18px/1 var(--sans); }
.home-footer { text-align: center; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.home-footer .link { font-size: 14px; }

.ad-slot { text-align: center; }
.ad-slot > span { display: block; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; opacity: 0.6; margin-bottom: 6px; }

/* Case screens */
.game-bar {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px; background: rgba(251, 246, 236, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.game-bar .link { justify-self: start; font-size: 16px; }
.game-bar-end { justify-self: end; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: 40px; min-width: 230px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(35, 33, 31, 0.2); padding: 6px; display: flex; flex-direction: column;
}
.menu-list button { background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 8px; }
.menu-list button:hover:not(:disabled) { background: rgba(35, 33, 31, 0.06); }
.menu-list button:disabled { opacity: 0.4; }
.menu-list .destructive { color: var(--cross); }

.case-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.case-title { font: 700 22px/1.25 var(--serif); margin-bottom: 8px; }
.story { font: 16px/1.5 var(--serif); color: rgba(35, 33, 31, 0.85); }
.stamp-small { font: 900 20px var(--display); margin-bottom: 6px; }

.evidence-row { margin-bottom: 10px; }
.cards { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.cards::-webkit-scrollbar { display: none; }
.cards .plain { width: auto; flex: none; }
.evidence {
  width: 130px; min-height: 132px; padding: 10px; border-radius: 12px; border: 1px solid rgba(35, 33, 31, 0.15);
  display: flex; flex-direction: column; gap: 3px; text-align: left;
}
.evidence.large { width: auto; min-height: 0; padding: 16px; gap: 6px; }
.evidence-top { display: flex; justify-content: space-between; align-items: flex-start; }
.evidence-emoji { font: 30px/1 var(--emoji); }
.large .evidence-emoji { font-size: 48px; }
.evidence-kind { font: 900 9px var(--display); color: rgba(35, 33, 31, 0.5); }
.evidence-name { font: 700 15px/1.2 var(--serif); }
.large .evidence-name { font-size: 21px; }
.evidence-blurb { font: italic 16px var(--serif); }
.evidence-trait { font-size: 11.5px; color: rgba(35, 33, 31, 0.75); }
.large .evidence-trait { font-size: 15px; }

.statement { gap: 10px; align-items: flex-start; padding: 6px 0; }
.statement .quote { display: block; font: italic 16px var(--serif); }
.struck { opacity: 0.4; }
.clues { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 8px; }
.clue { gap: 8px; align-items: baseline; font: 16px/1.4 var(--serif); }
.clue .num { font: 700 15px ui-monospace, Menlo, monospace; color: var(--red); }
.clue.struck span:last-child { text-decoration: line-through; }

/* The deduction grid, sized in cell units so it scales to the screen (cells at most 46px). */
.logic-grid-wrap { width: 100%; container-type: inline-size; margin-top: 8px; }
.logic-grid { display: grid; width: 100%; position: relative; }
.grid-head, .grid-cell { border: 0; padding: 0; display: grid; place-items: center; min-width: 0; min-height: 0; }
.grid-head { font: calc(62cqw / var(--wide)) / 1 var(--emoji); box-shadow: inset 0 0 0 0.5px rgba(35, 33, 31, 0.25); }
.grid-cell { background: var(--card); box-shadow: inset 0 0 0 0.5px rgba(35, 33, 31, 0.2); }
.grid-cell.mistake { background: color-mix(in srgb, var(--red) 25%, var(--card)); }
.grid-cell .x { color: var(--cross); font: 700 calc(50cqw / var(--wide)) / 1 var(--sans); }
.grid-cell .tick { color: var(--blue); font: 900 calc(58cqw / var(--wide)) / 1 var(--sans); }
.grid-box { border: 1.5px solid var(--ink); pointer-events: none; z-index: 1; }

/* Floor plan */
.board-tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.segmented { display: flex; background: rgba(35, 33, 31, 0.08); border-radius: 9px; padding: 2px; width: 200px; }
.segmented button { flex: 1; border: 0; background: none; border-radius: 7px; padding: 5px 0; font-size: 14px; font-weight: 600; }
.segmented .on { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.compass { font: 900 10px/1.1 var(--display); color: var(--purple); text-align: center; }
.board { display: grid; position: relative; width: 100%; aspect-ratio: 1; container-type: inline-size; }
.tile {
  position: relative; border: 0; padding: 0; min-width: 0; aspect-ratio: 1; box-shadow: inset 0 0 0 0.5px rgba(35, 33, 31, 0.12);
  display: grid; place-items: center; overflow: hidden;
}
.tile > * { grid-area: 1 / 1; }
.tile:disabled { cursor: default; }
.rug { position: absolute; inset: 10%; border-radius: 10%; background: rgba(229, 143, 169, 0.55); border: 1.5px dashed #c2577a; }
.furniture { width: 42%; height: 42%; display: grid; }
.furniture.corner { position: absolute; right: 2px; bottom: 2px; width: 24%; height: 24%; }
.shade { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.1); }
.tile-x { color: rgba(216, 66, 58, 0.8); font: 700 calc(40cqw / var(--n)) / 1 var(--sans); }
.tile-token { width: 72%; height: 72%; display: grid; z-index: 1; }
.tile-token .token { width: 100%; height: 100%; font-size: calc(43cqw / var(--n)); }
.room-emoji { position: absolute; top: 3px; left: 3px; font: calc(22cqw / var(--n)) / 1 var(--emoji); }
.walls { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.walls path, .walls rect { fill: none; stroke: var(--ink); stroke-width: 3px; stroke-linecap: square; vector-effect: non-scaling-stroke; }
.token {
  position: relative; display: grid; place-items: center; border-radius: 50%; border: 2px solid; font-family: var(--emoji);
  line-height: 1; transition: transform 0.2s;
}
.token.selected { border-width: 3.5px; transform: scale(1.06); }
.badge { position: absolute; top: -8%; right: -8%; font-size: 0.55em; }
.badge.warn { background: var(--red); color: #fff; border-radius: 50%; width: 1.1em; height: 1.1em; display: grid; place-items: center; font: 900 0.5em/1 var(--sans); }
.banner { min-height: 22px; margin: 8px 0 2px; color: var(--red); font-weight: 700; font-size: 14px; }
.room-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; font-size: 12.5px; }
.room-legend span { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(35, 33, 31, 0.3); flex: none; }
.tray { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px; }
.tray-person { width: auto; flex: none; flex-direction: column; align-items: center; gap: 4px; }
.person-clues { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; margin-bottom: 4px; }
.clue-face { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 20px/1 var(--emoji); }
.clue-line { display: block; font: 15.5px/1.4 var(--serif); }
.furniture-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.furniture-legend > span { display: flex; align-items: center; gap: 6px; }
.rug-swatch { width: 18px; height: 13px; border-radius: 3px; background: #e58fa9; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; gap: 12px; align-items: center;
  padding: 8px max(16px, calc((100vw - 720px) / 2 + 16px)) max(8px, env(safe-area-inset-bottom));
  background: rgba(251, 246, 236, 0.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottom-bar .pill { margin: 0; height: 48px; }

/* Sheets */
.backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.3); display: flex; align-items: flex-end;
  justify-content: center; animation: fade 0.15s;
}
.sheet {
  width: 100%; max-width: 620px; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; display: flex;
  flex-direction: column; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2); animation: rise 0.2s ease-out;
}
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 16px; }
}
.sheet-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.85); border-radius: inherit;
}
.sheet-bar .link { justify-self: start; }
.sheet-body { overflow-y: auto; padding: 16px 16px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 16px 0; }
.result .pill { margin-top: 8px; }
.result-text { font: 19px/1.45 var(--serif); }
.stamp { font: 900 40px var(--display); transform: rotate(-4deg); border: 4px solid; border-radius: 6px; padding: 0 16px; }
.pick-group { margin-top: 18px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: 8px; }
.pick {
  min-height: 78px; padding: 8px 6px; border-radius: 12px; background: var(--card); border: 1px solid rgba(35, 33, 31, 0.15);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; font-size: 13px;
}
.pick.selected { border: 2.5px solid var(--ink); }
.rule { display: flex; gap: 12px; align-items: flex-start; }
.rule-num { flex: none; width: 30px; height: 30px; border-radius: 50%; color: #fff; display: grid; place-items: center; font: 900 16px var(--display); }
.rule h3 { font: 700 17px var(--serif); }
.rule p { font: 16px/1.45 var(--serif); color: rgba(35, 33, 31, 0.85); }

.shop { display: flex; flex-direction: column; gap: 12px; }
.shop.busy { opacity: 0.6; }
.shop-item {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); text-align: left;
}
.shop-item b { font: 700 17px var(--serif); }
.shop-icon { flex: none; width: 46px; height: 46px; border-radius: 12px; color: #fff; display: grid; place-items: center; font: 700 24px/1 var(--emoji); }
.price { font: 900 17px var(--display); }
.note-error { color: var(--cross); font-size: 14px; }
.field { width: 100%; font: 17px var(--sans); padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(35, 33, 31, 0.25); background: #fff; margin-top: 12px; }

.loading { align-items: center; background: rgba(0, 0, 0, 0.25); }
.loading-box {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; border-radius: 18px;
  background: rgba(255, 253, 248, 0.95); font: 600 17px var(--serif);
}
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(35, 33, 31, 0.15); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
.toast {
  position: fixed; z-index: 30; left: 50%; bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px)); transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); font-weight: 600; animation: rise 0.2s ease-out;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.toast { animation: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
