@font-face { font-family: Fredoka; font-weight: 500; font-display: swap; src: url(fonts/fredoka-500.woff2) format('woff2'); }
@font-face { font-family: Fredoka; font-weight: 600; font-display: swap; src: url(fonts/fredoka-600.woff2) format('woff2'); }
@font-face { font-family: Fredoka; font-weight: 700; font-display: swap; src: url(fonts/fredoka-700.woff2) format('woff2'); }
@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(fonts/nunito-600.woff2) format('woff2'); }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(fonts/nunito-700.woff2) format('woff2'); }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(fonts/nunito-800.woff2) format('woff2'); }

:root {
  --velvet: #15123A; --velvet-2: #0C0A24; --felt: #2B2665; --felt-2: #363079; --felt-hi: #4A43A0;
  --sand: #F2D3A0; --sand-2: #D9A86C; --sand-3: #B9844E; --thread: #FFF4E2; --ink: #1B1830;
  --coral: #FF5A6E; --coral-2: #C9364B; --mint: #43E0A8; --mint-2: #1FA877; --gold: #FFC54A; --gold-2: #D69A1C;
  --muted: #B9B2E8; --muted-2: #8E87C4;
  --crew: #FFC54A;
  --noise-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.6 -.95'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --noise-d: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='4' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.02 .9' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.2 -.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --r-lg: 30px; --r-md: 20px; --r-sm: 14px;
  --shadow: 0 18px 40px rgba(5, 3, 20, .45);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Nunito, system-ui, sans-serif; font-weight: 600; color: var(--thread);
  background: var(--velvet-2); overflow: hidden; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 12px; }

