/* Shared preparation spacing keeps roster, equipment, account and room views aligned. */
:root { --preparation-gutter: 28px; --preparation-gap: 16px; }
#join-panel.character-page { padding: 20px var(--preparation-gutter); }
#join-panel[data-stage="roster"] #characters-view { display: block; min-height: 0; }
#join-panel[data-stage="roster"] .preparation-main { display: none; }
#join-panel[data-stage="roster"] #preparation-roster { display: block; width: 100%; max-width: 1200px; margin: auto; border: 0; padding: 24px 0; }
#join-panel[data-stage="roster"] #preparation-roster > .profile-note { display: block; }
#join-panel[data-stage="roster"] #roster-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
#join-panel[data-stage="roster"] #roster-cards > button, #join-panel[data-stage="roster"] #roster-cards > .roster-card-wrap { min-width: 0; min-height: 270px; border-radius: 10px; }
#join-panel[data-stage="roster"] #roster-cards > .roster-card-wrap > .roster-card { min-height: 270px; padding: 22px 72px 22px 22px; border-radius: 10px; }
#join-panel[data-stage="roster"] .roster-card { flex-direction: column; align-items: flex-start; gap: 16px; background: linear-gradient(145deg, #1b3740, #10212b); }
#join-panel[data-stage="roster"] .roster-card[aria-pressed="true"] { background: linear-gradient(145deg, #244c43, #142d2b); }
#join-panel .roster-portrait { width: 72px; height: 72px; border: 1px solid #6b99957a; border-radius: 12px; background: #0c1b23; }
#join-panel[data-stage="roster"] .roster-card > div { width: 100%; min-width: 0; }
#join-panel[data-stage="roster"] .roster-card b { font-size: 20px; }
#join-panel[data-stage="roster"] .roster-card small { font-size: 12px; line-height: 1.5; }
#join-panel .roster-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid #77a39a33; }
#join-panel .roster-stats strong { display: block; margin-top: 4px; font-size: 18px; color: #d2f5e5; }
#join-panel .roster-open { display: block; margin-top: 18px; font-size: 13px; color: #a6e6cd; }
#join-panel[data-stage="roster"] .roster-actions { display: flex; align-items: center; gap: 10px; }
#join-panel[data-stage="roster"] .profile-heading { display: block; margin: 0; }
#join-panel #roster-battle { width: auto; margin: 0 0 0 auto; padding: 10px 16px; min-height: 44px; font-size: 13px; white-space: nowrap; }
#join-panel #inventory-battle { width: auto; margin: 0 0 0 auto; padding: 8px 12px; min-height: 44px; font-size: 12px; white-space: nowrap; background: #8fd6bf; color: #10252d; }
#join-panel #lobby-view .room-list-actions { align-items: stretch; }
#join-panel #lobby-view .room-list-actions button { display: inline-flex; align-items: center; justify-content: center; height: 44px; min-height: 44px; margin: 0; line-height: 1.2; }
#join-panel .item-comparison { margin: 14px 0; padding: 12px 0; border-block: 1px solid #5f85834d; }
#join-panel .item-comparison h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: #abc6c6; }
#join-panel .item-comparison table { width: 100%; border-collapse: collapse; font-size: 12px; }
#join-panel .item-comparison th, #join-panel .item-comparison td { padding: 7px 3px; text-align: right; }
#join-panel .item-comparison th:first-child { text-align: left; font-weight: 500; text-transform: capitalize; }
#join-panel .item-comparison thead { color: #88a9b0; font-size: 10px; }
#join-panel .stat-gain { color: #99e9bb; }
#join-panel .stat-loss { color: #ffa79d; }
#join-panel #inventory-empty { display: none; }

