/* Setback Daily - "Architect's desk" theme. Fonts: Architects Daughter + Jost (both SIL OFL 1.1, self-hosted). */
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 300 800; font-display: swap; src: url(../fonts/jost-var-latin.woff2) format('woff2'); }
@font-face { font-family: 'Architects Daughter'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/architects-daughter-latin.woff2) format('woff2'); }
:root {
  --ink: #2b2722; --ink2: rgba(43,39,34,.72); --muted: #6f655a; --paper: #f8f3e4; --bond: #fbfaf4; --trace: #f2e6bd; --manila: #e7d19d; --kraft: #c9a874;
  --red: #c4372c; --stamp: #2f4796; --ok: #3e6b45; --desk: #9c7650; --sticky: #f8e98a;
  --hand: 'Architects Daughter', 'Jost', cursive; --ui: 'Jost', system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --chk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5c1.6 1.2 2.6 2.6 3.4 4.2C7.6 8.4 10.6 4.6 14.6 1.6' fill='none' stroke='%232b2722' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --xx: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3.4c3.4 3 6.4 6.2 10.2 9.6M12.6 2.6C9.4 6 6.6 9.4 3.4 13.4' fill='none' stroke='%23c4372c' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  --ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M8 22C6 9 40 3 66 4s32 8 30 17-26 15-52 15S3 30 9 17C14 8 34 4 50 4' fill='none' stroke='%23c4372c' stroke-width='2.2' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --hatch: repeating-linear-gradient(-55deg, rgba(43,39,34,.62) 0 1.3px, transparent 1.3px 4.2px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #6f5236; color: var(--ink); font-family: var(--ui); overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; max-width: 520px; margin: 0 auto; overflow: hidden; overflow: clip; background: var(--desk); background-size: 360px 360px; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; padding-top: var(--sat); padding-bottom: var(--sab); }
.screen.active { display: flex; animation: fadein .22s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
button { font-family: inherit; color: inherit; }

/* ---------- buttons: paper tabs + rubber stamps ---------- */
.btn { appearance: none; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink);
  font-family: var(--hand); text-transform: uppercase; font-size: 17px; line-height: 1.1; padding: 11px 14px 10px; background: var(--paper);
  border-radius: 3px 5px 2px 4px; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 0 rgba(60,40,20,.25), 0 5px 10px rgba(40,22,8,.28);
  transition: transform .08s ease, box-shadow .08s ease; position: relative; }
.btn::after { content: ''; position: absolute; inset: 4px; border: 1.2px solid rgba(43,39,34,.55); border-radius: 2px 4px 3px 2px; pointer-events: none; }
.btn:active { transform: translateY(2px) scale(.98); box-shadow: 0 1px 0 rgba(60,40,20,.25), 0 2px 4px rgba(40,22,8,.25); }
.btn.tab { background: var(--manila); }
.btn.tab::after { border-color: rgba(90,60,25,.45); }
/* primary = red-ink rubber stamp on cream card */
.btn.primary { background: var(--bond); color: var(--red); font-family: var(--ui); font-weight: 700; text-transform: uppercase; letter-spacing: 2px; font-size: 15px; }
.btn.primary::after { border: 2.5px solid var(--red); inset: 4px; border-radius: 4px; box-shadow: inset 0 0 0 2.5px var(--bond), inset 0 0 0 3.6px var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='1' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.6 1.25'/%3E%3C/filter%3E%3Crect width='60' height='60' filter='url(%23n)'/%3E%3C/svg%3E"); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='1' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.6 1.25'/%3E%3C/filter%3E%3Crect width='60' height='60' filter='url(%23n)'/%3E%3C/svg%3E"); }
.btn.primary:active { transform: translateY(2px) rotate(-.6deg) scale(.97); }
.btn.big { font-size: 17px; padding: 15px 18px 14px; }
.btn.big:not(.primary) { font-size: 20px; }
.btn.full { width: 100%; }
.btn.danger { color: var(--red); }
.btn.round { font-size: 15px; padding: 8px 13px 7px; }
.btn.cta { background: #2d4560; color: #f6efdc; font-family: var(--ui); font-weight: 600; font-size: 14px; letter-spacing: .4px; }
.btn.cta::after { border-color: rgba(246,239,220,.55); border-style: dashed; }
.btn[disabled] { opacity: .5; }
.link { background: none; border: 0; color: var(--ink); font-family: var(--hand); text-transform: uppercase; font-size: 16px; padding: 8px; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: rgba(43,39,34,.45); }
.link.danger { color: var(--red); }
.icon { background: var(--paper); border: 0; font-size: 26px; line-height: 1; width: 36px; height: 36px; cursor: pointer; color: var(--ink); border-radius: 3px 5px 3px 4px; box-shadow: 0 2px 0 rgba(60,40,20,.25), 0 4px 8px rgba(40,22,8,.25); padding: 0 0 3px; }
.row { display: flex; gap: 10px; justify-content: center; }
.row > .btn { flex: 1; }
.row.small { gap: 18px; }
.pad { padding: 8px 16px; } .pad2 { margin: 8px 16px; }
.muted { color: var(--muted); } .center { text-align: center; } .hidden { display: none !important; }
.disc { position: absolute; bottom: calc(6px + var(--sab)); left: 0; right: 0; text-align: center; font-size: 11px; color: rgba(255,244,222,.85); margin: 0; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.disc.in { position: static; margin-top: 4px; color: var(--muted); text-shadow: none; }
.tiny { font-size: 10px; color: var(--muted); margin-top: 24px; text-align: center; }
.coin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; vertical-align: -2px; margin-right: 4px; flex: none;
  background: radial-gradient(circle at 35% 30%, #f6dc93 0 18%, #d2a548 45%, #9a7020 100%); box-shadow: inset 0 0 0 2px rgba(120,80,20,.35), 0 1px 1px rgba(0,0,0,.25); }

/* ---------- title ---------- */
#titleBg { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-wrap { position: relative; flex: 1; padding: 8vh 34px calc(40px + var(--sab)); display: flex; flex-direction: column; gap: 11px; text-align: center; }
.title-top { margin-bottom: auto; }
.logo { display: flex; flex-direction: column; line-height: .95; color: var(--ink); font-family: var(--hand); text-transform: uppercase; transform: rotate(-2deg); }
.logo span { font-family: var(--ui); font-size: 14px; font-weight: 600; letter-spacing: 7px; text-transform: uppercase; color: var(--ink2); display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; padding-left: 7px; }
.logo span::before, .logo span::after { content: ''; flex: 0 0 46px; border-top: 1.4px dashed var(--ink2); }
.logo b { font-weight: 400; font-size: 54px; letter-spacing: -.5px; }
.tag { color: var(--ink2); margin: 10px auto 0; font-size: 16px; font-family: var(--hand); text-transform: uppercase; max-width: 250px; line-height: 1.3; }
.coins-line { color: #fff6e3; margin: 0; font-family: var(--hand); text-transform: uppercase; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
#scr-title .link { color: #fff6e3; text-decoration-color: rgba(255,246,227,.6); text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---------- bars (strip of bond paper across the top of the desk) ---------- */
.bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; min-height: 54px; background: var(--bond); box-shadow: 0 3px 8px rgba(40,22,8,.3); position: relative; z-index: 2; }
.bar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 3px; border-bottom: 1px solid rgba(43,39,34,.5); }
.bar h2 { flex: 1; margin: 0; font-size: 23px; font-weight: 400; font-family: var(--hand); text-transform: uppercase; }
.bar .icon { box-shadow: none; background: transparent; border: 1.3px solid rgba(43,39,34,.6); width: 32px; height: 32px; font-size: 22px; }
.coins { font-family: var(--hand); text-transform: uppercase; font-size: 16px; white-space: nowrap; display: inline-flex; align-items: center; }
.play-bar { padding: 5px 9px 7px; }
.pb-mid { flex: 1; min-width: 0; }
.pb-title { display: flex; align-items: center; gap: 8px; font-family: var(--hand); text-transform: uppercase; font-size: 18px; white-space: nowrap; }
.pb-title #lvlName { overflow: hidden; text-overflow: ellipsis; }
.mini { border: 0; background: var(--manila); font-family: var(--hand); text-transform: uppercase; font-size: 13px; padding: 2px 9px 1px; cursor: pointer; border-radius: 4px 4px 0 0; box-shadow: 0 1px 2px rgba(40,22,8,.3); flex: none; }
/* cost estimate: hand-drawn bar with graphite hatch */
.est { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.est-l { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: var(--ink2); }
.budget { position: relative; flex: 1; height: 13px; border: 1.4px solid var(--ink); border-radius: 2px 3px 1px 3px; transform: rotate(-.3deg); background: rgba(255,255,255,.4); }
.budget::after { content: ''; position: absolute; left: 90.9%; top: -4px; bottom: -4px; border-left: 1.2px dashed rgba(43,39,34,.5); }
.budget-fill { position: absolute; inset: 1px auto 1px 1px; width: 0; max-width: calc(100% - 2px); background: var(--hatch); transition: width .25s ease; }
.budget-fill.warn { background: repeating-linear-gradient(-55deg, rgba(176,118,30,.8) 0 1.4px, transparent 1.4px 4px); }
.budget-fill.over { background: repeating-linear-gradient(-55deg, rgba(196,55,44,.85) 0 1.6px, transparent 1.6px 3.6px); }
#budgetText { font-family: var(--hand); text-transform: uppercase; font-size: 13px; white-space: nowrap; min-width: 98px; text-align: right; }

/* ---------- plan review notes on a sticky note ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 7px 12px 6px 14px; margin: 8px 10px 2px; background: var(--sticky); position: relative; z-index: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 6px 10px -4px rgba(40,22,8,.45); transform: rotate(-.6deg); border-radius: 1px 1px 2px 14px / 1px 1px 2px 6px; }
.chips::before { content: 'PLAN REVIEW'; position: absolute; top: -8px; left: 10px; font: 700 8px var(--ui); letter-spacing: 2px; background: var(--red); color: #fff; padding: 2px 5px; transform: rotate(-2deg); }
.chip { font-family: var(--hand); text-transform: uppercase; font-size: 13.5px; padding: 1px 0; background: none; display: inline-flex; gap: 5px; align-items: center; border: 0; cursor: pointer; color: var(--ink); }
.chip::before { content: ''; width: 12px; height: 12px; border: 1.4px solid var(--ink); border-radius: 1px 3px 2px 2px; flex: none; background-size: 15px 15px; background-position: 0 -3px; background-repeat: no-repeat; }
.chip.ok::before { background-image: var(--chk); }
.chip.bad { color: var(--red); } .chip.bad::before { background-image: var(--xx); border-color: var(--red); background-position: -1px -1px; background-size: 13px 13px; }
.chip.warn { color: #7a5410; }
.chip.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.14) rotate(-2deg); } }

/* ---------- stage ---------- */
.stage { position: relative; flex: 1; min-height: 0; touch-action: none; }
#plan { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.coach { position: absolute; top: 12px; left: 22px; right: 22px; background: var(--bond); color: var(--ink); padding: 10px 13px 2px; font-family: var(--hand); text-transform: uppercase; font-size: 15.5px; line-height: 1.3; z-index: 3; pointer-events: auto; transform: rotate(.8deg);
  box-shadow: 0 6px 14px rgba(40,22,8,.35); background-image: repeating-linear-gradient(transparent 0 19px, rgba(110,150,200,.35) 19px 20px); background-position: 0 6px; animation: fadein .3s ease; }
.coach::before { content: ''; position: absolute; top: -9px; left: 50%; width: 70px; height: 18px; margin-left: -35px; background: rgba(232,219,182,.85); transform: rotate(-3deg); }
.coach p { margin: 0 0 2px; } .coach b { font-weight: 400; color: var(--red); text-decoration: underline; text-decoration-color: rgba(196,55,44,.5); }
.coach .link { font-size: 13px; padding: 4px 0; color: var(--muted); }
.selbar { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; gap: 10px; justify-content: center; z-index: 2; }

/* ---------- room palette: marker swatch chips on the desk ---------- */
.tray { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 8px 7px 4px; }
.tile { position: relative; border: 0; padding: 5px 0 3px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-family: var(--hand); text-transform: uppercase; font-size: 10.5px; letter-spacing: -.2px; touch-action: none; cursor: grab;
  background: var(--bond); border-radius: 1px; box-shadow: 0 2px 0 rgba(60,40,20,.2), 0 4px 7px rgba(40,22,8,.3); }
.tile:nth-child(odd) { transform: rotate(-1.2deg); } .tile:nth-child(even) { transform: rotate(1deg); }
.tile canvas { width: 38px; height: 32px; }
.tile .need { position: absolute; top: -7px; right: -4px; font-family: var(--hand); text-transform: uppercase; font-size: 12px; color: var(--red); background: var(--bond); border: 1.4px solid var(--red); border-radius: 50%; min-width: 26px; height: 20px; line-height: 17px; text-align: center; padding: 0 2px; transform: rotate(-6deg); }
.tile .need.done { color: var(--ok); border-color: var(--ok); }
.tile.dim { opacity: .5; }
.tile:active { transform: scale(.94); }
.actions { display: flex; gap: 10px; padding: 6px 10px 10px; }
.actions .btn { flex: 1; }
.actions #btnSubmit { flex: 1.25; }
.pulse { position: relative; z-index: 2; }
.pulse::before { content: ''; position: absolute; inset: -7px -6px; background: var(--ring) center/100% 100% no-repeat; pointer-events: none; animation: ringpulse 1.1s ease-in-out infinite; z-index: 3; }
@keyframes ringpulse { 0%,100% { opacity: .95; transform: scale(1); } 50% { opacity: .45; transform: scale(1.06); } }

/* ---------- lists (drawing index) ---------- */
.list { overflow-y: auto; padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.lvl { display: flex; gap: 12px; align-items: center; background: var(--bond); padding: 10px 12px; border: 0; text-align: left; cursor: pointer; font-size: 15px; position: relative;
  box-shadow: 0 2px 0 rgba(60,40,20,.2), 0 6px 10px rgba(40,22,8,.3); border-radius: 1px; }
.lvl:nth-child(odd) { transform: rotate(-.5deg); } .lvl:nth-child(even) { transform: rotate(.4deg); }
.lvl .num { width: 54px; height: 48px; border: 1.4px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; font-family: var(--hand); text-transform: uppercase; font-size: 19px; line-height: 1; }
.lvl .num small { font: 600 7px var(--ui); letter-spacing: 1.2px; color: var(--ink2); margin-bottom: 3px; }
.lvl h4 { margin: 0; font-size: 19px; font-weight: 400; font-family: var(--hand); text-transform: uppercase; } .lvl p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.lvl .st { margin-left: auto; white-space: nowrap; display: flex; gap: 2px; }
.lvl .st i { width: 15px; height: 15px; display: block; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: rgba(43,39,34,.18); }
.lvl .st i.on { background: var(--stamp); }
.lvl.locked { opacity: .78; padding-right: 152px; } .lvl.locked h4, .lvl.locked p { opacity: .55; }
.lvl.locked::after { content: 'NOT ISSUED'; position: absolute; right: 14px; top: 50%; margin-top: -11px; font: 700 11px var(--ui); letter-spacing: 2px; color: var(--red); border: 2px solid var(--red); padding: 3px 7px; transform: rotate(-8deg); opacity: .8; }
.style-card { background: var(--bond); padding: 12px; box-shadow: 0 2px 0 rgba(60,40,20,.2), 0 6px 10px rgba(40,22,8,.3); display: flex; gap: 12px; align-items: center; border-radius: 1px; }
.style-card canvas { width: 110px; height: 80px; background: var(--trace); flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.style-card h4 { margin: 0; font-family: var(--hand); text-transform: uppercase; font-weight: 400; font-size: 18px; } .style-card p { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.style-card .chip { font-size: 15px; }

/* ---------- result: permit stamp + plan review comments ---------- */
#scr-result { background: transparent; }
.result-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 10px 14px 20px; gap: 9px; }
.result-body.shake { animation: deskshake .28s ease; }
@keyframes deskshake { 20% { transform: translateY(3px); } 45% { transform: translateY(-1px); } 70% { transform: translateY(1px); } }
.stamp-wrap { position: relative; width: 260px; height: 132px; margin: 2px 0 -2px; opacity: 0; }
.stamp-wrap.thunk { animation: thunk .42s cubic-bezier(.3,.0,.4,1) forwards; }
@keyframes thunk { 0% { opacity: 0; transform: scale(2.3) rotate(-15deg); } 62% { opacity: 1; transform: scale(.93) rotate(-6deg); } 80% { transform: scale(1.02) rotate(-6.5deg); } 100% { opacity: 1; transform: scale(1) rotate(-6deg); } }
#resStamp { width: 260px; height: 132px; display: block; }
.stars { position: absolute; left: 0; right: 0; top: 86px; display: flex; justify-content: center; gap: 12px; }
.stars i { width: 28px; height: 28px; display: block; background: var(--stamp); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); opacity: 0; transform: scale(2.2); }
.stars i.on { animation: starthunk .3s cubic-bezier(.3,0,.4,1) forwards; }
@keyframes starthunk { 0% { opacity: 0; transform: scale(2.4) rotate(-20deg); } 70% { opacity: .95; transform: scale(.9); } 100% { opacity: .92; transform: scale(1); } }
.res-head { font-size: 24px; margin: 0; font-family: var(--hand); text-transform: uppercase; color: #fff6e3; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
#resCanvas { width: 100%; max-width: 360px; height: 168px; background: var(--trace); box-shadow: 0 6px 12px rgba(40,22,8,.35); transform: rotate(.6deg); }
.checks { list-style: none; margin: 0; width: 100%; max-width: 380px; background: var(--bond); padding: 22px 14px 8px 30px; position: relative; box-shadow: 0 6px 12px rgba(40,22,8,.35); transform: rotate(-.4deg);
  background-image: repeating-linear-gradient(transparent 0 28px, rgba(110,150,200,.28) 28px 29px); background-position: 0 19px; }
.checks::before { content: 'PLAN REVIEW COMMENTS'; position: absolute; top: 6px; left: 30px; font: 700 9px var(--ui); letter-spacing: 2px; color: var(--red); }
.checks::after { content: ''; position: absolute; top: 0; bottom: 0; left: 22px; border-left: 1px solid rgba(196,55,44,.45); }
.checks li { display: flex; gap: 8px; align-items: center; min-height: 29px; font-family: var(--hand); text-transform: uppercase; font-size: 15px; position: relative; }
.checks li b { margin-left: auto; font-weight: 400; white-space: nowrap; font-size: 14px; color: var(--ink2); }
.checks li::before { content: ''; width: 13px; height: 13px; flex: none; background-repeat: no-repeat; background-size: contain; }
.checks .y::before { background-image: var(--chk); }
.checks .s::before { background: var(--stamp); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.checks .n { color: var(--red); } .checks .n::before { background-image: var(--xx); }
.res-coins { font-family: var(--hand); text-transform: uppercase; font-size: 17px; color: #fff3cf; margin: 0; min-height: 20px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
#scr-result .link { color: #fff6e3; text-decoration-color: rgba(255,246,227,.6); text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---------- storm ---------- */
#storm { position: absolute; inset: 0; width: 100%; height: 100%; }
.storm-hud { position: absolute; top: calc(18px + var(--sat)); left: 24px; right: 24px; display: flex; justify-content: space-between; font-family: var(--hand); text-transform: uppercase; font-size: 18px; color: var(--ink); pointer-events: none; }
.storm-hud span { background: rgba(251,250,244,.8); border: 1.3px solid var(--ink); padding: 3px 9px 1px; transform: rotate(-1deg); }
.storm-hud span + span { transform: rotate(1.2deg); min-width: 86px; text-align: center; }
.skip { position: absolute; bottom: calc(18px + var(--sab)); right: 18px; }
.card { position: absolute; left: 14px; right: 14px; bottom: calc(12px + var(--sab)); background: var(--bond); padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 9px; text-align: center; box-shadow: 0 10px 24px rgba(40,22,8,.45); animation: up .35s cubic-bezier(.2,1.3,.4,1); border-radius: 1px; transform: rotate(-.4deg); }
.card::before, .modal-card::before { content: ''; position: absolute; top: -10px; left: 50%; width: 92px; height: 20px; margin-left: -46px; background: rgba(232,219,182,.88); transform: rotate(-2deg); box-shadow: 0 1px 1px rgba(0,0,0,.06); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: rotate(-.4deg); opacity: 1; } }
.storm-out { font-size: 26px; margin: 0; font-family: var(--hand); text-transform: uppercase; }
.card .muted { margin: 0; font-size: 14px; }
.card .res-coins, .modal-card .res-coins { color: #8a5d00; text-shadow: none; }

/* ---------- street (corkboard) ---------- */
.street-scroll { overflow-x: auto; overflow-y: hidden; flex: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; box-shadow: inset 0 0 0 6px #7a5634, inset 0 0 0 8px #5d3f24; }
#street { display: block; height: 380px; }
#streetNote { color: #fff6e3; font-family: var(--hand); text-transform: uppercase; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---------- spec sheet (Style & storm) ---------- */
.sheet-back { position: absolute; inset: 0; background: rgba(30,18,8,.4); z-index: 10; }
.sheet { position: absolute; left: 6px; right: 6px; bottom: 0; z-index: 11; background: var(--bond); padding: 8px 14px calc(12px + var(--sab)); transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.9,.3,1); max-height: 90%; overflow-y: auto; box-shadow: 0 -8px 24px rgba(30,18,8,.4); visibility: hidden; border-radius: 1px; }
.sheet.open { transform: none; visibility: visible; }
.sheet-grip { width: 64px; height: 16px; background: rgba(232,219,182,.9); margin: -2px auto 8px; transform: rotate(-2deg); }
#preview { width: 100%; height: 140px; display: block; background: var(--trace); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.opt-h { font: 700 11px var(--ui); color: var(--ink2); text-transform: uppercase; letter-spacing: 2px; margin: 14px 0 6px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(43,39,34,.4); padding-bottom: 3px; }
.opt-h span + span { font: 400 14px var(--hand); letter-spacing: 0; text-transform: uppercase; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 30%; border: 0; background: transparent; padding: 7px 3px 6px; font-family: var(--hand); text-transform: uppercase; font-size: 14px; letter-spacing: -.2px; cursor: pointer; line-height: 1.12; position: relative; }
.seg button.long { font-size: 12px; letter-spacing: -.5px; }
.seg button small { display: block; font-family: var(--ui); color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.seg button.on::before { content: ''; position: absolute; inset: -2px -1px; background: var(--ring) center/100% 100% no-repeat; }
.seg button.locked { opacity: .55; }
.toggle { display: flex; align-items: center; gap: 10px; background: transparent; padding: 8px 2px; font-family: var(--hand); text-transform: uppercase; cursor: pointer; border: 0; width: 100%; font-size: 16px; text-align: left; border-bottom: 1px dashed rgba(43,39,34,.25); }
.toggle small { color: var(--muted); display: block; font-size: 11.5px; font-family: var(--ui); }
.toggle .sw { margin-left: auto; width: 22px; height: 22px; border: 1.6px solid var(--ink); border-radius: 2px 4px 2px 3px; flex: none; background-size: 26px 26px; background-position: -1px -6px; background-repeat: no-repeat; }
.toggle.on .sw { background-image: var(--chk); }
.meter { display: flex; gap: 3px; } .meter i { width: 13px; height: 10px; border: 1.2px solid var(--ink); } .meter i.on { background: var(--hatch); } .meter i.need { box-shadow: 0 4px 0 -2.5px var(--red); }
.stepper { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.stepper button { width: 40px; height: 38px; border: 0; background: var(--manila); font-size: 24px; cursor: pointer; font-family: var(--hand); text-transform: uppercase; box-shadow: 0 2px 0 rgba(60,40,20,.25), 0 3px 6px rgba(40,22,8,.2); border-radius: 3px; }
.stepper span { flex: 1; text-align: center; font-family: var(--hand); text-transform: uppercase; font-size: 17px; }

/* ---------- modal (memo sheet taped to desk) + toast ---------- */
.modal { position: absolute; inset: 0; background: rgba(30,18,8,.45); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background: var(--bond); padding: 20px 18px 16px; width: 100%; max-height: 90%; overflow-y: auto; box-shadow: 0 12px 28px rgba(30,18,8,.5); animation: up .3s ease; display: flex; flex-direction: column; gap: 10px; position: relative; border-radius: 1px; transform: rotate(-.4deg); overflow: visible; }
.modal-card h3 { margin: 0; font-size: 26px; font-weight: 400; font-family: var(--hand); text-transform: uppercase; } .modal-card p { margin: 0; }
.memo-h { font: 700 9px var(--ui); letter-spacing: 2px; color: var(--ink2); border-bottom: 1.3px solid var(--ink); padding-bottom: 4px; display: flex; justify-content: space-between; }
.brief-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.brief-list span { font-family: var(--hand); text-transform: uppercase; font-size: 16px; display: inline-flex; align-items: center; gap: 6px; }
.brief-list span i { width: 22px; height: 14px; display: inline-block; border: 1.2px solid var(--ink); }
.facts { font-size: 14px; border-top: 1px solid rgba(43,39,34,.3); }
.facts div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(43,39,34,.18); } .facts span { color: var(--muted); font-size: 12.5px; } .facts b { font-weight: 400; font-family: var(--hand); text-transform: uppercase; font-size: 15px; text-align: right; }
.revise { display: flex; align-items: baseline; gap: 10px; }
.revise-word { font-family: var(--hand); text-transform: uppercase; font-size: 40px; color: var(--red); line-height: 1; padding: 4px 16px 0; background: var(--ring) center/100% 100% no-repeat; transform: rotate(-4deg); }
.revise-sub { font-family: var(--hand); text-transform: uppercase; color: var(--red); font-size: 17px; }
.redlines { margin: 0; padding: 0 0 0 4px; list-style: none; counter-reset: rl; display: flex; flex-direction: column; gap: 8px; }
.redlines li { counter-increment: rl; display: flex; gap: 10px; font-family: var(--hand); text-transform: uppercase; font-size: 15.5px; color: var(--red); line-height: 1.25; }
.redlines li::before { content: counter(rl); flex: none; width: 22px; height: 22px; border: 1.5px solid var(--red); border-radius: 50%; display: grid; place-items: center; font-size: 13px; transform: rotate(-8deg); }
.share-img { width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.toast { position: absolute; left: 50%; top: calc(70px + var(--sat)); transform: translate(-50%, -20px) rotate(-1deg); background: var(--sticky); color: var(--ink); padding: 9px 14px 7px; font-family: var(--hand); text-transform: uppercase; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; max-width: 88%; text-align: center; box-shadow: 0 6px 12px rgba(40,22,8,.35); }
.toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }
.about { padding: 14px 18px 24px; margin: 12px; overflow-y: auto; font-size: 15px; line-height: 1.45; background: var(--bond); box-shadow: 0 6px 12px rgba(40,22,8,.35); }
.about h3 { font-family: var(--hand); text-transform: uppercase; font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.about a { color: var(--stamp); }
@media (min-height: 760px) { .tile canvas { width: 40px; height: 34px; } .tile { padding: 6px 0 4px; } }
@media (prefers-reduced-motion: reduce) { .stamp-wrap.thunk, .stars i.on { animation-duration: .01s; } }

/* ---------- career: business card / name plate ---------- */
.tag b { font-weight: 400; color: var(--red); }
.tag2 { margin: 5px 0 0; font-size: 9.5px; letter-spacing: .6px; color: var(--ink2); text-transform: uppercase; font-weight: 600; }
.bizcard { position: relative; width: 248px; margin: 16px auto 0; padding: 11px 14px 10px; text-align: left; background: #fdfcf7; transform: rotate(2.4deg);
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 7px 12px rgba(40,22,8,.32); border-radius: 2px; background-image: linear-gradient(90deg, transparent 0 6px, rgba(196,55,44,.0) 6px); }
.bizcard::before { content: ''; position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; border: 1.6px solid var(--ink); transform: rotate(45deg) scale(.7); }
.bc-firm { font: 700 8px var(--ui); letter-spacing: 1.3px; color: var(--ink2); padding-left: 24px; padding-right: 44px; white-space: nowrap; margin-top: 2px; }
.bc-name { font-family: var(--hand); text-transform: uppercase; font-size: 22px; line-height: 1.15; margin-top: 8px; }
.bc-name small { font-size: 14px; color: var(--ink2); }
.bc-line { font-size: 11px; color: var(--muted); margin-top: 1px; }
.bc-xp { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.bc-bar { height: 7px; border: 1.2px solid var(--ink); border-radius: 1px 2px 1px 2px; position: relative; }
.bc-bar i { position: absolute; inset: 0 auto 0 0; background: var(--hatch); }
.bc-xp span { font-family: var(--hand); text-transform: uppercase; font-size: 12px; color: var(--ink2); }
.bc-rank { position: absolute; right: 12px; top: 10px; display: flex; gap: 3px; }
.bc-rank i { width: 7px; height: 7px; border: 1.1px solid var(--ink); border-radius: 50%; }
.bc-rank i.on { background: var(--ink); }
#bizCard .bc-line { display: none; } #bizCard { margin-top: 12px; }
.bizcard.mini { width: auto; margin: 0 4px 2px; transform: rotate(-.6deg); }
.bizcard.big { width: 270px; transform: rotate(-3deg); margin: 0 auto; }
.bizcard.big .bc-name { font-size: 25px; }
.rank-h { display: flex; justify-content: space-between; font: 700 10px var(--ui); letter-spacing: 2px; color: rgba(255,246,227,.75); padding: 8px 4px 0; border-bottom: 1px dashed rgba(255,246,227,.4); text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.rank-h span + span { font: 400 14px var(--hand); letter-spacing: 0; text-transform: uppercase; }
.rank-h.on { color: #fff6e3; }
.lvl.teaser { cursor: default; } .lvl.teaser::after { content: 'COMING SOON'; color: var(--stamp); border-color: var(--stamp); }
.xp-line { margin: 0; font-family: var(--hand); text-transform: uppercase; font-size: 15px; color: var(--stamp); }
.promo { position: absolute; inset: 0; z-index: 25; pointer-events: none; display: flex; justify-content: center; padding-top: calc(70px + var(--sat)); }
.promo::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 28%, rgba(30,18,8,.55), rgba(30,18,8,0) 70%); opacity: 0; }
.promo.go::before { animation: promofade 3.6s ease forwards; }
@keyframes promofade { 0%,100% { opacity: 0; } 12%,85% { opacity: 1; } }
.promo-in { position: relative; height: 200px; }
.promo.go .promo-in { animation: promodrop 3.6s cubic-bezier(.2,1.2,.4,1) forwards; }
@keyframes promodrop { 0% { transform: translateY(-260px) rotate(-14deg); opacity: 0; } 14% { transform: translateY(0) rotate(0); opacity: 1; } 88% { transform: none; opacity: 1; } 100% { transform: translateY(-20px); opacity: 0; } }
.promo-h { text-align: center; margin: 0 0 10px; font-family: var(--hand); text-transform: uppercase; font-size: 30px; color: #fff6e3; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.promo-stamp { position: absolute; right: -14px; bottom: 8px; font: 700 22px var(--ui); letter-spacing: 3px; color: var(--red); border: 3px double var(--red); padding: 4px 10px; opacity: 0; mix-blend-mode: multiply; }
.promo.go .promo-stamp { animation: pstamp 3.6s cubic-bezier(.3,0,.4,1) forwards; }
@keyframes pstamp { 0%,17% { opacity: 0; transform: scale(2.4) rotate(-25deg); } 24% { opacity: .9; transform: scale(.94) rotate(-12deg); } 27%,88% { opacity: .9; transform: scale(1) rotate(-12deg); } 100% { opacity: 0; } }

/* ---------- daily lot + replay ---------- */
.daily-btn { flex-direction: column; gap: 1px; padding: 9px 14px 8px; }
.daily-btn small { font: 600 10px var(--ui); letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink2); }
.daily-note { font-family: var(--hand); text-transform: uppercase; font-size: 14.5px; color: var(--stamp); border: 1.3px dashed var(--stamp); padding: 6px 9px 5px; transform: rotate(-.5deg); line-height: 1.3; }
.daily-note.pr { color: #8a5d00; border-color: #8a5d00; }
.daily-note small { font: 600 10px var(--ui); letter-spacing: 1px; text-transform: uppercase; opacity: .85; }
.share-text { white-space: pre-wrap; word-break: break-word; font: 13px/1.35 var(--ui); background: rgba(242,230,189,.6); border: 1px solid rgba(43,39,34,.3); padding: 8px 10px; margin: 0; -webkit-user-select: text; user-select: text; }
.rec-wrap { display: flex; justify-content: center; }
.rec-wrap canvas, .rec-wrap video { height: 46vh; max-height: 420px; width: auto; aspect-ratio: 9 / 16; box-shadow: 0 4px 12px rgba(30,18,8,.35); background: var(--trace); }
.rec-status { text-align: center; font-family: var(--hand); text-transform: uppercase; font-size: 16px; }

/* ---------- adjacency rules: bubble diagram, difficulty, rule chips ---------- */
.modal-card.long { overflow-y: auto; max-height: 94%; padding-top: 16px; gap: 8px; }
.modal-card.long::before { display: none; }
.dots { font-family: var(--ui); letter-spacing: 1px; font-size: .85em; }
.diff-line { font-family: var(--hand); text-transform: uppercase; font-size: 13.5px; color: var(--stamp); margin-top: -4px; }
.bubble-note { position: relative; background: var(--sticky); padding: 8px 10px 8px; transform: rotate(.6deg); box-shadow: 0 3px 7px rgba(40,22,8,.25); margin: 4px 2px 2px; }
.bubble-note::before { content: ''; position: absolute; top: -8px; left: 50%; width: 70px; height: 16px; margin-left: -35px; background: rgba(232,219,182,.88); transform: rotate(-3deg); }
.bn-h { font: 700 8.5px var(--ui); letter-spacing: 2px; text-transform: uppercase; color: var(--ink2); }
#bubbleCv { display: block; width: 100%; height: 172px; }
.bn-key { display: flex; gap: 14px; justify-content: center; font: 600 9px var(--ui); letter-spacing: 1px; text-transform: uppercase; color: var(--ink2); margin: -2px 0 4px; }
.bn-key span { display: inline-flex; align-items: center; gap: 5px; }
.bn-key i { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--ink); }
.bn-key i.k-apart { border-top: 2px dashed var(--red); }
.rule-list { margin: 0; padding-left: 20px; font-family: var(--hand); text-transform: uppercase; font-size: 13px; line-height: 1.25; }
.rule-list li { margin: 1px 0; }
.facts.tight div { padding: 2px 0; }
.facts.tight b { font-size: 13.5px; }
.chips .chip.adj { color: var(--stamp); }
.chips .chip.adj.bad { color: var(--red); }
.daily-btn small .dots { font-size: 9px; letter-spacing: 1px; }

/* ---------- v8: adjacency matrix + hurricane spec ---------- */
.mx-note { transform: rotate(-.4deg); }
.bn-h { display: flex; justify-content: space-between; }
.bn-h span { font: 400 11px var(--hand); letter-spacing: 0; color: var(--muted); }
#mxCv { display: block; width: 100%; cursor: pointer; margin: 2px 0; }
.mx-key { flex-wrap: wrap; gap: 4px 10px; margin: 0 0 4px; }
.mx-key b { font-size: 13px; margin-right: 3px; color: var(--ink); }
.mx-key b.x { color: var(--red); }
.mx-row { font: 13px var(--hand); text-transform: uppercase; line-height: 1.2; min-height: 16px; padding: 3px 4px; border-top: 1px dashed rgba(43,39,34,.35); border-bottom: 1px dashed rgba(43,39,34,.35); margin-bottom: 4px; }
.rl-h { font: 700 8.5px var(--ui); letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink2); margin: 4px 0 1px; }
.rule-list.pref { list-style: circle; }
.rule-list .rk { margin-left: 6px; font-family: var(--ui); }
.rule-list .rk.ok { color: #2e7d4f; } .rule-list .rk.no { color: var(--red); }
.brief-spec { font: 14px var(--hand); text-transform: uppercase; border: 1.5px solid var(--red); color: var(--red); padding: 5px 8px; margin: 8px 0 4px; transform: rotate(-.5deg); line-height: 1.2; }
.spec-strip { display: flex; flex-direction: column; align-items: stretch; gap: 1px; margin: 4px 10px 0; padding: 4px 8px 5px; background: rgba(251,250,244,.92); border: 1.5px solid var(--red); border-radius: 2px; font-family: var(--hand); text-transform: uppercase; color: var(--ink); cursor: pointer; text-align: left; box-shadow: 0 2px 4px rgba(40,22,8,.18); }
.spec-strip .ss-h { font: 700 9px var(--ui); letter-spacing: 1.6px; color: var(--red); }
.spec-strip .ss-slots { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.spec-strip .ss u { text-decoration: none; color: var(--red); letter-spacing: 1px; }
.spec-strip .ss.on u { color: #2b3f8a; letter-spacing: 0; }
.spec-strip.done { border-color: rgba(43,39,34,.55); }
.spec-strip.done .ss-h { color: #2e7d4f; }
.spec-h { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 2px; padding: 4px 6px; border: 1.5px solid var(--red); color: var(--red); font: 700 11px var(--ui); letter-spacing: 2px; }
.spec-h span + span { font: 400 12.5px var(--hand); letter-spacing: 0; }
.spec-h.done { border-color: rgba(43,39,34,.5); color: #2e7d4f; }
.spec-why { margin: 3px 0 0; font-size: 12.5px; }
.slot { color: var(--red) !important; } .slot.on { color: #2b3f8a !important; }
.link.grade { display: block; margin: 6px auto 0; font-family: var(--hand); text-transform: uppercase; font-size: 14px; }
.revise.spec-inc .revise-word { font-size: 34px; transform: rotate(-6deg); padding: 6px 14px 2px; }
.hand-p { font-family: var(--hand); text-transform: uppercase; font-size: 14px; line-height: 1.25; margin: 8px 0 4px; }
