/* Visual theme choices stay scoped to the host's settings form. */
#settings-form .map-theme-options { margin:24px 0; padding:0; border:0; min-width:0; }
#settings-form .map-theme-options legend { padding:0; font-size:1.12rem; font-weight:750; }
#settings-form .map-theme-options > p { margin:7px 0 14px; color:var(--muted); font-size:.88rem; }
#settings-form .map-theme-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
#settings-form .map-theme-tile { position:relative; display:flex; flex-direction:column; gap:7px; margin:0; padding:9px; border:2px solid var(--line,#d7e1e5); border-radius:14px; background:var(--panel,#fff); cursor:pointer; min-width:0; transition:border-color .15s,box-shadow .15s; }
#settings-form .map-theme-tile input { position:absolute; top:16px; right:16px; width:18px; height:18px; margin:0; accent-color:#237d94; cursor:inherit; }
#settings-form .map-theme-tile:has(input:checked) { border-color:#237d94; box-shadow:0 0 0 2px #237d9426; }
#settings-form .map-theme-tile:has(input:focus-visible) { outline:3px solid #d59b39; outline-offset:3px; }
#settings-form .map-theme-tile:has(input:disabled) { cursor:not-allowed; }
#settings-form .map-theme-tile:has(input:disabled) .theme-scene { filter:saturate(.7); }
#settings-form .theme-scene { display:block; width:100%; height:auto; border-radius:8px; }
#settings-form .map-theme-name { font-weight:750; font-size:.9rem; line-height:1.3; }
#settings-form .map-theme-tile small { font-size:.76rem; font-weight:400; line-height:1.4; color:var(--muted); }
#settings-form .map-theme-access { align-self:flex-start; margin-top:auto; padding-top:4px; font-size:.69rem; font-weight:650; color:var(--muted); }
@media (max-width:480px) { #settings-form .map-theme-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; } }
/* One live renderer sits with its controls, so picking never loses the result. */
#settings-form .map-theme-workbench { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.1fr); gap:20px; align-items:start; }
#settings-form .map-theme-live { position:sticky; top:16px; min-width:0; }
#settings-form .map-theme-live .lobby-board3d { width:100%; height:440px; min-height:0; margin:0; max-height:58vh; border-radius:16px; overflow:hidden; }
#settings-form .map-theme-preview-status { margin:10px 0 0; font-size:.82rem; line-height:1.45; color:var(--muted); }
#settings-form .map-theme-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
#settings-form .map-theme-tile { gap:5px; padding:7px; }
#settings-form .theme-scene { max-height:76px; object-fit:cover; }
#settings-form .map-theme-name { font-size:.82rem; }
#settings-form .map-theme-tile small { font-size:.7rem; }
.lobby-saved-map { display:flex; align-items:center; justify-content:center; gap:24px; padding:16px; color:var(--muted); font-size:.85rem; }
.lobby-saved-map .map-thumbnail { width:150px; height:150px; }
@media (max-width:760px) {
  #settings-form .map-theme-workbench { display:block; }
  #settings-form .map-theme-live { position:static; }
  #settings-form .map-theme-live .lobby-board3d { height:230px; max-height:32vh; }
  #settings-form .map-theme-preview-status { margin:7px 0 10px; font-size:.75rem; }
  #settings-form .map-theme-grid { display:flex; overflow-x:auto; gap:9px; padding:4px 3px 12px; scroll-snap-type:x proximity; }
  #settings-form .map-theme-tile { flex:0 0 154px; scroll-snap-align:start; }
  #settings-form .theme-scene { max-height:72px; }
  .lobby-saved-map { gap:12px; }
  .lobby-saved-map .map-thumbnail { width:110px; height:110px; }
}
/* Theme controls live with the island, while radios belong to the settings form. */
.lobby-theme-workbench{display:grid;grid-template-columns:minmax(0,1fr) 180px;gap:14px;align-items:start}
.lobby-theme-preview{min-width:0}.lobby-theme-preview .lobby-board3d{width:100%;height:300px;min-height:240px}
.lobby-theme-preview .map-theme-preview-status{font-size:12px;line-height:1.5;margin:8px 0}
.lobby-theme-options{border:0;padding:0;margin:0;min-width:0}.lobby-theme-options legend{font-weight:700;font-size:13px;margin-bottom:8px}
.lobby-theme-list{display:flex;flex-direction:column;gap:6px;max-height:300px;overflow-y:auto;padding:3px}
.lobby-theme-option{display:flex;align-items:center;gap:8px;padding:7px;border:1px solid var(--line);border-radius:8px;cursor:pointer;font-size:12px;text-decoration:none;color:inherit;background:var(--paper)}
.lobby-theme-option .theme-scene{width:34px;height:28px;object-fit:cover;border-radius:5px;flex-shrink:0}.lobby-theme-option>span:first-of-type{flex:1}.lobby-theme-option input{width:16px;height:16px;margin:0;cursor:pointer;flex-shrink:0}.lobby-theme-option:has(input:checked){outline:2px solid #297991;background:#e6f3f6}.lobby-theme-option.locked{background:#dce1e5;color:#566472}.lobby-theme-option.locked .theme-scene{filter:brightness(.6) saturate(.6)}.lobby-theme-option:focus-visible{outline:3px solid #bd8c35}
@media(max-width:700px){.lobby-theme-workbench{grid-template-columns:minmax(0,1fr) 150px;gap:8px}.lobby-theme-preview .lobby-board3d{height:260px;min-height:220px}.lobby-theme-list{max-height:260px}}
@media(max-width:420px){.lobby-theme-workbench{grid-template-columns:1fr}.lobby-theme-list{max-height:180px}}
.waiting-island .lobby-theme-option{color:#243e50;background:#f3f7fa}
.waiting-island .lobby-theme-option.locked{color:#657581;background:#c4cdd5}
.waiting-island .lobby-theme-option:has(input:checked){background:#daedf4;color:#163e50}
.waiting-island .lobby-theme-preview .map-theme-preview-status{color:#d8e4ee}
.lobby-theme-option>span:first-of-type{white-space:nowrap;font-size:11px}.lobby-theme-preview{position:relative}.enlarge-map{position:absolute;z-index:2;top:12px;right:12px;background:#fff;color:#254355;box-shadow:0 2px 10px #0002}.map-preview-modal{width:min(1200px,96vw)!important;max-width:1200px!important}.enlarged-map{height:min(72vh,760px);min-height:260px;width:100%;overflow:hidden;border-radius:16px}.enlarged-map canvas{display:block;width:100%;height:100%}
.lobby-piece-bar canvas,.lobby-piece-styles canvas{display:block;width:100%;height:100%;object-fit:contain}.lobby-piece-styles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.lobby-piece-styles label{display:block;cursor:pointer;border:2px solid var(--line);border-radius:14px;padding:14px;background:var(--paper)}.lobby-piece-styles label:has(input:checked){border-color:#df8d24;background:#fff5e5}.lobby-piece-styles input{width:auto;margin-right:8px}.lobby-piece-styles [data-piece-bar]{display:block;height:100px}.supporter-link{display:flex;align-items:center;justify-content:center;width:100%;box-sizing:border-box;margin:16px 0 0;padding:12px 17px;border-radius:7px;font-size:14px;font-weight:600;text-decoration:none}
@media(max-width:600px){.lobby-piece-styles{grid-template-columns:1fr}.enlarged-map{height:65vh}}
.lobby-piece-bar canvas,.lobby-piece-bar [data-piece-bar],.lobby-piece-styles canvas{pointer-events:none}
.lobby-theme-option{letter-spacing:normal}.lobby-theme-option>span:first-of-type{font-size:11px;letter-spacing:normal;min-width:0}.lobby-theme-workbench{grid-template-columns:minmax(0,1fr) 190px}
@media(max-width:700px){.lobby-theme-workbench{grid-template-columns:minmax(0,1fr) 165px}.lobby-theme-option{gap:5px;padding:5px}.lobby-theme-option .theme-scene{width:25px}}
@media(max-width:420px){.lobby-theme-workbench{grid-template-columns:1fr}}

/* Compact rows: identity, colored pieces, readiness, then host controls. */
.crew>.crew-member{height:auto;min-height:72px;flex:0 0 auto;padding:10px 0;flex-wrap:nowrap;gap:8px;border-left:0}
.crew-member>.crew-identity{flex:1 1 110px;min-width:0}
.crew-member>.lobby-piece-bar{display:block;flex:0 1 180px;width:180px;min-width:90px;padding:0;margin:0;border:0;border-radius:7px;background:transparent;box-shadow:none}
.lobby-piece-bar [data-piece-bar]{display:block;height:52px;min-width:0}
.crew-member .status{flex:0 0 auto;font-size:11px;white-space:nowrap}
.crew-member>.kick-player{flex:none;width:28px;min-width:28px;padding:5px}
.lobby-piece-bar:focus-visible{outline:2px solid var(--accent,#2456ba);outline-offset:2px}
@media(max-width:600px){
 .crew>.crew-member{gap:5px;min-height:66px;padding:8px 0}
 .crew-member>.crew-identity{flex-basis:85px}.crew-member strong{font-size:12px}.crew-member .status{font-size:9px}
 .crew-member>.lobby-piece-bar{flex-basis:130px;min-width:80px}.lobby-piece-bar [data-piece-bar]{height:44px}
 .crew-member .bot-difficulty{gap:0;padding:1px}.crew-member .bot-difficulty .difficulty-option{font-size:9px;padding:3px;min-height:23px}
 .crew-member:has(.bot-difficulty)>.status{display:block}
}
/* Reserve identical preview/status/action columns, including rows without a kick action. */
.crew>.crew-member:has(.lobby-piece-bar){display:grid;grid-template-columns:minmax(0,1fr) 180px 90px 28px;column-gap:8px}
.crew-member>.crew-identity{grid-column:1}
.crew-member>.lobby-piece-bar{grid-column:2;width:100%;min-width:0;justify-self:end}
.crew-member>.status{grid-column:3;justify-self:end}
.crew-member>.kick-player{grid-column:4;justify-self:end}
.lobby-piece-styles label{display:grid;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:12px}
.lobby-piece-styles label>input{display:block;width:18px;height:18px;margin:0;align-self:center}
.lobby-piece-styles label>strong{line-height:1.4;letter-spacing:normal}
.lobby-piece-styles label>[data-piece-bar]{grid-column:1 / -1;min-width:0}
@media(max-width:600px){
 .crew>.crew-member:has(.lobby-piece-bar){grid-template-columns:minmax(0,1fr) 110px 63px 24px;column-gap:5px}
 .crew-member>.kick-player{width:24px;min-width:24px;padding:3px}
}
@media(min-width:601px) and (max-width:1100px){
 .crew>.crew-member:has(.lobby-piece-bar){grid-template-columns:minmax(0,1fr) 140px 80px 28px;column-gap:6px}
}
.lobby-theme-option.locked{width:100%;box-sizing:border-box;text-align:left;font-family:inherit;box-shadow:none}
.lobby-theme-preview .enlarge-map{top:8px;right:8px;min-height:28px;padding:5px 9px;font-size:11px;line-height:18px;border-radius:7px}
.lobby-settings-summary{grid-template-columns:repeat(3,minmax(0,1fr))}
.lobby-settings-summary>div{min-width:0;padding:12px}
@media(max-width:600px){.lobby-settings-summary>div{padding:10px 8px}.lobby-settings-summary dt{font-size:11px}.lobby-settings-summary dd{font-size:14px}}
.lobby-theme-preview .lobby-board3d{margin:0}
