@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("fonts/nunito-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-024F; }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-024F; }

:root {
  --space: #0B0620;
  --nebula: #3A1F7A;
  --violet: #6B3FB0;
  --pink: #F25C9E;
  --gem: #D43F8D;
  --gold: #FFD36B;
  --mist: #F4EEFF;
  --ink: #2A1840;
  --line: rgba(244, 238, 255, 0.18);
  --glass: rgba(255, 255, 255, 0.07);
  --display: "Fredoka", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  --card-w: clamp(46px, 10.5vw, 104px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--body);
  color: var(--mist);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(107, 63, 176, 0.55), transparent 60%),
    radial-gradient(900px 600px at 110% 20%, rgba(242, 92, 158, 0.25), transparent 60%),
    var(--space);
  background-attachment: fixed;
  line-height: 1.45;
}
[hidden] { display: none !important; }
h1, h2, legend, .big, .status { font-family: var(--display); }
h1 { font-size: 1.8rem; margin: 6px 0 0; line-height: 1.1; }
h2 { font-size: 1.15rem; margin: 0; }
a { color: var(--gold); }
button { font: inherit; cursor: pointer; color: inherit; }

.screen { max-width: 600px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 16px; align-content: start; }
.home { text-align: center; justify-items: center; padding-top: 6vh; }
.logo { width: min(320px, 80vw); height: auto; }
.tagline { margin: 0; font-size: 1.1rem; }
.proto { font-size: 0.75rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; opacity: 0.8; }
.langs { display: flex; gap: 6px; justify-content: center; margin: 2px 0 4px; }
.langs button { font: inherit; font-size: 0.85rem; color: inherit; background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; opacity: 0.75; }
.langs button:hover { opacity: 1; }
.langs button.on { opacity: 1; background: var(--gold, #f2c94c); color: #1a1033; border-color: transparent; font-weight: 700; }
.menu { display: grid; gap: 12px; width: 100%; max-width: 420px; margin-top: 8px; }

.big {
  font-weight: 600; font-size: 1.1rem; padding: 15px 18px; border-radius: 16px; border: 0;
  background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; text-align: left;
  box-shadow: 0 6px 20px rgba(242, 92, 158, 0.25);
}
.big.ghost { background: var(--glass); border: 1px solid var(--line); box-shadow: none; }
.big:disabled { opacity: 0.45; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--mist); opacity: 0.8; padding: 6px 0; justify-self: center; }
.panel-card { background: rgba(20, 10, 48, 0.75); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-weight: 700; }
input:not([type=radio]):not([type=checkbox]) {
  font: inherit; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3); color: var(--mist); width: 100%;
}
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { display: flex; gap: 6px; align-items: center; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); cursor: pointer; }
.pills label:has(input:checked) { border-color: var(--pink); background: rgba(242, 92, 158, 0.18); }
.deck-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.deck-pick label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); font-size: 0.9rem; }
.hint { margin: 6px 0 0; font-size: 0.85rem; opacity: 0.8; }
.error { color: #ff9cc2; margin: 0; min-height: 1.2em; }
.share { display: flex; gap: 8px; }
.share button { border: 0; border-radius: 12px; padding: 0 16px; background: var(--pink); color: #fff; font-weight: 700; }
.seats { list-style: none; margin: 0; display: grid; gap: 10px; }
.seats li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seats select, .seats button { font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); color: var(--mist); }
.seats select option { color: #000; }
.rules-text ol, .rules-text ul { padding-left: 1.2em; }
.rules-text p { margin: 0 0 10px; }

.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; display: inline-block; border: 2px solid rgba(255, 255, 255, 0.8); }
.c-yellow { --pc: #F2C94C; } .c-blue { --pc: #7EC8F0; } .c-pink { --pc: #F4A7C0; } .c-green { --pc: #7FD3A0; } .c-purple { --pc: #B79BEB; }
.dot { background: var(--pc); }
.badge { font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }

/* ---------- game ---------- */
.screen.game { max-width: 1200px; gap: 10px; padding: 8px 10px calc(clamp(48px, 7vh, 74px) * 1.34 + 44px); }
.game-top { display: flex; align-items: center; gap: 10px; }
.mini-logo { height: 30px; width: auto; }
.status { flex: 1; font-weight: 600; font-size: 1.05rem; min-width: 0; }
.status small { display: block; font-family: var(--body); font-weight: 400; font-size: 0.8rem; opacity: 0.8; }
.booms { display: flex; gap: 3px; }
.booms img { width: 22px; height: 30px; object-fit: cover; border-radius: 3px; opacity: 0.25; filter: grayscale(1); }
.booms img.on { opacity: 1; filter: none; box-shadow: 0 0 10px #ffb347; }
.icon-btn { background: var(--glass); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; }

.opponents { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.opp { flex: 1 0 auto; min-width: 160px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; background: var(--glass); }
.opp.turn { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 14px color-mix(in srgb, var(--pc) 50%, transparent); }
.opp-head { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.opp-stats { display: flex; gap: 10px; font-size: 0.85rem; margin-top: 4px; flex-wrap: wrap; }
.mini-areas { display: flex; gap: 4px; margin-top: 6px; }
.mini-area { position: relative; width: 34px; height: 46px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); border: 1px dashed var(--line); font-size: 0.7rem; display: grid; place-items: center; overflow: hidden; }
.mini-area img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mini-area b { position: absolute; right: 1px; bottom: 0; background: rgba(0, 0, 0, 0.7); border-radius: 4px; padding: 0 3px; font-size: 0.7rem; }

/* Space board */
.space { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
  background: linear-gradient(160deg, rgba(58, 31, 122, 0.85), rgba(11, 6, 32, 0.9)); border: 1px solid var(--line); border-radius: 18px; padding: 10px; }
.piles { display: grid; gap: 8px; justify-items: center; width: calc(var(--card-w) * 0.9); }
.pile { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; display: grid; place-items: center; text-align: center; font-size: 0.75rem;
  background: radial-gradient(circle at 50% 40%, #6B3FB0, #2a1458 70%); border: 2px solid rgba(255, 255, 255, 0.2); }
.pile .p { font-family: var(--display); font-size: 1.6rem; color: var(--pink); background: #fff; border-radius: 10px; padding: 0 9px; line-height: 1.3; }
.pile .n { position: absolute; bottom: 3px; left: 0; right: 0; }
.pile .boomtag { position: absolute; top: -6px; right: -8px; font-size: 0.9rem; }
.discard { width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; border: 1px dashed var(--line); position: relative; }
.discard img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.discard span { position: absolute; bottom: 2px; left: 2px; right: 2px; font-size: 0.7rem; text-align: center; background: rgba(0, 0, 0, 0.6); border-radius: 4px; }
.board { display: grid; gap: 6px; grid-auto-flow: column; justify-content: start; overflow-x: auto; }
.col { display: grid; gap: 6px; justify-items: center; border-radius: 10px; padding: 3px; }
.col.target { background: rgba(255, 211, 107, 0.15); outline: 2px dashed var(--gold); cursor: pointer; }
.slot { padding: 0; border: 0; color: inherit; width: var(--card-w); aspect-ratio: 3 / 4; border-radius: 7px; overflow: hidden; background: rgba(0, 0, 0, 0.3); position: relative; }
.slot img, .card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.take { outline: 3px solid var(--gold); box-shadow: 0 0 14px var(--gold); }
.dock { min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.dock .free { font-size: 0.7rem; opacity: 0.5; padding-top: 10px; }

/* ships */
.ship { width: 26px; height: 44px; display: block; }
.ship-btn { background: none; border: 2px solid transparent; border-radius: 10px; padding: 2px; }
.ship-btn.sel { border-color: var(--gold); background: rgba(255, 211, 107, 0.15); }
.ship-btn:disabled { opacity: 0.35; cursor: default; }

/* action bar */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.act { border: 1px solid var(--line); background: var(--glass); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.act.primary { background: linear-gradient(135deg, var(--pink), var(--violet)); border: 0; color: #fff; }
.act:disabled { opacity: 0.4; cursor: default; }
.helper { font-size: 0.9rem; opacity: 0.9; flex: 1 1 220px; }

/* my board */
.me { border: 1px solid var(--line); border-radius: 18px; padding: 10px; background: rgba(20, 10, 48, 0.7); }
.me.turn { border-color: var(--pc); }
.me-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.gems { font-family: var(--display); font-size: 1.1rem; }
.home-ships { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.areas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.area { border-radius: 12px; padding: 6px; background: rgba(255, 255, 255, 0.05); min-height: 90px; }
.area h3 { margin: 0 0 4px; font-size: 0.8rem; font-family: var(--display); font-weight: 600; display: flex; justify-content: space-between; }
.stack-cards { display: flex; flex-direction: column; }
.stack-cards .card { width: 100%; max-width: 110px; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; margin-top: -78%; box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.4); }
.stack-cards .card:first-child { margin-top: 0; }
.area.choosable { outline: 2px dashed var(--gold); cursor: pointer; }

/* hand */
.hand-wrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(11, 6, 32, 0.98), rgba(11, 6, 32, 0.85)); border-top: 1px solid var(--line); }
.hand-title { font-size: 0.8rem; opacity: 0.85; margin-bottom: 4px; }
.hand { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.hand .card { flex: none; width: clamp(48px, 7vh, 74px); aspect-ratio: 3 / 4; border-radius: 7px; overflow: hidden; border: 2px solid transparent; position: relative; background: #000; padding: 0; }
.hand .card.sel { border-color: var(--gold); transform: translateY(-4px); }
.hand .card.pay { border-color: var(--pink); }
.hand .card.pay::after { content: "pay"; position: absolute; top: 2px; right: 2px; font-size: 0.65rem; font-weight: 700; background: var(--pink); border-radius: 4px; padding: 0 4px; }
.hand .card.hidden { background: radial-gradient(circle at 50% 40%, #6B3FB0, #2a1458 70%); display: grid; place-items: center; }

/* resource icons */
.res { width: 22px; height: 22px; vertical-align: middle; background: #f6eef3; border-radius: 5px; }
.res.exact { outline: 2px solid #000; }

/* sheet (dialogs) */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(5, 2, 15, 0.7); display: grid; place-items: end center; }
@media (min-width: 700px) { .sheet { place-items: center; } }
.sheet-inner { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: #1c0f42; border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 18px; display: grid; gap: 12px; }
@media (min-width: 700px) { .sheet-inner { border-radius: 22px; } }
.sheet-inner h2 { font-size: 1.3rem; }
.zoom { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 14px; align-items: start; }
.zoom img.big-card { width: 100%; border-radius: 12px; }
@media (max-width: 480px) { .zoom { grid-template-columns: 1fr; } .zoom img.big-card { max-width: 260px; justify-self: center; } }
.info { display: grid; gap: 6px; font-size: 0.95rem; }
.info .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.paybar { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); display: grid; gap: 6px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.pick-grid button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; position: relative; }
.pick-grid button.on { border-color: var(--pink); }
.pick-grid button img { width: 100%; height: 100%; object-fit: cover; }
.pick-grid button .prod { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.65); display: flex; justify-content: center; gap: 2px; padding: 2px; }
.pick-grid button .prod .res { width: 16px; height: 16px; }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.92rem; }
.score table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.score th, .score td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.score td:first-child, .score th:first-child { text-align: left; }
.score tr.total td { font-weight: 700; font-size: 1.05rem; }

.cover { position: fixed; inset: 0; z-index: 30; background: var(--space); display: grid; place-items: center; text-align: center; padding: 24px; }
.cover .box { display: grid; gap: 16px; justify-items: center; }
.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 40; background: #ff6fae; color: #2a0016; font-weight: 700; padding: 10px 16px; border-radius: 12px; max-width: 90vw; }

@media (max-width: 640px) {
  .areas { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .area h3 { font-size: 0.7rem; }
  .opp { min-width: 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ================= printed boards (from the retail PDFs) ================= */
/* Space Board: the real board picture; cards sit exactly in the printed spaces. */
.space { display: grid; grid-template-columns: 1fr; gap: 8px; background: none; border: 0; padding: 0; }
.piles { display: flex; gap: 8px; width: auto; justify-content: center; align-items: center; }
.piles .pile, .piles .discard { width: 54px; }
.sb { width: min(100%, 470px); margin: 0 auto; padding-right: 64px; }
.sb-seg { position: relative; width: 100%; background-size: 100% 100%; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); }
.sb-seg:first-child { border-radius: 10px 10px 0 0; }
.sb-seg:last-child { border-radius: 0 0 10px 10px; }
.sb-seg.ext { margin-top: 2px; }
.sb-line { position: absolute; left: 0; right: 0; }
.sb-line.target { cursor: pointer; }
.sb-line.target::before { content: ""; position: absolute; inset: -4px 0; border-radius: 10px; outline: 2px dashed var(--gold); background: rgba(255, 211, 107, 0.08); }
.sb-slot { position: absolute; top: 0; height: 100%; }
.sb-slot .slot { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 6px; background: transparent; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
.sb-slot .slot:empty { box-shadow: none; }
.sb-dock { position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); width: 58px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.sb-dock .free { font-size: 0.65rem; opacity: 0.55; text-align: center; width: 100%; line-height: 1.2; }
.ship-h { width: 56px; height: 22px; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }

/* Player board */
.pb-wrap { display: flex; gap: 6px; align-items: stretch; margin-top: 8px; }
.pb { position: relative; flex: 1; aspect-ratio: 1000 / 793; background-size: 100% 100%; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); max-width: 520px; }
.pb-slot { position: absolute; }
.pb-card { position: absolute; left: 0; width: 100%; aspect-ratio: 3 / 4; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #000; box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.45); }
.pb-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-count { position: absolute; right: -4px; top: -10px; z-index: 2; min-width: 22px; text-align: center; font-size: 0.8rem; background: var(--pink); color: #fff; border-radius: 999px; padding: 1px 6px; }
.pb-gems { position: absolute; left: 8.55%; top: 66.5%; width: 10.1%; height: 22.7%; display: grid; place-items: center; align-content: center; text-align: center; }
.pb-gems span { font-size: clamp(0.8rem, 2.4vw, 1.4rem); line-height: 1; }
.pb-gems b { font-family: var(--display); font-size: clamp(0.9rem, 2.6vw, 1.6rem); color: #fff; text-shadow: 0 1px 4px #000; }
.me .pb-wrap { margin-top: 6px; }
.me-head { gap: 8px; }
.home-ships { flex-wrap: wrap; }
.ship-btn .ship-h { width: 62px; height: 24px; }

/* Opponents: small player boards showing the top card of each area */
.opp { min-width: 190px; max-width: 250px; flex: 1 1 200px; }
.opp .pb-wrap.mini { margin-top: 6px; gap: 4px; }
.opp .pb-wrap.mini .pb-gems span { font-size: 0.7rem; }
.opp .pb-wrap.mini .pb-gems b { font-size: 0.85rem; }
.opp .pb-wrap.mini .pb-count { font-size: 0.65rem; padding: 0 5px; top: -6px; }
.opp-head .opp-stats { margin: 0 0 0 auto; font-weight: 400; }

/* Final scores: the printed scorepad */
.scorepad { background: url(img/scorepad-paper.webp?v=2) center / cover, #f6d9e8; color: #222; border-radius: 12px; padding: 6px; overflow-x: auto; }
.scorepad table { width: 100%; border-collapse: collapse; }
.scorepad th, .scorepad td { border: 1.5px solid #222; padding: 4px 6px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.scorepad tr > :first-child { width: 64px; }
.scorepad img { height: 34px; width: auto; display: block; margin: 0 auto; mix-blend-mode: multiply; }
.scorepad th { font-family: var(--display); font-size: 0.95rem; }
.scorepad .win { background: rgba(255, 211, 107, 0.6); }
.scorepad tr.total td { font-size: 1.25rem; }

/* Computer screens: Space Board on the left, everything else on the right */
@media (min-width: 980px) {
  .screen.game { grid-template-columns: minmax(360px, 520px) 1fr; grid-template-areas: "top top" "space opp" "space actions" "space me"; align-items: start; }
  .game-top { grid-area: top; }
  .opponents { grid-area: opp; flex-wrap: wrap; }
  .space { grid-area: space; position: sticky; top: 8px; }
  .actions { grid-area: actions; }
  .me { grid-area: me; }
}

/* Home spaceships on the left edge of the player board, the city extension joined on the right (as on the table) */
.pb-wrap { gap: 0; align-items: center; }
.pb-wrap .pb { flex: 1 1 0; max-width: none; border-radius: 10px 0 0 10px; }
.pb-wrap .pb-ext { flex: 0.4365 1 0; aspect-ratio: 437 / 793; border-radius: 0 10px 10px 0; margin-left: -1px; }
.pb-ships { display: flex; flex-direction: column; gap: 4px; justify-content: center; margin-right: -14px; z-index: 2; min-width: 0; }
.pb-ships .ship-h, .pb-ships .home-ship .ship-h { transform: scaleX(-1); }
.pb-ships .ship-btn { padding: 1px; }
.pb-ships .ship-btn .ship-h { width: clamp(44px, 9vw, 70px); height: auto; aspect-ratio: 62 / 24; }
.pb-ships .home-ship .ship-h { width: 30px; height: auto; aspect-ratio: 62 / 24; }
.pb-ships .ship-btn.sel .ship-h { filter: drop-shadow(0 0 6px var(--gold)); }
.supply { position: relative; width: 140px; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.supply img { width: 100%; display: block; }
.supply span { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-weight: 700; font-size: .8rem; background: rgba(0,0,0,.6); }

/* ================= help: rules panel, tips, guided tour ================= */
.big.learn { background: linear-gradient(135deg, #FFD36B, #F25C9E); color: #2a0d2c; }
.big small { font-family: var(--body); font-weight: 400; font-size: 0.85rem; }
.icon-btn.on { background: var(--gold); color: #2a1840; border-color: var(--gold); }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 25; width: min(400px, 100vw); background: #1a0d3d; border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.2rem; }
.drawer-body { overflow-y: auto; padding: 10px 14px 40px; display: grid; gap: 8px; }
.rule { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.rule summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1rem; }
.rule p, .rule ul, .rule ol { margin: 8px 0 0; font-size: 0.92rem; }
.rule ul, .rule ol { padding-left: 1.2em; }
.rule.now { border-color: var(--gold); background: rgba(255, 211, 107, 0.1); }
.res-list { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.res-list span { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.area-rules p { display: flex; gap: 8px; align-items: center; }
.sp-icon { height: 34px; width: auto; border-radius: 6px; flex: none; }

.coach { flex-basis: 100%; background: rgba(255, 211, 107, 0.12); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 12px; font-size: 0.95rem; }
.coach .btn-row { margin-top: 8px; }
p.coach { margin: 4px 0 0; }
.hint-glow { outline: 3px solid var(--gold) !important; box-shadow: 0 0 18px var(--gold) !important; border-radius: 8px; animation: glow 1s ease-in-out infinite; }
.hand .card.pay-glow { outline-color: var(--pink) !important; box-shadow: 0 0 18px var(--pink) !important; }
@keyframes glow { 50% { box-shadow: 0 0 4px var(--gold); } }

.tour { position: fixed; inset: 0; z-index: 35; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(5, 2, 15, 0.72); outline: 3px solid var(--gold); pointer-events: none; transition: all 0.25s ease; }
.tour-tip { position: fixed; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); background: #24124f; border: 1px solid var(--gold);
  border-radius: 16px; padding: 14px 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.tour-tip h3 { margin: 0 0 6px; font-family: var(--display); font-size: 1.15rem; }
.tour-tip p { margin: 0 0 10px; }
.tour-count { font-size: 0.75rem; opacity: 0.7; }

/* ================= deep space background (same as the PuffiNova website's "Meet the residents") ================= */
body {
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(242, 92, 158, 0.25), transparent 70%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(62, 111, 216, 0.25), transparent 70%),
    linear-gradient(180deg, #1A0D40, var(--space) 70%);
  background-attachment: fixed;
}
.deep { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.deep .stars { position: absolute; inset: 0; background-repeat: repeat; }
.deep .stars--1 { background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 120px 80px, #fff, transparent), radial-gradient(1.5px 1.5px at 200px 160px, #ffe9a8, transparent), radial-gradient(1px 1px at 60px 190px, #fff, transparent); background-size: 180px 180px; animation: pn-twinkle 4s ease-in-out infinite alternate; }
.deep .stars--2 { background-image: radial-gradient(2px 2px at 50px 60px, #ffd6ec, transparent), radial-gradient(1px 1px at 300px 200px, #fff, transparent), radial-gradient(2px 2px at 380px 40px, #fff, transparent); background-size: 420px 300px; animation: pn-twinkle 6s ease-in-out infinite alternate-reverse; }
.deep .stars--3 { background-image: radial-gradient(3px 3px at 100px 120px, rgba(255,211,107,.9), transparent), radial-gradient(2.5px 2.5px at 500px 300px, rgba(242,92,158,.9), transparent); background-size: 620px 460px; opacity: .9; animation: pn-drift 60s linear infinite; }
@keyframes pn-twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes pn-drift { to { background-position: 620px 460px; } }
.deep .shoot { position: absolute; width: 160px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(255,255,255,0), #fff); opacity: 0; transform: rotate(-25deg); animation: pn-shoot 9s ease-in infinite; }
.deep .shoot::after { content: ""; position: absolute; right: -2px; top: -2px; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 3px rgba(255, 230, 180, .9); }
.deep .shoot--1 { left: 10%; top: 12%; }
.deep .shoot--2 { left: 45%; top: 30%; animation-delay: 3.5s; animation-duration: 11s; }
.deep .shoot--3 { left: 25%; top: 62%; animation-delay: 6.5s; animation-duration: 13s; }
@keyframes pn-shoot { 0% { opacity: 0; translate: 0 0; } 3% { opacity: 1; } 10% { opacity: 0; translate: 380px 180px; } 100% { opacity: 0; translate: 380px 180px; } }
/* Let the space show through the panels a little more */
.panel-card, .me { background: rgba(20, 10, 48, 0.55); backdrop-filter: blur(2px); }
.opp { background: rgba(255, 255, 255, 0.05); }
.hand-wrap { background: linear-gradient(to top, rgba(11, 6, 32, 0.95), rgba(11, 6, 32, 0.7)); }
.cover { background: rgba(11, 6, 32, 0.92); }
@media (prefers-reduced-motion: reduce) { .deep * { animation: none !important; } }

/* Start page: residents floating at the front; they glow when you hover or tap them.
   They never cover the buttons: beside the menu on wide screens, in rows above and below it on narrow ones. */
.crew { display: flex; justify-content: space-around; align-items: center; gap: 8px; width: 100%; }
.crew-pal { width: min(21vw, 104px); height: auto; cursor: pointer; user-select: none;
  animation: pn-bob 8s ease-in-out infinite; transition: filter 0.3s ease, scale 0.3s ease;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); -webkit-tap-highlight-color: transparent; }
.crew-pal:hover, .crew-pal.glow { scale: 1.12;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 22px var(--gold)) drop-shadow(0 0 44px var(--pink)); }
@keyframes pn-bob { 50% { transform: translateY(-12px) rotate(3deg); } }
@media (min-width: 1000px) {
  /* Wide screens: one column of residents in the free space on each side of the menu (the menu column is 600px). */
  .crew { position: fixed; top: 0; bottom: 0; width: calc((100vw - 640px) / 2); flex-direction: column; justify-content: space-evenly; padding: 12px 0; pointer-events: none; }
  .crew-a { left: 0; }
  .crew-b { right: 0; }
  .crew-pal { pointer-events: auto; width: auto; height: auto; max-width: min(170px, 78%); max-height: 21vh; }
  .crew-pal:nth-child(odd) { margin-right: 22%; }
  .crew-pal:nth-child(even) { margin-left: 22%; }
}
@media (prefers-reduced-motion: reduce) { .crew-pal { animation: none; } }

/* ================= sounds & animations (fx.js) ================= */
#fx { position: fixed; inset: 0; z-index: 18; pointer-events: none; overflow: hidden; }
.fx-ghost { position: fixed; margin: 0; transform-origin: top left; will-change: transform, opacity; }
.fx-card { border-radius: 7px; object-fit: cover; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 211, 107, 0.45); }
.fx-ship svg { width: 100%; height: 100%; display: block; }
.fx-float { position: fixed; font-family: var(--display); font-weight: 700; font-size: 1.5rem; white-space: nowrap; text-shadow: 0 2px 8px #000, 0 0 14px var(--pink); }
.fx-float.gain { color: var(--gold); }
.fx-float.loss { color: #ff9cc2; }
.fx-boom { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(255, 190, 80, 0.55), rgba(242, 92, 158, 0.25) 45%, transparent 70%); }
.fx-boom img { width: min(46vw, 240px); border-radius: 14px; box-shadow: 0 0 60px #ffb347, 0 0 120px var(--pink); }
.fx-boom b { font-family: var(--display); font-size: clamp(1.4rem, 5vw, 2.4rem); color: #fff; text-shadow: 0 3px 14px #000, 0 0 24px #ff7b00; }
.fx-confetti { position: fixed; top: 0; }
body.fx-shake .screen.game { animation: fx-shake 0.6s ease-in-out; }
@keyframes fx-shake { 10%, 50%, 90% { transform: translate(-7px, 3px); } 30%, 70% { transform: translate(7px, -4px); } }
.dock-ship { display: block; }
.discard-top { position: absolute; inset: 0; }
/* small life in the interface */
.players-turn, .opp.turn, .me.turn { transition: border-color 0.3s, box-shadow 0.3s; }
.me.turn { box-shadow: 0 0 0 1px var(--pc), 0 0 22px color-mix(in srgb, var(--pc) 45%, transparent); }
.act, .big, .icon-btn, .hand .card, .ship-btn { transition: transform 0.12s ease, filter 0.2s ease; }
.act:not(:disabled):hover, .big:not(:disabled):hover, .icon-btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.act:not(:disabled):active, .big:not(:disabled):active { transform: translateY(1px) scale(0.98); }
.hand .card:hover { transform: translateY(-8px) scale(1.06); z-index: 2; }
.sb-slot .slot { transition: transform 0.15s ease, box-shadow 0.2s ease; }
.sb-slot .slot:not(:empty):hover { transform: scale(1.05); z-index: 2; }
.pb-gems.pop { animation: fx-pop 0.5s ease-out; }
@keyframes fx-pop { 40% { transform: scale(1.5); } }
.sheet-inner { animation: fx-sheet 0.22s ease-out; }
@keyframes fx-sheet { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet-inner, body.fx-shake .screen.game { animation: none; } }

/* Top bar: wrap instead of pushing the page wider on narrow screens */
.screen.game > * { min-width: 0; }
.game-top { flex-wrap: wrap; row-gap: 6px; }
.game-top .status { flex: 1 1 150px; }
@media (max-width: 640px) {
  .game-top { gap: 6px; }
  .mini-logo { height: 24px; }
  .icon-btn { width: 34px; height: 34px; }
  .booms img { width: 18px; height: 25px; }
}

/* 🎵 background sound switch */
[data-music].off { opacity: 0.45; text-decoration: line-through; }

/* ---------- Artwork protection: no saving, dragging, long-press menu, selecting or printing of the pictures ---------- */
img, svg, .pb, .sb-seg { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* Pictures don't receive taps themselves (the button around them does), so phones never offer "Save image". */
img:not(.crew-pal) { pointer-events: none; }
body { -webkit-touch-callout: none; }
.screen, .sheet, .drawer, .cover { transition: filter 0.15s; }
/* The artwork is fogged for a moment when Print Screen is pressed. */
body.away .screen, body.away .sheet, body.away .drawer, body.away .cover { filter: blur(22px) saturate(0.6); }
@media print {
  body > * { display: none !important; }
  body::after { content: "PuffiNova © – this page cannot be printed."; display: block; padding: 40px; color: #000; font-size: 18px; }
}
