:root {
  color-scheme: dark;
  --ocean: #071226;
  --paper: #f4f3ee;
  --mint: #8fe0a6;
  --gold: #ffd36a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: Outfit, system-ui, sans-serif;
  background: radial-gradient(ellipse at 50% -18%, #18446e 0, var(--ocean) 62%);
}
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.coop-shell { width: min(1220px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.coop-head { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:20px; }
.coop-head a { color:#c9e6ef; }
.coop-head h1 { margin:0; font:700 clamp(20px,3.5vw,34px) Fredoka,sans-serif; letter-spacing:.04em; }
.coop-head h1 span { color:var(--mint); }
.coop-panel {
  border:1px solid #ffffff25;
  border-radius:22px;
  padding:clamp(18px,4vw,36px);
  background:linear-gradient(145deg,#102641ef,#0a1729f5);
  box-shadow:0 22px 70px #0005;
}
.coop-panel h2 { margin:0 0 8px; font:700 clamp(24px,3.5vw,36px) Fredoka,sans-serif; }
.coop-panel h3 { margin:0 0 10px; color:#fff; font:600 21px Fredoka,sans-serif; }
.coop-panel p { color:#bfd0dc; line-height:1.55; }
.eyebrow,.sub-label { margin:0 0 8px!important; color:#a6e7bb!important; font-size:11px; font-weight:800; letter-spacing:.15em; }
.entry-panel { overflow:hidden; position:relative; }
.entry-panel::after { position:absolute; z-index:0; right:-80px; top:-110px; width:330px; height:330px; content:""; border:1px solid #9fe9ca30; border-radius:50%; box-shadow:0 0 0 26px #9fe9ca10,0 0 0 56px #9fe9ca08; pointer-events:none; }
.entry-panel > * { position:relative; z-index:1; }
.entry-panel > p:not(.eyebrow) { max-width:780px; }
.campaign-teaser { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:22px 0; color:#e4efe9; font-weight:700; }
.campaign-teaser span,.campaign-teaser strong { padding:8px 12px; border:1px solid #ffffff24; border-radius:999px; background:#ffffff08; }
.campaign-teaser i { color:var(--gold); font-style:normal; }
.coop-actions { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:24px; }
.coop-card { padding:20px; border-radius:16px; background:#ffffff08; border:1px solid #ffffff1a; }
.coop-card p { min-height:48px; }
.coop-button { border:0; border-radius:999px; padding:12px 20px; min-height:46px; cursor:pointer; color:#132238; background:linear-gradient(135deg,#aaf0bd,#7dd9a2); font-weight:800; transition:transform .16s ease,filter .16s ease; }
.coop-button:hover:not(:disabled) { transform:translateY(-2px); filter:brightness(1.08); }
.coop-button.secondary { color:#fff; background:#ffffff12; border:1px solid #ffffff2b; }
.coop-button:disabled { opacity:.45; cursor:not-allowed; }
.join-row { display:flex; gap:8px; margin:14px 0; }
.join-row input { width:100%; min-width:0; text-transform:uppercase; letter-spacing:.16em; border-radius:10px; border:1px solid #ffffff35; background:#071426; padding:12px; color:white; }
.coop-error { min-height:24px; color:#ffaaa7!important; }
.room-row { display:grid; grid-template-columns:minmax(220px, .8fr) minmax(350px,1.2fr); gap:20px; align-items:center; margin:22px 0 30px; }
.room-code { display:inline-flex; gap:12px; align-items:center; border:1px dashed #8fe0a6a6; border-radius:12px; padding:8px 14px; color:#d8ffe1; font:700 23px ui-monospace,monospace; letter-spacing:.16em; }
.player-slots { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.player-slot { min-height:72px; padding:14px 16px; border-radius:14px; border:1px solid #ffffff20; background:#ffffff08; }
.player-slot.ready { border-color:#8fe0a680; background:#8fe0a612; }
.player-slot b { display:block; margin-bottom:5px; }
.player-slot small { color:#b2c9d2; }
.roster-layout { display:grid; grid-template-columns:minmax(0,1fr) 250px; gap:22px; align-items:start; }
.character-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin:16px 0; }
.character-card { min-width:0; padding:10px 8px; color:white; background:#ffffff0b; border:1px solid #ffffff22; border-radius:14px; cursor:pointer; text-align:center; transition:transform .15s ease,border-color .15s ease,background .15s ease; }
.character-card:hover:not(:disabled) { transform:translateY(-3px); border-color:#ffffff66; }
.character-card canvas { display:block; width:min(100%,100px); height:auto; aspect-ratio:1; margin:0 auto 7px; border-radius:14px; background:radial-gradient(ellipse at 50% 70%,#294d60,#10263c 72%); }
.character-card span,.character-card small { display:block; }
.character-card span { font-weight:800; }
.character-card small { margin-top:3px; color:#a9c3d2; font-size:11px; }
.character-card.selected { border-color:var(--mint); box-shadow:0 0 0 2px #8fe0a644; background:#8fe0a61b; }
.selection-preview { position:sticky; top:16px; padding:18px; border:1px solid #ffffff26; border-radius:18px; background:linear-gradient(160deg,#1c3850,#0a192a); text-align:center; }
.selection-preview canvas { display:block; width:160px; max-width:100%; height:auto; margin:0 auto 12px; border-radius:18px; background:radial-gradient(ellipse at 50% 70%,#416276,#10263c 72%); }
.selection-preview h3 { margin:0 0 6px; }
.selection-preview p { min-height:48px; margin:0 0 14px; font-size:13px; }
.selection-preview .coop-button { width:100%; }
#lobby-status { text-align:center; font-weight:700; }
.mission-title-row { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.campaign-counter { padding:8px 12px; border:1px solid #ffffff25; border-radius:999px; color:#e0eee7; white-space:nowrap; font-size:13px; font-weight:800; }
.combat-hud { display:grid; grid-template-columns:minmax(150px,.7fr) minmax(260px,1.3fr); gap:14px; align-items:stretch; margin:18px 0 10px; }
.objective-panel,.boss-panel { min-height:86px; padding:12px 14px; border:1px solid #ffffff24; background:#ffffff09; border-radius:14px; }
.combat-hud strong { color:#ffd5d2; font:700 13px Fredoka,sans-serif; letter-spacing:.1em; }
.objective-mark { display:flex; gap:8px; margin:6px 0 2px; color:#ffcb67; font-size:15px; }
.objective-panel small,.combat-hud small { color:#d7e3de; }
.boss-health { height:14px; margin:7px 0 3px; border-radius:99px; overflow:hidden; background:#381623; border:1px solid #ffd5d244; }
.boss-health span { display:block; width:100%; height:100%; background:linear-gradient(90deg,#a3133b,#ff5472); transition:width .18s ease; }
.team-health { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.team-life { min-width:0; border:1px solid #ffffff24; background:#ffffff09; border-radius:11px; padding:9px 11px; font-size:12px; }
.team-life span { display:block; overflow:hidden; color:#bfe7d1; text-overflow:ellipsis; white-space:nowrap; }
.team-life b { display:block; margin:4px 0 5px; }
.xp-track { display:block; height:4px; overflow:hidden; border-radius:4px; background:#ffffff1a; }
.xp-track i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#7ccff3,#ffe28a); }
.combat-status { min-height:26px; margin:10px 0; text-align:center; color:#ffe6a6!important; font-weight:700; }
#arena-wrap { overflow:hidden; position:relative; margin-top:12px; border-radius:20px; border:1px solid #ffffff30; background:#071226; box-shadow:0 14px 48px #0005; }
#arena { display:block; width:100%; aspect-ratio:16/9; }
.arena-hud { position:absolute; z-index:1; inset:12px 14px auto; display:flex; justify-content:space-between; pointer-events:none; color:#fff; font-weight:700; text-shadow:0 2px 7px #000b; }
.arena-controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:8px; padding:12px 0 4px; }
.arena-controls button { min-width:58px; min-height:48px; touch-action:none; }
.arena-controls [data-ability] { min-width:96px; font-size:12px; }
.dpad { display:grid; grid-template-columns:repeat(4,54px); gap:5px; }
.dpad button { min-width:0; min-height:46px; padding:4px; font-size:21px; }
.control-hint { margin:5px 0 0!important; text-align:center; font-size:12px; }
.ending-actions { padding-top:16px; text-align:center; }
[hidden] { display:none!important; }
@media (max-width:900px) {
  .roster-layout { grid-template-columns:minmax(0,1fr) 210px; gap:14px; }
  .character-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .selection-preview canvas { width:130px; }
}
@media (max-width:650px) {
  .coop-shell { width:min(100% - 20px,1220px); padding:16px 0 28px; }
  .coop-head { align-items:flex-start; flex-direction:column; gap:8px; }
  .coop-panel { padding:18px 14px; border-radius:17px; }
  .coop-actions,.room-row,.roster-layout { grid-template-columns:1fr; }
  .room-row { gap:16px; }
  .player-slots { gap:8px; }
  .player-slot { padding:11px; }
  .character-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .character-card canvas { width:90px; }
  .selection-preview { position:static; }
  .selection-preview canvas { width:140px; }
  .mission-title-row { align-items:flex-start; flex-direction:column; gap:5px; }
  .combat-hud { grid-template-columns:1fr; gap:8px; }
  .team-health { grid-template-columns:1fr 1fr; }
  .arena-hud { inset:8px 9px auto; font-size:11px; }
  .arena-controls { position:sticky; bottom:env(safe-area-inset-bottom,0px); z-index:3; margin:0 -4px; padding:8px 4px calc(8px + env(safe-area-inset-bottom,0px)); border:1px solid #ffffff20; border-radius:14px; background:linear-gradient(180deg,rgba(13,29,51,.88),rgba(7,18,38,.97)); box-shadow:0 -8px 22px #0004; backdrop-filter:blur(12px); }
  .dpad { grid-template-columns:repeat(4,44px); gap:4px; }
  .dpad button { min-height:42px; }
  .arena-controls button { min-width:49px; min-height:44px; }
  .arena-controls [data-ability] { min-width:76px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; transition-duration:.01ms!important; animation-duration:.01ms!important; }
}

/* -------------------------------------------------------------------------
   OHANA CO-OP polish: selection, combat readability and room identity.
   ------------------------------------------------------------------------- */
.entry-panel {
  background:
    radial-gradient(circle at 84% 18%, rgba(255,211,106,.12), transparent 22%),
    radial-gradient(circle at 12% 80%, rgba(143,224,166,.11), transparent 28%),
    linear-gradient(145deg,#102b42f2,#081424f8);
}
.character-card {
  position: relative;
  overflow: hidden;
  min-height: 164px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255,255,255,.08), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.025));
}
.character-card::after {
  content:"";
  position:absolute;
  left:14%; right:14%; bottom:-28px;
  height:54px;
  border-radius:50%;
  background:rgba(143,224,166,.12);
  filter:blur(10px);
  pointer-events:none;
}
.character-card.selected {
  transform:translateY(-2px);
  background:
    radial-gradient(circle at 50% 20%, rgba(255,211,106,.18), transparent 42%),
    linear-gradient(180deg, rgba(143,224,166,.18), rgba(143,224,166,.04));
}
.selection-preview {
  box-shadow:0 18px 45px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.06);
}
#touch-attack {
  min-width:112px;
  box-shadow:0 6px 20px rgba(255,211,106,.16);
}
#touch-dodge {
  min-width:118px;
  border-color:rgba(155,231,255,.38);
  color:#c9f4ff;
}
.arena-controls .coop-button.secondary[data-ability] {
  background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.05));
}
@media (max-width:650px) {
  #touch-attack,#touch-dodge { flex:1 1 130px; }
}

/* Lobby UX: invite link, share, connection pill, language toggle */
.coop-head-actions { display:flex; align-items:center; gap:14px; }
.lang-toggle { border:1px solid #ffffff40; background:#0c1d36; color:#e9f6ff; border-radius:999px; padding:7px 14px; font:700 13px Outfit,sans-serif; letter-spacing:.04em; cursor:pointer; }
.lang-toggle:hover,.lang-toggle:focus-visible { border-color:var(--mint); outline:none; }
.invite-banner { margin:0 0 16px; padding:12px 16px; border-radius:12px; border:1px solid #8fe0a6; background:linear-gradient(90deg,#123b37,#0d2540); color:#eafff1; font-size:15px; }
.invite-banner b { color:var(--mint); letter-spacing:.08em; }
.coop-card.invited { border-color:var(--mint); box-shadow:0 0 0 2px #8fe0a655, 0 12px 34px #0006; }
.room-code #room-code { font-size:clamp(26px,4vw,38px); letter-spacing:.22em; }
.share-row { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:12px; }
.share-url { display:block; width:100%; margin-top:10px; padding:8px 10px; border-radius:9px; border:1px solid #ffffff26; background:#071426; color:#bfe3d0; font:12px ui-monospace,monospace; }
.net-pill { display:inline-flex; align-items:center; gap:7px; padding:6px 12px; border-radius:999px; font:700 13px Outfit,sans-serif; background:#103a2c; color:#bff5d4; border:1px solid #3ccf8e66; }
.net-pill i { width:9px; height:9px; border-radius:50%; background:#3ccf8e; box-shadow:0 0 0 3px #3ccf8e33; }
.net-pill[data-state="reconnecting"] { background:#3a300f; color:#ffe9a8; border-color:#f2c14e88; }
.net-pill[data-state="reconnecting"] i { background:#f2c14e; animation:net-blink 1s infinite; }
.net-pill[data-state="offline"],.net-pill[data-state="session-conflict"] { background:#3a1616; color:#ffd0d0; border-color:#ff6b6b88; }
.net-pill[data-state="offline"] i,.net-pill[data-state="session-conflict"] i { background:#ff6b6b; }
@keyframes net-blink { 50% { opacity:.25; } }
@media (max-width:650px) {
  .coop-head-actions { width:100%; justify-content:space-between; }
  .room-code { display:flex; justify-content:space-between; width:100%; }
  .share-row .coop-button { flex:1 1 auto; }
}

/* V631 lobby refresh · same OHANA palette, clearer room flow, mobile-first. */
:root {
  --lobby-ink: #06131f;
  --lobby-sea: #10283d;
  --lobby-card: rgba(13, 34, 51, .9);
  --lobby-line: rgba(191, 234, 223, .2);
  --lobby-copy: #d6e7e6;
  --lobby-soft: #a9c7cb;
  --lobby-pink: #ff9cba;
  --lobby-sky: #85ddf0;
  --lobby-display: "Fredoka", system-ui, sans-serif;
  --lobby-body: "Outfit", system-ui, sans-serif;
}
html { min-height:100%; scroll-behavior:smooth; }
body {
  min-height:100vh;
  min-height:100svh;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  touch-action:pan-y;
  user-select:text;
  font-family:var(--lobby-body);
  color:#f7f4e9;
  background:
    radial-gradient(ellipse at 50% -17%, rgba(255,222,153,.27), transparent 31rem),
    radial-gradient(ellipse at 8% 35%, rgba(48,145,157,.22), transparent 30rem),
    radial-gradient(ellipse at 100% 78%, rgba(82,85,153,.25), transparent 32rem),
    linear-gradient(165deg,#163955 0%,#0b2438 39%,#071521 100%);
}
body::before,body::after { content:"";position:fixed;z-index:-1;pointer-events:none; }
body::before { width:48rem;height:22rem;left:50%;top:19rem;transform:translateX(-50%);border-radius:50%;background:radial-gradient(ellipse,rgba(77,181,179,.12),transparent 68%);filter:blur(8px); }
body::after { width:22rem;height:7rem;left:50%;top:24rem;transform:translateX(-50%);border-radius:50%;border:1px solid rgba(255,234,185,.08);box-shadow:0 0 0 24px rgba(255,234,185,.025),0 0 0 48px rgba(255,234,185,.018); }
button,input,select { font-family:var(--lobby-body); }
button,a,input,select { -webkit-tap-highlight-color:transparent; }
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible { outline:3px solid #ffe28a!important;outline-offset:3px!important;box-shadow:0 0 0 6px rgba(255,226,138,.18)!important; }
.coop-shell { width:min(1160px,calc(100% - 40px));padding:26px 0 54px; }
.coop-head { min-height:54px;margin-bottom:22px;padding:0 2px; }
.coop-head h1 { display:flex;align-items:center;gap:.45em;font:700 clamp(19px,2.3vw,27px)/1 var(--lobby-display);letter-spacing:.045em;color:#fff7dd; }
.coop-head h1::before { content:"✦";display:grid;place-items:center;width:35px;height:35px;border:1px solid rgba(255,226,138,.42);border-radius:12px;background:linear-gradient(145deg,#ffdf9a,#f4ad69);color:#3a3440;font-size:18px;box-shadow:0 5px 20px rgba(255,195,122,.24); }
.coop-head h1 span { color:#9be6c1; }
.header-tagline { color:#c8d8d6;font:600 .58em var(--lobby-body);letter-spacing:.06em; }
.coop-head-actions { gap:16px; }
.coop-head-actions>a { color:#d1eaeb;font-size:14px;font-weight:700;text-decoration:none; }
.coop-head-actions>a:hover { color:#fff0bf; }
.language-switch { display:inline-flex;align-items:center;gap:3px;padding:4px;border:1px solid rgba(222,243,237,.23);border-radius:999px;background:rgba(4,17,29,.62);box-shadow:inset 0 1px 0 rgba(255,255,255,.06); }
.language-switch button { min-width:42px;min-height:34px;padding:5px 10px;border:0;border-radius:999px;background:transparent;color:#a8c3ca;font-size:12px;font-weight:900;letter-spacing:.08em;cursor:pointer; }
.language-switch button.is-active { color:#102736;background:#b9f0d1;box-shadow:0 2px 9px rgba(4,10,18,.28); }
.coop-panel { position:relative;overflow:hidden;padding:clamp(22px,4vw,46px);border:1px solid rgba(218,245,230,.22);border-radius:28px;background:linear-gradient(145deg,rgba(16,43,62,.95),rgba(7,23,36,.97));box-shadow:0 28px 90px rgba(0,0,0,.38),inset 0 1px 0 rgba(255,255,255,.07); }
.coop-panel::before { content:"";position:absolute;inset:0 0 auto;height:3px;background:linear-gradient(90deg,transparent,#8fe0a6 22%,#ffe08b 53%,#9addf2 79%,transparent);opacity:.9; }
.coop-panel>* { position:relative;z-index:1; }
.coop-panel h2 { max-width:820px;margin:0 0 10px;color:#fff4d7;font:700 clamp(31px,5vw,54px)/1.05 var(--lobby-display);letter-spacing:-.025em;text-wrap:balance; }
.coop-panel h3 { color:#fff1d0;font:600 23px/1.15 var(--lobby-display); }
.coop-panel p { color:var(--lobby-copy); }
.eyebrow,.sub-label { color:#a9edc6!important;font-size:11px;font-weight:900;letter-spacing:.16em; }
.entry-intro { max-width:660px;margin:0 0 26px;font-size:16px;line-height:1.65; }
.entry-panel::after { z-index:0;right:-90px;top:-140px;width:410px;height:410px;border:1px solid rgba(255,233,185,.15);box-shadow:0 0 0 24px rgba(255,233,185,.035),0 0 0 50px rgba(255,233,185,.025),0 0 0 82px rgba(255,233,185,.018); }
.campaign-teaser { display:none; }
.mode-picker { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:25px 0 20px; }
.mode-card { position:relative;display:flex;align-items:center;gap:14px;min-width:0;min-height:104px;padding:17px 18px;border:1px solid rgba(208,237,229,.22);border-radius:18px;text-align:left;color:#f7f5ed;background:linear-gradient(135deg,rgba(255,255,255,.085),rgba(255,255,255,.025));cursor:pointer;transition:transform .18s ease,border-color .18s ease,background .18s ease,box-shadow .18s ease; }
.mode-card:hover { transform:translateY(-2px);border-color:rgba(180,239,210,.58); }
.mode-card.is-selected { border-color:#a9efc7;background:linear-gradient(135deg,rgba(96,186,145,.23),rgba(87,185,205,.1));box-shadow:0 0 0 1px rgba(169,239,199,.2),0 12px 28px rgba(0,0,0,.18); }
.mode-icon { flex:0 0 48px;display:grid;place-items:center;width:48px;height:48px;border:1px solid rgba(255,228,161,.5);border-radius:15px;background:linear-gradient(145deg,#ffe8ad,#e6a36a);color:#3d3841;font-size:24px;box-shadow:0 7px 20px rgba(227,173,117,.18); }
.versus-icon { border-color:rgba(255,153,173,.46);background:linear-gradient(145deg,#ffb4c7,#e68caa); }
.mode-copy { display:grid;gap:5px;min-width:0; }
.mode-copy strong { color:#fff1cf;font:600 18px/1.1 var(--lobby-display); }
.mode-copy small { max-width:29rem;color:#c4d9da;font-size:13px;line-height:1.4; }
.mode-check { flex:0 0 auto;display:grid;place-items:center;width:24px;height:24px;margin-left:auto;border:1px solid rgba(224,242,235,.24);border-radius:50%;color:transparent;font-size:13px; }
.mode-card.is-selected .mode-check { border-color:#a9efc7;background:#a9efc7;color:#173b39; }
.arena-choice { display:inline-flex;align-items:center;gap:10px;margin:-4px 0 18px;padding:9px 13px;border:1px solid rgba(255,207,142,.36);border-radius:12px;background:rgba(255,203,128,.08);color:#ffe8be;font-size:13px;font-weight:700; }
.arena-choice select { min-height:35px;padding:5px 28px 5px 9px;border:1px solid rgba(255,255,255,.2);border-radius:8px;background:#0d2434;color:#fff; }
.coop-actions { grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:0; }
.coop-card { position:relative;min-width:0;padding:20px 22px 22px;border:1px solid rgba(196,231,224,.19);border-radius:20px;background:linear-gradient(145deg,rgba(17,45,64,.88),rgba(8,28,43,.9));box-shadow:0 12px 35px rgba(0,0,0,.16); }
.create-card { border-color:rgba(143,224,166,.38);background:radial-gradient(ellipse at 100% 0%,rgba(143,224,166,.11),transparent 45%),linear-gradient(145deg,rgba(18,55,61,.92),rgba(8,28,43,.94)); }
.join-card { background:radial-gradient(ellipse at 100% 0%,rgba(121,199,231,.12),transparent 45%),linear-gradient(145deg,rgba(18,43,66,.92),rgba(8,28,43,.94)); }
.action-card-top { display:flex;align-items:center;gap:9px;margin-bottom:13px; }
.action-icon { display:grid;place-items:center;width:34px;height:34px;border:1px solid rgba(167,239,195,.37);border-radius:11px;background:rgba(143,224,166,.13);color:#a9efc7;font-size:23px;line-height:1; }
.join-icon { border-color:rgba(134,213,235,.36);background:rgba(134,213,235,.12);color:#9ee8f3; }
.card-kicker { color:#a7c5c9;font-size:10px;font-weight:900;letter-spacing:.16em; }
.coop-card h3 { margin:0 0 7px;font-size:23px; }
.coop-card>p { min-height:0;margin:0 0 18px;color:#b9d1d4;font-size:14px;line-height:1.5; }
.coop-button { display:inline-flex;align-items:center;justify-content:center;gap:14px;min-height:50px;padding:12px 19px;border:1px solid rgba(243,255,245,.34);border-radius:13px;color:#102a31;background:linear-gradient(135deg,#b8f1c9,#89d9a5);box-shadow:0 7px 20px rgba(66,176,125,.16);font-size:15px;font-weight:850; }
.coop-button:hover:not(:disabled) { transform:translateY(-2px);filter:brightness(1.06);box-shadow:0 10px 24px rgba(66,176,125,.25); }
.coop-button.secondary { border-color:rgba(184,220,229,.26);background:rgba(211,237,239,.085);color:#e8f7f6;box-shadow:none; }
#create-room { width:100%;justify-content:space-between; }
#create-room span:last-child { display:grid;place-items:center;width:25px;height:25px;border-radius:50%;background:rgba(12,57,43,.1);font-size:19px; }
.join-row { gap:10px;margin:0; }
.join-row input { width:100%;min-height:50px;padding:10px 14px;border:1px solid rgba(184,220,229,.32);border-radius:12px;background:rgba(3,16,28,.6);color:#fff4d4;font-family:ui-monospace,monospace;font-size:17px;font-weight:800;letter-spacing:.1em; }
.join-row input::placeholder { color:#78969c;letter-spacing:.13em; }
#join-room { flex:0 0 auto;min-width:105px; }
.coop-error { margin:12px 0 0; }
.invite-banner { border-color:rgba(143,224,166,.55);background:linear-gradient(95deg,rgba(24,88,67,.9),rgba(17,60,80,.82));box-shadow:0 12px 30px rgba(0,0,0,.15); }
.room-row { grid-template-columns:minmax(260px,.9fr) minmax(360px,1.1fr);gap:20px;margin:22px 0 28px; }
.room-code { width:max-content;max-width:100%;padding:7px 8px 7px 15px;border:1px solid rgba(169,239,199,.43);border-radius:14px;background:rgba(143,224,166,.08);font-family:ui-monospace,monospace; }
.room-code #room-code { color:#ffe5a7;font-size:clamp(27px,4vw,38px);letter-spacing:.2em;text-shadow:0 0 19px rgba(255,215,132,.18); }
.room-code .coop-button { min-height:40px;padding:8px 13px;font-size:13px; }
.share-row { gap:9px;margin-top:10px; }
#share-link { min-height:42px;padding:9px 14px;font-size:13px; }
.share-url { max-width:100%;min-height:38px;border-color:rgba(193,227,229,.2);background:rgba(3,16,28,.5);color:#bfe3d9;font-size:11px; }
.net-pill { min-height:34px;padding:6px 10px;background:rgba(25,93,63,.45);font-size:12px; }
.player-slots { gap:10px; }
.player-slot { min-width:0;min-height:79px;padding:13px 15px;border-color:rgba(200,231,229,.18);border-radius:14px;background:rgba(226,246,243,.045); }
.player-slot.ready { border-color:rgba(143,224,166,.58);background:rgba(48,127,88,.18); }
.player-slot b { color:#fff0cd;font:600 16px var(--lobby-display); }
.player-slot small { color:#aecbd0;line-height:1.35; }
.roster-layout { grid-template-columns:minmax(0,1fr) 270px;gap:20px;align-items:start; }
.roster-layout>div>h3 { margin:0 0 5px;font-size:24px; }
.character-grid { grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:13px 0 0; }
.character-card { display:flex;flex-direction:column;align-items:center;min-height:186px;padding:11px 8px 12px;border-color:rgba(198,228,229,.17);border-radius:17px;background:linear-gradient(165deg,rgba(241,255,250,.095),rgba(255,255,255,.025)); }
.character-card:hover:not(:disabled) { border-color:rgba(169,239,199,.65);background-color:rgba(143,224,166,.08); }
.character-card canvas { width:min(100%,108px);margin:0 auto 6px;border:1px solid rgba(206,240,225,.09);border-radius:17px;background:radial-gradient(ellipse at 50% 65%,rgba(67,124,126,.42),rgba(11,35,51,.24) 68%); }
.character-card span { color:#fff0ce;font:600 16px/1.15 var(--lobby-display); }
.character-card small { margin-top:4px;color:#b7d0d1;font-size:11px;line-height:1.2; }
.character-card .hero-ability { max-width:100%;overflow:hidden;color:#8ee1c4;font-size:10px;line-height:1.35;text-overflow:ellipsis;white-space:nowrap; }
.character-card.selected { border-color:#ffe29a;box-shadow:0 0 0 2px rgba(255,226,154,.22),0 11px 28px rgba(0,0,0,.2); }
.character-card.partner-picked::before { content:"OTRO JUGADOR";align-self:stretch;order:0;margin:-4px -2px 5px;padding:3px 4px;border-radius:6px;background:rgba(135,208,240,.18);color:#bcefff;font-size:8px;font-weight:900;letter-spacing:.06em; }
.character-card.partner-picked canvas { order:1; }
.character-card.partner-picked span { order:2; }
.character-card.partner-picked small { order:3; }
.selection-preview { position:sticky;top:16px;padding:17px;border-color:rgba(202,232,226,.22);border-radius:20px;background:radial-gradient(ellipse at 50% 5%,rgba(255,218,143,.1),transparent 58%),linear-gradient(155deg,#153b50,#091a2a);box-shadow:0 17px 45px rgba(0,0,0,.25),inset 0 1px 0 rgba(255,255,255,.07); }
.selection-preview canvas { width:172px;max-width:100%;border:1px solid rgba(205,240,221,.14);border-radius:22px;background:radial-gradient(ellipse at 50% 67%,rgba(102,164,158,.45),rgba(11,35,51,.4) 72%); }
#lobby-portrait:not([data-pose]) { display:none; }
.selection-preview h3 { color:#fff0cd;font-size:22px; }
.selection-preview p { color:#c0d7d7;font-size:13px; }
.selection-preview .coop-button { width:100%; }
.change-character { width:100%;margin-top:8px; }
#lobby-status { max-width:740px;margin:12px auto 0;padding:10px 14px;border:1px solid rgba(191,230,217,.16);border-radius:12px;background:rgba(211,239,232,.045);color:#cce2dd;font-size:13px; }
#entry-error,#lobby-error { color:#ffc3c1!important; }
.net-pill[data-state="reconnecting"] { background:rgba(128,89,21,.38); }
.net-pill[data-state="offline"],.net-pill[data-state="session-conflict"] { background:rgba(125,33,43,.42); }
.arena-choice[hidden],#change-character[hidden] { display:none!important; }
@media (max-width:900px) {
  .coop-shell { width:min(100% - 32px,850px); }
  .room-row { grid-template-columns:minmax(220px,.8fr) minmax(300px,1.2fr); }
  .roster-layout { grid-template-columns:minmax(0,1fr) 225px; }
  .character-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .character-card canvas { width:min(100%,96px); }
}
@media (max-width:650px) {
  body::after { top:20rem; }
  .coop-shell { width:calc(100% - 24px);padding:13px 0 32px; }
  .coop-head { flex-direction:row;align-items:center;gap:8px;margin-bottom:14px; }
  .coop-head h1 { gap:7px;font-size:clamp(15px,4vw,20px);letter-spacing:.015em; }
  .header-tagline { display:none; }
  .coop-head h1::before { flex:0 0 32px;width:32px;height:32px;border-radius:11px;font-size:16px; }
  .coop-head-actions { width:auto;justify-content:flex-end;gap:8px; }
  .coop-head-actions>a { display:none; }
  .language-switch { padding:3px; }
  .language-switch button { min-width:37px;min-height:32px;padding:4px 8px; }
  .coop-panel { padding:22px 16px;border-radius:22px; }
  .coop-panel h2 { font-size:clamp(31px,9vw,40px); }
  .entry-intro { margin-bottom:20px;font-size:14px; }
  .mode-picker { grid-template-columns:1fr;gap:8px;margin:18px 0 14px; }
  .mode-card { min-height:80px;padding:12px;gap:11px;border-radius:15px; }
  .mode-icon { flex-basis:41px;width:41px;height:41px;border-radius:13px;font-size:21px; }
  .mode-copy strong { font-size:17px; }
  .mode-copy small { font-size:12px; }
  .mode-check { width:22px;height:22px; }
  .coop-actions,.room-row,.roster-layout { grid-template-columns:minmax(0,1fr); }
  .coop-actions { gap:10px; }
  .coop-card { padding:15px 16px 17px;border-radius:17px; }
  .action-card-top { margin-bottom:9px; }
  .coop-card h3 { margin-bottom:5px;font-size:21px; }
  .coop-card>p { margin-bottom:12px;font-size:13px; }
  .coop-button { min-height:50px; }
  .join-row input { min-width:0;font-size:16px; }
  .join-row { gap:7px; }
  #join-room { min-width:92px;padding-inline:12px; }
  .room-row { gap:12px;margin:17px 0 21px; }
  .room-code { width:100%;gap:7px; }
  .room-code #room-code { font-size:clamp(24px,8vw,33px); }
  .room-code .coop-button { min-width:75px;padding-inline:10px; }
  .share-row { display:grid;grid-template-columns:minmax(0,1fr) auto; }
  .share-row #share-link { min-height:44px; }
  .net-pill { justify-self:end;padding-inline:8px;font-size:11px; }
  .share-url { font-size:10px; }
  .player-slots { gap:7px; }
  .player-slot { min-height:67px;padding:10px; }
  .player-slot b { font-size:14px; }
  .roster-layout { gap:12px; }
  .roster-layout>div>h3 { font-size:21px; }
  .character-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px; }
  .character-card { min-height:174px;padding:9px 7px 10px;border-radius:15px; }
  .character-card canvas { width:min(100%,108px); }
  .character-card span { font-size:16px; }
  .character-card .hero-ability { font-size:10px; }
  .selection-preview { position:relative;top:auto;display:grid;grid-template-columns:88px minmax(0,1fr);column-gap:13px;align-items:center;padding:12px;text-align:left; }
  .selection-preview:has(#lobby-portrait:not([data-pose])) { display:block;text-align:center; }
  .selection-preview canvas { grid-row:span 3;width:88px;margin:0;border-radius:16px; }
  .selection-preview h3 { align-self:end;margin:0 0 4px;font-size:19px; }
  .selection-preview p { align-self:start;min-height:0;margin:0 0 8px;font-size:12px; }
  .selection-preview .coop-button { grid-column:1/-1; }
  .selection-preview .change-character { grid-column:1/-1; }
  .mission-title-row { align-items:flex-start; }
  .arena-controls { overflow-x:auto; }
}
@media (max-width:360px) {
  .coop-shell { width:calc(100% - 18px); }
  .coop-panel { padding-inline:12px; }
  .coop-head h1 { font-size:14px; }
  .share-row { grid-template-columns:1fr; }
  .net-pill { justify-self:start; }
}
@media (prefers-reduced-motion:reduce) {
  body::before,body::after { animation:none!important; }
  .mode-card,.coop-button,.character-card { transition:none!important; }
}

/* V632 lobby fixes · leave room, live partner pick, taken heroes, mobile ready bar. */
#lobby { overflow:clip; }
.leave-room { min-height:40px;margin:0 0 16px;padding:8px 14px;gap:8px;font-size:13px; }
.leave-room span[aria-hidden] { font-size:17px;line-height:1; }
.character-card.partner-picked::before { content:"TU COMPAÑERO"; }
html[lang="en"] .character-card.partner-picked::before { content:"YOUR TEAMMATE"; }
.character-card.taken { cursor:not-allowed;opacity:.5;filter:grayscale(.55); }
.character-card.taken:hover { transform:none; }
.character-card.taken::before { background:rgba(255,156,186,.2);color:#ffd0dc; }
.selection-preview .coop-error:empty { display:none; }
@media (max-width:650px) {
  .coop-head-actions>a { display:inline-flex;align-items:center;min-height:32px;font-size:12px;white-space:nowrap; }
  .coop-head h1 small { display:none; }
  .leave-room { margin-bottom:12px; }
  /* The preview and Listo stay pinned to the bottom while scrolling the roster. */
  .selection-preview { position:sticky;top:auto;bottom:max(8px,env(safe-area-inset-bottom));z-index:6;display:grid;grid-template-columns:56px minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:10px;row-gap:1px;align-items:center;margin-top:4px;padding:9px 10px;text-align:left;border-color:rgba(169,239,199,.36);border-radius:18px;background:linear-gradient(155deg,rgba(21,59,80,.97),rgba(9,26,42,.98));box-shadow:0 -8px 30px rgba(0,0,0,.45),0 0 0 1px rgba(255,255,255,.04);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px); }
  .selection-preview:has(#lobby-portrait:not([data-pose])) { display:grid;grid-template-columns:minmax(0,1fr) auto;text-align:left; }
  .selection-preview canvas { grid-column:1;grid-row:1/3;width:56px;margin:0;border-radius:12px; }
  .selection-preview h3 { grid-column:2;grid-row:1;align-self:end;margin:0;font-size:17px; }
  .selection-preview p { grid-column:2;grid-row:2;align-self:start;min-height:0;margin:0;overflow:hidden;font-size:11px;white-space:nowrap;text-overflow:ellipsis; }
  .selection-preview:has(#lobby-portrait:not([data-pose])) h3,.selection-preview:has(#lobby-portrait:not([data-pose])) p { grid-column:1; }
  .selection-preview .coop-button,.selection-preview .change-character { grid-column:-2/-1;grid-row:1/3;width:auto;min-width:92px;min-height:48px;margin:0;padding-inline:14px; }
  #change-character { font-size:12px;line-height:1.15;max-width:132px;white-space:normal; }
}
@media (max-width:360px) {
  .coop-head-actions>a { display:none; }
}

/* V633 · keep the mobile ready bar clear of Netlify's fixed bottom-right badge (64px). */
@media (max-width:650px) {
  .coop-shell { padding-bottom:calc(88px + env(safe-area-inset-bottom)); }
  .selection-preview { bottom:calc(72px + env(safe-area-inset-bottom)); }
  .character-grid { padding-bottom:8px; }
}
/* V634: resume a running match from the lobby page without a redirect trap. */
.resume-room{display:flex;align-items:center;gap:.4em;margin:0 0 14px;width:max-content;max-width:100%}
.resume-room[hidden]{display:none}
.resume-room [data-room]{font-family:ui-monospace,monospace;letter-spacing:.08em}
/* V634 photobooth: 8-frame strips rendered from the real rig, played on hover,
   keyboard focus and selection; static first frame for reduced motion. */
.character-card .hero-frame { position:relative;display:block;width:min(100%,108px);aspect-ratio:1;margin:0 auto 6px;border:1px solid rgba(206,240,225,.09);border-radius:17px;overflow:hidden;background:radial-gradient(ellipse at 50% 65%,rgba(67,124,126,.42),rgba(11,35,51,.24) 68%); }
.character-card .hero-frame canvas { width:100%;height:100%;margin:0;border:0;border-radius:0;background:none; }
.character-card .photobooth { position:absolute;inset:4% 2% 0;display:block;background-repeat:no-repeat;background-size:800% 100%;background-position:0 0;opacity:0;transition:opacity .18s ease; }
.character-card .hero-frame.has-booth canvas { opacity:0; }
.character-card .hero-frame.has-booth .photobooth { opacity:1; }
.character-card .hero-name { display:block; }
@keyframes ohana-photobooth { from { background-position:0 0; } to { background-position:100% 0; } }
.character-card:hover:not(:disabled) .photobooth,
.character-card:focus-visible .photobooth,
.character-card.selected .photobooth { animation:ohana-photobooth 1.6s steps(8,jump-none) infinite; }
.character-card.selected .hero-frame { border-color:rgba(255,226,154,.45); }
@media (prefers-reduced-motion: reduce) {
  .character-card .photobooth { animation:none !important;transition:none; }
}
@media (max-width:650px) { .character-card .hero-frame { width:min(100%,96px); } }
