/* Star Bonanza: a cartoon space farm. Candy colours, chunky stickers with thick ink outlines, buttons that squish when
   you press them, bubbly fonts (Lilita One for shouting, Fredoka for buttons, Nunito for reading) and big text
   everywhere. Everything here belongs to this game alone. */

:root {
  --ink: #2d1b4e;
  --ink-soft: #5b4a7a;
  --paper: #fffaf0;
  --cream: #fff1d6;
  --yellow: #ffd23f;
  --yellow-d: #d99e00;
  --pink: #ff6fae;
  --pink-d: #cf3d7e;
  --mint: #4ee6b0;
  --mint-d: #1fae7d;
  --sky: #5cc8ff;
  --sky-d: #2a8fd0;
  --grape: #7b5cff;
  --orange: #ff9a3c;
  --wood: #d49254;
  --wood-d: #9a5c2a;
  --soil: #7a4a2c;
  --night: #1e1352;
  --coin: #ffc531;
  --display: 'Lilita One', 'Fredoka', system-ui, sans-serif;
  --ui: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', 'Fredoka', system-ui, sans-serif;
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --shadow: 0 6px 0 rgba(30, 19, 82, 0.55);
  --o3: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
  --o2: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 1.5px 1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px -1.5px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink); font: 700 16px/1.4 var(--body); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-soft); font-weight: 600; }