/* ---------- velvet sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 50% at 18% 12%, rgba(123, 63, 168, .55), transparent 70%),
    radial-gradient(50% 45% at 82% 30%, rgba(194, 71, 126, .32), transparent 70%),
    radial-gradient(60% 50% at 60% 110%, rgba(30, 140, 122, .40), transparent 70%),
    radial-gradient(45% 45% at 0% 100%, rgba(59, 60, 176, .45), transparent 70%),
    var(--velvet);
  transition: filter 1.2s;
}
.sky::after { content: ''; position: absolute; inset: 0; background: var(--noise-d); opacity: .5; mix-blend-mode: multiply; }
.sky.alarm { filter: hue-rotate(-40deg) saturate(1.4) brightness(.85); }
.sky.pink { filter: hue-rotate(60deg) saturate(1.6) brightness(1.15); }
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.grain { position: fixed; inset: 0; z-index: 90; pointer-events: none; background: var(--noise-l); opacity: .07; mix-blend-mode: overlay; }
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 95; pointer-events: none; }
#app { position: relative; z-index: 2; height: 100%; }

/* ---------- felt panel with stitched seam ---------- */
.felt {
  position: relative; border-radius: var(--r-lg);
  background: var(--noise-l), var(--noise-d), linear-gradient(180deg, var(--felt-2), var(--felt));
  background-blend-mode: soft-light, multiply, normal;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .09), inset 0 -10px 22px rgba(0, 0, 0, .28), var(--shadow);
}
.felt::before {
  content: ''; position: absolute; inset: 9px; border-radius: calc(var(--r-lg) - 8px); pointer-events: none;
  border: 2px dashed rgba(255, 244, 226, .26);
}
.felt.sand { background: var(--noise-l), var(--noise-d), linear-gradient(180deg, #F7E2BF, var(--sand-2)); color: var(--ink); }
.felt.sand::before { border-color: rgba(120, 72, 30, .4); }
.felt.dark { background: var(--noise-l), var(--noise-d), linear-gradient(180deg, #221E52, #17143D); }

/* quilted wall: padded diamond pattern */
.quilt {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .07), transparent 62%) 0 0 / 54px 54px,
    linear-gradient(45deg, transparent 48.5%, rgba(10, 6, 30, .35) 49.5% 50.5%, transparent 51.5%) 0 0 / 54px 54px,
    linear-gradient(-45deg, transparent 48.5%, rgba(10, 6, 30, .35) 49.5% 50.5%, transparent 51.5%) 0 0 / 54px 54px,
    linear-gradient(45deg, transparent 47%, rgba(255, 244, 226, .10) 48% 48.6%, transparent 49.5%) 0 0 / 54px 54px,
    var(--noise-d), linear-gradient(180deg, #2A2563, #1D1A4A);
}

/* ---------- cushion buttons ---------- */
.btn {
  --b: var(--mint); --b2: var(--mint-2); --fg: #06301F;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 26px; border-radius: 22px;
  font-family: Fredoka; font-weight: 600; font-size: 21px; color: var(--fg); letter-spacing: .01em;
  background: var(--noise-l), radial-gradient(120% 90% at 50% 10%, color-mix(in srgb, var(--b) 70%, white), var(--b) 55%, var(--b2));
  background-blend-mode: soft-light, normal;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), inset 0 -7px 0 rgba(0, 0, 0, .18), 0 10px 24px rgba(0, 0, 0, .3);
  transition: transform .18s var(--ease-pop), filter .2s;
}
.btn::before { content: ''; position: absolute; inset: 6px; border-radius: 16px; border: 2px dashed rgba(0, 0, 0, .18); pointer-events: none; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: scale(.96, .9); }
.btn[disabled] { filter: grayscale(.7) brightness(.7); cursor: not-allowed; transform: none; }
.btn.gold { --b: var(--gold); --b2: var(--gold-2); --fg: #3A2600; }
.btn.coral { --b: var(--coral); --b2: var(--coral-2); --fg: #fff; }
.btn.ghost { --b: #4A43A0; --b2: #2B2665; --fg: var(--thread); }
.btn.sand { --b: #FBE6C2; --b2: var(--sand-2); --fg: var(--ink); }
.btn.big { min-height: 66px; font-size: 25px; padding: 0 34px; border-radius: 26px; }
.btn.small { min-height: 42px; font-size: 16px; padding: 0 16px; border-radius: 16px; }
.btn.small::before { inset: 4px; border-radius: 12px; }

/* choice cards (answers) */
.choice {
  position: relative; text-align: left; width: 100%; padding: 16px 20px 16px 58px; border-radius: 20px;
  font-family: Nunito; font-weight: 800; font-size: 18px; line-height: 1.3; color: var(--ink);
  background: var(--noise-l), linear-gradient(180deg, #FFF8EC, #F1DFC0); background-blend-mode: soft-light, normal;
  box-shadow: inset 0 2px 0 #fff, inset 0 -5px 0 rgba(120, 72, 30, .18), 0 8px 18px rgba(0, 0, 0, .28);
  transition: transform .18s var(--ease-pop);
}
.choice::before { content: ''; position: absolute; inset: 5px; border-radius: 15px; border: 2px dashed rgba(120, 72, 30, .25); pointer-events: none; }
.choice .key { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: Fredoka; font-weight: 700; font-size: 16px; color: #fff; background: var(--felt-hi); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.choice:hover { transform: translateY(-2px) rotate(-.4deg); }
.choice:active { transform: scale(.98); }
.choice.right { background: linear-gradient(180deg, #D8FFEE, #8CEBC5); }
.choice.wrong { background: linear-gradient(180deg, #FFE0E4, #FF9AA8); }
.choice[disabled] { cursor: default; }

/* embroidered patch */
.patch {
  --c: var(--crew);
  position: relative; display: grid; place-items: center; border-radius: 50%;
  background: var(--fibers), radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, white), var(--c) 60%, color-mix(in srgb, var(--c) 70%, black));
  background-blend-mode: soft-light, normal;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 55%, black), 0 0 0 7px rgba(255, 244, 226, .85), 0 8px 18px rgba(0, 0, 0, .35);
  color: var(--ink); font-family: Fredoka; font-weight: 700;
}
.patch::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; border: 2px dashed rgba(27, 24, 48, .35); }

/* sewn fabric label (timer etc.) */
.tag {
  position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 8px 18px 8px 16px; border-radius: 10px;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .035) 0 1px, transparent 1px 3px), repeating-linear-gradient(0deg, rgba(0, 0, 0, .03) 0 1px, transparent 1px 3px), #FBF4E6;
  color: var(--ink); box-shadow: 0 6px 14px rgba(0, 0, 0, .3), inset 0 -3px 0 rgba(0, 0, 0, .08);
}
.tag::before, .tag::after { content: ''; position: absolute; top: 6px; bottom: 6px; width: 0; border-left: 2px dashed rgba(201, 54, 75, .55); }
.tag::before { left: 6px; } .tag::after { right: 6px; }

/* masking tape */
.tape-strip {
  position: absolute; height: 26px; width: 110px; background: var(--noise-l), rgba(244, 233, 204, .86); background-blend-mode: soft-light;
  clip-path: polygon(2% 0, 98% 4%, 100% 30%, 97% 52%, 100% 78%, 98% 100%, 3% 96%, 0 72%, 3% 48%, 0 22%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}

/* ---------- typography ---------- */
.display { font-family: Fredoka; font-weight: 700; letter-spacing: -.01em; line-height: .95; }
h1, h2, h3 { font-family: Fredoka; font-weight: 600; line-height: 1.1; }
.muted { color: var(--muted); }
.logo { font-family: Fredoka; font-weight: 700; font-size: clamp(72px, 9vw, 132px); line-height: .9; display: flex; }
.logo span { display: inline-block; background: linear-gradient(180deg, #FFFDF8 0%, #FFE7C4 55%, #F6C98E 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 0 #B9773A) drop-shadow(0 14px 22px rgba(0, 0, 0, .45)); animation: hop 3.6s var(--ease-pop) infinite; }
.logo span.sus { background: linear-gradient(180deg, #FFC2D6 0%, #FF7FA6 60%, #E9467A 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 6px 0 #9E2550) drop-shadow(0 14px 22px rgba(0, 0, 0, .45)); }
.logo span:nth-child(2) { animation-delay: .25s; }
@keyframes hop { 0%, 80%, 100% { transform: translateY(0) } 86% { transform: translateY(-8px) scale(1.02, .98) } 92% { transform: translateY(0) scale(.98, 1.02) } }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; animation: screenIn .5s ease both; }
@keyframes screenIn { from { opacity: 0; transform: scale(.985) } to { opacity: 1; transform: none } }
.center-col { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; padding: 24px; }

/* join */
.join-wrap { margin: auto; width: min(1180px, 94vw); display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.join-left p.tagline { font-size: 20px; line-height: 1.5; color: #D5CFF7; max-width: 30em; margin-top: 14px; }
.join-left .sub { font-family: Fredoka; font-weight: 600; font-size: 30px; color: #FFE3B8; margin-top: 14px; }
.join-left .sub b { color: var(--gold); }
.alert-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px 8px 14px; border-radius: 999px; background: rgba(255, 90, 110, .16); border: 2px solid rgba(255, 90, 110, .7); color: #FFD0D9; font-family: Fredoka; font-weight: 600; font-size: 16px; box-shadow: 0 0 30px rgba(255, 90, 110, .3); margin-bottom: 18px; }
.alert-pill i { width: 12px; height: 12px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 12px 3px var(--coral); animation: blinkDot 1s steps(2) infinite; }
@keyframes blinkDot { 50% { opacity: .25 } }
.join-card { padding: 34px 34px 30px; }
.join-card h2 { font-size: 26px; margin-bottom: 6px; }
.code-boxes { display: flex; gap: 10px; margin: 16px 0 6px; }
.code-boxes input { width: 64px; height: 76px; border-radius: 20px; text-align: center; font-family: Fredoka; font-weight: 700; font-size: 38px; text-transform: uppercase; color: var(--thread); background: #16133A; border: 2px solid #3B3675; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .35); caret-color: var(--gold); }
.code-boxes input:focus { border-color: var(--gold); outline: none; }
.field-error { color: #FFB0BC; min-height: 24px; font-size: 16px; }
.join-ship { position: relative; display: grid; place-items: center; }
.join-ship .plush-float { position: absolute; }

/* avatar builder */
.builder { margin: auto; width: min(1180px, 95vw); display: grid; grid-template-columns: 420px 1fr; gap: 28px; align-items: stretch; }
.builder .preview { display: grid; place-items: center; padding: 28px; }
.builder .preview .plush { width: 300px; height: 300px; animation: floaty 4s ease-in-out infinite; }
.builder .preview .name-tag { margin-top: -6px; font-family: Fredoka; font-size: 26px; }
.builder .opts { padding: 26px 30px; display: flex; flex-direction: column; gap: 18px; }
.opt-row h3 { font-size: 18px; color: var(--muted); font-family: Nunito; font-weight: 800; margin-bottom: 10px; }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { width: 46px; height: 46px; border-radius: 50%; background: var(--fibers), var(--c); background-blend-mode: soft-light; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), 0 4px 10px rgba(0, 0, 0, .3); transition: transform .2s var(--ease-pop); }
.swatch[aria-pressed="true"] { transform: scale(1.12); box-shadow: 0 0 0 3px var(--velvet), 0 0 0 6px var(--thread); }
.accs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.acc { aspect-ratio: 1; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 2px dashed rgba(255, 244, 226, .2); display: grid; place-items: center; padding: 4px; transition: transform .2s var(--ease-pop); }
.acc .plush { width: 100%; height: 100%; }
.acc[aria-pressed="true"] { background: rgba(255, 197, 74, .18); border: 2px solid var(--gold); transform: translateY(-3px); }
.name-input { width: 100%; height: 58px; border-radius: 18px; padding: 0 20px; font-family: Fredoka; font-size: 24px; color: var(--thread); background: #16133A; border: 2px solid #3B3675; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .3); }
.name-input:focus { outline: none; border-color: var(--gold); }
.crews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.crew-btn { --c: #fff; position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; text-align: left; background: rgba(255, 255, 255, .05); border: 2px solid transparent; transition: transform .2s var(--ease-pop); }
.crew-btn .patch { width: 40px; height: 40px; font-size: 18px; flex: none; }
.crew-btn b { font-family: Fredoka; font-weight: 600; font-size: 19px; display: block; }
.crew-btn small { color: var(--muted); font-size: 13px; }
.crew-btn[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); transform: translateY(-2px); }
.crew-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* lobby */
.lobby { margin: 0 auto; width: min(1400px, 96vw); display: flex; flex-direction: column; padding: 28px 0 24px; gap: 20px; height: 100%; }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.lobby-head h1 { font-size: 40px; }
.lobby-head p { color: var(--muted); font-size: 18px; margin-top: 4px; }
.lobby-grid { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; min-height: 0; }
.crew-col { --c: #fff; display: flex; flex-direction: column; align-items: center; padding: 18px 10px 12px; gap: 6px; min-height: 0; }
.crew-col .patch { width: 64px; height: 64px; font-size: 28px; }
.crew-col h3 { font-size: 22px; margin-top: 10px; }
.crew-col .motto { font-size: 13px; color: var(--muted); text-align: center; min-height: 34px; }
.crew-col .members { flex: 1; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 2px 4px; overflow: hidden; padding-top: 6px; }
.member { display: flex; flex-direction: column; align-items: center; width: 92px; animation: dropIn .6s var(--ease-pop) both; }
.member .plush { width: 84px; height: 84px; }
.member span { font-size: 13px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.me span { color: var(--gold); }
.member.me .plush { cursor: pointer; }
@keyframes dropIn { from { transform: translateY(-40px) scale(.6); opacity: 0 } }
.waiting-line { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--muted); font-size: 18px; }
.dots i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin: 0 3px; animation: dotb 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s } .dots i:nth-child(3) { animation-delay: .3s }
@keyframes dotb { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-7px); opacity: 1 } }

/* ---------- game layout ---------- */
.game { flex-direction: column; }
.hud { display: flex; align-items: center; gap: 18px; padding: 14px 22px; position: relative; z-index: 5; }
.hud .crew-badge { display: flex; align-items: center; gap: 12px; }
.hud .crew-badge .patch { width: 46px; height: 46px; font-size: 20px; }
.hud .crew-badge b { font-family: Fredoka; font-weight: 600; font-size: 20px; display: block; }
.hud .crew-badge small { color: var(--muted); font-size: 14px; }
.hud .spacer { flex: 1; }
.hud .round-name { font-family: Fredoka; font-weight: 600; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.hud .round-name small { font-family: Nunito; font-size: 15px; color: var(--muted); font-weight: 700; }
.timer-tag { font-family: Fredoka; font-weight: 700; font-size: 28px; font-variant-numeric: tabular-nums; }
.timer-tag small { font-family: Nunito; font-size: 13px; font-weight: 800; color: #6E5A44; display: block; line-height: 1; }
.timer-tag.hot { animation: hot 1s infinite; } @keyframes hot { 50% { background-color: #FFD6DC } }
.hud .icon-btn { width: 46px; height: 46px; border-radius: 16px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; font-size: 20px; }
.net-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.net-dot.off { background: var(--coral); box-shadow: 0 0 10px var(--coral); }

.game-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 330px; gap: 18px; padding: 0 22px 20px; }
.stage { position: relative; overflow: hidden; border-radius: var(--r-lg); }
.stage-inner { position: absolute; inset: 0; }
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.side .ship-card { padding: 16px 10px 6px; }
.side .ship-card h3 { font-size: 16px; color: var(--muted); font-family: Nunito; font-weight: 800; text-align: center; }
.side .crew-card { padding: 16px 18px; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.crew-card h3 { font-size: 18px; }
.repair-bar { height: 22px; border-radius: 12px; background: rgba(0, 0, 0, .3); overflow: hidden; position: relative; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4); }
.repair-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 12px; background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .18) 0 8px, transparent 8px 16px), linear-gradient(90deg, var(--mint-2), var(--mint)); transition: width 1s ease; }
.repair-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.mini-board { display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.mini-board .row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; font-size: 15px; }
.mini-board .row .patch { width: 22px; height: 22px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 55%, black); }
.mini-board .row .patch::after { display: none; }
.mini-board .row.me { color: var(--gold); }

/* ---------- ship map ---------- */
.ship { width: 100%; height: auto; display: block; overflow: visible; }
.ship .room-bg { fill: #3A3480; transition: fill .6s; }
.ship .room-glow { fill: none; }
.ship .room-stitch { fill: none; stroke: rgba(255, 244, 226, .35); stroke-width: 1.6; stroke-dasharray: 4 3.5; }
.ship .room-ico { font-size: 22px; }
.ship .room-name { font-family: Fredoka; font-weight: 600; font-size: 11px; fill: var(--thread); }
.ship .tear, .ship .tape, .ship .seam, .ship .seam-thread, .ship .room-pct-g { display: none; }
.ship .tear-hole { fill: #120E2C; stroke: #FF8A99; stroke-width: 1.4; stroke-linejoin: round; }
.ship .stuffing circle { fill: #FFF8EE; opacity: .95; }
.ship .tape rect { fill: rgba(244, 233, 204, .92); }
.ship .seam { fill: none; stroke: var(--gold); stroke-width: 3; stroke-dasharray: 2.5 4; stroke-linecap: round; }
.ship .seam-thread { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; }
.ship .room-pct-g rect { fill: #1B1830; stroke: rgba(255, 244, 226, .4); stroke-dasharray: 2 2; }
.ship .room-pct { font-family: Fredoka; font-weight: 700; font-size: 11px; fill: var(--gold); }
.ship .state-broken .room-bg { fill: #6A2347; }
.ship .state-broken .tear { display: block; }
.ship .state-broken .room-glow { fill: rgba(255, 90, 110, .22); animation: alarmGlow 1.4s infinite; }
.ship .state-broken .room-ico { opacity: .55; }
.ship .state-taped .room-bg { fill: #4A4480; }
.ship .state-taped .tear { display: block; } .ship .state-taped .stuffing { display: none; }
.ship .state-taped .tape, .ship .state-taped .room-pct-g { display: block; }
.ship .state-sewn .room-bg { fill: #2F6E64; }
.ship .state-sewn .room-glow { fill: rgba(67, 224, 168, .18); }
.ship .state-sewn .seam, .ship .state-sewn .room-pct-g { display: block; }
.ship .state-sewn .room-stitch { stroke: rgba(255, 197, 74, .7); }
.ship .sewing .seam { display: none; } .ship .sewing .seam-thread { display: block; }
.ship .sewing .tear { display: block; } .ship .sewing .stuffing { display: none; }
.ship .sewn-now .room-glow { fill: rgba(255, 197, 74, .45); animation: sewnPulse 1.2s ease-out; }
.ship .needle { display: none; } .ship .sewing .needle { display: block; }
@keyframes alarmGlow { 50% { opacity: .2 } }
@keyframes sewnPulse { from { opacity: 1 } to { opacity: .2 } }
.ship .antenna { fill: #8C7A60; transition: fill .6s; }
.ship .antenna-glow { opacity: 0; transition: opacity .6s; }
.ship.done .antenna { fill: var(--gold); } .ship.done .antenna-glow { opacity: 1; animation: alarmGlow 1.8s infinite; }
.ship .ship-label { font-family: Fredoka; font-weight: 700; font-size: 14px; letter-spacing: 3px; fill: var(--sand-3); }
.ship.pink .room-bg { fill: #FF8FCF !important; }
.ship.pink .hull { fill: #FFC2E4; }

/* ---------- plush animations ---------- */
.plush { overflow: visible; }
.floaty, .plush.float { animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-1deg) } 50% { transform: translateY(-10px) rotate(1.5deg) } }
.plush .pl-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1) } 96% { transform: scaleY(.1) } }
.plush.dance { animation: dance .5s ease-in-out infinite alternate; }
@keyframes dance { from { transform: rotate(-8deg) translateY(0) } to { transform: rotate(8deg) translateY(-12px) } }
.plush.wobble { animation: wob .4s ease-in-out 3; }
@keyframes wob { 25% { transform: rotate(-6deg) } 75% { transform: rotate(6deg) } }
.plush .pl-tear { animation: tearDrop 1s ease-in infinite; transform-box: fill-box; }
@keyframes tearDrop { from { transform: translateY(0); opacity: 1 } to { transform: translateY(14px); opacity: 0 } }
.plush.sleep { animation: sleepy 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes sleepy { 50% { transform: rotate(8deg) scale(1.02, .96) } }

/* speech bubble */
.bubble { position: relative; background: #FFF6E9; color: var(--ink); font-family: Fredoka; font-weight: 500; font-size: 19px; line-height: 1.3; padding: 12px 18px; border-radius: 20px; box-shadow: 0 10px 24px rgba(0, 0, 0, .35); }
.bubble::after { content: ''; position: absolute; bottom: -10px; left: 30px; border: 10px solid transparent; border-top-color: #FFF6E9; border-bottom: 0; }
.bubble.left::after { left: auto; bottom: auto; top: 18px; left: -10px; border: 10px solid transparent; border-right-color: #FFF6E9; border-left: 0; }

/* ---------- round frame ---------- */
.round { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 22px 26px; gap: 14px; }
.round-intro { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(12, 10, 36, .78); backdrop-filter: blur(4px); animation: fadeOut .4s ease 3.6s forwards; }
.round-intro .card { padding: 30px 40px; max-width: 760px; text-align: center; animation: popIn .5s var(--ease-pop) both; }
.round-intro .num { font-family: Fredoka; font-weight: 700; color: var(--gold); font-size: 20px; }
.round-intro h2 { font-size: 46px; margin: 6px 0 10px; }
.round-intro p { font-size: 21px; line-height: 1.45; color: #E2DCFF; }
@keyframes fadeOut { to { opacity: 0; visibility: hidden } }
@keyframes popIn { from { transform: scale(.7) rotate(-3deg); opacity: 0 } }
.round-timer { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: rgba(0, 0, 0, .25); z-index: 15; }
.round-timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--gold)); transform-origin: left; }
.round-timer.hot i { background: var(--coral); }
.done-wait { position: absolute; inset: 0; z-index: 18; display: grid; place-items: center; background: rgba(12, 10, 36, .55); animation: screenIn .4s both; }
.done-wait .card { padding: 26px 34px; text-align: center; max-width: 560px; }
.done-wait .score { font-family: Fredoka; font-size: 64px; font-weight: 700; color: var(--gold); }
.done-wait p { color: var(--muted); font-size: 18px; margin-top: 6px; }

/* ---------- listen ---------- */
.listen-wrap { margin: auto; width: min(1280px, 95vw); display: grid; grid-template-columns: 360px 1fr; gap: 34px; align-items: center; }
.porthole { position: relative; width: 340px; height: 340px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #2C2870, #120F33 70%);
  box-shadow: 0 0 0 14px #CDA06A, 0 0 0 18px #8A6A45, 0 0 0 22px #E9C792, inset 0 0 40px rgba(0, 0, 0, .6), 0 30px 60px rgba(0, 0, 0, .5); }
.porthole::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 3px dashed rgba(90, 59, 34, .7); }
.porthole .plush { width: 250px; height: 250px; animation: talk .35s ease-in-out infinite alternate; }
@keyframes talk { to { transform: scale(1.02, .98) translateY(2px) } }
.porthole .glass { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, rgba(255, 255, 255, .18), transparent 40%); pointer-events: none; }
.listen-name { text-align: center; margin-top: 30px; font-family: Fredoka; font-size: 30px; font-weight: 600; }
.listen-name small { display: block; font-family: Nunito; font-size: 17px; color: var(--muted); margin-top: 4px; font-weight: 700; }
.care-label {
  position: relative; color: var(--ink); padding: 34px 44px 30px; border-radius: 6px 6px 18px 18px;
  background: repeating-linear-gradient(90deg, rgba(27, 24, 48, .035) 0 1px, transparent 1px 3px), repeating-linear-gradient(0deg, rgba(27, 24, 48, .03) 0 1px, transparent 1px 3px), linear-gradient(180deg, #FFFBF2, #F3E8D2);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .45), inset 0 -6px 0 rgba(0, 0, 0, .06);
  transform: rotate(-.8deg);
}
.care-label::before { content: ''; position: absolute; left: 14px; right: 14px; top: 12px; border-top: 2px dashed rgba(201, 54, 75, .55); }
.care-label::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 12px; border-top: 2px dashed rgba(201, 54, 75, .55); }
.care-label .fold { position: absolute; top: -18px; left: 50%; translate: -50% 0; width: 120px; height: 26px; border-radius: 6px 6px 0 0; background: #E9DCC2; box-shadow: inset 0 -4px 6px rgba(0, 0, 0, .1); }
.care-label h2 { font-size: 40px; color: var(--ink); }
.care-label .kicker { font-family: Nunito; font-weight: 800; color: var(--coral-2); font-size: 16px; margin-bottom: 6px; }
.care-label ul { list-style: none; margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.care-label li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start; font-size: 21px; line-height: 1.35; opacity: .12; filter: blur(3px); transition: opacity .6s, filter .6s, transform .6s var(--ease-pop); transform: translateX(-10px); }
.care-label li.on { opacity: 1; filter: none; transform: none; }
.care-label li .ico { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-family: Fredoka; font-weight: 700; font-size: 15px; margin-top: 2px; }
.care-label li b { font-family: Fredoka; font-weight: 600; }
.care-label li span { color: #4C4566; }
.listen-foot { margin-top: 22px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 16px; }
.listen-foot .bar { flex: 1; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.listen-foot .bar i { display: block; height: 100%; background: var(--gold); transform-origin: left; }

/* ---------- result ---------- */
.result-wrap { margin: auto; width: min(1100px, 95vw); display: grid; grid-template-columns: 1fr 380px; gap: 30px; align-items: center; }
.result-wrap .ship-big { padding: 22px 18px 6px; }
.result-side { display: flex; flex-direction: column; gap: 16px; }
.result-side h2 { font-size: 34px; }
.score-row { display: flex; gap: 14px; }
.score-box { flex: 1; padding: 18px; text-align: center; }
.score-box b { font-family: Fredoka; font-size: 52px; font-weight: 700; display: block; color: var(--gold); line-height: 1; }
.score-box span { color: var(--muted); font-size: 15px; }

/* ---------- intro / reveal cinematic ---------- */
.cine { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.cine .party { position: absolute; bottom: 8%; left: 0; right: 0; display: flex; justify-content: center; gap: 1.5vw; }
.cine .party .plush { width: 150px; height: 150px; }
.cine .big-count { font-family: Fredoka; font-weight: 700; font-size: 140px; color: var(--thread); text-shadow: 0 10px 0 rgba(0, 0, 0, .25); }
.cine .big-msg { font-family: Fredoka; font-weight: 700; font-size: clamp(48px, 6vw, 96px); text-align: center; line-height: 1; }
.cine .big-msg.red { color: #FFD0D9; text-shadow: 0 0 30px rgba(255, 90, 110, .8), 0 6px 0 #8E1E33; }
.cine .typed { font-size: 26px; line-height: 1.5; max-width: 900px; text-align: center; color: #F2EEFF; min-height: 80px; }
.alarm-overlay { position: fixed; inset: 0; z-index: 80; pointer-events: none; background: radial-gradient(circle, transparent 40%, rgba(255, 40, 70, .45)); animation: alarmPulse 1s infinite; }
@keyframes alarmPulse { 50% { opacity: .3 } }
.ombre { position: absolute; width: 140px; height: 140px; top: 30%; left: -200px; animation: ombreRun 2.4s ease-in-out forwards; }
@keyframes ombreRun { 40% { transform: translateX(60vw) translateY(-20px) } 100% { transform: translateX(120vw) translateY(10px) } }
.glitch { animation: glitch .25s steps(2) 6; }
@keyframes glitch { 0% { transform: translate(0); filter: none } 25% { transform: translate(-6px, 2px); filter: drop-shadow(6px 0 0 #4DE8FF) drop-shadow(-6px 0 0 #FF4D6D) } 50% { transform: translate(5px, -3px) } 75% { transform: translate(-3px, 1px); filter: drop-shadow(-4px 0 0 #4DE8FF) drop-shadow(4px 0 0 #FF4D6D) } }
.mission { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: min(1040px, 92vw); margin-top: 24px; }
.mission .m { padding: 16px 18px; display: flex; align-items: center; gap: 14px; text-align: left; animation: popIn .5s var(--ease-pop) both; }
.mission .m .e { font-size: 28px; }
.mission .m b { font-family: Fredoka; font-weight: 600; font-size: 18px; display: block; }
.mission .m small { color: var(--muted); font-size: 14px; }

/* ---------- end ---------- */
.end-wrap { margin: auto; width: min(1300px, 96vw); display: grid; grid-template-columns: 1.2fr .8fr; gap: 26px; align-items: stretch; padding: 20px 0; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; height: 340px; padding: 0 10px; }
.podium .step { --c: #fff; width: 150px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; animation: rise 1s var(--ease-pop) both; }
.podium .block { width: 100%; border-radius: 18px 18px 6px 6px; display: grid; place-items: center; font-family: Fredoka; font-weight: 700; font-size: 44px; color: var(--ink);
  background: var(--fibers), linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, white), var(--c)); background-blend-mode: soft-light, normal; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .15), 0 10px 24px rgba(0, 0, 0, .35); position: relative; }
.podium .block::before { content: ''; position: absolute; inset: 6px; border-radius: 13px 13px 3px 3px; border: 2px dashed rgba(27, 24, 48, .3); }
.podium .step b { font-family: Fredoka; font-weight: 600; font-size: 20px; }
.podium .step small { color: var(--muted); }
.podium .avatars { display: flex; justify-content: center; flex-wrap: wrap; width: 150px; margin-bottom: -6px; }
.podium .avatars .plush { width: 40px; height: 40px; margin: 0 -5px; animation: hopAv 1s ease-in-out infinite; }
@keyframes hopAv { 50% { transform: translateY(-8px) } }
@keyframes rise { from { transform: translateY(120px); opacity: 0 } }
.badge-big { padding: 26px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.badge-big .patch { width: 150px; height: 150px; font-size: 70px; --c: var(--gold); }
.badge-big h2 { font-size: 30px; margin-top: 12px; }
.carnet-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* emergency meeting */
.meeting { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(circle, rgba(255, 90, 110, .25), transparent 70%); }
.meeting h1 { font-size: 64px; color: #FFE3E7; text-shadow: 0 6px 0 #8E1E33, 0 0 40px rgba(255, 90, 110, .7); }
.vote-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.vote { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; border-radius: 20px; background: rgba(255, 255, 255, .06); border: 2px solid transparent; transition: transform .2s var(--ease-pop); position: relative; }
.vote .plush { width: 110px; height: 110px; }
.vote[aria-pressed="true"] { border-color: var(--coral); background: rgba(255, 90, 110, .18); transform: translateY(-4px); }
.vote .count { position: absolute; top: 6px; right: 8px; min-width: 28px; height: 28px; border-radius: 14px; background: var(--coral); color: #fff; font-family: Fredoka; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.eject { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(5, 3, 18, .92); }
.eject .plush { width: 160px; height: 160px; animation: ejectSpin 4s linear forwards; }
@keyframes ejectSpin { from { transform: translateX(-60vw) rotate(0) } to { transform: translateX(60vw) rotate(720deg) } }
.eject p { position: absolute; bottom: 22%; font-family: Fredoka; font-size: 34px; text-align: center; padding: 0 20px; }

/* misc */
.shake { animation: shk .42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shk { 10%, 90% { transform: translate(-2px, 1px) } 20%, 80% { transform: translate(4px, -2px) } 30%, 50%, 70% { transform: translate(-7px, 3px) } 40%, 60% { transform: translate(7px, -3px) } }
.flash { position: fixed; inset: 0; z-index: 85; pointer-events: none; animation: flashA .5s ease-out forwards; }
.flash.red { background: rgba(255, 60, 90, .35); } .flash.green { background: rgba(67, 224, 168, .25); } .flash.white { background: rgba(255, 255, 255, .6); }
@keyframes flashA { to { opacity: 0 } }
.toast { position: fixed; left: 50%; top: 92px; translate: -50% 0; z-index: 88; padding: 12px 22px; border-radius: 16px; background: #FFF6E9; color: var(--ink); font-family: Fredoka; font-size: 20px; box-shadow: var(--shadow); animation: toastIn .4s var(--ease-pop) both, fadeOut .4s ease 2.4s forwards; }
@keyframes toastIn { from { transform: translateY(-30px); opacity: 0 } }
.offline-banner { position: fixed; bottom: 14px; left: 50%; translate: -50% 0; z-index: 89; padding: 10px 18px; border-radius: 14px; background: rgba(255, 90, 110, .9); color: #fff; font-weight: 800; display: none; }
.offline-banner.on { display: block; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 1180px) {
  .game-body { grid-template-columns: 1fr 270px; }
  .join-wrap, .builder { grid-template-columns: 1fr; }
  .join-ship { display: none; }
  .listen-wrap { grid-template-columns: 1fr; justify-items: center; }
  .porthole { width: 240px; height: 240px; } .porthole .plush { width: 180px; height: 180px; }
  .lobby-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 760px) {
  .hud { padding: 10px 18px; }
  .care-label li { font-size: 18px; gap: 10px; } .care-label h2 { font-size: 32px; }
  .porthole { width: 270px; height: 270px; } .porthole .plush { width: 200px; height: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  body { background: #fff; overflow: visible; color: #000; }
  .sky, #stars, .grain, .fx-canvas, #app, .offline-banner { display: none !important; }
  #print-carnet { display: block !important; }
}
#print-carnet { display: none; color: #1B1830; font-family: Nunito; padding: 10mm; }
#print-carnet h1 { font-family: Fredoka; font-size: 28pt; margin-bottom: 4mm; }
#print-carnet .fiche { border: 1.5pt dashed #C9364B; border-radius: 6mm; padding: 6mm 8mm; margin-bottom: 6mm; page-break-inside: avoid; }
#print-carnet .fiche h2 { font-family: Fredoka; font-size: 16pt; margin-bottom: 3mm; }
#print-carnet .fiche li { margin: 1.5mm 0 1.5mm 5mm; font-size: 11pt; }

/* ---------- host panel ---------- */
.host-wrap { width: min(1500px, 96vw); margin: 0 auto; padding: 20px 0 40px; display: flex; flex-direction: column; gap: 16px; }
.host-head { display: flex; align-items: center; gap: 18px; }
.host-head .logo { margin-right: auto; }
.host-code, .host-now { padding: 14px 26px; text-align: center; min-width: 220px; }
.host-code small, .host-now small { display: block; color: var(--muted); font-size: 14px; }
.host-code b { font-family: Fredoka; font-weight: 700; font-size: 64px; letter-spacing: 8px; color: var(--gold); line-height: 1.05; }
.host-now b { font-family: Fredoka; font-weight: 700; font-size: 48px; font-variant-numeric: tabular-nums; }
.host-controls { padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.host-controls select { height: 56px; border-radius: 18px; padding: 0 14px; background: #16133A; color: var(--thread); border: 2px solid #3B3675; font-weight: 800; }
.host-grid { display: grid; grid-template-columns: 320px 1fr 340px; gap: 16px; align-items: start; }
.host-card { padding: 18px 20px; }
.host-card h3 { font-size: 19px; margin-bottom: 10px; }
.host-tl { list-style: none; max-height: 520px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.host-tl li { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 10px; font-size: 14px; }
.host-tl li.past { opacity: .4; } .host-tl li.cur { background: var(--gold); color: #3A2600; font-weight: 800; }
.host-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.host-table th, .host-table td { padding: 7px 6px; text-align: center; border-bottom: 1px dashed rgba(255, 244, 226, .15); }
.host-table th:first-child, .host-table td:first-child { text-align: left; }
.host-players { display: flex; flex-direction: column; gap: 4px; max-height: 560px; overflow: auto; }
.hp-row { display: grid; grid-template-columns: 34px 1fr auto 28px; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 10px; border-left: 4px solid var(--c); }
.hp-row .kick { width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 90, 110, .2); color: #FFB0BC; }
.hp-row .kick:hover { background: var(--coral); color: #fff; }