/* A compact, left-aligned room form instead of a full-width empty panel. */
#join-panel #room-composer { grid-template-columns: minmax(0, 1fr); width: min(100%, 520px); max-width: 100%; gap: 14px; padding: 18px; margin: 16px 0; }
#join-panel #room-composer h2 { min-height: 36px; padding-right: 44px; margin: 0; }
#join-panel #room-composer .room-listing { display: flex; align-items: center; gap: 10px; margin: 0; }
#join-panel #room-composer .room-listing input { width: 22px; height: 22px; min-height: 22px; padding: 0; margin: 0; flex: 0 0 auto; }
#join-panel #room-composer > .profile-note { margin: 0; line-height: 1.5; }
#join-panel #room-composer #join-button { width: 100%; grid-column: 1 / -1; margin: 0; min-height: 44px; padding: 12px; }

/* Keep the preparation navigation consistent between equipment and room selection. */
#join-panel .preparation-header { box-sizing: border-box; min-height: 48px; padding: 4px 8px; border: 0; }
#join-panel .preparation-header #room-composer-close { position: static; flex: 0 0 auto; width: auto; min-height: 44px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }

/* Preparation notices are short toasts, not loose text over the workspace. */
body:has(#join-panel:not([hidden])) #notice { top: auto; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: min(420px, calc(100vw - 32px)); padding: 10px 16px; border: 1px solid #5f9a8a; border-radius: 8px; background: #143029f2; box-shadow: 0 10px 30px #0008; color: #d8f5e9; font-size: 13px; text-align: center; z-index: 20; pointer-events: none; }
body:has(#join-panel:not([hidden])) #notice:empty { display: none; }
#join-panel #lobby-view { padding-top: var(--preparation-gap); }

@media (pointer: fine) and (min-width: 701px) {
  #join-panel.character-page { padding: 20px var(--preparation-gutter); }
  #join-panel .manager-top, #join-panel .manager-page { max-width: 1260px; margin-inline: auto; }
  #join-panel .manager-page { padding-top: 26px; }
  #join-panel .manager-page-head { align-items: center; margin-bottom: 20px; padding-bottom: 18px; }
  #join-panel .manager-page-head h1 { margin: 0; font-size: 32px; }
  #join-panel.saved-inventory #characters-view { display: block; max-width: 1260px; margin: auto; }
  #join-panel.saved-inventory[data-stage="build"] #preparation-roster { display: none; }
  #join-panel.saved-inventory .preparation-main { padding: 0; }
  #join-panel.saved-inventory #build-stage .build-heading { min-height: 62px; }
  #join-panel.saved-inventory #build-stage .build-heading { display: none; }
  #join-panel.saved-inventory #build-stage .equipment-header-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin: 2px 0 12px; padding: 4px 0; border: 0; border-radius: 0; background: transparent; box-sizing: border-box; }
  #join-panel.saved-inventory #build-stage #inventory-close { display: block; position: static; width: auto; min-height: 44px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
  #join-panel.saved-inventory #build-stage .character-tabs { position: static; min-height: 40px; margin: 0; padding: 0; gap: 6px; justify-content: flex-end; }
  #join-panel.saved-inventory #build-stage .character-tabs button { min-height: 40px; }
  #join-panel.saved-inventory #build-stage .character-overview { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: 'paper inventory'; gap: 20px; align-items: stretch; }
  #join-panel.saved-inventory #build-stage .character-overview:has(#mobile-item-dialog[open]) { grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); grid-template-areas: 'details inventory'; }
  #join-panel.saved-inventory #build-stage .character-overview:has(#mobile-item-dialog[open]) > .paper-doll-panel { display: none; }
  #join-panel.saved-inventory .item-detail-dock:not(:has(dialog[open])) { display: none; }
  #join-panel.saved-inventory .item-detail-dock { max-height: calc(100dvh - 155px); border: 1px solid #42626988; }
  #join-panel.saved-inventory #build-stage .paper-doll-panel { height: 390px; padding: 8px; gap: 6px; grid-template-columns: 64px minmax(0, 1fr) 64px; grid-template-rows: 48px repeat(3, minmax(0, 1fr)); }
  #join-panel.saved-inventory #build-stage .inventory-panel { height: auto; min-height: 0; align-self: stretch; box-sizing: border-box; display: flex; flex-direction: column; }
  #join-panel.saved-inventory #build-stage #gear-inventory { flex: 1 1 auto; min-height: 0; align-content: start; overflow-y: auto; }
  #join-panel.saved-inventory #character-preview { height: 100%; min-height: 0; }
  #join-panel.saved-inventory .gear-slot { min-height: 44px; }
  #join-panel.saved-inventory .gear-slot.slot-head { width: 64px; }
  #join-panel.saved-inventory .gear-slot .slot-item, #join-panel.saved-inventory .gear-slot .slot-empty, #join-panel.saved-inventory .gear-slot small, #join-panel.saved-inventory .paper-doll-hint { display: none; }
  #join-panel.saved-inventory #build-stage #gear-inventory { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 70px; max-height: calc(100dvh - 265px); }
  #join-panel.saved-inventory .backpack-cell { padding: 6px; gap: 5px; }
  #join-panel.saved-inventory .backpack-cell i { font-size: 22px; line-height: 1; }
  #join-panel.saved-inventory .backpack-cell b { flex-shrink: 0; width: 100%; font-size: 11px; line-height: 14px; }
  #join-panel.saved-inventory .backpack-cell small { display: none; }
  #join-panel.saved-inventory .inventory-heading { min-height: 32px; align-items: center; padding-bottom: 10px; margin-bottom: 12px; }
  #join-panel.saved-inventory .inventory-heading .eyebrow { font-size: 11px; }
  #join-panel.saved-inventory .inventory-heading > span { font-size: 12px; }
}
@media (pointer: coarse), (max-width: 700px) {
  :root { --preparation-gutter: 14px; --preparation-gap: 12px; }
  #join-panel:not([hidden]) { padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + var(--preparation-gutter)) calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + var(--preparation-gutter)); }
  #join-panel #lobby-view, #join-panel #account-view { padding: 0; }
  #join-panel #lobby-view { padding-top: var(--preparation-gap); }
  #join-panel.saved-inventory #build-stage .build-heading > div { display: none; }
  #join-panel.saved-inventory #build-stage .equipment-header-bar { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 4px; border: 0; background: transparent; }
  #join-panel.saved-inventory #build-stage #inventory-close { display: block; position: static; width: auto; height: 42px; min-height: 42px; padding: 6px 8px; font-size: 11px; white-space: nowrap; }
  #join-panel.saved-inventory #build-stage .character-tabs { position: static; width: auto; height: 44px; min-height: 44px; margin: 0; padding: 0; gap: 4px; justify-content: flex-end; }
  #join-panel.saved-inventory #build-stage .character-tabs button { width: auto; height: 40px; min-height: 40px; padding: 5px 8px; font-size: 11px; }
  #join-panel.saved-inventory #build-stage .character-tabs #mobile-roster-toggle { display: none; }
  #join-panel[data-stage="roster"] #characters-view { flex: 1; min-height: 0; overflow: hidden; }
  #join-panel[data-stage="roster"] #preparation-roster { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 12px 0; }
  #join-panel[data-stage="roster"] #preparation-roster > .profile-note { display: none; }
  #join-panel[data-stage="roster"] #roster-cards { flex: 1; min-height: 0; gap: 10px; margin: 10px 0; grid-auto-rows: minmax(0, 1fr); }
  #join-panel.saved-inventory:has(#characters-view:not([hidden]) #build-stage:not([hidden])) { padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + var(--preparation-gutter)) calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + var(--preparation-gutter)); }
  #join-panel[data-stage="roster"] #roster-cards > button { position: relative; min-height: 0; height: 100%; padding: 12px; }
  #join-panel[data-stage="roster"] #roster-cards > .roster-card-wrap { position: relative; min-height: 0; height: 100%; }
  #join-panel[data-stage="roster"] #roster-cards > .roster-card-wrap > .roster-card { min-height: 0; height: 100%; padding: 12px; }
  /* Avatar beside the name; Edit sits bottom-right, clear of names and stats. */
  #join-panel[data-stage="roster"] .roster-edit { top: auto; bottom: 10px; right: 10px; }
  #join-panel[data-stage="roster"] .roster-card { gap: 8px; }
  #join-panel .roster-portrait { position: absolute; top: 10px; left: 12px; width: 30px; height: 30px; border-radius: 7px; }
  #join-panel[data-stage="roster"] .roster-card b { display: block; min-height: 30px; line-height: 30px; padding-left: 38px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #join-panel[data-stage="roster"] .roster-card small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #join-panel .roster-stats { gap: 5px; margin-top: 10px; padding-top: 6px; }
  #join-panel[data-stage="roster"] .roster-stats small { font-size: 10px; }
  #join-panel .roster-stats strong { font-size: 14px; }
  #join-panel .roster-open { margin-top: 8px; font-size: 11px; }
  #join-panel[data-stage="roster"] .roster-actions { flex: 0 0 44px; }
  #join-panel[data-stage="roster"]:has(#roster-cards > :nth-child(4)) #characters-view { overflow-y: auto; }
  #join-panel[data-stage="roster"]:has(#roster-cards > :nth-child(4)) #preparation-roster { height: auto; }
  #join-panel[data-stage="roster"]:has(#roster-cards > :nth-child(4)) #roster-cards { grid-auto-rows: 170px; flex: none; }
  #join-panel #room-composer { width: 100%; margin: 0; padding: 8px 12px; gap: 8px; }
}

/* Preparation progresses forward; account settings have a direct header action. */
#join-panel .preparation-header { display: flex; align-items: center; justify-content: flex-start; gap: 14px; min-height: 48px; padding: 4px 0; border: 0; }
#join-panel .preparation-header strong { font-size: 17px; font-weight: 600; letter-spacing: .015em; }
#join-panel .preparation-header > .preparation-account-button { margin-left: auto; }
#join-panel .preparation-header > strong { min-width: 0; }
#join-panel .preparation-room-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
#join-panel .preparation-room-actions[hidden] { display: none; }
#join-panel .preparation-room-actions button { display: inline-flex; align-items: center; justify-content: center; height: 44px; min-height: 44px; margin: 0; padding: 7px 12px; line-height: 1.2; white-space: nowrap; }
#join-panel .preparation-room-actions #refresh-rooms { width: 44px; padding: 0; }
#join-panel .preparation-account-button { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; min-height: 40px; flex: 0 0 40px; padding: 0; background: transparent; border: 0; color: #c1dad7; }
#join-panel .preparation-account-button[hidden] { display: none; }
#join-panel .preparation-account-button svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#join-panel .preparation-account-button:hover, #join-panel .preparation-account-button:focus-visible { color: #a6ebd1; background: #18333b; }
#join-panel #preparation-back { min-height: 44px; padding: 8px 12px; font-size: 12px; }
#join-panel .survivor-caption { display: none; }
#join-panel.saved-inventory .gear-slot { border-radius: 8px; background: linear-gradient(150deg, #1c343e, #12252f); box-shadow: inset 0 1px #ffffff06; }
#join-panel.saved-inventory .gear-slot.active { border-color: #a0dbc5; background: #27443f; }
#join-panel.saved-inventory .gear-slot[class*="rarity-"] { border-color: color-mix(in srgb, var(--rarity) 72%, #243942); box-shadow: inset 0 0 18px color-mix(in srgb, var(--rarity) 10%, transparent); }
#join-panel.saved-inventory .gear-slot[class*="rarity-"].active { border-color: color-mix(in srgb, var(--rarity) 82%, #fff 18%); outline: 1px solid #91d7c0; outline-offset: 1px; }
#join-panel.saved-inventory .backpack-cell.empty-cell { display: flex; min-height: 0; border-color: #4c6e7545; border-bottom-width: 1px; background: #10242c55; box-shadow: inset 0 1px 5px #0002; opacity: .28; pointer-events: none; }
#join-panel.saved-inventory .backpack-filters button { border-radius: 6px; }
#join-panel.saved-inventory .backpack-filters button[aria-selected="true"] { border-color: #82cdb5; background: #24483f; color: #d6f5e8; }
#join-panel .character-tabs #inventory-battle { display: inline-flex; justify-content: center; align-items: center; text-align: center; line-height: 1.2; }
#join-panel .backpack-pending { flex: 0 0 auto; margin: 0 0 8px; padding: 8px 10px; border: 1px solid #b68b55; border-radius: 6px; background: #352d1e; color: #f2d39b; font-size: 11px; line-height: 1.45; }
#join-panel .backpack-pending[hidden] { display: none; }
.equipment-icon { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.gear-slot .equipment-icon { width: 20px; height: 20px; }
.backpack-cell .equipment-icon { width: 24px; height: 24px; }
.slot-sockets { display: flex; gap: 5px; align-items: center; justify-content: center; margin-top: 3px; }
.slot-socket { display: block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #7f9ea6; background: #0a1720; box-shadow: inset 0 0 2px #0008; }
.slot-socket.filled { border-color: color-mix(in srgb, var(--socket-color, #d5dde1) 65%, white); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--socket-color, #d5dde1) 35%, white), var(--socket-color, #d5dde1) 55%, color-mix(in srgb, var(--socket-color, #d5dde1) 45%, #08121b)); box-shadow: 0 0 7px color-mix(in srgb, var(--socket-color, #d5dde1) 60%, transparent); }
#join-panel.saved-inventory .character-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; max-width: 760px; margin: 14px 0 18px; }
#join-panel.saved-inventory .character-stats .stat-cell { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-width: 0; padding: 9px 2px; border: 0; border-bottom: 1px solid #5c7c8052; border-radius: 0; background: transparent; }
#join-panel.saved-inventory .character-stats .stat-cell span { font-size: 13px; color: #9fb9bc; }
#join-panel.saved-inventory .character-stats .stat-cell b { margin: 0; font-size: 15px; white-space: nowrap; }

@media (pointer: fine) and (min-width: 701px) {
  #join-panel.saved-inventory #build-stage .character-tabs { align-items: center; gap: 6px; padding: 0; border: 0; border-radius: 0; background: transparent; margin: 0; }
  #join-panel.saved-inventory #build-stage .character-tabs button { min-height: 44px; }
  #join-panel.saved-inventory .inventory-panel { padding: 16px; border: 1px solid #4e73754d; border-radius: 10px; background: #10242c88; }
}
@media (pointer: coarse), (max-width: 700px) {
  #join-panel .preparation-header { flex: 0 0 52px; padding: 4px 0; min-height: 52px; }
  #join-panel .preparation-header strong { font-size: 15px; }
  #join-panel .preparation-header { gap: 8px; }
  #join-panel .preparation-room-actions { gap: 4px; }
  #join-panel .preparation-room-actions button { min-height: 40px; height: 40px; padding: 5px 7px; font-size: 11px; }
  #join-panel .preparation-room-actions #refresh-rooms { width: 36px; }
  #join-panel[data-stage="roster"] #roster-cards { margin-top: 0; }
  #join-panel.saved-inventory #build-stage::before { border: 0; border-radius: 0; background: transparent; }
  #join-panel.saved-inventory #build-stage .character-tabs { gap: 4px; }
  #join-panel.saved-inventory #build-stage .character-overview { gap: 12px; padding-top: 10px; }
  #join-panel.saved-inventory #build-stage .paper-doll-panel { position: relative; inset: auto; width: 100%; height: 100%; padding: 8px 6px 24px; border: 1px solid #4e73754d; border-radius: 10px; background: radial-gradient(ellipse at 50% 55%, #25464a99, #10212c88 75%); grid-template-columns: 60px minmax(0, 1fr) 60px; grid-template-rows: 44px repeat(3, minmax(0, 1fr)); }
  #join-panel.saved-inventory .survivor-caption { display: block; position: absolute; inset: auto 65px 7px; margin: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #aac8c7; font-size: 10px; pointer-events: none; }
  #join-panel.saved-inventory #build-stage .gear-slot { align-self: center; height: 100%; max-height: 64px; }
  #join-panel.saved-inventory #build-stage .inventory-panel { padding: 8px 10px 0; border: 1px solid #4e73754d; border-radius: 10px; background: #10242c88; }
  #join-panel.saved-inventory #build-stage .inventory-heading { display: flex; flex: 0 0 24px; padding: 0; margin: 0 0 6px; align-items: flex-start; }
  #join-panel.saved-inventory #build-stage .inventory-heading .eyebrow { display: block; font-size: 10px; letter-spacing: .12em; margin: 0; }
  #join-panel.saved-inventory #build-stage .inventory-heading #gear-materials { font-size: 10px; }
  #join-panel.saved-inventory #build-stage .backpack-filters { flex-basis: 46px; height: 46px; gap: 6px; }
  #join-panel.saved-inventory #build-stage .backpack-cell { padding: 3px; gap: 2px; }
  #join-panel.saved-inventory #build-stage .backpack-cell .equipment-icon { width: 19px; height: 19px; }
  #join-panel.saved-inventory #build-stage .backpack-cell b { font-size: 9px; line-height: 12px; }
  #join-panel #mobile-item-dialog { inset: 58px auto 0 0; height: calc(100% - 58px); border: 1px solid #4e737577; border-radius: 10px; }
}
@media (max-width: 480px) {
  #join-panel .preparation-header { gap: 5px; }
  #join-panel #preparation-back { padding-inline: 6px; font-size: 11px; }
  #join-panel .preparation-header strong { font-size: 13px; }
  #join-panel .preparation-room-actions { gap: 3px; }
  #join-panel .preparation-room-actions button { padding-inline: 5px; font-size: 10px; }
  #join-panel .preparation-room-actions #refresh-rooms { width: 32px; }
}

/* Native buttons centre their content vertically; flex/inline-flex text buttons
   would bypass the global text-box trim (anonymous flex items are not trimmed). */
.primary { display: block; text-align: center; }
#join-panel #lobby-view .room-list-actions button, #join-panel .preparation-room-actions button, #join-panel .character-tabs #inventory-battle { display: inline-block; }

/* Creation steps are a focused flow: the roster stays out of the way and the
   header back button cancels to it. */
#join-panel:is([data-stage="name"], [data-stage="class"]) #preparation-roster { display: none; }
#join-panel:is([data-stage="name"], [data-stage="class"]):not([hidden]) { position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: none; margin: 0; transform: none; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; }
#join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-header { flex: 0 0 auto; width: 100%; max-width: none; padding-inline: 0; gap: 12px; }
#join-panel:is([data-stage="name"], [data-stage="class"]) #preparation-title { flex: 1; min-width: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mint); line-height: 1.5; }
#join-panel .preparation-header .creation-next { flex: 0 0 auto; width: auto; min-width: 0; max-width: none; min-height: 44px; margin: 0; padding: 10px 16px; font-size: 13px; white-space: nowrap; }
#join-panel:is([data-stage="name"], [data-stage="class"]) #characters-view { display: block; flex: 1; min-height: 0; width: 100%; max-width: none; overflow-y: auto; }
#join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-main { width: 100%; max-width: 1200px; margin: auto; padding: clamp(24px, 7vh, 72px) 0 24px; box-sizing: border-box; }
#join-panel #name-stage { max-width: 600px; }
#join-panel[data-stage="name"] #name-stage { display: block; width: min(100%, 600px); margin: clamp(0px, 8vh, 80px) auto 0; }
#join-panel #name-stage .creation-name { max-width: none; margin: 28px 0 0; }
#join-panel #name-stage .creation-name input { min-height: 54px; font-size: 18px; }
#join-panel #name-stage .creation-name small { display: block; margin-top: 12px; line-height: 1.5; }
#join-panel[data-stage="class"] .classes { margin: 20px 0 0; }
#join-panel[data-stage="class"] #back-name { margin-bottom: 20px; }
#join-panel:is([data-stage="name"], [data-stage="class"]) #profile-error:empty { display: none; }
@media (max-height: 520px) and (min-width: 701px) {
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-main { padding: 12px 0 16px; }
  #join-panel[data-stage="class"] h1 { font-size: 22px; margin: 2px 0 8px; }
  #join-panel[data-stage="class"] .intro, #join-panel[data-stage="class"] #back-name { display: none; }
  #join-panel[data-stage="class"] .classes { margin-top: 12px; }
  #join-panel[data-stage="class"] .classes span { min-height: 0; padding: 14px; }
  #join-panel[data-stage="class"] .classes i { height: 48px; font-size: 36px; }
  #join-panel[data-stage="class"] .classes p { line-height: 1.5; }
}
@media (pointer: coarse), (max-width: 700px) {
  .character-page #build-stage .build-heading h1 { display: none; }
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-main { padding: 16px 0 18px; }
  /* Landscape phones: one-line headings, no intro copy, so steps fit 390px. */
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-main h1 { font-size: 22px; margin: 2px 0 8px; }
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-main h1 br { display: none; }
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-main .intro { display: none; }
  #join-panel[data-stage="class"] #back-name { display: none; }
  #join-panel[data-stage="name"] #name-stage { margin-top: 16px; }
  #join-panel[data-stage="class"] .classes { margin-top: 14px; }
  #join-panel[data-stage="class"] .classes span { min-height: 0; padding: 14px; }
  #join-panel[data-stage="class"] .classes i { height: 48px; font-size: 36px; }
  #join-panel[data-stage="class"] .classes p { line-height: 1.5; }
}
@media (max-width: 600px) {
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  #join-panel:is([data-stage="name"], [data-stage="class"]) #preparation-back { grid-column: 1; grid-row: 1; }
  #join-panel:is([data-stage="name"], [data-stage="class"]) #preparation-title { grid-column: 2; grid-row: 1; font-size: 10px; }
  #join-panel:is([data-stage="name"], [data-stage="class"]) .preparation-account-button { grid-column: 3; grid-row: 1; }
  #join-panel .preparation-header .creation-next { grid-column: 1 / -1; grid-row: 2; width: 100%; }
}

/* Text fields share the panel surfaces; focus is one mint ring, not an
   offset outline around a grey default box. */
:is(input:not([type]), input[type="text"], input[type="search"], input[type="email"]) {
  min-height: 46px; padding: 0 14px; box-sizing: border-box; border: 1px solid #48636e; border-radius: 7px;
  background: #0f1d24; color: #e6ece8; caret-color: var(--mint); transition: border-color .15s, box-shadow .15s, background .15s;
}
:is(input:not([type]), input[type="text"], input[type="search"], input[type="email"]):hover { border-color: #6c8c94; }
:is(input:not([type]), input[type="text"], input[type="search"], input[type="email"]):focus-visible { outline: none; border-color: var(--mint); background: #12252d; box-shadow: 0 0 0 3px #83dfc72e; }
:is(input:not([type]), input[type="text"], input[type="search"], input[type="email"])::placeholder { color: #6f8a8f; }
:is(input:not([type]), input[type="text"], input[type="search"], input[type="email"]):read-only { color: #a9bcbc; background: #0c181e; }
