/* All online surfaces share the gameplay viewport's one proportional scale. */
:root.is-online-layout { font-size:var(--game-rem);--layout-vw:var(--game-vw);--layout-vh:var(--game-vh);--layout-svh:var(--game-vh);--layout-dvh:var(--game-vh);overflow:hidden; }
.is-online-layout body { min-width:0;overflow:hidden; }
.online-menu-screen { position:fixed;inset:0;width:100%;height:100dvh;min-height:0;align-items:center;justify-content:center;padding:2rem;overflow:hidden; }
.online-menu-screen.is-active { display:flex; }
.online-menu-panel { width:32rem;margin:auto;padding:2rem;border:.0625rem solid rgba(255,226,116,.82);border-radius:.9rem;background:#052f46;box-shadow:0 1.5rem 4rem rgba(0,0,0,.4);text-align:center; }
.online-menu-screen.online-menu-with-art { flex-direction:column;gap:1rem; }
.online-menu-with-art > .online-menu-panel { margin:0;flex-shrink:0; }
.online-menu-panel h2 { margin:.5rem 0 1.7rem;color:#ffe476;font-family:Caribbean,Georgia,serif;font-weight:400;font-size:1.8rem; }
.online-menu-with-art > .setup-title-art { width:42rem;left:auto;transform:none;margin:0;flex-shrink:0; }
.online-menu-actions { display:grid;gap:1rem;max-width:23rem;margin:1.4rem auto 0; }
.online-name-actions { grid-template-columns:repeat(2,minmax(0,1fr));max-width:27rem; }
#online-name-step[hidden],#online-choice-step[hidden] { display:none; }
.online-menu-screen .button { font-family:Caribbean,Georgia,serif;font-weight:850; }
.online-dialog .button { font-family:Caribbean,Georgia,serif;font-weight:400; }
/* Match Local Fleet Selection Back, within the shared proportional scale. */
.online-menu-screen .online-back { width:13rem;justify-self:center;flex-shrink:0;border-color:rgba(255,239,178,.88);background:rgba(0,48,86,.68);color:#fff0b4;font-family:"Caribbean",Georgia,serif;font-size:1.2rem;letter-spacing:.055em; }
.online-field { display:grid;gap:.55rem;color:#ffe476;text-align:left;font-size:1rem; }
.online-field input, .online-field textarea { width:100%;min-height:3rem;padding:.7rem 1rem;border-radius:.5rem;border:.0625rem solid #75b0c6;background:#031e2e;color:#effcff;font:inherit;outline-offset:.25rem; }
.online-field input:focus, .online-field textarea:focus { outline:.125rem solid #ffe476; }
.online-help { color:#c7e3ed;line-height:1.5;font-size:.9rem;margin:.7rem 0; }
.online-error { color:#ffd49c;min-height:1.4rem;font-size:.95rem;line-height:1.4; }
.online-error:empty { min-height:0;margin:0; }
.online-wide-panel { width:40rem; }
.online-room-list { min-height:6rem;margin:1.5rem 0;display:grid;align-content:start;gap:.6rem;height:17rem;max-height:17rem;overflow:auto; }
.online-room-list article { display:flex;align-items:center;gap:1rem;padding:.85rem;border:.0625rem solid #4b829a;border-radius:.5rem;text-align:left; }
.online-room-list article > div { display:grid;gap:.3rem;flex:1;min-width:0;overflow-wrap:anywhere; }
.online-room-list article b { color:#ffe476;font-size:1.2rem;letter-spacing:.12em; }
.online-room-list article small { color:#c7e3ed;font-size:.9rem; }
.online-room-popup.order-popup { position:relative;inset:auto;transform:none;opacity:1;animation:none;width:43rem;padding:1.5rem; }
.online-room-popup.order-popup h2 { font-size:1.8rem;margin:0 0 .7rem; }
#online-lobby-hint { margin:.35rem 0; }
.online-crew.order-popup-list { margin:0 0 .6rem; }
.online-room-code { display:flex;align-items:center;justify-content:center;gap:.6rem;margin:0 0 .5rem;color:#c7e3ed; }
.online-room-code strong { color:#ffe476;font:400 1.8rem Caribbean,Georgia,serif;letter-spacing:.2em; }
#online-invite { min-width:6rem;padding:.45rem .8rem;font-size:.95rem; }
#online-invite-fallback[hidden] { display:none; }
#online-invite-fallback { margin:.5rem 0;font-size:.85rem; }
#online-invite-link { height:4.8rem;resize:none;line-height:1.4; }
.online-crew.order-popup-list li { grid-template-columns:1.2rem .8rem minmax(0,1fr) 7rem 12rem;text-align:left;min-height:3rem;gap:.6rem; }
.online-crew.order-popup-list li strong { font-size:1rem;overflow-wrap:anywhere; }
.online-crew small { display:block;color:#aacddc;font:400 .8rem system-ui,sans-serif;margin-top:.2rem; }
.online-crew .online-ready-status { color:#d7eaf1;font:400 .9rem system-ui,sans-serif; }
.online-crew .online-ready-status.is-ready { color:#91e5b0; }
.online-crew .empty-seat { opacity:.45; }
.online-color-picker { display:flex;justify-content:center;gap:1rem;margin:.8rem 0; }
.online-color-picker .swatch { width:2.3rem;height:2.3rem;flex-shrink:0; }
.online-color-picker .swatch:disabled { opacity:.28;cursor:not-allowed; }
.online-room-actions { display:flex;justify-content:center;flex-wrap:nowrap;gap:.8rem;margin-top:1.4rem; }
#online-start[hidden] { display:none; }
.online-game-screen { position:fixed;inset:0;overflow:hidden;background:#087eae; }
#online-game-mount,#online-game-mount iframe { position:absolute;inset:0;width:100%;height:100%;border:0; }
.online-game-status { display:none; }
.online-recovering { position:fixed;inset:0;z-index:150;display:grid;place-items:center;background:#06394e; }
.online-recovering[hidden] { display:none; }
.online-recovering .online-menu-panel { width:36rem; }
.online-recovering h2 { margin:0;white-space:nowrap; }
/* Fixed reference dimensions also apply to native dialog top-layer content. */
.online-dialog { width:36rem;max-width:none;max-height:none;padding:2rem;background:#052f46;color:#effcff;border:.0625rem solid #ffe476;border-radius:.9rem;text-align:center; }
.online-dialog h2 { color:#ffe476;font-family:Caribbean,Georgia,serif;font-weight:400;font-size:1.8rem; }
.online-dialog::backdrop { background:#001722b8; }
.online-menu-screen .button:disabled,.online-dialog .button:disabled { background:linear-gradient(135deg,#85898d,#585e64);color:#d9dce0;border-color:#8f969c;box-shadow:inset 0 .0625rem #ffffff20;cursor:not-allowed;opacity:1;transform:none; }

/* The requested menu peers share a size, without changing the blue Back style. */
#play-mode .online-back, #online-choice-step .online-back { width:100%;justify-self:stretch; }
#online-lobby .online-room-actions { display:grid;grid-auto-flow:column;grid-auto-columns:1fr;width:max-content;margin-inline:auto; }
#online-lobby #online-leave-lobby { width:auto;justify-self:stretch; }
#online-leave-dialog { width:28rem; }
/* Both voyage headings share an explicit type size. */
#play-mode-title, #online-title { font-size:1.8rem; }

.online-rooms-heading { display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:1.2rem;margin:.5rem 0 1.7rem; }
.online-rooms-heading h2 { grid-column:2;margin:0; }
.online-rooms-heading .button { grid-column:3;justify-self:start;white-space:nowrap; }

#online-create-dialog{position:fixed;inset:0;width:25rem;max-width:none;padding:1.5rem;transform:none;animation:none;color:#ffe476}#online-create-dialog::backdrop{background:rgba(0,15,25,.7)}#online-create-dialog .online-menu-actions{margin-top:0;gap:.75rem}#online-create-dialog .online-back{background:rgba(0,48,86,.68);color:#fff0b4;border-color:rgba(255,239,178,.88)}.online-lobby-heading{position:relative}.online-lobby-heading .online-lobby-labels{position:absolute;left:0;top:0;display:grid;gap:.15rem;font:400 .9rem Caribbean,Georgia,serif;color:#c7e3ed}

#online-create-dialog .button{font-weight:850}

/* Menu backgrounds reuse the main menu's sea layers and drift animation. */
#setup, #discovery { background:#052f46; }
.online-menu-screen:not(#discovery), .online-recovering, #challenge-game #challenge-loading, #challenge-game #challenge-failure {
  isolation:isolate;
  background:#01abff;
}
.menu-waves, .sea-haze { pointer-events:none; }

/* Stable Sailing Crew columns: names never displace points or readiness. */
.online-crew .online-points{justify-self:stretch;text-align:right;padding-right:.5rem;white-space:nowrap;font:700 .95rem/1.3 system-ui,sans-serif;font-variant-numeric:tabular-nums;color:#ffe476}
.online-crew .online-ready-status{text-align:right;white-space:nowrap}
.online-crew.order-popup-list li>strong{min-width:0;overflow:hidden}

/* Mode previews share the action width and the home prompt's sans-serif family. */
#online-create-mode,#ph-account-dialog #ph-signout-scope{box-sizing:border-box;text-align:center;text-align-last:center;width:100%;min-width:0;min-height:3.35rem;padding:.7rem 1rem;border:.0625rem solid #75b0c6;border-radius:.45rem;background:#031e2e;color:#fff;font:600 1rem/1.3 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color-scheme:dark}
#online-create-mode option,#ph-account-dialog #ph-signout-scope option{text-align:center;background:#031e2e;color:#fff}
#online-create-mode option:disabled{color:#8d969e}
#online-create-mode:focus-visible,#ph-account-dialog #ph-signout-scope:focus-visible{outline:.125rem solid #ffe476;outline-offset:.15rem}

#online-room-mode{color:#ffe476}

.online-room-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.online-room-filters .online-field{min-width:0;text-align:left}
#online-room-mode-filter{box-sizing:border-box;width:100%;min-width:0;min-height:3rem;padding:.7rem 1rem;border:.0625rem solid #75b0c6;border-radius:.5rem;background:#031e2e;color:#fff;font:inherit;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;text-align:left;text-align-last:left;color-scheme:dark}
#online-room-mode-filter option{background:#031e2e;color:#fff}
#online-room-mode-filter option:disabled{color:#8d969e}
#online-room-mode-filter:focus-visible{outline:.125rem solid #ffe476;outline-offset:.25rem}

/* Online Manhunt uses Cooperation's separated captain groups, without teams. */
.online-manhunt-presentation .fleet-status {border:0;border-radius:0;background:transparent;overflow:visible}
.online-manhunt-presentation .manhunt-status-group {border:.0625rem solid rgba(174,210,219,.24);border-radius:.72rem;overflow:hidden;background:rgba(1,25,39,.58)}
.online-manhunt-presentation .manhunt-status-heading,
.online-manhunt-presentation #order-popup-list .manhunt-order-heading {display:block;text-align:center;color:#fff;font:400 1.05rem/1.2 Caribbean,Georgia,serif;margin:.55rem 0;padding:0;min-height:0;background:none;border:0}

/* Keep the score summary border when Nelson's result has no points display. */
.online-manhunt-presentation #victory-dialog .victory-score-summary > [hidden],
.online-manhunt-presentation #victory-status[hidden] {display:none!important}

/* Override the generic Sailing Order row grid only in visible Online Cooperation. */
.online-room-view.cooperation-game #order-popup-list li.cooperation-vs {display:block;text-align:center;grid-template-columns:none}

/* Preserve heading geometry while hiding the line above rounded team groups. */
.cooperation-game .fleet-status-heading,
.online-manhunt-presentation .fleet-status-heading {border-bottom-color:transparent}

/* Cooperation winner names match the standard bold winner label. */
#victory-subtitle > span { font-weight: bolder; }

.online-crew .online-host-label{display:inline;margin:0 .5rem 0 0}

#online-ceremony-note{margin:1.2rem 0 0;text-align:center}
#online-ceremony-note[hidden]{display:none}
