@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; }

/* House style from Box Battle, with the Tidy Desk palette. */
:root {
  --bg: #e3f1ea; --paper: #fffdf8; --ink: #1f3a33; --muted: #5f7d73; --line: #bcd9cc;
  --aqua: #1fa37a; --aqua-dark: #12694e; --orange: #f0623f; --orange-dark: #a8371c;
  --green: #23a96b; --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(31, 58, 51, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(31, 58, 51, .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%); display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; max-width: 100%; }
.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(--aqua); 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: 44px; height: 44px; 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(31, 58, 51, .2); }
h1 { font: 40px/1 var(--display); margin: 2px 0 0; text-align: center; letter-spacing: .5px; }
h1 em { font-style: normal; color: var(--orange); }
h2 { font: 26px/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%; min-height: 48px; }
.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: 11px 10px 8px; min-height: 44px; }
.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(31, 58, 51, .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: 9; max-width: calc(100vw - 28px); text-align: center; }
dialog { border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); color: var(--ink); padding: 20px 18px 18px; width: min(440px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(31, 58, 51, .55); }
dialog ol { margin: 8px 0 14px; padding-left: 22px; } dialog li { margin: 4px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* home */
.today { display: flex; align-items: center; gap: 12px; }
.today > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mascot { width: 84px; height: 84px; object-fit: contain; flex: none; }
.acct { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.acct a { color: var(--aqua-dark); }

/* numbers above the board */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 6px 4px; text-align: center; min-width: 0; }
.stat small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stat b { display: block; font: 21px/1.1 var(--display); padding-top: 3px; color: var(--aqua-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal { text-align: center; font-weight: 600; font-size: 14.5px; min-height: 21px; }
.goal b { color: var(--orange-dark); }
.star { display: inline-block; width: 1em; height: 1em; line-height: 1; color: #f2b01e; vertical-align: -0.12em; }
img.star { object-fit: contain; }
.star.off { color: #c9d1da; } img.star.off { filter: grayscale(1); opacity: .35; }
.stars.big { display: flex; justify-content: center; gap: 6px; font-size: 54px; }
.stars.big .star { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.stars.big .star:nth-child(2) { animation-delay: .15s; } .stars.big .star:nth-child(3) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } }
.prize { width: 120px; height: 120px; object-fit: contain; margin: 0 auto; display: block; }
.banner { font: 34px/1.05 var(--display); text-align: center; color: var(--aqua-dark); padding-top: 6px; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* the desk: tiles sit on a half-tile grid, exactly where the rules say they are */
.deskwrap { background: #c99a62; background-image: repeating-linear-gradient(90deg, rgba(90, 50, 10, .08) 0 3px, transparent 3px 46px); border: 3px solid var(--ink); border-radius: 22px; padding: 10px; box-shadow: 0 6px 0 rgba(31, 58, 51, .2); margin: 0 auto; width: 100%; }
.desk { position: relative; width: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tile { position: absolute; padding: 0; margin: 0; border: 0; background: none; min-width: 0; cursor: pointer; }
.tile .face, .slot .face { position: absolute; inset: 1.5px 1.5px 4px 1.5px; background: #fff; border: 2.5px solid var(--ink); border-radius: 22%; box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; overflow: hidden; }
.face img { width: 84%; height: 84%; object-fit: contain; pointer-events: none; }
.face .code { font: 800 clamp(13px, 4.6vw, 22px)/1 var(--body); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.face.nopic { background: var(--k); }
.tile.covered { cursor: default; }
.tile.covered .face { background: #a9b3ae; box-shadow: 0 3px 0 #2b3b36; }
.tile.covered .face.nopic { background: color-mix(in srgb, var(--k) 45%, #333); }
.tile.covered .face > * { opacity: .5; filter: grayscale(.5) brightness(.75); }
.tile:not(.covered):active .face { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.tile:focus-visible { outline: none; } .tile:focus-visible .face { outline: 3px solid var(--orange); outline-offset: 1px; }
.tile.hint .face { outline: 4px solid var(--orange); outline-offset: 1px; animation: hint 1s ease-in-out infinite; }
@keyframes hint { 50% { transform: scale(1.1) rotate(-3deg); } }
.tile.nope .face { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* the tray of seven */
.tray { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 6px; box-shadow: 0 6px 0 rgba(31, 58, 51, .2); width: min(100%, 460px); margin: 0 auto; }
.tray.tight { border-color: var(--orange); background: #fff1ea; }
.slot { position: relative; aspect-ratio: 1; min-width: 0; border-radius: 22%; background: rgba(31, 58, 51, .1); }
.slot .face.vanish { animation: vanish .28s ease-in forwards; }
@keyframes vanish { 40% { transform: scale(1.18); } 100% { transform: scale(0); opacity: 0; } }
.tools.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.btn.small small { display: block; font: 600 11px/1.1 var(--body); letter-spacing: 0; opacity: .75; padding-top: 2px; }

/* level list */
.levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.lv { aspect-ratio: 1; min-width: 0; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; }
.lv b { font: 21px/1 var(--display); padding-top: 4px; }
.lv span { font-size: 11px; letter-spacing: -1px; line-height: 1; height: 12px; }
.lv.done { background: #e9f7ef; }
.lv.next { background: var(--yellow); }
.lv[disabled] { opacity: .45; box-shadow: none; pointer-events: none; background: #eef1f4; }
.lv:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

@media (max-height: 700px) { h1 { font-size: 32px; } .hero { width: min(100%, 300px); } }
@media (prefers-reduced-motion: reduce) { .btn, .lv { transition: none; } .stars.big .star, .tile.hint .face, .tile.nope .face { animation: none; } .slot .face.vanish { animation: none; opacity: 0; } }
