@font-face { font-family: 'Luckiest Guy'; src: url(/fonts/luckiest-guy-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 400; src: url(/fonts/rubik-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 600; src: url(/fonts/rubik-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 800; src: url(/fonts/rubik-latin-800-normal.woff2) format('woff2'); font-display: swap; }

/* ---------- the Break Tab house style (from Box Battle), with this game's palette ---------- */
:root {
  --bg: #f3ecdf; --paper: #fffdf8; --ink: #2d2a32; --muted: #776f7c; --line: #dcd2c0;
  --aqua: #1f8f8a; --aqua-dark: #14605d; --orange: #f08a24; --orange-dark: #a8560c;
  --green: #23a56b; --red: #e8483f; --yellow: #ffd23f;
  --display: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.45 var(--body); overscroll-behavior: none; background: var(--bg);
  background-image: linear-gradient(rgba(45, 42, 50, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(45, 42, 50, .05) 1px, transparent 1px); background-size: 26px 26px;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
.screen { width: min(540px, 100%); min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.screen > *, .card > * { min-width: 0; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }
p { margin: 0; } .muted { color: var(--muted); } .center { text-align: center; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar .sp { flex: 1; }
.logo { font: 26px/1 var(--display); color: var(--aqua-dark); letter-spacing: .4px; padding-top: 4px; text-decoration: none; white-space: nowrap; }
.logo span { color: var(--orange); }
.chip { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); font-size: 18px; font-weight: 800; display: grid; place-items: center; flex: none; }

.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 16px; box-shadow: 0 6px 0 rgba(45, 42, 50, .2); }
h1 { font: 40px/1 var(--display); margin: 2px 0 0; text-align: center; letter-spacing: .5px; }
h1 em { font-style: normal; color: var(--aqua-dark); }
h2 { font: 24px/1.08 var(--display); margin: 0; letter-spacing: .3px; }
.btn { border: 3px solid var(--ink); border-radius: 16px; padding: 14px 18px 10px; font: 22px/1 var(--display); letter-spacing: .5px; background: var(--paper); box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; width: 100%; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.blue { background: var(--aqua); color: #fff; } .btn.orange { background: var(--orange); color: #fff; } .btn.yellow { background: var(--yellow); }
.btn.small { font-size: 16px; padding: 10px 12px 7px; width: auto; box-shadow: 0 4px 0 var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.hero { width: min(100%, 420px); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 20px; border: 3px solid var(--ink); margin: 0 auto; display: block; box-shadow: 0 6px 0 rgba(45, 42, 50, .2); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 600; padding: 10px 16px; border-radius: 999px; z-index: 30; max-width: calc(100vw - 28px); text-align: center; }
dialog { border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); color: var(--ink); padding: 22px 20px 18px; width: min(460px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(45, 42, 50, .55); }
dialog ol { margin: 8px 0 14px; padding-left: 22px; } dialog li { margin: 5px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.acct { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.acct a { color: var(--aqua-dark); }
.today { display: flex; align-items: center; gap: 12px; }
.today > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mascot { width: 76px; height: 76px; object-fit: contain; flex: none; }
.prize { width: 130px; height: 130px; object-fit: contain; margin: 0 auto 6px; display: block; }
.fb { display: inline-grid; place-items: center; text-align: center; font-weight: 800; font-size: 11px; line-height: 1.05; border-radius: 10px; background: var(--line); color: var(--ink); overflow: hidden; }
.fb.mascot, .fb.prize { border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); font-size: 15px; }
@media (max-height: 700px) { h1 { font-size: 32px; } }

/* ---------- Office Refit: the counters, the orders, the board ---------- */
.screen.play { gap: 8px; }
.hud { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.stat { display: flex; align-items: center; gap: 5px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 4px 7px; min-width: 0; }
.stat span { display: flex; flex-direction: column; min-width: 0; line-height: 1.05; }
.stat b { font: 17px/1 var(--display); padding-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat small { font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ico { width: 22px; height: 22px; object-fit: contain; flex: none; }
.fb.ico { border-radius: 50%; font-size: 13px; border: 2px solid var(--ink); }
.i-energy { background: var(--yellow); } .i-coin { background: #f5b942; } .i-star { background: #4d9bf0; color: #fff; }
.hud .btn { min-height: 44px; }
.refit.ready { background: var(--orange); color: #fff; animation: nudge 1.3s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }

.orders { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.order { background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.order.ready { background: #e6f7ec; border-color: var(--green); }
.orders.dropping .order { border-style: dashed; }
.order.over { outline: 4px solid var(--yellow); outline-offset: -1px; }
.order.paid { animation: paid .5s ease-out; }
@keyframes paid { 0% { background: var(--yellow); transform: scale(1.05); } }
.order .top { display: flex; align-items: center; gap: 3px; min-width: 0; }
.who { width: 44px; height: 44px; flex: none; border: 0; background: none; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.face { width: 40px; height: 40px; object-fit: contain; }
.fb.face { border-radius: 50%; border: 2px solid var(--ink); background: #cfe6f5; font-size: 16px; }
.sam { display: block; position: relative; border-radius: 50%; background: #f6c9a0; border: 2px solid var(--ink); overflow: hidden; }
.sam::before { content: ''; position: absolute; inset: -2px -2px 58% -2px; background: #e8483f; border-bottom: 2px solid var(--ink); border-radius: 50% 50% 30% 30%; }
.sam::after { content: ''; position: absolute; left: 32%; bottom: 14%; width: 36%; height: 16%; border-bottom: 3px solid var(--ink); border-radius: 0 0 50% 50%; }
.sam i { position: absolute; left: 27%; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); box-shadow: 13px 0 0 var(--ink); }
.wants { flex: 1; min-width: 0; display: flex; gap: 2px; justify-content: center; }
.want { position: relative; flex: 0 1 38px; aspect-ratio: 1; min-width: 0; border: 2px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; }
.want .p { position: absolute; left: 7%; top: 7%; width: 86%; height: 86%; object-fit: contain; }
.want.have { border-color: var(--green); background: #e3f7ea; }
.want.got .p { opacity: .35; }
.tick { position: absolute; inset: 0; display: grid; place-items: center; color: var(--green); font: 800 20px var(--body); font-style: normal; }
.order .go { width: 100%; min-height: 36px; font-size: 14px; padding: 7px 2px 4px; display: flex; align-items: center; justify-content: center; gap: 3px; box-shadow: 0 3px 0 var(--ink); }
.order .go .ico { width: 16px; height: 16px; font-size: 10px; border-width: 1px; }

.info { display: flex; align-items: center; gap: 8px; min-height: 58px; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 5px 8px; }
.what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.what p { font-size: 12.5px; line-height: 1.25; font-weight: 600; }
.chain { display: flex; align-items: center; gap: 1px; }
.chain span { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; display: grid; place-items: center; }
.chain span.on { border-color: var(--orange); background: #fff3d6; }
.chain .p { width: 100%; height: 100%; object-fit: contain; }
.chain i { color: var(--muted); font-style: normal; font-weight: 800; }
.info .btn { flex: none; display: flex; align-items: center; gap: 3px; min-height: 44px; }

/* 7 across, 9 down. The board shrinks on short screens so all of it stays in view. */
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; width: min(100%, max(252px, calc((100dvh - 326px) * 7 / 9))); margin: 0 auto; padding: 4px; background: #cdc2ae; border: 3px solid var(--ink); border-radius: 16px; touch-action: none; user-select: none; -webkit-user-select: none; }
.cell { position: relative; aspect-ratio: 1; min-width: 0; padding: 0; margin: 0; border: 0; border-radius: 9px; background: #f8f2e7; display: grid; place-items: center; touch-action: none; }
.cell .p { position: absolute; left: 5%; top: 5%; width: 90%; height: 90%; object-fit: contain; pointer-events: none; }
.cell.gen { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--ink); }
.cell.gen::after { content: 'tap'; position: absolute; left: 0; right: 0; bottom: 0; font: 800 9px/12px var(--body); color: #fff; background: var(--ink); border-radius: 0 0 9px 9px; pointer-events: none; }
.cell.sel { box-shadow: inset 0 0 0 3px var(--orange); background: #fff0cc; }
.cell.over { box-shadow: inset 0 0 0 3px var(--aqua); background: #dff3f1; }
.cell.dragging .p, .cell.dragging .lv { opacity: .2; }
.cell.web { background: #b3ada2; }
.cell.web .p { opacity: .6; filter: grayscale(.7); }
.cob { position: absolute; inset: 0; border-radius: 9px; pointer-events: none; background: repeating-radial-gradient(circle at 0 0, transparent 0 8px, rgba(255, 255, 255, .85) 8px 9.5px), repeating-conic-gradient(from 0deg at 0 0, rgba(255, 255, 255, .85) 0 1.5deg, transparent 1.5deg 18deg); }
.lv { position: absolute; right: 1px; bottom: 1px; min-width: 14px; height: 14px; border-radius: 7px; background: var(--ink); color: #fff; font: 800 10px/14px var(--body); text-align: center; pointer-events: none; }
.cell.pop .p { animation: pop .32s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.3); } }
.ghost { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; display: grid; place-items: center; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .3)); will-change: transform; }
.ghost .p { width: 100%; height: 100%; object-fit: contain; }
/* stand-ins when a picture file is missing: a labelled tile, told apart by its word, number and shape as well as its colour */
.fb.p { width: 88%; height: 88%; display: grid; grid-auto-flow: row; align-content: center; font-size: 9.5px; border: 2px solid var(--ink); }
.fb.p b { font: 15px/1 var(--display); padding-top: 2px; }
.fb.k-p { background: #bfe8b5; } .fb.k-c { background: #e3c5a4; border-radius: 50%; } .fb.k-d { background: #c4d9f5; border-style: dashed; } .fb.k-s { background: #f3c6d8; border-radius: 3px; }
.fb.gen { background: #fff; }
.chain .fb.p, .want .fb.p { border-width: 1px; font-size: 0; }
.chain .fb.p b, .want .fb.p b { font-size: 11px; }

/* ---------- the refit screen ---------- */
.stat.wide { justify-content: center; text-align: center; grid-column: span 2; }
.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tab { border: 3px solid var(--ink); border-radius: 12px; background: var(--paper); min-height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 5px 0 3px; }
.tab b { font: 18px/1 var(--display); } .tab small { font-size: 11px; font-weight: 600; color: var(--muted); }
.tab.on { background: var(--yellow); } .tab.done small { color: var(--green); font-weight: 800; }
.note { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.note p { font-weight: 600; } .note .mascot { width: 56px; height: 56px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 8px 6px 10px; min-height: 54px; }
.steps .n { width: 28px; height: 28px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-weight: 800; flex: none; }
.steps .nm { flex: 1; font-weight: 800; min-width: 0; }
.steps li.done { background: #e3f7ea; border-style: dashed; } .steps li.done .n { background: var(--green); color: #fff; }
.steps li.later { opacity: .6; }
.steps .cost, .steps .btn { display: flex; align-items: center; gap: 4px; font-weight: 800; flex: none; }
.steps .btn { min-height: 44px; }

.scene { position: relative; aspect-ratio: 16 / 10; border: 3px solid var(--ink); border-radius: 20px; overflow: hidden; background: #ddd; box-shadow: 0 6px 0 rgba(45, 42, 50, .2); }
.wall { position: absolute; inset: 0 0 34% 0; background: #b3ac9f; transition: background .6s; }
.floor { position: absolute; inset: 66% 0 0 0; background: #857c6d; border-top: 3px solid var(--ink); transition: background .6s; }
.prop { position: absolute; }
.prop .p { width: 100%; height: auto; display: block; }
.prop .fb.p { aspect-ratio: 1; font-size: 11px; display: grid; }
.prop.flip { transform: scaleX(-1); }
.prop.new { animation: drop .55s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes drop { 0% { translate: 0 -40px; scale: .5; opacity: 0; } }
.window { left: 58%; top: 9%; width: 32%; height: 42%; border: 3px solid var(--ink); border-radius: 6px; background: linear-gradient(#8a8f8c, #a4a79d); }
.window::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 3px solid var(--ink); }
.window::after { content: ''; position: absolute; top: 50%; left: 0; right: 0; border-top: 3px solid var(--ink); }
.cobweb { left: 0; top: 0; width: 22%; aspect-ratio: 1; background: repeating-radial-gradient(circle at 0 0, transparent 0 9px, rgba(255, 255, 255, .8) 9px 10.5px), repeating-conic-gradient(from 0deg at 0 0, rgba(255, 255, 255, .8) 0 1.5deg, transparent 1.5deg 15deg); -webkit-mask: radial-gradient(circle at 0 0, #000 68%, transparent 70%); mask: radial-gradient(circle at 0 0, #000 68%, transparent 70%); }
.cobweb.c2 { left: auto; right: 0; transform: scaleX(-1); }
.dust { aspect-ratio: 2.4; border-radius: 50%; background: radial-gradient(#a59e92, #6f695f); box-shadow: 14px -8px 0 -4px #8d867a, -10px -6px 0 -6px #9a9387; }
.patch { aspect-ratio: 1.4; background: #8f887c; border-radius: 30% 60% 40% 55%; }
.cabinet { aspect-ratio: 1.5; background: #efe6d4; border: 3px solid var(--ink); border-radius: 6px; }
.counter { left: 4%; right: 4%; bottom: 14%; height: 24%; background: #8a6b4a; border: 3px solid var(--ink); border-radius: 8px; transition: background .6s; }
.stain { aspect-ratio: 2.2; background: #4f3f2c; border-radius: 50%; opacity: .7; }
.cupboards { left: 6%; right: 6%; top: 6%; height: 22%; border: 3px solid var(--ink); border-radius: 8px; background: repeating-linear-gradient(90deg, #f6ecd8 0 calc(25% - 3px), var(--ink) calc(25% - 3px) 25%); }
.carpet { inset: 66% 0 0 0; background: repeating-linear-gradient(45deg, #6f5546 0 10px, #5e4739 10px 20px); border-top: 3px solid var(--ink); }
.rug { left: 16%; bottom: 1%; width: 68%; height: 24%; border-radius: 50%; border: 3px solid var(--ink); background: radial-gradient(closest-side, #ffd23f 0 28%, #e8483f 28% 55%, #1f8f8a 55% 80%, #ffd23f 80%); }
.ctable { aspect-ratio: 2.6; background: #b98654; border: 3px solid var(--ink); border-radius: 10px 10px 4px 4px; }
.lights { top: 5%; left: 0; right: 0; height: 9%; border-top: 2px solid var(--ink); background: radial-gradient(circle at 50% 45%, #ffd23f 0 4px, #c98a00 4px 5px, transparent 6px) 0 0 / 30px 100% repeat-x; animation: twinkle 1.6s steps(2) infinite; }
@keyframes twinkle { 50% { filter: brightness(1.35) saturate(1.4); } }
.boxes { aspect-ratio: 1; background: #c79a61; border: 3px solid var(--ink); border-radius: 6px; display: grid; place-items: center; font: 26px/1 var(--display); padding-top: 4px; }
.gloom { inset: 0; background: rgba(20, 20, 45, .5); z-index: 5; }
.lamp { top: -3px; left: 43%; width: 14%; height: 13%; background: var(--yellow); border: 3px solid var(--ink); border-radius: 0 0 50% 50%; box-shadow: 0 0 34px 12px rgba(255, 210, 63, .55); }
.wboard { left: 8%; top: 9%; width: 38%; height: 30%; background: #fff; border: 4px solid #8a8f98; border-radius: 4px; display: grid; place-items: center; font: 800 11px var(--body); color: var(--red); rotate: -1.5deg; }
.door { left: 42%; bottom: 34%; width: 18%; height: 52%; background: #8a5a3b; border: 3px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0; }
.door::after { content: ''; position: absolute; right: 12%; top: 52%; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--ink); }
.sign { top: 7%; left: 5%; padding: 6px 10px 2px; background: var(--ink); color: var(--yellow); font: 19px/1 var(--display); letter-spacing: 2px; border-radius: 8px; text-shadow: 0 0 8px rgba(255, 210, 63, .9); }
.sign b { font-weight: 400; color: #6b6470; text-shadow: none; }
.plaque { aspect-ratio: 4; background: #fff; border: 2px solid var(--ink); border-radius: 4px; display: grid; place-items: center; font: 800 8px var(--body); letter-spacing: .5px; }
.ribbon { left: 0; right: 0; top: 47%; height: 7%; background: var(--red); border-block: 2px solid var(--ink); z-index: 6; }
.ribbon::after { content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); box-shadow: -16px 0 0 -4px var(--red), 16px 0 0 -4px var(--red); }
/* what each finished step changes on the walls and floors */
.r1.d1 .floor, .r5.d1 .floor { background: #d2a36b; }
.r1.d2 .wall { background: #bfe0ee; }
.r1.d5 .window, .r3 .window { background: linear-gradient(#8fd3f4, #d8f3ff); }
.r2 .wall { background: #bdb5a2; } .r2 .floor { background: repeating-conic-gradient(#8c8577 0 25%, #a19a8b 0 50%) 0 0 / 40px 40px; }
.r2.d1 .counter { background: #ecdcc0; } .r2.d1 .floor { background: repeating-conic-gradient(#d9d2c4 0 25%, #f4efe4 0 50%) 0 0 / 40px 40px; }
.r2.d2 .wall { background: #f6d9a8; }
.r3 .wall { background: #c4b5a3; } .r3 .floor { background: #c08f5c; }
.r3.d6 .wall { background: #f3d2b4; }
.r4 .wall { background: #aeb4bd; } .r4 .floor { background: #6f7885; }
.r4.d2 .wall { background: #d7e3ee; } .r4.d2 .floor { background: #8b97a8; }
.r5 .wall { background: #b9b2a5; } .r5.d3 .wall { background: #cfe9e2; }

@media (max-width: 380px) { .logo { font-size: 22px; } .stat { padding: 4px 5px; gap: 3px; } .stat b { font-size: 15px; } .ico { width: 18px; height: 18px; } }
@media (prefers-reduced-motion: reduce) {
  .refit.ready, .order.paid, .cell.pop .p, .prop.new, .lights { animation: none; }
  .wall, .floor, .counter, .btn { transition: none; }
}