/* ---------- the stage and the layers ---------- */
#stage { position: fixed; inset: 0; z-index: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }
#labels { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
#app { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.screen { position: absolute; inset: 0; }
.screen > * { pointer-events: auto; }
.layer-fx { position: fixed; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.layer-prompt { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.layer-modal { position: fixed; inset: 0; z-index: 20; }
.layer-dialog { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.layer-dialog > * { pointer-events: auto; }

/* ---------- the kit: stickers, buttons, switches ---------- */
.panel { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--shadow); color: var(--ink); }
.ico { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; }
.ico svg { width: 100%; height: 100%; stroke-width: 2.6; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 18px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); color: var(--ink); font: 600 17px/1.1 var(--ui); letter-spacing: 0.01em; cursor: pointer; box-shadow: 0 5px 0 var(--ink); transition: transform 0.12s var(--bounce), box-shadow 0.12s, background 0.15s, filter 0.15s; user-select: none; }
.btn:hover:not(:disabled) { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 7px 0 var(--ink); filter: brightness(1.04); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; filter: saturate(0.4); }
.btn:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }
.btn.gold { background: var(--yellow); }
.btn.primary, .btn.sky { background: var(--sky); }
.btn.mint { background: var(--mint); }
.btn.pink, .btn.danger { background: var(--pink); color: #fff; text-shadow: 0 1px 0 var(--ink); }
.btn.ghost { background: rgba(255, 255, 255, 0.85); }
.btn.big { min-height: 56px; padding: 12px 26px; font-size: 20px; border-radius: 18px; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 15px; border-radius: 12px; box-shadow: 0 4px 0 var(--ink); }
.btn.on { background: var(--yellow); }
.icon-btn { display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 3px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 20px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform 0.12s var(--bounce); }
.icon-btn:hover { transform: scale(1.08) rotate(-6deg); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn.off { background: #d9d2ea; }
.btn.icon-btn { min-height: 0; padding: 0; }
.small-icon { width: 34px; height: 34px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--yellow); font: 600 13px var(--ui); white-space: nowrap; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); animation: blink 1.6s infinite; }
@keyframes blink { 50% { transform: scale(0.7); } }
input, select { padding: 10px 14px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; font: 700 17px var(--body); outline: none; }
input:focus, select:focus { box-shadow: 0 0 0 4px rgba(92, 200, 255, 0.6); }
.segmented { display: inline-flex; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 4px 0 var(--ink); }
.seg { min-height: 40px; padding: 6px 14px; border: none; background: transparent; font: 600 16px var(--ui); color: var(--ink); cursor: pointer; }
.seg + .seg { border-left: 3px solid var(--ink); }
.seg:hover:not(:disabled) { background: var(--cream); }
.seg.on { background: var(--yellow); }
.seg:disabled { cursor: default; }
.switch { position: relative; flex: none; width: 62px; height: 34px; border: 3px solid var(--ink); border-radius: 999px; background: #e4ddf2; cursor: pointer; box-shadow: 0 3px 0 var(--ink); transition: background 0.2s; }
.switch::before { content: ''; position: absolute; top: 2px; left: 3px; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; transition: transform 0.25s var(--bounce); }
.switch.on { background: var(--mint); }
.switch.on::before { transform: translateX(26px); }
.switch:disabled { opacity: 0.6; cursor: default; }
input[type='range'] { -webkit-appearance: none; appearance: none; flex: 1; height: 26px; padding: 0; border: none; background: transparent; box-shadow: none; }
input[type='range']::-webkit-slider-runnable-track { height: 12px; border-radius: 99px; border: 2px solid var(--ink); background: linear-gradient(90deg, var(--yellow) var(--v, 50%), #fff var(--v, 50%)); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; border: 3px solid var(--ink); background: var(--pink); }
input[type='range']::-moz-range-track { height: 10px; border-radius: 99px; border: 2px solid var(--ink); background: #fff; }
input[type='range']::-moz-range-progress { height: 10px; border-radius: 99px; background: var(--yellow); }
input[type='range']::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink); background: var(--pink); }
kbd { display: inline-block; min-width: 28px; padding: 2px 8px; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 8px; background: #fff; font: 600 13px var(--ui); text-align: center; }
.keyhints { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 600 14px var(--ui); color: var(--ink-soft); }
.kh { display: inline-flex; align-items: center; gap: 6px; }

/* a gold Star Coin, with or without a number on it */
.coin { display: inline-grid; place-items: center; min-width: 1.15em; height: 1.15em; padding: 0 0.1em; margin: 0 0.12em; border-radius: 50%; border: 2px solid var(--ink); background: radial-gradient(circle at 35% 30%, #fff3b0, var(--coin) 55%, #e09a00); font: 900 0.62em/1 var(--body); font-style: normal; color: var(--ink); vertical-align: -0.18em; }
.coin:empty::after { content: '★'; font-size: 0.65em; color: #b87400; }
.coins { display: inline-flex; align-items: center; font-weight: 900; }

/* the warp between screens: a flash of candy colour */
.warp { position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 50%, transparent 0, transparent 30%, var(--yellow) 31%, var(--pink) 60%, var(--grape) 100%); }
.warp.go { animation: warp 0.7s var(--ease); }
@keyframes warp { 0% { opacity: 0; } 30% { opacity: 0.85; } 100% { opacity: 0; } }

/* ---------- labels that follow things around the farm ---------- */
.deck-tag, .tag, .padtag, .futag, .saletag { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; pointer-events: none; }
.deck-tag { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 600 13px var(--ui); color: var(--ink-soft); }
.deck-tag .dk-ico { font-size: 18px; }
.deck-tag .dk-n { font: 400 22px var(--display); color: var(--ink); }
.deck-tag.last { background: var(--pink); color: #fff; animation: wobble 0.8s infinite; }
.deck-tag.last .dk-n { color: #fff; }
@keyframes wobble { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.tag { display: flex; align-items: center; gap: 7px; padding: 3px 12px 3px 4px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 600 15px var(--ui); color: var(--ink); }
.tag .tg-av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--cream); font-size: 18px; }
.tag .tg-n { display: inline-flex; align-items: center; font: 400 18px var(--display); }
.tag .tg-h { font-size: 13px; color: var(--ink-soft); }
.tag.me { background: #e3f6ff; }
.tag.turn { background: var(--yellow); }
.tag.away { opacity: 0.6; }
.padtag { display: flex; align-items: baseline; gap: 4px; padding: 1px 8px; border: 2px solid var(--wood-d); border-radius: 8px; background: #ffe2b8; box-shadow: 0 2px 0 var(--wood-d); font: 600 12.5px var(--ui); color: var(--ink); transform-origin: bottom; }
.padtag b { font: 400 18px var(--display); color: var(--c); text-shadow: var(--o2); }
.padtag.empty { opacity: 0; }
.saletag { padding: 2px 9px; border: 3px solid var(--ink); border-radius: 6px; background: #fff; font: 400 13px var(--display); letter-spacing: 0.06em; color: #e8323f; box-shadow: 0 3px 0 var(--ink); }
.futag { padding: 3px 12px; border: 3px solid var(--ink); border-radius: 999px; background: var(--c); font: 400 15px var(--display); letter-spacing: 0.02em; color: #fff; text-shadow: var(--o2), 0 3px 0 var(--ink); box-shadow: 0 3px 0 var(--ink); animation: popIn 0.5s 0.75s var(--bounce) both; }
@keyframes popIn { from { opacity: 0; transform: scale(0.3); } }

/* ---------- the logo ---------- */
.logo-lockup { display: flex; flex-direction: column; align-items: center; }
.emblem { width: clamp(90px, 14vw, 140px); height: auto; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(30, 19, 82, 0.5)); }
@keyframes bob { 50% { transform: translateY(-8px) rotate(6deg); } }
.wordmark { display: flex; flex-direction: column; align-items: center; line-height: 0.88; margin-top: -6px; }
.wm-1, .wm-2 { font: 400 clamp(56px, 10vw, 110px) var(--display); letter-spacing: 0.03em; text-shadow: var(--o3), 0 8px 0 var(--ink), 0 10px 0 var(--ink); }
.wm-1 { color: var(--yellow); transform: rotate(-3deg); }
.wm-2 { color: var(--pink); font-size: clamp(46px, 8.4vw, 92px); transform: rotate(2deg); }

/* ---------- the start screen ---------- */
.splash { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 40%, #5b33a8, #2e1a73 55%, #120c3d); transition: opacity 0.6s, transform 0.6s var(--ease); }
.splash.out { opacity: 0; transform: scale(1.15); pointer-events: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-bottom: 110px; text-align: center; }
.splash-bar { width: min(380px, 70vw); height: 22px; padding: 3px; border: 3px solid var(--ink); border-radius: 99px; background: #fff; box-shadow: 0 5px 0 var(--ink); transition: opacity 0.3s; }
.splash-bar i { display: block; width: 0; height: 100%; border-radius: 99px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, #ffe680 12px 24px); transition: width 0.3s; animation: stripes 0.8s linear infinite; }
@keyframes stripes { to { background-position: 34px 0; } }
.splash-status { min-height: 22px; font: 600 18px var(--ui); color: #fff; }
.splash.loaded .splash-bar { opacity: 0; }
.splash-press { padding: 14px 34px; border: 3px solid var(--ink); border-radius: 20px; background: var(--yellow); font: 400 26px var(--display); color: var(--ink); box-shadow: 0 6px 0 var(--ink); cursor: pointer; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07) rotate(-2deg); } }
.splash-tip { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); padding: 10px 18px; border: 3px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); font: 700 16px var(--body); text-align: center; }
.splash-tip:empty { display: none; }
.splash-tip.in { animation: tip 4.5s ease-in-out; }
@keyframes tip { 0% { opacity: 0; transform: translate(-50%, 10px); } 10%, 90% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.splash-foot { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font: 600 14px var(--ui); color: rgba(255, 255, 255, 0.75); }
#app, #labels { transition: opacity 0.6s; }
body:has(#splash:not(.out)) #app, body:has(#splash:not(.out)) #labels { opacity: 0; pointer-events: none; }

/* ---------- the title screen ---------- */
.home { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; pointer-events: none; }
.home > * { pointer-events: auto; }
.home-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; }
.arcade-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px 8px 10px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 600 16px var(--ui); color: var(--ink); text-decoration: none; transition: transform 0.15s var(--bounce); }
.arcade-link:hover { transform: translateX(-4px) rotate(-2deg); }
.home-top-right { display: flex; align-items: center; gap: 10px; }
.farmer { display: inline-flex; align-items: center; gap: 10px; padding: 5px 14px 5px 6px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); cursor: pointer; transition: transform 0.15s var(--bounce); }
.farmer:hover { transform: rotate(2deg) scale(1.03); }
.farmer-art { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); font-size: 22px; }
.farmer-text { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.farmer-text b { font: 600 17px var(--ui); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.farmer-text small { font: 700 13px var(--body); color: var(--ink-soft); }
.farmer-edit { width: 18px; height: 18px; color: var(--ink-soft); }
.home-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; min-height: 0; overflow-y: auto; }
.home-logo { position: relative; }
.home-logo .emblem { width: clamp(70px, 9vw, 104px); }
.home-logo .wm-1 { font-size: clamp(50px, 7.5vw, 92px); }
.home-logo .wm-2 { font-size: clamp(40px, 6.2vw, 76px); }
.peekers { position: absolute; inset: -20px -110px; pointer-events: none; }
.peek { position: absolute; width: 88px; height: 88px; animation: peek 3.2s ease-in-out infinite; filter: drop-shadow(0 4px 0 rgba(30, 19, 82, 0.45)); }
.peek.p0 { left: 0; top: 30%; animation-delay: -0.4s; }
.peek.p1 { right: 0; top: 18%; animation-delay: -1.2s; width: 78px; height: 78px; }
.peek.p2 { right: 18px; bottom: 0; animation-delay: -2s; width: 70px; height: 70px; }
.peek.p3 { left: 22px; bottom: -6px; animation-delay: -2.6s; width: 66px; height: 66px; }
.peek.p4 { left: 50%; top: -34px; margin-left: 70px; width: 58px; height: 58px; animation-delay: -1.7s; }
@keyframes peek { 50% { translate: 0 -12px; rotate: 8deg; } }
.home-tag { margin: 2px 0 6px; padding: 6px 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 800 16px var(--body); text-align: center; }
.home-view { width: min(560px, 100%); }
.home-view.in > * { animation: bounceIn 0.5s var(--bounce) both; }
@keyframes bounceIn { from { opacity: 0; transform: scale(0.85) translateY(20px); } }
.big-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bigbtn { justify-content: flex-start; gap: 12px; min-height: 78px; padding: 10px 16px; text-align: left; border-radius: 20px; box-shadow: 0 6px 0 var(--ink); }
.bigbtn:nth-child(odd):hover:not(:disabled) { transform: translateY(-3px) rotate(-1.5deg); }
.bigbtn:nth-child(even):hover:not(:disabled) { transform: translateY(-3px) rotate(1.5deg); }
.bb-ico { display: grid; place-items: center; flex: none; width: 50px; height: 50px; border-radius: 14px; border: 3px solid var(--ink); background: rgba(255, 255, 255, 0.75); font-size: 28px; }
.bb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bb-text b { font: 400 22px/1.05 var(--display); letter-spacing: 0.01em; }
.bb-text small { font: 700 14px/1.2 var(--body); color: rgba(45, 27, 78, 0.8); }
.bigbtn.pink { color: var(--ink); text-shadow: none; }
.home.enter .home-logo { animation: bounceIn 0.8s var(--bounce) both; }
.home.enter .big-menu > * { animation: bounceIn 0.6s var(--bounce) both; }
.home.enter .big-menu > :nth-child(2) { animation-delay: 0.08s; }
.home.enter .big-menu > :nth-child(3) { animation-delay: 0.16s; }
.home.enter .big-menu > :nth-child(4) { animation-delay: 0.24s; }
.home-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px 14px; }
.online, .version { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); font: 600 14px var(--ui); box-shadow: 0 3px 0 var(--ink); }
.online:empty { display: none; }
.sub-panel { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.sub-panel h2 { margin: 0; font: 400 32px var(--display); }
.sub-panel .muted { margin: -6px 0 0; font-size: 16px; }
.sub-label { font: 600 17px var(--ui); }
.sub-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sub-actions .big { flex: 1; }
.code-boxes { display: flex; gap: 10px; justify-content: center; }
.code-box { width: 70px; height: 84px; padding: 0; text-align: center; font: 400 46px var(--display); text-transform: uppercase; border-radius: 16px; box-shadow: 0 5px 0 var(--ink); }
.opp-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.opp { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; transition: transform 0.12s var(--bounce); }
.opp:hover { transform: translateY(-3px); }
.opp.on { background: var(--yellow); }
.opp-bots { font-size: 13px; min-height: 16px; }
.opp b { font: 400 28px var(--display); line-height: 1.1; }
.opp small { font: 700 12px var(--body); }

/* ---------- dialogs and windows ---------- */
.dialog-wrap, .modal-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(30, 19, 82, 0.55); animation: fadeIn 0.2s; }
.dialog-wrap.closing { opacity: 0; transition: opacity 0.18s; }
@keyframes fadeIn { from { opacity: 0; } }
.dialog { width: min(460px, 100%); padding: 22px 22px 20px; border: 3px solid var(--ink); border-radius: 24px; background: var(--paper); box-shadow: 0 8px 0 var(--ink); animation: bounceIn 0.4s var(--bounce); }
.dialog.danger { background: #fff0f5; }
.dialog-head h2 { margin: 0 0 10px; font: 400 28px/1.1 var(--display); }
.dialog-body p { margin: 0 0 6px; font: 700 17px/1.45 var(--body); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.name-form { display: flex; gap: 10px; margin-top: 10px; }
.name-input { flex: 1; min-width: 0; height: 54px; font: 600 22px var(--ui); }
.name-form .icon-btn { width: 54px; height: 54px; border-radius: 16px; }
.modal { display: flex; flex-direction: column; width: min(640px, 100%); max-height: calc(100vh - 32px); animation: bounceIn 0.4s var(--bounce); }
.modal.wide { width: min(1000px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 10px 22px; border-bottom: 3px dashed rgba(45, 27, 78, 0.25); }
.modal-head h2 { margin: 0; font: 400 30px var(--display); }
.modal-body { overflow-y: auto; padding: 16px 22px 24px; }

/* how to play */
.rules .lead { margin: 0 0 14px; font: 800 19px/1.45 var(--body); }
.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 10px 0 16px; }
.howto-step { position: relative; padding: 14px 12px 12px; border: 3px solid var(--ink); border-radius: 18px; background: var(--cream); box-shadow: 0 4px 0 var(--ink); text-align: center; transform: rotate(calc((var(--i) - 2.5) * 1deg)); }
.hs-num { position: absolute; top: -14px; left: -10px; display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid var(--ink); border-radius: 50%; background: var(--pink); color: #fff; font: 400 20px var(--display); }
.hs-ico { font-size: 40px; line-height: 1.1; }
.howto-step h3 { margin: 4px 0; font: 400 21px var(--display); }
.howto-step p { margin: 0; font: 700 15px/1.35 var(--body); }
.rules-box { margin: 14px 0; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 18px; background: #e8f8ff; }
.rules-box h3 { margin: 0 0 4px; font: 400 22px var(--display); }
.rules-box p { margin: 0; font: 700 16px/1.45 var(--body); }
.rules-head { margin: 22px 0 2px; font: 400 26px var(--display); }
.star-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 10px; margin-top: 10px; }
.star-row { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 3px solid var(--ink); border-radius: 18px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 35%, #fff), #fff 70%); box-shadow: 0 4px 0 var(--ink); }
.star-row img { width: 82px; height: 82px; }
.sr-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sr-name b { font: 400 22px var(--display); }
.sr-name small { font: 800 13px var(--body); color: var(--ink-soft); }
.sr-name .real { font: 700 12px var(--body); color: var(--ink-soft); opacity: 0.8; }
.sr-name em { font: 700 13.5px/1.3 var(--body); color: var(--ink); }
.sr-pays { display: flex; gap: 4px; }
.pay { display: flex; flex-direction: column; align-items: center; min-width: 36px; padding: 3px 2px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.pay b { font: 400 20px var(--display); line-height: 1.1; }
.pay .coin { font-size: 22px; margin: 0; }
.pay.none { opacity: 0.35; justify-content: center; font: 400 20px var(--display); }

/* settings */
.settings { display: flex; flex-direction: column; gap: 10px; }
.set-head { margin: 8px 0 0; font: 400 22px var(--display); }
.set-row { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); }
.set-row:has(input[type='range']) { grid-template-columns: 32px 150px 1fr 40px; }
.set-glyph { font-size: 22px; text-align: center; }
.set-label { display: flex; flex-direction: column; font: 600 17px var(--ui); }
.set-label small { font: 700 13px var(--body); color: var(--ink-soft); }
.set-val { font: 400 20px var(--display); text-align: right; }
.set-foot { display: flex; justify-content: flex-end; margin-top: 6px; }

/* ---------- the lobby ---------- */
.lobby { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(330px, 420px) minmax(0, 1fr) minmax(320px, 380px); grid-template-rows: auto minmax(0, 1fr) auto; gap: 14px 18px; padding: 14px 18px 16px; pointer-events: none; }
.lobby > * { pointer-events: auto; }
.lobby-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.lobby-title { margin: 0; padding: 4px 18px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 400 28px var(--display); }
.lobby-head-right { margin-left: auto; display: flex; gap: 10px; }
.card-label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 400 21px var(--display); }
.lock-note { margin-left: auto; font: 700 13px var(--body); color: var(--ink-soft); }
.crew { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow-y: auto; min-height: 0; align-self: start; max-height: 100%; }
.code-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; padding-bottom: 12px; border-bottom: 3px dashed rgba(45, 27, 78, 0.25); }
.lobby-code { display: flex; gap: 6px; }
.lobby-code span { display: grid; place-items: center; width: 52px; height: 62px; border: 3px solid var(--ink); border-radius: 14px; background: var(--yellow); box-shadow: 0 4px 0 var(--ink); font: 400 38px var(--display); transform: rotate(calc((var(--i) - 1.5) * 4deg)); }
.code-btns { display: flex; gap: 8px; align-items: center; }
.qr-box { display: flex; justify-content: center; }
.qr { width: 150px; height: 150px; padding: 8px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; }
.seats { display: flex; flex-direction: column; gap: 8px; }
.seat { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 10px 6px 6px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: 0 4px 0 var(--ink); animation: bounceIn 0.4s var(--bounce) both; animation-delay: calc(var(--i) * 40ms); }
.seat.me { background: #e3f6ff; }
.seat-av { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream); font-size: 26px; }
.seat-who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.15; }
.seat-who b { font: 600 18px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-who small { font: 700 13px var(--body); color: var(--ink-soft); }
.seat.empty { border-style: dashed; background: rgba(255, 255, 255, 0.55); box-shadow: none; }
.seat.empty .seat-av { background: transparent; border-style: dashed; font-size: 20px; opacity: 0.6; }
.seat-wait { flex: 1; font: 700 15px var(--body); color: var(--ink-soft); }
.lobby-side { grid-column: 3; grid-row: 2; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px; min-height: 0; }
.rules-panel { padding: 14px; }
.rules-card { display: flex; flex-direction: column; gap: 10px; }
.rule-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); }
.rule-row.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.rule-row .segmented { align-self: stretch; display: flex; }
.rule-row .seg { flex: 1; padding: 6px 4px; font-size: 15px; }
.rr-text { display: flex; flex-direction: column; min-width: 0; }
.rr-text b { font: 600 17px var(--ui); }
.rr-text small { font: 700 13px/1.3 var(--body); color: var(--ink-soft); }
.rules-note { margin: 0; font: 700 14px var(--body); }
.chat-panel { display: flex; flex-direction: column; padding: 12px 14px; min-height: 0; overflow: hidden; }
.chat-panel .chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.launchbar { grid-column: 1 / -1; grid-row: 3; display: flex; justify-content: center; }
.launch-inner { display: flex; align-items: center; gap: 18px; padding: 8px 8px 8px 20px; border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.launch-note { font: 800 16px var(--body); }
.launch-note.waiting { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px 10px 0; font: 600 18px var(--ui); }
.launch { min-width: 220px; }
.launch:not(:disabled) { animation: pulse 1.4s ease-in-out infinite; }

/* chat */
.chat-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.chat-tabs .tab { padding: 4px 14px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; font: 600 15px var(--ui); cursor: pointer; }
.chat-tabs .tab.on { background: var(--yellow); }
.chat-log, .battle-log { flex: 1; min-height: 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; font: 700 15px var(--body); }
.chat-log b { color: var(--pink-d); margin: 0 3px; }
.battle-log .line { font-size: 14px; padding: 2px 0; border-bottom: 2px dotted rgba(45, 27, 78, 0.15); }
.battle-log .line.k-turn { font-weight: 900; color: var(--grape); }
.emotes { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; flex: none; }
.emote { width: 38px; height: 38px; padding: 0; border: 3px solid var(--ink); border-radius: 12px; background: #fff; font-size: 19px; cursor: pointer; transition: transform 0.12s var(--bounce); }
.emote:hover { transform: scale(1.18) rotate(-8deg); }
.chat-form input { width: 100%; }

/* ---------- the game ---------- */
.topbar { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 10px 14px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { display: grid; place-items: center; width: 44px; height: 44px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 0 3px 0 var(--ink); font-size: 22px; }
.code { padding: 3px 10px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; font: 400 18px var(--display); letter-spacing: 0.08em; }
.top-mid { display: flex; align-items: center; gap: 10px; }
.turn-pill, .deck-pill { display: flex; align-items: center; gap: 8px; padding: 5px 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); white-space: nowrap; }
.turn-pill b { font: 400 21px var(--display); }
.turn-pill .muted, .deck-pill .muted { font: 700 14px var(--body); }
.tp-av { font-size: 22px; }
.turn-pill.mine { background: var(--yellow); animation: wobble 2s ease-in-out infinite; }
.deck-pill b { font: 400 21px var(--display); }
.dp-ico { font-size: 20px; }
.deck-pill.last { background: var(--pink); color: #fff; }
.deck-pill.last .muted { color: #fff; }
.top-right { display: flex; gap: 8px; justify-content: flex-end; }
.strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-width: 0; }
.pchip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); cursor: pointer; font: inherit; color: var(--ink); transition: transform 0.15s var(--bounce); }
.pchip:hover { transform: translateY(2px) rotate(-1deg); }
.pchip.me { background: #e3f6ff; }
.pchip.turn { background: var(--yellow); transform: scale(1.06); }
.pchip.away { opacity: 0.6; }
.pc-av { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; font-size: 22px; }
.pc-who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.pc-who b { font: 600 16px var(--ui); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-fields { display: flex; gap: 5px; margin-top: 3px; }
.pf { position: relative; display: inline-block; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--wood-d); background: #ffe2b8; }
.pf img { width: 100%; height: 100%; }
.pf em { position: absolute; right: -6px; bottom: -6px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 99px; border: 2px solid var(--ink); background: #fff; font: 900 10px/12px var(--body); font-style: normal; text-align: center; }
.pf.empty { border-style: dashed; background: transparent; }
.pc-n { display: inline-flex; align-items: center; gap: 1px; font: 700 15px var(--body); }
.pc-n b { font: 400 22px var(--display); }
.pc-n.cards b { font-size: 18px; color: var(--ink-soft); }

/* the dock: Zorp's bubble, the hand and the patches */
.dock { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.todo { display: flex; align-items: center; gap: 10px; }
.zorp { flex: none; width: 66px; height: 66px; filter: drop-shadow(0 4px 0 rgba(30, 19, 82, 0.6)); animation: bob 2.6s ease-in-out infinite; }
.zorp svg { width: 100%; height: 100%; }
.bubble { position: relative; flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 58px; padding: 6px 16px; border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.bubble::before { content: ''; position: absolute; left: -15px; top: 50%; width: 22px; height: 22px; margin-top: -11px; background: inherit; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg) skew(10deg, 10deg); }
.todo.go .bubble { background: #fff4c2; animation: nudge 2.4s ease-in-out infinite; }
.todo.go.soft .bubble { background: #e3f6ff; animation: none; }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-1deg) scale(1.01); } 90% { transform: rotate(1deg) scale(1.01); } }
.todo-text { flex: 1; min-width: 0; }
.todo-text h3 { margin: 0; font: 400 clamp(21px, 2.1vw, 28px)/1.1 var(--display); }
.todo-text p { margin: 2px 0 0; font: 700 15px/1.35 var(--body); }
.todo-text .quip { font-style: italic; color: var(--grape); }
.todo-actions { display: flex; gap: 8px; flex: none; }
.todo-timer { display: flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); }
.tt-n { font: 400 20px var(--display); min-width: 42px; }
.todo-timer .timer { width: 54px; height: 10px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; }
.timer-fill { display: block; height: 100%; background: var(--mint); transition: width 0.25s linear; }
.todo.hurry .todo-timer { background: var(--pink); color: #fff; animation: wobble 0.6s infinite; }
.todo.hurry .timer-fill { background: var(--yellow); }
.tray-pick { display: flex; gap: 6px; }
.afk-note { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 12px; border: 3px dashed var(--ink); border-radius: 14px; background: #fff; font: 600 15px var(--ui); }
.afk-note small { font: 700 13px var(--body); color: var(--ink-soft); }
.dock-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.hand-wrap { padding: 6px 12px 8px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dock-head { display: flex; align-items: baseline; gap: 10px; }
.dock-head b { font: 400 19px var(--display); }
.dock-head .muted { font-size: 14px; }
.hand { display: flex; gap: 8px; align-items: flex-end; min-height: 136px; padding: 10px 4px 6px; overflow-x: auto; overflow-y: visible; scrollbar-width: thin; }
.hand-empty { align-self: center; font: 800 16px var(--body); color: var(--ink-soft); }

/* star cards: like the bean cards, with their coin table along the bottom */
.scard { --c: #fff; position: relative; display: flex; flex-direction: column; align-items: center; flex: none; width: 100px; padding: 0 0 6px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 4px 0 var(--ink); color: var(--ink); font: inherit; cursor: default; overflow: hidden; transition: transform 0.15s var(--bounce), box-shadow 0.15s; }
.scard .sc-name { align-self: stretch; padding: 3px 4px 2px; background: var(--c); border-bottom: 3px solid var(--ink); font: 400 14px/1.15 var(--display); letter-spacing: 0.02em; color: #fff; text-shadow: var(--o2), 0 3px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.scard img { width: 70px; height: 70px; margin: 2px 0 0; background: radial-gradient(circle, color-mix(in srgb, var(--c) 30%, #fff) 30%, transparent 70%); pointer-events: none; }
.sc-meter { display: flex; gap: 2px; justify-content: center; margin-top: 1px; }
.sc-meter .m { display: flex; flex-direction: column; align-items: center; width: 22px; font: 900 13px/1 var(--body); }
.sc-meter .m .coin { font-size: 15px; margin: 1px 0 0; }
.sc-meter .m.none { color: #c8bfdb; font-size: 16px; justify-content: center; }
.sc-badge { position: absolute; top: 24px; left: -4px; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 8px; background: var(--pink); color: #fff; font: 400 13px var(--display); transform: rotate(-12deg); box-shadow: 0 2px 0 var(--ink); }
button.scard { cursor: pointer; }
button.scard:hover { transform: translateY(-8px) rotate(-2deg); }
.scard.next { box-shadow: 0 4px 0 var(--ink), 0 0 0 4px var(--yellow); }
.scard.sel { transform: translateY(-12px) rotate(2deg); box-shadow: 0 4px 0 var(--ink), 0 0 0 5px var(--mint); }
.scard.sel::after { content: '✓'; position: absolute; top: 26px; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 50%; background: var(--mint); font: 900 14px var(--body); }
.scard.small { width: 74px; padding: 0 0 3px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.scard.small .sc-name { font-size: 11.5px; padding: 2px 3px; border-bottom-width: 2px; }
.scard.small img { width: 58px; height: 58px; }
.scard.small .sc-badge { top: 16px; font-size: 11px; padding: 0 5px; }
.scard.big { width: 84px; }
.scard.big img { width: 66px; height: 66px; }
.hand .scard:hover, .hand .scard.sel { z-index: 2; }
.todo .scard { transform: rotate(-4deg); }

/* cards fly up into the hand when they are dealt; the "Next!" sticker bobs; coin counters bounce when they grow */
.scard.deal { animation: dealIn 0.6s var(--bounce) both; animation-delay: var(--d, 0ms); }
@keyframes dealIn { from { opacity: 0; transform: translateY(150px) rotate(-14deg) scale(0.55); } 60% { opacity: 1; } }
.sc-badge { animation: sticker 1.3s ease-in-out infinite; }
@keyframes sticker { 50% { transform: rotate(-6deg) translateY(-3px) scale(1.06); } }
.pc-n.bump b { display: inline-block; animation: coinBump 0.7s var(--bounce); }
.pc-n.bump .coin { animation: coinSpin 0.7s ease-out; }
@keyframes coinBump { 0% { transform: scale(1); } 30% { transform: scale(1.7) rotate(-8deg); color: #e09a00; } 100% { transform: scale(1); } }
@keyframes coinSpin { from { transform: rotateY(0); } to { transform: rotateY(720deg); } }
.todo.talk .bubble { animation: bubblePop 0.5s var(--bounce); }
.todo.talk .zorp { animation: zorpTalk 0.6s var(--bounce), bob 2.6s 0.6s ease-in-out infinite; }
@keyframes bubblePop { from { transform: scale(0.7) translateX(-20px); opacity: 0; } }
@keyframes zorpTalk { 0% { transform: scale(1); } 25% { transform: scale(1.18, 0.86) rotate(-6deg); } 55% { transform: scale(0.92, 1.12) rotate(5deg); } 100% { transform: scale(1); } }
.bigbtn { animation: idleWiggle 5s ease-in-out infinite; }
.bigbtn:nth-child(2) { animation-delay: -1.2s; } .bigbtn:nth-child(3) { animation-delay: -2.5s; } .bigbtn:nth-child(4) { animation-delay: -3.7s; }
@keyframes idleWiggle { 0%, 88%, 100% { transform: none; } 91% { transform: rotate(-1.6deg) scale(1.02); } 94% { transform: rotate(1.6deg) scale(1.02); } 97% { transform: rotate(-0.8deg); } }
.home.enter .big-menu > * { animation-name: bounceIn, idleWiggle; animation-duration: 0.6s, 5s; animation-iteration-count: 1, infinite; }

/* your patches: wooden planters full of soil */
.nursery-wrap { display: flex; }
.nurseries { display: flex; gap: 10px; align-items: flex-end; }
.nursery { --c: #c98a4b; position: relative; display: flex; flex-direction: column; gap: 4px; width: 190px; padding: 8px 10px 10px; border: 3px solid var(--ink); border-radius: 18px; background: repeating-linear-gradient(0deg, var(--wood) 0 18px, #c4834a 18px 20px); box-shadow: 0 5px 0 var(--ink); color: var(--ink); transition: transform 0.15s var(--bounce); }
.n-key { position: absolute; top: 6px; right: 8px; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 6px; background: #fff; font: 900 12px var(--body); }
.n-soil { position: relative; display: flex; align-items: center; justify-content: center; height: 54px; border: 3px solid var(--ink); border-radius: 50% 50% 14px 14px / 40% 40% 14px 14px; background: radial-gradient(ellipse at 50% 30%, #9a6440, var(--soil) 70%); }
.n-soil img { width: 64px; height: 64px; margin-top: -14px; animation: bob 2.4s ease-in-out infinite; }
.n-sprout { font-size: 32px; }
.n-count { position: absolute; right: 6px; bottom: 4px; padding: 0 8px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; font: 400 20px var(--display); }
.n-info { display: flex; flex-direction: column; padding: 2px 6px; border-radius: 10px; background: rgba(255, 250, 240, 0.92); border: 2px solid var(--ink); line-height: 1.2; }
.n-info b { font: 400 17px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-info small { display: flex; align-items: center; font: 800 13.5px var(--body); }
.n-info .n-next { color: var(--ink-soft); font-size: 12.5px; }
.nursery .btn.small { width: 100%; }
.n-hint { position: absolute; left: 50%; top: -16px; z-index: 1; transform: translateX(-50%) rotate(-3deg); padding: 2px 12px; border: 3px solid var(--ink); border-radius: 999px; background: var(--yellow); font: 400 15px var(--display); white-space: nowrap; box-shadow: 0 3px 0 var(--ink); }
.nursery.fits { cursor: pointer; animation: hop 1s ease-in-out infinite; }
.nursery.fits:hover { transform: translateY(-6px) rotate(-1deg); animation: none; }
@keyframes hop { 50% { transform: translateY(-5px); } }
.nursery.clash { cursor: pointer; }
.nursery.clash .n-hint { background: var(--orange); }
.nursery.empty .n-soil { background: radial-gradient(ellipse at 50% 30%, #8a5a3a, #6a3e22 70%); }
.nursery.ghost { width: 150px; background: rgba(255, 250, 240, 0.7); border-style: dashed; box-shadow: none; }
.nursery.ghost .n-soil { border-style: dashed; background: rgba(122, 74, 44, 0.35); }
.nursery.ghost.can { background: #e9fff5; border-style: solid; box-shadow: 0 5px 0 var(--ink); }

/* ---------- the Trading Post ---------- */
.trade { position: absolute; top: 76px; right: 12px; width: 360px; bottom: calc(var(--dock-h, 260px) + 22px); display: flex; flex-direction: column; overflow: hidden; animation: slideIn 0.45s var(--bounce); }
@keyframes slideIn { from { opacity: 0; transform: translateX(50px) rotate(3deg); } }
.awning { flex: none; height: 30px; position: relative; background: repeating-linear-gradient(90deg, var(--pink) 0 30px, #fff 30px 60px); border-bottom: 3px solid var(--ink); }
.awning::after { content: ''; position: absolute; left: 0; right: 0; bottom: -15px; height: 14px; background: radial-gradient(circle at 15px 0, var(--pink) 12px, transparent 13px) 0 0 / 60px 14px repeat-x, radial-gradient(circle at 45px 0, #fff 12px, transparent 13px) 0 0 / 60px 14px repeat-x; }
.tr-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 16px 6px; }
.tr-head h2 { margin: 0; font: 400 28px var(--display); transform: rotate(-2deg); }
.tr-clock { padding: 2px 10px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; font: 600 15px var(--ui); }
.tr-clock .tt-n { font-size: 18px; min-width: 0; }
.trade-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.tr-sec { display: flex; flex-direction: column; gap: 8px; }
.tr-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.tr-title b { font: 400 20px var(--display); }
.tr-title small { font: 700 13.5px var(--body); color: var(--ink-soft); }
.faceup { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.empty-note { padding: 8px 10px; border: 3px dashed rgba(45, 27, 78, 0.3); border-radius: 14px; font: 700 15px var(--body); color: var(--ink-soft); }
.offers { display: flex; flex-direction: column; gap: 10px; }
.offer { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 10px 12px; border: 3px dashed var(--ink); border-radius: 16px; background: #fff; animation: bounceIn 0.4s var(--bounce); }
.offer.can { border-style: solid; background: #e9fff5; box-shadow: 0 4px 0 var(--ink); }
.offer.mine { background: #e3f6ff; }
.of-head { display: flex; align-items: center; gap: 6px; }
.of-av { font-size: 22px; }
.of-head b { font: 600 17px var(--ui); }
.of-head small { margin-left: auto; font: 700 13px var(--body); color: var(--ink-soft); }
.of-body { display: flex; align-items: center; gap: 8px; }
.of-give, .of-want { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.of-body small { font: 800 12px var(--body); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.of-cards, .of-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.of-arrow { font: 400 26px var(--display); color: var(--pink-d); }
.offer .btn { width: 100%; }
.wchip { --c: #fff; display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px 2px 2px; border: 2px solid var(--ink); border-radius: 999px; background: color-mix(in srgb, var(--c) 30%, #fff); font: 700 13px var(--body); color: var(--ink); }
.wchip img { width: 32px; height: 32px; }
.wchip b { font: 400 17px var(--display); }
.wchip.removable { cursor: pointer; }
.wchip .x { margin-left: 3px; font-weight: 900; color: var(--pink-d); }
.builder { padding: 12px; border: 3px solid var(--ink); border-radius: 18px; background: var(--cream); }
.bd-row { display: flex; flex-direction: column; gap: 5px; }
.bd-row > small { font: 800 13px var(--body); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.bd-chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 36px; align-items: center; }
.bd-chips .muted { font-size: 14px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kind { position: relative; width: 50px; height: 50px; padding: 1px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; cursor: pointer; box-shadow: 0 3px 0 var(--ink); transition: transform 0.12s var(--bounce); }
.kind img { width: 100%; height: 100%; }
.kind:hover { transform: translateY(-3px) rotate(-4deg); }
.kind.on { background: var(--yellow); }
.k-n { position: absolute; top: -9px; right: -9px; display: grid; place-items: center; min-width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 99px; background: var(--pink); color: #fff; font: 400 14px var(--display); }
.bd-row.to select { width: 100%; }
.builder .post { width: 100%; margin-top: 4px; }

/* the star that flies from your hand to the patch */
.ghost-star { position: fixed; z-index: 7; pointer-events: none; filter: drop-shadow(0 6px 0 rgba(30, 19, 82, 0.5)); will-change: transform; }

/* the which-cards dialog */
.pick-group + .pick-group { margin-top: 12px; }
.pg-title { margin-bottom: 4px; font: 400 19px var(--display); }
.pg-cards { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 10px; }

/* the chat drawer and the menu */
.chat-drawer { position: absolute; left: 12px; bottom: calc(var(--dock-h, 260px) + 22px); width: 320px; height: 320px; padding: 12px; display: none; flex-direction: column; z-index: 4; }
.chat-open .chat-drawer { display: flex; }
.chat-drawer .chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pause { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px; background: rgba(30, 19, 82, 0.55); animation: fadeIn 0.2s; }
.pause.closing { opacity: 0; transition: opacity 0.18s; }
.pause-panel { width: min(440px, 100%); padding: 20px 20px 16px; animation: bounceIn 0.4s var(--bounce); }
.pause-panel h2 { margin: 0 0 14px; font: 400 32px var(--display); text-align: center; }
.pause-keys { margin-top: 12px; display: flex; justify-content: center; }
.menu { display: flex; flex-direction: column; gap: 10px; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 16px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink); text-align: left; cursor: pointer; transition: transform 0.12s var(--bounce), background 0.15s; }
.menu-item .mi-label { font: 400 22px var(--display); }
.menu-item .mi-sub { font: 700 14px var(--body); color: var(--ink-soft); }
.menu-item.sel, .menu-item:hover { background: var(--yellow); transform: translateX(4px) rotate(-1deg); }
.menu-item.danger.sel, .menu-item.danger:hover { background: var(--pink); }
.menu-item:focus-visible { outline: none; }

/* ---------- pop-ups and banners ---------- */
.pop { position: absolute; transform: translate(-50%, -100%) rotate(var(--r, 0deg)); padding: 6px 14px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; font: 600 17px var(--ui); color: var(--ink); white-space: nowrap; box-shadow: 0 4px 0 var(--ink); animation: popUp 1.8s var(--bounce) forwards; display: flex; align-items: center; gap: 4px; }
.pop b { font: 400 24px var(--display); }
.pop.comic { padding: 12px 22px; border: none; border-radius: 0; background: var(--yellow); font: 400 26px var(--display); letter-spacing: 0.02em; box-shadow: none; clip-path: polygon(0% 14%, 12% 0%, 22% 12%, 36% 0%, 48% 12%, 62% 0%, 74% 12%, 88% 0%, 100% 14%, 92% 32%, 100% 50%, 92% 68%, 100% 86%, 88% 100%, 74% 88%, 62% 100%, 48% 88%, 36% 100%, 22% 88%, 12% 100%, 0% 86%, 8% 68%, 0% 50%, 8% 32%); filter: drop-shadow(0 0 0 var(--ink)); }
.pop.comic.small { font-size: 20px; padding: 9px 16px; background: #fff; }
.pop.comic.big { font-size: 36px; padding: 16px 30px; }
.pop.comic.pink { background: var(--pink); color: #fff; text-shadow: var(--o2); }
.pop.comic.sad { background: #c9c1e4; font-size: 20px; }
.pop.comic.green { background: #b7e04a; }
.pop.speech { border-radius: 18px; background: #fff; }
.pop.speech::after { content: ''; position: absolute; left: 50%; bottom: -14px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--ink); }
.pop.plain { background: none; border: none; box-shadow: none; }
.pop .emote { font-size: 44px; }
.pop .coin { font-size: 26px; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, -60%) rotate(var(--r, 0deg)) scale(0.3); } 15% { opacity: 1; transform: translate(-50%, -110%) rotate(var(--r, 0deg)) scale(1.15); } 25% { transform: translate(-50%, -110%) rotate(var(--r, 0deg)) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%) rotate(var(--r, 0deg)); } }
.banner { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; animation: banner 2.5s var(--bounce) forwards; }
.banner-title { font: 400 clamp(46px, 8vw, 96px)/1 var(--display); letter-spacing: 0.02em; color: var(--yellow); text-shadow: var(--o3), 0 8px 0 var(--ink), 0 10px 0 var(--ink); transform: rotate(-3deg); }
.banner.pink .banner-title { color: var(--pink); }
.banner.mint .banner-title { color: var(--mint); }
.banner-sub { display: inline-block; margin-top: 12px; padding: 6px 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 800 clamp(15px, 1.8vw, 19px) var(--body); white-space: normal; max-width: 80vw; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(-10deg); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 25% { transform: translate(-50%, -50%) scale(1); } 82% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9); } }

/* toasts and problems */
.toasts { position: fixed; top: 70px; right: 14px; z-index: 35; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { padding: 10px 16px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 0 4px 0 var(--ink); font: 700 15px var(--body); max-width: 320px; animation: bounceIn 0.35s var(--bounce); }
.problem { position: fixed; left: 50%; bottom: 24px; z-index: 36; max-width: min(560px, 92vw); padding: 12px 18px; border: 3px solid var(--ink); border-radius: 18px; background: var(--pink); color: #fff; font: 800 16px/1.35 var(--body); text-shadow: 0 1px 0 var(--ink); box-shadow: 0 5px 0 var(--ink); transform: translate(-50%, 160%); transition: transform 0.35s var(--bounce); pointer-events: none; }
.problem.show { transform: translate(-50%, 0) rotate(-1deg); }

/* ---------- the end ---------- */
.end-wrap { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; padding: 16px; background: rgba(30, 19, 82, 0.5); animation: fadeIn 0.5s; }
.end-wrap.peek { background: none; pointer-events: none; }
.end-wrap.peek .end { opacity: 0.12; }
.end-wrap.peek .end-btns { pointer-events: auto; opacity: 1; }
.end { width: min(660px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px 22px; text-align: center; animation: bounceIn 0.6s var(--bounce); transition: opacity 0.3s; }
.end h1 { margin: 0; font: 400 clamp(40px, 6vw, 60px)/1.1 var(--display); letter-spacing: 0.02em; color: var(--yellow); text-shadow: var(--o3), 0 6px 0 var(--ink), 0 8px 0 var(--ink); }
.end .lead { margin: 8px 0 12px; font: 800 18px var(--body); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 6px 0 14px; }
.step { display: flex; flex-direction: column; align-items: center; width: 150px; animation: bounceIn 0.6s var(--bounce) both; }
.step.p1 { animation-delay: 0.5s; }
.step.p2 { animation-delay: 0.25s; }
.st-av { font-size: 38px; animation: bob 2s ease-in-out infinite; }
.step.p1 .st-av { font-size: 50px; }
.st-name { font: 600 17px var(--ui); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-block { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; width: 100%; padding: 8px 0; border: 3px solid var(--ink); border-radius: 14px 14px 4px 4px; box-shadow: 0 4px 0 var(--ink); }
.step.p1 .st-block { height: 104px; background: var(--yellow); }
.step.p2 .st-block { height: 80px; background: #dfe6f5; }
.step.p3 .st-block { height: 64px; background: #ffc18a; }
.step.me .st-name { color: var(--pink-d); }
.st-place { font-size: 30px; line-height: 1; }
.st-coins { display: flex; align-items: center; font: 400 28px var(--display); }
.end-rest { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.end-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 6px 12px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; font: 700 16px var(--body); text-align: left; }
.end-row.me { background: #e3f6ff; }
.end-row .rank { font: 400 20px var(--display); }
.end-row .lum { display: flex; align-items: center; font: 400 22px var(--display); }
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 10px; text-align: left; }
.award { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); }
.aw-ico { font-size: 30px; }
.aw-ico img { width: 44px; height: 44px; }
.award b { display: block; font: 400 18px var(--display); }
.award small { display: block; font: 700 13.5px/1.3 var(--body); }
.end-stats { margin: 0 0 12px; font: 700 14px var(--body); color: var(--ink-soft); }
.end-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .lobby { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) minmax(290px, 340px); }
  .trade { width: 330px; }
  .nursery { width: 168px; }
  .nursery.ghost { width: 126px; }
  .scard { width: 100px; }
  .pc-who b { max-width: 80px; }
}
@media (max-width: 960px) {
  .dock-row { grid-template-columns: minmax(0, 1fr); }
  .nurseries { width: 100%; }
  .nursery, .nursery.ghost { flex: 1; width: auto; min-width: 0; }
  .lobby { display: flex; flex-direction: column; overflow-y: auto; padding-bottom: 0; }
  .lobby-side { display: flex; flex-direction: column; }
  .crew, .lobby-side { flex: none; max-height: none; overflow: visible; }
  .chat-panel { display: none; }
  .launchbar { position: sticky; bottom: 0; margin: auto -18px 0; padding: 12px; background: linear-gradient(0deg, rgba(30, 19, 82, 0.95) 60%, transparent); }
  .howto { grid-template-columns: 1fr 1fr; }
  .star-table { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  html, body { font-size: 15px; }
  .topbar { grid-template-columns: auto 1fr; grid-template-areas: 'brand right' 'strip strip'; padding: 6px 8px; gap: 6px; }
  .brand { grid-area: brand; }
  .logo { display: none; }
  .strip { grid-area: strip; }
  .top-right { grid-area: right; gap: 5px; justify-content: flex-end; }
  .icon-btn { width: 40px; height: 40px; font-size: 17px; }
  .turn-pill, .deck-pill { padding: 3px 10px; }
  .turn-pill b, .deck-pill b { font-size: 17px; }
  .deck-pill .muted { display: none; }
  .strip { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
  .pchip { flex: none; padding: 3px 9px 3px 3px; gap: 5px; }
  .pc-av { width: 30px; height: 30px; font-size: 17px; }
  .pc-who b { font-size: 13px; max-width: 64px; }
  .pf { width: 20px; height: 20px; }
  .dock { left: 6px; right: 6px; bottom: 6px; gap: 6px; }
  .zorp { width: 46px; height: 46px; }
  .bubble { padding: 6px 10px; gap: 8px; min-height: 0; }
  .bubble::before { left: -11px; width: 16px; height: 16px; margin-top: -8px; }
  .todo-text h3 { font-size: 18px; }
  .todo-text p { font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .todo-text .quip { display: none; }
  .todo-timer { display: none; }
  .todo .scard.big { width: 62px; }
  .todo .scard.big img { width: 46px; height: 46px; }
  .todo-actions .btn.big { min-height: 44px; padding: 6px 12px; font-size: 15px; }
  .todo { flex-wrap: wrap; }
  .todo-actions { margin-left: 56px; }
  .hand-wrap { padding: 4px 8px 6px; }
  .dock-head .muted { display: none; }
  .hand { min-height: 112px; padding-top: 10px; gap: 6px; }
  .scard { width: 78px; }
  .scard img { width: 60px; height: 60px; }
  .scard .sc-name { font-size: 11.5px; }
  .sc-meter .m { width: 17px; font-size: 11px; }
  .sc-meter .m .coin { font-size: 12px; }
  .nursery { padding: 6px; gap: 3px; border-radius: 14px; }
  .n-soil { height: 46px; }
  .n-soil img { width: 52px; height: 52px; margin-top: -10px; }
  .n-count { font-size: 15px; padding: 0 6px; }
  .n-info b { font-size: 13px; }
  .n-info small { font-size: 11.5px; }
  .n-info .n-next, .n-key { display: none; }
  .nursery .btn.small { min-height: 32px; padding: 3px 6px; font-size: 12.5px; }
  .n-hint { font-size: 12px; padding: 1px 8px; top: -13px; }
  .trade { top: auto; left: 6px; right: 6px; width: auto; bottom: calc(var(--dock-h, 280px) + 12px); max-height: calc(100dvh - var(--dock-h, 280px) - 140px); }
  .tr-head { padding-top: 12px; }
  .tr-head h2 { font-size: 22px; }
  .chat-drawer { left: 6px; right: 6px; width: auto; }
  .big-menu { grid-template-columns: 1fr; gap: 10px; }
  .bigbtn { min-height: 64px; }
  .bb-ico { width: 42px; height: 42px; font-size: 22px; }
  .bb-text b { font-size: 19px; }
  .peekers { inset: -10px -20px; }
  .peek { width: 54px; height: 54px; }
  .peek.p1, .peek.p2, .peek.p3, .peek.p4 { width: 46px; height: 46px; }
  .home-tag { font-size: 14px; }
  .farmer-text small, .farmer-edit { display: none; }
  .farmer-text b { max-width: 110px; font-size: 15px; }
  .code-box { width: 58px; height: 70px; font-size: 38px; }
  .lobby-code span { width: 44px; height: 52px; font-size: 30px; }
  .lobby-title { font-size: 20px; }
  .howto { grid-template-columns: 1fr; }
  .star-row { grid-template-columns: 62px 1fr; }
  .star-row img { width: 62px; height: 62px; }
  .sr-pays { grid-column: 1 / -1; justify-content: center; }
  .step { width: 104px; }
  .set-row:has(input[type='range']) { grid-template-columns: 28px 1fr 34px; }
  .set-row:has(input[type='range']) input { grid-column: 1 / -1; }
}
@media (max-height: 700px) and (min-width: 821px) {
  .home-logo .emblem { display: none; }
  .bigbtn { min-height: 64px; }
  .hand { min-height: 136px; }
  .scard img { width: 70px; height: 70px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }

/* the farm behind the menus is scenery: its name tags stay away */
body.on-home #labels, body.on-lobby #labels { opacity: 0; }

/* keyboard hints off: the keys still work, the screen stays clean */
.keyhints, .nm-keyhints, .home-hints { display: none !important; }

/* less to read: house rules are just their names (How to play has the rest) */
.rr-text small, .rules-note, .home-tag { display: none; }
