/* Shared planning is an explicit room alongside the private War Room. */
#sharedRoomsBackdrop { z-index: 40; background: #080e18b8; backdrop-filter: blur(5px); }
.shared-rooms-modal { width: min(640px, 100%); padding: 24px; overscroll-behavior: contain; }
.shared-rooms-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.shared-rooms-heading h2 { min-width: 0; font-size: 28px; }
.shared-rooms-heading button { width: 44px; min-height: 44px; flex: 0 0 auto; font-size: 22px; }
.shared-rooms-modal > .fine-print { max-width: 490px; margin-top: 8px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.shared-rooms-list { display: grid; gap: 9px; margin-top: 20px; }
.shared-rooms-list:empty { margin-top: 0; }
.shared-rooms-list > .fine-print { margin: 0; padding: 12px 0; }
.shared-room-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 14px; }
.shared-room-card-copy { display: grid; min-width: 0; gap: 5px; }
.shared-room-card-copy strong { overflow-wrap: anywhere; color: var(--ink); font-size: 14px; line-height: 1.35; }
.shared-room-card-copy small { color: var(--ink-soft); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.shared-room-card-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; flex: 0 0 auto; }
.shared-room-card-actions button { min-height: 44px; padding: 9px 13px; font-size: 12px; }
.shared-room-create { display: grid; gap: 16px; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.shared-room-create > label { font-size: 12px; }
.shared-room-create input:not([type="checkbox"]) { min-height: 46px; font-size: 16px; font-weight: 400; letter-spacing: normal; }
.shared-room-create > .primary-button { min-height: 46px; justify-self: start; }
.shared-room-create > .fine-print { margin-top: -6px; }
.shared-room-invitees { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; margin: 0; border: 0; padding: 0; }
.shared-room-invitees legend { margin-bottom: 9px; padding: 0; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.shared-room-invitees label { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; color: var(--ink); font-size: 12px; line-height: 1.4; letter-spacing: normal; cursor: pointer; overflow-wrap: anywhere; }
.shared-room-invitees label:has(input:checked) { border-color: var(--gold); background: #f6efdf; }
.shared-room-invitees input[type="checkbox"], #followSharedPresenter { width: 17px; height: 17px; flex: 0 0 auto; margin: 0; accent-color: var(--gold); }
.shared-room-invitees input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; box-shadow: none; }
.shared-room-invitees > .fine-print { grid-column: 1 / -1; }
.shared-room-invitation-badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; max-width: 160px; flex: 0 0 auto; border: 1px solid #89734b; border-radius: 999px; background: #2a2b2b; padding: 7px 12px; color: #efd59e; font-size: 11px; font-weight: 750; line-height: 1.25; }
.shared-room-invitation-badge:hover { border-color: #c9a762; background: #36332b; }
.shared-room-invitation-badge:focus-visible { outline: 2px solid #efd59e; outline-offset: 3px; }
#openSharedRoomsLobby { min-height: 44px; }

/* Desktop keeps collaboration details alongside the map. Mobile moves these
   same controls into the room drawer below. */
#warRoomView.shared-room-active { grid-template-rows: auto auto auto minmax(0, 1fr); }
.shared-room-bar { --shared-bg: #141b23; --shared-panel: #1a232d; --shared-line: #3a4653; --shared-text: #e4e9ed; --shared-muted: #a4b2be; --shared-accent: #dec285; display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: center; gap: 6px 20px; min-width: 0; max-height: 38vh; overflow: auto; overscroll-behavior: contain; scrollbar-color: #526171 transparent; border-bottom: 1px solid var(--shared-line); background: var(--shared-bg); padding: 10px 22px; color: var(--shared-text); color-scheme: dark; }
.shared-room-status { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; min-width: 0; }
.shared-room-status strong { overflow: hidden; max-width: 100%; color: var(--shared-text); font-size: 13px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.shared-room-status small { color: var(--shared-accent); font-size: 11px; line-height: 1.5; }
.shared-room-members { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; grid-column: 1; }
.shared-member { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border: 1px solid #3c4854; border-radius: 5px; padding: 3px 7px; color: var(--shared-muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.shared-member.is-presenter { border-color: #857048; color: var(--shared-accent); background: #dec2850b; }
.shared-member.is-invited { border-style: dashed; color: #96a5b2; }
.shared-member small { color: inherit; font-size: 9px; }
.shared-room-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; min-width: 0; grid-column: 2; grid-row: 1 / 3; }
.shared-room-controls button, .shared-members-panel button { min-height: 44px; border: 1px solid var(--shared-line); border-radius: 7px; background: var(--shared-panel); padding: 8px 11px; color: var(--shared-text); font-size: 11px; font-weight: 750; }
.shared-room-controls button:hover:not(:disabled), .shared-members-panel button:hover:not(:disabled) { border-color: #708495; background: #25323e; }
.shared-room-controls button:disabled, .shared-members-panel button:disabled { opacity: .45; cursor: not-allowed; }
.shared-room-controls select { width: auto; min-width: 110px; max-width: 180px; min-height: 44px; border-color: var(--shared-line); border-radius: 7px; background: var(--shared-panel); padding: 8px 26px 8px 10px; color: var(--shared-text); font-size: 12px; }
#followSharedPresenterLabel { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 7px; color: var(--shared-muted); font-size: 11px; font-weight: 600; letter-spacing: normal; cursor: pointer; }
#followSharedPresenter { accent-color: var(--shared-accent); }
.shared-room-bar :is(button, input, select):focus-visible { outline: 2px solid var(--shared-accent); outline-offset: 2px; box-shadow: none; }
.shared-members-panel { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 12px 20px; min-width: 0; margin-top: 6px; border-top: 1px solid var(--shared-line); padding-top: 14px; }
.shared-members-panel > .fine-print { grid-column: 1 / -1; margin: 0; color: var(--shared-muted); }
.shared-members-panel .shared-room-invitees { grid-column: 1; }
.shared-members-panel .shared-room-invitees legend { color: var(--shared-muted); }
.shared-members-panel .shared-room-invitees label { border-color: var(--shared-line); background: var(--shared-panel); color: var(--shared-text); font-size: 11px; }
.shared-members-panel .shared-room-invitees label:has(input:checked) { border-color: #ad935e; background: #292923; }
.shared-members-panel .shared-room-invitees input { accent-color: var(--shared-accent); }
#inviteSharedPlayers { justify-self: start; grid-column: 1; }
#sharedMemberActions { display: grid; grid-column: 2; grid-row: 2 / 4; gap: 7px; min-width: 0; margin: 0; padding: 0; list-style: none; }
#sharedMemberActions > :is(div, li) { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; min-height: 44px; border-bottom: 1px solid #ffffff0c; padding-bottom: 6px; color: var(--shared-muted); font-size: 11px; overflow-wrap: anywhere; }
#sharedMemberActions button { flex: 0 0 auto; color: #efaaa2; }
#closeSharedRoom { grid-column: 1 / -1; justify-self: start; border-color: #805651; background: #382522; color: #f1b5ae; }
.shared-room-active .war-room-map-toolbar { min-height: 53px; }

body[data-map-style="tactical"] .shared-rooms-modal { border: 1px solid #3c5364; border-radius: 7px; background: #131f29; color: #dce7ef; }
body[data-map-style="tactical"] .shared-rooms-heading h2 { font-family: var(--tactical-mono); font-size: 23px; }
body[data-map-style="tactical"] .shared-room-card { border-color: #344b5b; border-radius: 5px; background: #192936; }
body[data-map-style="tactical"] .shared-room-card-copy strong { color: #e1edf4; }
body[data-map-style="tactical"] :is(.shared-room-card-copy small, .shared-rooms-modal > .fine-print, .shared-room-invitees legend) { color: #a4bac9; }
body[data-map-style="tactical"] .shared-room-create { border-color: #344b5b; }
body[data-map-style="tactical"] .shared-room-invitees label { border-color: #3c5364; border-radius: 4px; background: #152530; color: #c8dbe6; }
body[data-map-style="tactical"] .shared-room-invitees label:has(input:checked) { border-color: #86bdd0; background: #253f4e; }
body[data-map-style="tactical"] .shared-room-invitees input { accent-color: #94cddd; }
body[data-map-style="tactical"] .shared-room-bar { --shared-bg: #111d27; --shared-panel: #1a2d3a; --shared-line: #375263; --shared-accent: #a6d8e8; }
body[data-map-style="tactical"] .shared-room-status strong { font-family: var(--tactical-mono); font-weight: 500; }
body[data-map-style="tactical"] .shared-member { border-color: #3b5668; border-radius: 3px; }
body[data-map-style="tactical"] .shared-member.is-presenter { border-color: #6b9cac; background: #a6d8e80b; }
body[data-map-style="tactical"] .shared-room-controls :is(button, select), body[data-map-style="tactical"] .shared-members-panel button { border-radius: 4px; }
body[data-map-style="tactical"] .shared-room-invitation-badge { border-color: #557f93; border-radius: 4px; background: #1c3442; color: #b6e0ee; }

@media (max-width: 1180px) {
  .shared-room-bar { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .shared-room-controls { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .war-room-header-actions { flex-wrap: wrap; }
}

@media (max-width: 980px) {
  #warRoomView.shared-room-active { grid-template-rows: auto auto auto minmax(0, 1fr); }
  .war-room-header { gap: 7px 8px; }
  .war-room-header-actions { flex-wrap: nowrap; }
  .war-room-header-actions .war-room-quiet-button { min-height: 44px; padding: 7px 8px; font-size: 9px; }
  .war-room-header-actions .war-room-close-button { min-width: 44px; min-height: 44px; }
  .shared-room-bar { max-height: min(34vh, 280px); gap: 6px; padding: 8px 11px; }
  .shared-room-status { justify-content: space-between; gap: 2px 10px; }
  .shared-room-status strong { max-width: 66%; font-size: 12px; }
  .shared-room-status small { font-size: 10px; }
  .shared-room-members { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
  .shared-member { flex: 0 0 auto; max-width: 230px; font-size: 10px; }
  .shared-room-controls { gap: 5px; }
  .shared-room-controls select { flex: 1 1 120px; min-width: 0; max-width: 100%; font-size: 16px; }
  .shared-room-controls button { flex: 0 0 auto; font-size: 10px; }
  #followSharedPresenterLabel { flex: 1 1 auto; padding-left: 0; }
  .shared-members-panel { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #sharedMemberActions { grid-column: 1; grid-row: auto; }
  .shared-room-invitation-badge { max-width: 94px; padding: 6px 9px; font-size: 10px; }
  .account-lockup:has(.shared-room-invitation-badge:not([hidden])) { gap: 5px; }
  .account-lockup:has(.shared-room-invitation-badge:not([hidden])) > .power-dot { display: none; }
}

@media (max-width: 600px) {
  #sharedRoomsBackdrop { align-items: end; padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .shared-rooms-modal { max-height: calc(100dvh - 20px - env(safe-area-inset-bottom)); border-radius: 17px; padding: 18px; }
  .shared-rooms-heading h2 { font-size: 25px; }
  .shared-room-card { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .shared-room-card-copy { flex: 1 1 180px; }
  .shared-room-card-actions { justify-content: flex-start; }
  .shared-room-create > .primary-button { width: 100%; }
  .shared-room-invitees { gap: 7px; }
  .shared-room-invitees label { padding: 9px; font-size: 11px; }
  body[data-map-style="tactical"] .shared-rooms-heading h2 { font-size: 21px; }
}

@media (max-width: 360px) {
  .shared-room-invitees { grid-template-columns: minmax(0, 1fr); }
  .war-room-header-actions .war-room-quiet-button { padding: 7px 6px; font-size: 8px; }
  .war-room-header .war-room-mark { display: none; }
  .shared-room-status strong { max-width: 100%; }
}

.war-room-mobile-identity, #openWarRoomMobileControls, .war-room-mobile-controls-backdrop { display: none; }

@media (max-width: 980px) {
  #warRoomView, #warRoomView.shared-room-active { grid-template-rows: 56px minmax(0, 1fr); padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
  #warRoomView > .war-room-header { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; min-height: 56px; height: 56px; padding: 6px 8px; }
  #warRoomView > .war-room-header > .war-room-brand { display: none; }
  .war-room-mobile-identity { display: grid; min-width: 0; gap: 3px; }
  .war-room-mobile-identity strong { overflow: hidden; color: #f0e7d4; font-size: 14px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
  .war-room-mobile-identity small { overflow: hidden; color: #c1af8e; font-size: 10px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
  #warRoomView .war-room-header-actions { gap: 5px; }
  #openWarRoomMobileControls { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 58px; min-height: 44px; padding: 7px 10px; font-size: 11px; }
  #openWarRoomMobileControls[data-has-result="true"]::after { position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: #dec285; content: ""; }
  #warRoomView #closeWarRoom { min-width: 44px; min-height: 44px; padding: 0; }
  #warRoomView #closeWarRoom span { font-size: 23px; }
  #warRoomView .war-room-shell { padding: 4px; }
  #warRoomView :is(.war-room-map-column, .war-room-orders-panel) { max-width: calc(100vw - 8px); }
  #warRoomView .war-room-map-toolbar { min-height: 48px; height: 48px; gap: 8px; padding: 2px 6px; }
  #warRoomView .war-room-map-toolbar > div:first-child { min-width: 0; }
  #warRoomView .war-room-map-toolbar .eyebrow { margin: 0; font-size: 0; line-height: 1; }
  #warRoomView .war-room-map-toolbar .eyebrow::after { color: #c3aa72; font-size: 8px; letter-spacing: .12em; content: "SIMULATION"; }
  #warRoomView .war-room-map-toolbar h1 { overflow: hidden; margin: 3px 0 0; font-size: 13px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
  #warRoomView .war-room-map-actions { flex: 0 0 auto; gap: 4px; }
  #warRoomView :is(#warRoomZoomIn, #warRoomZoomOut) { min-width: 44px; width: 44px; min-height: 44px; height: 44px; font-size: 22px; }
  #warRoomView .war-room-map-shell { min-height: 0; }
  #warRoomView .war-room-mobile-nav { min-height: 48px; height: calc(48px + env(safe-area-inset-bottom)); }
  #warRoomView .war-room-mobile-nav button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 4px 8px; font-size: 11px; }
  #warRoomView .war-room-mobile-nav button span { font-size: 15px; }

  .war-room-mobile-controls-backdrop { position: fixed; z-index: 35; inset: 0; display: flex; align-items: flex-end; background: #02060bb8; backdrop-filter: blur(3px); padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
  .war-room-mobile-controls { display: flex; width: min(620px, 100%); max-height: min(86dvh, 840px); flex-direction: column; overflow: hidden; margin: 0 auto; border: 1px solid #4b4437; border-radius: 16px; background: #111820; color: #e7e4db; box-shadow: 0 12px 70px #0008; color-scheme: dark; }
  .war-room-mobile-controls-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; border-bottom: 1px solid #3d4246; padding: 10px 14px; }
  .war-room-mobile-controls-heading .eyebrow { margin: 0; color: #c3aa72; font-size: 9px; }
  .war-room-mobile-controls-heading h2 { margin: 3px 0 0; color: #f0e7d4; font-size: 20px; }
  #closeWarRoomMobileControls { min-width: 44px; width: 44px; min-height: 44px; height: 44px; font-size: 24px; }
  .war-room-mobile-controls-body { display: flex; min-height: 0; flex-direction: column; gap: 16px; overflow-y: auto; overscroll-behavior: contain; padding: 14px; scrollbar-color: #64707c transparent; }
  .war-room-mobile-controls-body > :is(:empty, :has(> [hidden]:only-child)) { display: none; }
  .war-room-mobile-control-row { display: flex; flex-wrap: wrap; gap: 9px; }
  #warRoomMobileControls :is(button, select, label:has(input)) { min-height: 44px; }
  #warRoomMobileControls :is(button, input, select, summary):focus-visible { outline: 2px solid #dec285; outline-offset: 2px; }
  #warRoomMobileControls .war-room-phase-comparison { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 12px; border: 1px solid #3d4246; border-radius: 8px; }
  #warRoomMobileControls .war-room-phase-comparison > span { min-width: 0; text-align: left; }
  #warRoomMobileControls .war-room-phase-comparison strong { font-size: 13px; line-height: 1.4; }
  #warRoomMobileControls .war-room-phase-comparison small { color: #a3b1be; font-size: 9px; }
  #warRoomMobileControls .war-room-phase-comparison em { grid-column: 1 / -1; justify-self: start; font-size: 9px; }
  #warRoomMobileControls .shared-room-bar { max-height: none; overflow: visible; gap: 12px; border: 0; background: transparent; padding: 0; }
  #warRoomMobileControls .shared-room-status { align-items: start; flex-direction: column; gap: 5px; }
  #warRoomMobileControls .shared-room-status strong { max-width: 100%; font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
  #warRoomMobileControls .shared-room-status small { font-size: 12px; line-height: 1.5; }
  #warRoomMobileControls .shared-room-members { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 0; }
  #warRoomMobileControls .shared-member { max-width: 100%; font-size: 11px; }
  #warRoomMobileControls .shared-room-controls { gap: 8px; }
  #warRoomMobileControls .shared-room-controls select { flex: 1 1 135px; }
  #warRoomMobileControls .shared-room-controls button { font-size: 12px; }
  #warRoomMobileControls #followSharedPresenterLabel { flex-basis: 100%; font-size: 13px; }
  #warRoomMobileControls .shared-members-panel { margin-top: 0; }
  #warRoomMobileControls .shared-room-invitees { grid-template-columns: minmax(0, 1fr); }
  #warRoomMobileControls .shared-room-invitees label { font-size: 12px; }
  #warRoomMobileControls .war-room-map-mode { width: 100%; }
  #warRoomMobileControls .war-room-map-mode button { flex: 1; font-size: 12px; }
  #warRoomMobileActions > button { flex: 1 1 auto; font-size: 12px; }
  #warRoomMobileControls .war-room-warning { display: grid; justify-content: start; gap: 7px; min-height: 0; border: 1px solid #504331; border-radius: 8px; background: #28251d; padding: 12px; font-size: 11px; line-height: 1.5; }
  #warRoomMobileControls .war-room-warning > span { justify-self: start; font-size: 9px; }
  #warRoomMobileControls .war-room-warning small { display: block; font-size: 11px; }
  #warRoomMobileControls .war-room-result { max-height: none; overflow: visible; border: 1px solid #3d4246; border-radius: 8px; padding: 12px; }
  #warRoomMobileControls .war-room-result-heading { gap: 8px; }
  #warRoomMobileControls .war-room-result-heading h2 { font-size: 16px; }
  #warRoomMobileControls .war-room-recap { grid-template-columns: minmax(0, 1fr); }
  #warRoomMobileControls .war-room-recap-event p { font-size: 11px; }
  #warRoomMobileControls .war-room-exact-orders, #warRoomMobileControls .war-room-exact-power :is(strong, span) { font-size: 11px; }
  #warRoomMobileControls .war-room-exact-orders summary { min-height: 44px; padding-top: 12px; }

  body[data-map-style="tactical"] .war-room-mobile-identity strong { color: #deedf5; font-family: var(--tactical-mono); font-weight: 500; }
  body[data-map-style="tactical"] .war-room-mobile-identity small { color: #a6ccdf; }
  body[data-map-style="tactical"] .war-room-mobile-controls { border-color: #3c586b; border-radius: 8px; background: #101d27; }
  body[data-map-style="tactical"] .war-room-mobile-controls-heading { border-color: #344e60; }
  body[data-map-style="tactical"] .war-room-mobile-controls-heading h2 { color: #deedf5; font-family: var(--tactical-mono); font-size: 18px; }
  body[data-map-style="tactical"] #warRoomMobileControls :is(button, input, select, summary):focus-visible { outline-color: #a6d8e8; }
  body[data-map-style="tactical"] #warRoomMobileControls :is(.war-room-phase-comparison, .war-room-result) { border-color: #344e60; }
}
