:root {
  --night: #1c1638;
  --night-2: #262050;
  --card: #2a2257;
  --line: #4d3f96;
  --paper: #fbf8ff;
  --ink: #1a1233;
  --text: #f4efff;
  --text-soft: #b8acdf;
  --pink: #ff5fa2;
  --pink-d: #d93a7f;
  --moon: #ffd76a;
  --moon-soft: #fff1c2;
  --fish: #3fd6c6;
  --user: #6a3fd9;
  --wrong: #e5383b;
  --display: 'Bungee', 'Arial Black', Impact, sans-serif;
  --ui: 'Fredoka', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: #151030; }
body {
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--ui);
  background: radial-gradient(900px 520px at 85% -8%, #3b2d80 0, transparent 62%), linear-gradient(180deg, var(--night) 0%, #151030 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .55;
  background-image:
    radial-gradient(1.4px 1.4px at 22px 34px, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 120px 80px, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 190px 150px, #ffe9a8 50%, transparent 52%),
    radial-gradient(1px 1px at 60px 180px, #fff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 160px 20px, #cfe9ff 50%, transparent 52%);
  background-size: 230px 230px;
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .3; } }
.top, .screen { position: relative; z-index: 1; }

/* ---------------- header ---------------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 6px; max-width: 1180px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; }
.logo-cat { width: 44px; height: 44px; display: block; }
.logo-cat .cat { width: 100%; height: 100%; }
.logo-text { font-family: var(--display); font-size: 22px; letter-spacing: .5px; color: var(--moon); }
.logo-text b { font-weight: 400; color: var(--pink); }
.top-actions { display: flex; gap: 8px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1.5px solid var(--line); color: var(--text);
  font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background .15s, transform .12s;
}
.chip-btn:hover { background: rgba(255, 255, 255, .12); }
.chip-btn:active { transform: scale(.95); }
button:focus-visible, a:focus-visible, input:focus-visible + .switch { outline: 3px solid var(--fish); outline-offset: 3px; }

/* ---------------- the cats: faces and moods ---------------- */
.cat { overflow: visible; }
.cat .eye-happy, .cat .eye-sleep, .cat .eye-x, .cat .eye-shock, .cat .mouth-open, .cat .lids, .cat .lashes, .cat .bow, .cat .frown, .cat .blep { display: none; }
.cat.fem .lashes, .cat.fem .bow { display: inline; }
.cat.grumpy .lids, .cat.grumpy .frown { display: inline; }
.cat.grumpy .mouth { display: none; }
.cat.dog .blep { display: inline; }
.cat.happy .eye-open, .cat.sleep .eye-open, .cat.shock .eye-open, .cat.faint .eye-open, .cat.sing .eye-open { display: none; }
.cat.happy .lids, .cat.sleep .lids, .cat.shock .lids, .cat.faint .lids, .cat.sing .lids, .cat.crazy .lids { display: none; }
.cat.happy .eye-happy, .cat.sing .eye-happy { display: inline; }
.cat.sleep .eye-sleep { display: inline; }
.cat.shock .eye-shock { display: inline; }
.cat.faint .eye-x { display: inline; }
.cat.shock .mouth-open, .cat.faint .mouth-open, .cat.sing .mouth-open { display: inline; }
.cat.shock .mouth, .cat.faint .mouth, .cat.sing .mouth, .cat.shock .frown, .cat.faint .frown, .cat.sing .frown,
.cat.shock .blep, .cat.faint .blep, .cat.sing .blep { display: none; }
.cat.grumpy.happy .frown { display: none; }
.cat.grumpy.happy .mouth { display: inline; }
.cat .pupil { transform-box: fill-box; transform-origin: center; transition: transform .25s; }
.cat.crazy .pupil { transform: scale(2.7, 1.25); }
.cat.stare .pupil { transform: translate(-2.5px, -3px); }
.cat .eye-open { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
.cat .tail { transform-box: view-box; transform-origin: 86px 112px; animation: swish 2.6s ease-in-out infinite; }
.cat.dog .tail { animation-duration: .9s; }
.cat.grumpy .tail { animation-duration: 4.5s; }
.cat .head { transform-box: view-box; transform-origin: 60px 76px; }
.cat.dog .head { animation: tilt 5s ease-in-out infinite; }
.cat.fem .head { animation: preen 6s ease-in-out infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes swish { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-12deg); } }
@keyframes wagfast { from { transform: rotate(8deg); } to { transform: rotate(-22deg); } }
@keyframes tilt { 0%, 70%, 100% { transform: rotate(0); } 78%, 90% { transform: rotate(-12deg); } }
@keyframes preen { 0%, 80%, 100% { transform: rotate(0); } 86% { transform: rotate(5deg); } 92% { transform: rotate(-3deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------------- home ---------------- */
.home { max-width: 780px; margin: 0 auto; padding: 4px 18px 48px; display: grid; gap: 18px; }
.hero { position: relative; text-align: center; padding-top: 4px; }
.moon-deco {
  position: absolute; right: 4%; top: -4px; width: 74px; height: 74px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle at 34% 30%, rgba(0, 0, 0, .08) 0 8%, transparent 9%), radial-gradient(circle at 64% 62%, rgba(0, 0, 0, .07) 0 11%, transparent 12%), radial-gradient(circle at 40% 40%, #fff7d8, #ffd76a 62%, #e7b247);
  box-shadow: 0 0 50px rgba(255, 215, 106, .45);
}
.hero h1 {
  font-family: var(--display); font-weight: 400; font-size: clamp(48px, 11vw, 92px); line-height: .95; margin: 0; letter-spacing: 1px;
  color: var(--moon); text-shadow: 0 0 22px rgba(255, 215, 106, .45), 3px 4px 0 #0e0a24;
}
.hero h1 span { color: var(--pink); text-shadow: 0 0 22px rgba(255, 95, 162, .65), 3px 4px 0 #0e0a24; }
.tagline { margin: 6px 0 4px; font-weight: 600; font-size: 17px; color: var(--text-soft); }
.sill { max-width: 540px; margin: 0 auto; }
.trio {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; align-items: end;
  background: linear-gradient(transparent calc(100% - 50px), #8a6a4f calc(100% - 50px), #5b4331 calc(100% - 38px), transparent calc(100% - 38px));
}
.trio-cat { background: none; border: 0; padding: 0; display: grid; justify-items: center; align-content: end; color: var(--text); }
.trio-cat .cat { width: min(30vw, 150px); height: auto; margin-bottom: -2px; filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .5)); animation: bob 3.2s ease-in-out infinite; }
.trio-cat.triibik .cat { animation-delay: -1.1s; }
.trio-cat.traks .cat { animation-delay: -2.2s; }
.trio-cat b { margin-top: 14px; font-family: var(--display); font-weight: 400; font-size: 15px; color: var(--moon); line-height: 1; }
.trio-cat small { font-size: 12px; color: var(--text-soft); font-weight: 500; line-height: 1.3; }
.hero-bubble {
  position: relative; margin: 14px auto 0; max-width: 560px; text-align: left;
  background: var(--paper); color: var(--ink); border-radius: 16px; padding: 10px 14px; font-size: 15px; line-height: 1.35;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}
.hero-bubble::before { content: ''; position: absolute; left: 50%; top: -8px; width: 16px; height: 16px; margin-left: -8px; background: var(--paper); transform: rotate(45deg); }
.hero-bubble b { color: var(--pink-d); }

.card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; color: var(--text);
  background: linear-gradient(180deg, #2c245c, #221b4a); border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06); transition: transform .12s;
}
.card:active { transform: scale(.98); }
.resume { background: linear-gradient(135deg, var(--moon), #ffb85c); color: var(--ink); border-color: transparent; font-weight: 700; font-size: 17px; justify-content: space-between; box-shadow: 0 0 26px rgba(255, 215, 106, .35); }
.resume small { font-weight: 600; opacity: .75; }
.daily-moon { width: 52px; height: 52px; flex: none; }
.daily-moon .moon { width: 100%; height: 100%; animation: wobble 3s ease-in-out infinite; }
.moon.glow { filter: drop-shadow(0 0 10px rgba(255, 215, 106, .85)); }
.daily-text { display: grid; gap: 2px; flex: 1; }
.daily-text b { font-family: var(--display); font-weight: 400; font-size: 19px; color: var(--moon); }
.daily-text small { font-size: 14px; color: var(--text-soft); font-weight: 500; }
.daily-date { font-weight: 700; font-size: 13px; background: var(--pink); color: #fff; border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.daily.done { opacity: .7; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }

.picker h2 { font-family: var(--display); font-weight: 400; font-size: 17px; letter-spacing: .5px; margin: 0 0 12px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 6px; }
.level {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 12px 6px 12px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 20px; color: var(--text);
  transition: transform .15s, background .15s, box-shadow .15s;
}
.level::before, .level::after { content: ''; position: absolute; top: -12px; border-left: 12px solid transparent; border-right: 12px solid transparent; border-bottom: 14px solid var(--line); }
.level::before { left: 12px; } .level::after { right: 12px; }
.level svg { width: 58px; height: 60px; filter: drop-shadow(0 0 1px rgba(255, 255, 255, .45)); }
.level b { font-weight: 700; font-size: 14.5px; line-height: 1.1; text-align: center; }
.level small { font-size: 11.5px; color: var(--text-soft); font-weight: 500; text-align: center; line-height: 1.15; }
.level.on { background: linear-gradient(180deg, #ff6fae, var(--pink-d)); border-color: #ff9cc8; transform: translateY(-3px); box-shadow: 0 0 24px rgba(255, 95, 162, .45); }
.level.on::before, .level.on::after { border-bottom-color: #ff8fc0; }
.level.on small { color: #ffe3f0; }
.level.on svg { animation: bob 1.2s ease-in-out infinite; }
.variants { display: flex; flex-wrap: wrap; gap: 9px; }
.variant { padding: 9px 15px; border-radius: 999px; background: transparent; border: 1.5px solid var(--line); color: var(--text); font-weight: 600; font-size: 15px; }
.variant.on { background: var(--fish); color: var(--ink); border-color: var(--fish); box-shadow: 0 0 18px rgba(63, 214, 198, .45); }
.variant-note { margin: 10px 2px 0; font-size: 14.5px; color: var(--text-soft); font-weight: 500; min-height: 1.4em; }

.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 54px; height: 30px; flex: none; border-radius: 999px; background: #3a3170; border: 1.5px solid var(--line); position: relative; transition: background .2s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--paper); transition: transform .2s; }
.toggle input:checked + .switch { background: var(--pink); border-color: var(--pink); }
.toggle input:checked + .switch::after { transform: translateX(23px); }
.toggle b { display: block; font-weight: 700; font-size: 16px; }
.toggle small { display: block; font-size: 13.5px; color: var(--text-soft); font-weight: 500; }
.chaos-toggle { background: rgba(255, 255, 255, .04); border: 1.5px dashed var(--line); border-radius: 16px; padding: 12px 16px; }

.big-btn {
  justify-self: center; display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 24px; letter-spacing: .5px;
  padding: 14px 38px 15px; border-radius: 999px;
  background: linear-gradient(135deg, #ff6fae, var(--pink-d)); color: #fff; border: 0;
  box-shadow: 0 6px 0 #8f1f52, 0 0 30px rgba(255, 95, 162, .45); transition: transform .12s, box-shadow .12s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #8f1f52, 0 0 20px rgba(255, 95, 162, .4); }
.big-btn.small { font-size: 18px; padding: 11px 24px 12px; }
.big-btn.alt { background: linear-gradient(135deg, var(--moon), #ffb85c); color: var(--ink); box-shadow: 0 6px 0 #a5772a; }
.big-btn.alt:active { box-shadow: 0 2px 0 #a5772a; }

/* ---------------- game ---------------- */
.game {
  --bs: min(600px, calc(100dvh - 170px), calc(100vw - 380px));
  max-width: 1120px; margin: 0 auto; padding: 4px 20px 28px;
  display: grid; grid-template-columns: auto 320px; gap: 28px; justify-content: center; align-items: start;
}
.board-col { display: grid; gap: 10px; width: var(--bs); }
.status { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 15px; }
.status-title { font-family: var(--ui); font-weight: 700; font-size: 17px; color: var(--text); background: none; border: 0; padding: 0; text-align: left; }
.status-mist b { color: var(--pink); }
.timer { background: rgba(255, 255, 255, .06); border: 1.5px solid var(--line); color: var(--moon); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.board-box { position: relative; width: var(--bs); height: var(--bs); }
.board-box.flipping { transform: perspective(1000px) rotateY(180deg); transition: transform .85s cubic-bezier(.5, -.2, .3, 1.3); }
.board {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  background: var(--paper); border: 3px solid #120c2a; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 2px var(--line), 0 14px 34px rgba(0, 0, 0, .5), 0 0 44px rgba(255, 95, 162, .18);
}
.cell {
  position: relative; border: 0; padding: 0; margin: 0; background: transparent;
  border-right: 1px solid #e3dcf3; border-bottom: 1px solid #e3dcf3;
  font-family: var(--ui); font-weight: 600; font-size: calc(var(--bs) / 9 * .58); line-height: 1;
  display: grid; place-items: center; color: var(--user); cursor: pointer;
  transition: background .12s;
}
.cell.c8 { border-right: 0; } .cell.r8 { border-bottom: 0; }
.cell.br { border-right: 2.5px solid #2a1f55; } .cell.bb { border-bottom: 2.5px solid #2a1f55; }
.cell.diag { background: #fff0f4; }
.cell.coop { background: #f7e8cc; }
.cell.fishcell::before {
  content: ''; position: absolute; inset: 16% 9%; opacity: .4;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 34'%3E%3Cpath d='M6 17 C 16 3, 36 3, 44 17 C 36 31, 16 31, 6 17 Z M42 17 L56 6 L56 28 Z' fill='%233fd6c6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cell .v { position: relative; z-index: 1; }
.cell.given { color: var(--ink); font-weight: 700; }
.cell.peer { background: #efe9ff; }
.cell.peer.coop { background: #eedcb8; }
.cell.peer.diag { background: #f8e4f2; }
.cell.same { background: var(--moon-soft); }
.cell.sel { background: var(--moon); }
.cell.wrong { color: var(--wrong); background: #ffe0e3; }
.cell.wrong .v { animation: nope .4s; }
.cell.conflict { background: #ffd6dc; }
.cell.hinted .v::after { content: ''; position: absolute; right: -8px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--fish); border: 1.5px solid var(--ink); }
.cell.gold .v { color: var(--pink-d); text-shadow: 0 0 8px #ff9cc8, 0 0 2px #fff; }
.cell.pop .v { animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); }
.cell.flash { animation: flash .7s ease-out; }
.cell.nudge .v { display: inline-block; animation: nudge .28s ease-in-out infinite alternate; }
.cell .notes { position: absolute; inset: 3px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); z-index: 1; }
.cell .notes i { font-style: normal; font-size: calc(var(--bs) / 9 * .23); font-weight: 600; color: #7c70a8; display: grid; place-items: center; }
.cell .notes i.hl { color: var(--ink); background: var(--moon-soft); border-radius: 4px; }
@keyframes pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
@keyframes nope { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes flash { 0% { background: #fff3b0; } 100% { } }
@keyframes nudge { from { transform: translateX(0) rotate(0); } to { transform: translateX(-5px) rotate(-10deg); } }

.diag-lines { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); pointer-events: none; display: none; }
.diag-lines line { stroke: rgba(255, 40, 90, .55); stroke-width: .45; animation: laserline 1.6s ease-in-out infinite alternate; }
.board-box.diagonal .diag-lines { display: block; }
@keyframes laserline { from { opacity: .45; } to { opacity: .9; } }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; border-radius: 16px; }
.fx > * { pointer-events: auto; }
.pause-cover {
  position: absolute; inset: 0; z-index: 8; border-radius: 16px; border: 1.5px solid var(--line);
  background: #221b4a; color: var(--text); display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 20px;
  font-weight: 600; font-size: 18px;
}
.pause-cat .cat { width: 130px; height: 134px; filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .5)); }

.ticker {
  position: relative; overflow: hidden; height: 34px; border-radius: 10px;
  background: #0f0b24; color: var(--moon); display: flex; align-items: center; border: 1.5px solid var(--line);
  font-weight: 600; font-size: 14px; opacity: .4; transition: opacity .3s;
}
.ticker.live { opacity: 1; }
.ticker-label { flex: none; background: var(--pink); color: #fff; padding: 0 10px; height: 100%; display: grid; place-items: center; font-family: var(--display); font-size: 13px; letter-spacing: .5px; z-index: 1; }
.ticker-text { white-space: nowrap; padding-left: 100%; }
.ticker.live .ticker-text { animation: ticker 16s linear forwards; }
@keyframes ticker { to { transform: translateX(-100%); } }

/* side panel */
.side { display: grid; gap: 14px; position: sticky; top: 10px; }
.mascot { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; min-height: 120px; }
.mascot-cat .cat { width: 110px; height: 114px; animation: bob 2.6s ease-in-out infinite; cursor: pointer; filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .55)); }
.mascot-cat .cat.faint { animation: faint 1.6s ease-in-out; }
.mascot-cat .cat.dance { animation: dance .45s ease-in-out infinite; }
.mascot-cat .cat.purr { animation: purr .3s ease-in-out 5; }
.mascot-cat .cat.puff { animation: puff .55s ease-out; }
.mascot-cat .cat.sing { animation: sing .3s ease-in-out infinite; }
@keyframes faint { 0% { transform: rotate(0); } 25%, 75% { transform: rotate(-85deg) translate(-10px, 30px); } 100% { transform: rotate(0); } }
@keyframes dance { 0% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(12deg) translateY(-12px); } 100% { transform: rotate(-12deg) translateY(0); } }
@keyframes purr { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05, .95); } }
@keyframes puff { 0% { transform: scale(1); } 30% { transform: scale(1.2, 1.12); } 100% { transform: scale(1); } }
@keyframes sing { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06, .96); } }
.bubble {
  position: relative; background: var(--paper); color: var(--ink); border-radius: 16px;
  padding: 10px 13px; font-size: 14.5px; line-height: 1.32; font-weight: 500; min-height: 46px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35); transition: transform .2s;
}
.bubble::before { content: ''; position: absolute; left: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; background: var(--paper); transform: rotate(45deg); }
.bubble.say { animation: say .35s cubic-bezier(.3, 1.6, .5, 1); }
.bubble b { color: var(--pink-d); }
@keyframes say { from { transform: scale(.7); } to { transform: scale(1); } }

.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 9px 4px 8px;
  background: var(--card); border: 1.5px solid var(--line); color: var(--text); border-radius: 14px;
  font-weight: 600; font-size: 12.5px; box-shadow: 0 3px 0 #120c2a;
}
.tool .ti { font-size: 21px; line-height: 1; }
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #120c2a; }
.tool.on { background: var(--fish); color: var(--ink); border-color: var(--fish); }
.tool-flag { position: absolute; top: -8px; right: -6px; font-style: normal; font-size: 11px; font-weight: 700; background: var(--pink); color: #fff; border-radius: 999px; padding: 2px 6px; }
.tool.on .tool-flag { background: var(--ink); color: var(--fish); }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  position: relative; aspect-ratio: 1.15; display: grid; place-items: center;
  background: linear-gradient(180deg, #3a2f72, #2b2259); border: 1.5px solid #5546a8; border-radius: 16px;
  font-family: var(--ui); font-weight: 600; font-size: 30px; color: #fff;
  box-shadow: 0 4px 0 #120c2a; transition: transform .1s, box-shadow .1s, background .15s, filter .3s;
}
.key b { font-weight: 600; display: inline-block; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #120c2a; }
.key small { position: absolute; right: 7px; bottom: 4px; font-size: 11px; font-weight: 600; color: var(--text-soft); }
.key.done { opacity: .3; }
.pad.notes-mode .key { background: linear-gradient(180deg, #1d5c63, #164448); border-color: #2c8f92; color: #7ff2e4; font-size: 22px; }
.pad.strike .key { transform: translateY(5px); filter: saturate(.4) brightness(.85); }
.pad.strike .key b { transform: rotate(90deg) translateX(5px); }
.legend { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; background: var(--card); color: var(--text); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; font-weight: 700; font-size: 13px; }
.legend span { display: grid; gap: 1px; }
.legend em { font-style: normal; font-size: 20px; }
.shortcuts { margin: 0; font-size: 12px; color: var(--text-soft); font-weight: 500; line-height: 1.4; }

/* cat language */
.kassikeel .cell .v, .kassikeel .key b { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.kassikeel .cell .v { font-size: .76em; }

/* board moods */
.board-box.catnip .board { animation: catnip 2.6s linear infinite; }
@keyframes catnip { 0% { filter: hue-rotate(0); transform: skew(0); } 25% { transform: skew(2deg, 1deg); } 50% { filter: hue-rotate(180deg); transform: skew(0); } 75% { transform: skew(-2deg, -1deg); } 100% { filter: hue-rotate(360deg); transform: skew(0); } }
.board-box.tremble { animation: tremble .07s linear infinite; }
@keyframes tremble { 0%, 100% { translate: 0 0; } 25% { translate: -1.5px .5px; } 75% { translate: 1.5px -.5px; } }
.board-box.jolt .cell .v { display: inline-block; animation: jolt .6s cubic-bezier(.3, 1.6, .5, 1); }
.board-box.jolt .cell:nth-child(3n) .v { animation-delay: .06s; }
.board-box.jolt .cell:nth-child(4n) .v { animation-delay: .12s; }
@keyframes jolt { 0% { transform: none; } 35% { transform: translateY(-14px) rotate(-12deg); } 100% { transform: none; } }

/* incidents on the board */
.fx .gift-on { position: absolute; width: 11.1%; height: 11.1%; display: grid; place-items: center; cursor: pointer; border: 0; background: none; padding: 0; z-index: 6; transition: opacity .5s, transform .5s; }
.fx .gift-on .mouse { width: 88%; height: auto; animation: wiggle .6s ease-in-out infinite alternate; filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, .3)); }
.fx .gift-on.opening .mouse { animation: wiggle .1s linear infinite alternate; }
.fx .gift-on .sock { width: 56%; height: auto; }
.fx .gift-on.gone { opacity: 0; transform: scale(1.5); }
@keyframes wiggle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.fx .flyer { position: absolute; width: 16%; transition: left .9s ease-in-out, top .9s ease-in-out; z-index: 7; pointer-events: none; }
.fx .flyer .cat { width: 100%; height: auto; }
.fx .peek { position: absolute; bottom: 0; width: 32%; translate: 0 110%; transition: translate .45s cubic-bezier(.3, 1.6, .5, 1); z-index: 7; pointer-events: none; }
.fx .peek.left { left: 2%; } .fx .peek.right { right: 2%; } .fx .peek.center { left: 34%; }
.fx .peek.up { translate: 0 22%; }
.fx .peek .cat { width: 100%; height: auto; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); }
.fx .peek.jump { animation: catjump 1.4s cubic-bezier(.2, .9, .3, 1); }
@keyframes catjump { 0% { transform: none; } 30% { transform: translateY(-190%) rotate(-25deg); } 70% { transform: translateY(-20%) rotate(10deg); } 100% { transform: none; } }
.fx .laser {
  position: absolute; width: 12%; aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; z-index: 8;
  background: radial-gradient(circle, #fff 0 9%, #ff2a4a 20%, rgba(255, 42, 74, .45) 38%, transparent 62%);
  transition: left .5s cubic-bezier(.5, 0, .3, 1), top .5s cubic-bezier(.5, 0, .3, 1), opacity .4s;
  animation: laserpulse .25s ease-in-out infinite alternate;
}
@keyframes laserpulse { from { transform: scale(.85); } to { transform: scale(1.12); } }
.fx .runner { position: absolute; bottom: -12%; width: 30%; transition: left 1s ease-out; z-index: 7; pointer-events: none; }
.fx .runner .cat { width: 100%; height: auto; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); }
.fx .runner.wag .cat .tail { animation: wagfast .12s ease-in-out infinite alternate; }
.fx .runner .carried { display: none; position: absolute; width: 26%; left: 37%; top: 52%; }
.fx .runner.carry .carried { display: block; }
.fx .runner .carried .yarn, .fx .ball .yarn { width: 100%; height: auto; display: block; }
.fx .ball { position: absolute; bottom: 8%; width: 13%; border: 0; padding: 0; background: none; z-index: 8; transition: opacity .3s; animation: ballbob .5s ease-in-out infinite alternate; }
.fx .ball.thrown { animation: throwball .8s ease-out forwards; }
@keyframes ballbob { from { transform: translateY(0); } to { transform: translateY(-8px); } }
@keyframes throwball { to { transform: translate(260%, -420%) scale(.5) rotate(540deg); opacity: 0; } }
.fx .dim { position: absolute; inset: 0; background: rgba(8, 5, 24, .62); pointer-events: none; z-index: 6; animation: fadein .6s; transition: opacity .5s; }
.fx .dim.out { opacity: 0; }
@keyframes fadein { from { opacity: 0; } }
.fx .woof { position: absolute; font-family: var(--display); font-size: calc(var(--bs) * .07); color: #fff; text-shadow: 0 0 10px var(--pink); pointer-events: none; z-index: 9; animation: rise .9s ease-out forwards; }
.fx .ghosty { position: absolute; right: 5%; top: 5%; width: 15%; opacity: 0; transform: translateY(10px); transition: opacity .5s, transform .5s; z-index: 8; pointer-events: none; }
.fx .ghosty.show { opacity: .95; transform: none; }
.fx .ghosty .ghost { width: 100%; height: auto; }
.fx .ghost .wave { transform-box: fill-box; transform-origin: 0 100%; animation: wave .35s ease-in-out infinite alternate; }
@keyframes wave { from { transform: rotate(-15deg); } to { transform: rotate(20deg); } }
.fx .paw { position: absolute; width: 46%; border: 0; padding: 0; background: none; z-index: 8; transition: left 1.2s cubic-bezier(.3, .8, .4, 1); }
.fx .paw svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); }
.fx .loafer { position: absolute; width: 35%; border: 0; padding: 0; background: none; z-index: 7; animation: loafin .6s cubic-bezier(.3, 1.5, .5, 1); transition: transform .7s ease-in, opacity .7s; }
.fx .loafer svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); }
.fx .loafer.petted svg { animation: purr .3s ease-in-out 2; }
.fx .loafer.leave { transform: translateX(140%); opacity: 0; }
@keyframes loafin { from { transform: translateY(-60%) scale(.6); opacity: 0; } }
.loaf .zzz { font-family: var(--display); font-size: 18px; fill: var(--ink); transform-box: fill-box; animation: zzz 2.4s ease-in-out infinite; opacity: 0; }
.loaf .z2 { animation-delay: .6s; } .loaf .z3 { animation-delay: 1.2s; }
@keyframes zzz { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
.fx .heart, .fx .slurp { position: absolute; font-weight: 700; font-size: 13px; color: var(--pink-d); background: rgba(255, 255, 255, .92); border-radius: 999px; padding: 2px 8px; pointer-events: none; z-index: 9; animation: rise 1s ease-out forwards; white-space: nowrap; }
.fx .slurp { color: var(--user); }
@keyframes rise { to { transform: translateY(-26px); opacity: 0; } }
.fx .hairball-on { position: absolute; width: 11.1%; height: 11.1%; border: 0; padding: 0; background: none; display: grid; place-items: center; z-index: 6; animation: splat .35s cubic-bezier(.3, 1.6, .5, 1); transition: transform .35s, opacity .35s; }
.fx .hairball-on .hairball { width: 94%; height: auto; }
.fx .hairball-on.clean { transform: scale(0) rotate(180deg); opacity: 0; }
@keyframes splat { from { transform: scale(2.4); opacity: 0; } }
.fx .cuke { position: absolute; bottom: 3%; width: 26%; transition: left 1.2s ease-out; z-index: 8; pointer-events: none; }
.fx .cuke svg { width: 100%; height: auto; display: block; }
.fx .strike-sign { position: absolute; right: 2%; bottom: 2%; width: 44%; z-index: 8; display: grid; justify-items: center; gap: 4px; translate: 0 130%; transition: translate .45s cubic-bezier(.3, 1.5, .5, 1); }
.fx .strike-sign.up { translate: 0 0; }
.strike-sign .ss-txt { font-family: var(--display); background: #fff; color: var(--wrong); border: 3px solid var(--ink); border-radius: 6px; padding: 4px 10px; font-size: calc(var(--bs) * .045); animation: picket .6s ease-in-out infinite alternate; }
@keyframes picket { from { transform: rotate(-7deg) translateY(0); } to { transform: rotate(5deg) translateY(-4px); } }
.strike-sign .cat { width: 46%; height: auto; margin-top: -6px; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); }
.strike-sign .ss-fish { display: flex; align-items: center; gap: 6px; background: var(--fish); color: var(--ink); border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 14px; box-shadow: 0 3px 0 #1a7f75; animation: bob 1s ease-in-out infinite; white-space: nowrap; }
.strike-sign .fishy { width: 30px; height: auto; }
.fx .roomba-on { position: absolute; width: 21%; border: 0; padding: 0; background: none; z-index: 7; transition: left 7s linear; }
.fx .roomba-on svg { width: 100%; height: auto; display: block; }
.fx .roomba-on .led { animation: led .5s steps(1) infinite; }
.fx .roomba-on.off { animation: offspin 1.1s ease-in forwards; }
@keyframes led { 50% { opacity: .2; } }
@keyframes offspin { to { transform: rotate(540deg) scale(.2); opacity: 0; } }
.sitter-on { position: fixed; left: 50%; bottom: 0; width: min(92vw, 460px); translate: -50% 110%; transition: translate .55s cubic-bezier(.3, 1.3, .5, 1); z-index: 45; border: 0; padding: 0; background: none; }
.sitter-on.up { translate: -50% 6%; }
.sitter-on svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 -6px 18px rgba(0, 0, 0, .5)); }
.sitter-on.wiggle svg { animation: sitwiggle .35s; }
@keyframes sitwiggle { 30% { transform: rotate(-3deg); } 70% { transform: rotate(3deg); } }

/* sky layer: zoomies, rain, choir, boxes, confetti */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.sky .zoom { position: absolute; width: 120px; animation: .7s linear forwards; filter: blur(.5px); }
.sky .zoom.ltr { left: -160px; animation-name: zoomltr; }
.sky .zoom.rtl { right: -160px; animation-name: zoomrtl; }
.sky .zoom .cat { width: 100%; height: auto; }
.sky .zoom::after { content: ''; position: absolute; top: 45%; width: 150px; height: 18px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .6) 0 2px, transparent 2px 7px); }
.sky .zoom.ltr::after { right: 100%; } .sky .zoom.rtl::after { left: 100%; }
@keyframes zoomltr { to { transform: translateX(calc(100vw + 320px)) skewX(-14deg); } }
@keyframes zoomrtl { to { transform: translateX(calc(-100vw - 320px)) skewX(14deg); } }
.sky .fall { position: absolute; top: -130px; width: 70px; animation: fall linear forwards; }
.sky .fall svg { width: 100%; height: auto; display: block; }
@keyframes fall { to { transform: translateY(calc(100vh + 170px)) rotate(var(--rot, 360deg)); } }
.sky .tufts { position: absolute; width: 18px; animation: fall linear forwards; }
.sky .tufts svg { width: 100%; height: auto; }
.sky .tumble { position: absolute; display: grid; place-items: center; font-family: var(--ui); font-weight: 700; color: var(--user); text-shadow: 0 0 6px #fff; animation: tumble 1.6s cubic-bezier(.4, 0, .8, .6) forwards; }
@keyframes tumble { 15% { transform: translate(18px, -14px) rotate(30deg); } 100% { transform: translate(70px, 105vh) rotate(400deg); } }
.sky .march { position: absolute; bottom: 8px; display: flex; align-items: flex-end; gap: 6px; left: 100%; animation: march 9s linear forwards; }
.sky .march .cat { width: 76px; height: auto; animation: dance .4s ease-in-out infinite; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); }
.sky .march .kitten { width: 46px; height: auto; animation: bob .4s ease-in-out infinite; }
.sky .march .flag { align-self: flex-start; background: var(--pink); color: #fff; font-family: var(--display); font-size: 18px; padding: 4px 10px; border-radius: 8px; box-shadow: 0 0 18px rgba(255, 95, 162, .6); }
@keyframes march { to { transform: translateX(calc(-100vw - 110%)); } }
.sky .boxdrop { position: absolute; left: 50%; bottom: 10px; width: 170px; margin-left: -85px; animation: boxfall .7s cubic-bezier(.5, 0, .7, .4) both; }
.sky .boxdrop .cbox { position: relative; z-index: 2; width: 100%; height: auto; display: block; }
.sky .boxdrop .boxcat { position: absolute; left: 22%; width: 56%; bottom: 30%; z-index: 1; transform: translateY(-120vh); transition: transform .5s cubic-bezier(.4, 0, .7, 1); }
.sky .boxdrop .boxcat .cat { width: 100%; height: auto; }
.sky .boxdrop.in .boxcat { transform: translateY(0); }
.sky .boxdrop .boxsays { position: absolute; left: 66%; top: -34px; background: #fff; color: var(--ink); font-weight: 700; border-radius: 12px; padding: 4px 10px; opacity: 0; transition: opacity .3s; white-space: nowrap; }
.sky .boxdrop.in .boxsays { opacity: 1; }
.sky .boxdrop.hop { animation: boxhop 3.6s ease-in-out forwards; }
.cbox-text { font-family: var(--display); font-size: 15px; fill: #8a5a2b; }
@keyframes boxfall { from { transform: translateY(-110vh); } }
@keyframes boxhop { 0%, 20%, 40%, 60% { transform: translateY(0); } 10%, 30%, 50% { transform: translateY(-40px); } 100% { transform: translateX(calc(50vw + 220px)); } }
.sky .choir { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 2px; animation: choirin .5s ease-out; }
.sky .choir .singer { width: min(19vw, 112px); transform: translateY(22%); }
.sky .choir .singer.hit { animation: singhit .45s ease-out; }
.sky .choir .cat { width: 100%; height: auto; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); }
@keyframes choirin { from { transform: translateY(100%); } }
@keyframes singhit { 0% { transform: translateY(22%); } 40% { transform: translateY(-4%) scale(1.1); } 100% { transform: translateY(22%); } }

/* banners & toasts */
.banner {
  position: fixed; left: 50%; top: 14px; z-index: 70; translate: -50% -160%;
  max-width: min(92vw, 620px); text-align: center;
  font-family: var(--display); font-size: clamp(15px, 3vw, 21px); line-height: 1.2;
  background: linear-gradient(135deg, #ff6fae, var(--pink-d)); color: #fff; border-radius: 18px;
  padding: 12px 18px 13px; box-shadow: 0 0 30px rgba(255, 95, 162, .5), 0 6px 0 #8f1f52;
  visibility: hidden; transition: translate .45s cubic-bezier(.3, 1.5, .5, 1), visibility 0s .45s;
}
.banner.show { translate: -50% 0; visibility: visible; transition: translate .45s cubic-bezier(.3, 1.5, .5, 1); }
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 70; translate: -50% 200%;
  background: #0f0b24; color: var(--moon); border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 18px;
  font-weight: 600; font-size: 15px; max-width: 92vw; text-align: center;
  opacity: 0; visibility: hidden; transition: translate .35s cubic-bezier(.3, 1.5, .5, 1), opacity .25s, visibility 0s .35s;
}
.toast.show { translate: -50% 0; opacity: 1; visibility: visible; transition: translate .35s cubic-bezier(.3, 1.5, .5, 1), opacity .25s; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(8, 5, 24, .72); backdrop-filter: blur(4px); overflow-y: auto; }
.panel {
  width: min(560px, 100%); background: #221b4a; color: var(--text); border: 1.5px solid var(--line); border-radius: 24px;
  padding: 22px 22px 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .6), 0 0 44px rgba(255, 95, 162, .15); position: relative;
  animation: panelin .4s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes panelin { from { transform: scale(.8); opacity: 0; } }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0 0 12px; color: var(--moon); }
.panel .x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--text); font-weight: 700; font-size: 17px; }
.win-panel { text-align: center; }
.win-panel h2 { font-size: clamp(32px, 7vw, 46px); color: var(--pink); text-shadow: 0 0 20px rgba(255, 95, 162, .6); margin-bottom: 4px; }
.win-cats .cat { width: 140px; height: 145px; filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); animation: dance .45s ease-in-out infinite; }
.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.win-stats div { background: #2c245c; border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 4px; }
.win-stats b { display: block; font-size: 22px; font-weight: 700; color: var(--moon); }
.win-stats small { font-weight: 600; color: var(--text-soft); font-size: 12.5px; }
.record { display: inline-block; background: var(--moon); color: var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 700; rotate: -3deg; animation: bob 1s ease-in-out infinite; }
.win-fact { background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 10px 12px; font-size: 14.5px; line-height: 1.35; margin: 10px 0 14px; text-align: left; }
.win-fact b { color: var(--pink); }
.win-ach { display: grid; gap: 6px; margin-bottom: 12px; }
.ach { display: flex; align-items: center; gap: 10px; text-align: left; background: #2c245c; border: 1.5px solid var(--line); border-radius: 14px; padding: 7px 10px; }
.ach .medal { font-size: 26px; }
.ach b { display: block; font-size: 15px; } .ach small { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.ach.locked { opacity: .35; filter: grayscale(1); }
.panel-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stats-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.stats-table th, .stats-table td { padding: 8px 6px; border-bottom: 1.5px dashed var(--line); text-align: left; font-weight: 600; }
.stats-table td.n, .stats-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.settings-list { display: grid; gap: 14px; margin-bottom: 18px; }

/* loading: Traks chases your puzzle */
.catching { display: grid; justify-items: center; gap: 6px; color: var(--text); font-weight: 600; font-size: 19px; text-align: center; }
.chase { position: relative; width: 260px; height: 130px; }
.load-toy { position: absolute; bottom: 6px; width: 64px; animation: toyrun .9s ease-in-out infinite alternate; }
.load-cat { position: absolute; bottom: 0; width: 118px; animation: catrun .9s ease-in-out infinite alternate; }
.load-toy svg, .load-cat svg { width: 100%; height: auto; display: block; }
.load-cat .cat { filter: drop-shadow(0 0 2px rgba(255, 255, 255, .6)); }
@keyframes toyrun { from { left: 160px; } to { left: 196px; } }
@keyframes catrun { from { left: 0; transform: rotate(-4deg); } to { left: 52px; transform: rotate(4deg) translateY(-6px); } }

/* ---------------- phones (built for Samsung Galaxy, 360–412 px wide) ---------------- */
button, .board, .pad { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.board, .pad, .tools, .status { -webkit-user-select: none; user-select: none; }
.menu-btn {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1.5px solid var(--line); color: var(--text); font-size: 17px; font-weight: 700; padding: 0;
}
.status-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-sub { margin: 0 0 6px; font-weight: 600; color: var(--text-soft); }
.win-extra { margin: 4px 0; font-weight: 600; font-size: 14.5px; }
.win-ach-title { font-weight: 700; margin: 6px 0; }
.install-box { background: rgba(255, 255, 255, .05); border: 1.5px dashed var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 16px; display: grid; gap: 6px; justify-items: start; }
.install-box p { margin: 0; font-size: 14px; line-height: 1.4; color: var(--text-soft); }
@media (min-width: 861px) { .menu-btn { display: none; } }

@media (max-width: 860px) {
  body.in-game { overscroll-behavior: none; }
  body.in-game .top { display: none; }
  .game {
    --bs: min(calc(100vw - 12px), calc(100dvh - 268px - env(safe-area-inset-bottom) - env(safe-area-inset-top)), 560px);
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: calc(6px + env(safe-area-inset-top)) 6px calc(10px + env(safe-area-inset-bottom));
    max-width: none; min-height: 100dvh;
  }
  .board-col, .side { display: contents; }
  .status { order: 1; width: var(--bs); height: 42px; gap: 7px; font-size: 14px; }
  .status-title { font-size: 15px; }
  .status-mist span[data-i] { display: none; }
  .status-mist::before { content: '✖ '; color: var(--pink); }
  .timer { padding: 6px 10px; }
  .mascot { order: 2; width: var(--bs); height: 52px; min-height: 0; display: block; position: relative; z-index: 9; }
  .mascot-cat { position: absolute; left: 0; top: 0; }
  .mascot-cat .cat { width: 52px; height: 54px; }
  .bubble { position: absolute; left: 62px; right: 0; top: 3px; font-size: 13.5px; line-height: 1.3; padding: 6px 10px 7px; min-height: 0; }
  .bubble::before { top: 18px; margin-top: 0; }
  .bubble.quiet { opacity: 0; transform: scale(.95); pointer-events: none; transition: opacity .6s, transform .6s; }
  .board-box { order: 3; margin-block: auto; }
  .ticker { order: 4; position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; height: 34px; border-radius: 0; z-index: 65; display: none; }
  .ticker.live { display: flex; }
  .tools { order: 5; width: var(--bs); gap: 6px; }
  .tool { padding: 6px 2px 6px; font-size: 12px; border-radius: 12px; }
  .tool .ti { font-size: 19px; }
  .pad { order: 6; width: var(--bs); grid-template-columns: repeat(9, 1fr); gap: 5px; }
  .key { aspect-ratio: auto; height: 58px; font-size: 28px; border-radius: 12px; box-shadow: 0 3px 0 #120c2a; }
  .key small { right: 3px; bottom: 2px; font-size: 10px; }
  .pad.notes-mode .key { font-size: 21px; }
  .legend { position: fixed; top: calc(54px + env(safe-area-inset-top)); left: 6px; right: 6px; z-index: 30; grid-template-columns: repeat(9, 1fr); padding: 5px 4px; font-size: 11px; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
  .legend em { font-size: 17px; }
  .shortcuts { display: none; }
  .sky .march { bottom: auto; top: 40px; }
  .sky .march .cat { width: 58px; } .sky .march .kitten { width: 38px; }
  .cell .notes i { font-size: calc(var(--bs) / 9 * .26); }
  .banner { top: calc(6px + env(safe-area-inset-top)); padding: 10px 14px 11px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
/* tall phones (Galaxy S2x and friends): bigger thumb keys, controls sit at the bottom */
@media (max-width: 860px) and (min-height: 760px) {
  .key { height: clamp(62px, calc((100dvh - var(--bs) - 210px) * .5), 78px); font-size: 30px; }
  .tool { padding: 9px 2px 8px; }
  .game { --bs: min(calc(100vw - 12px), calc(100dvh - 276px - env(safe-area-inset-bottom) - env(safe-area-inset-top)), 560px); }
}

@media (max-width: 560px) {
  .top { padding: 8px 12px 4px; }
  .logo-text { display: none; } .logo-cat { width: 40px; height: 40px; }
  .chip-btn { padding: 7px 10px; font-size: 13px; }
  .chip-btn span[data-i] { display: none; }
  .home { padding: 2px 12px calc(104px + env(safe-area-inset-bottom)); gap: 14px; }
  .hero h1 { font-size: 46px; }
  .moon-deco { width: 52px; height: 52px; right: 0; top: -2px; }
  .tagline { font-size: 14.5px; margin: 4px 0 2px; }
  .trio-cat .cat { width: 27vw; }
  .trio-cat b { font-size: 13.5px; }
  .trio-cat small { font-size: 10.5px; }
  .hero-bubble { font-size: 13.5px; padding: 8px 11px; margin-top: 10px; }
  .levels { gap: 7px; }
  .level { padding: 10px 3px 10px; border-radius: 16px; }
  .level::before, .level::after { border-left-width: 9px; border-right-width: 9px; border-bottom-width: 11px; top: -10px; }
  .level::before { left: 8px; } .level::after { right: 8px; }
  .level svg { width: 44px; height: 46px; }
  .level b { font-size: 12.5px; }
  .level small { font-size: 10.5px; }
  .variant { padding: 8px 12px; font-size: 14px; }
  .card { padding: 12px 14px; }
  #startBtn { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 20; white-space: nowrap; }
  .win-stats b { font-size: 18px; }
  .panel { padding: 18px 16px 20px; }
  .win-cats .cat { width: 110px; height: 114px; }
}
@media (max-width: 380px) { .level small { display: none; } }

/* phone held sideways */
@media (orientation: landscape) and (max-height: 520px) {
  body.in-game .top { display: none; }
  .game {
    --bs: min(calc(100dvh - 58px), 56vw);
    display: grid; grid-template-columns: var(--bs) minmax(250px, 1fr); gap: 14px; align-items: start; justify-content: center;
    padding: 6px 12px;
  }
  .board-col, .side { display: grid; gap: 6px; }
  .status { height: 40px; }
  .mascot { height: 46px; }
  .mascot-cat .cat { width: 46px; height: 48px; }
  .bubble { left: 54px; }
  .pad { width: auto; grid-template-columns: repeat(3, 1fr); }
  .key { height: calc((100dvh - 150px) / 3); }
  .tools, .legend { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .board-box.catnip .board, .board-box.tremble, .stars { animation: none !important; }
}
