/* A quiet, pastel control surface above the voxel world. Geometry and input
   ownership stay in index.html; this layer owns the visual treatment. */
:root {
  --ui-font: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ui-ink: #354b52;
  --ui-paper: #faf9f3;
  --ui-yellow: #eee2ba;
  --ui-pink: #efd2c9;
  --ui-cyan: #c9e5df;
  --ui-lime: #dce8cf;
  --ui-purple: #dbd5eb;
  --ui-danger: #a34247;
  --ui-paper-strong: rgba(250, 249, 243, .94);
  --ui-paper-muted: rgba(250, 249, 243, .65);
  --ui-ink-strong: rgba(53, 75, 82, .94);
  --ui-ink-solid: rgba(53, 75, 82, .82);
  --ui-ink-soft: rgba(53, 75, 82, .32);
  --ui-ink-faint: rgba(53, 75, 82, .12);
  --ui-cyan-soft: rgba(201, 229, 223, .65);
  --ui-yellow-soft: rgba(238, 226, 186, .55);
  --ui-border: rgba(74, 101, 105, .20);
  --ui-line: 1px solid var(--ui-border);
  --ui-line-paper: 1px solid rgba(250, 249, 243, .7);
  --ui-shadow-sm: 0 3px 12px rgba(37, 67, 73, .08);
  --ui-shadow-md: 0 8px 24px rgba(37, 67, 73, .12);
  --ui-shadow-lg: 0 16px 48px rgba(37, 67, 73, .16);
  --ui-motion: 180ms;
  --ui-chat-minecraft-line: rgba(201, 229, 223, .25);
  --ui-chat-minecraft-strip: transparent;
  --ui-chat-minecraft-focus: #6e9e98;
  --ui-chat-minecraft-text: var(--ui-ink);
  --ui-chat-minecraft-error: var(--ui-danger);
  --ui-chat-minecraft-shadow: transparent;
  --ui-chat-minecraft-scrollbar: #b0c5c1;
  --ui-chat-minecraft-hover: rgba(201, 229, 223, .5);
  --ui-chat-minecraft-hover-outline: transparent;
  --ui-chat-minecraft-send-hover: #b9dbd3;
  --ui-chat-minecraft-send-outline: transparent;
  --map-water: #91c6cf;
  --map-sand: #efe5c7;
  --map-grass: #b2cdaa;
  --map-highland: #83a78b;
}
body, button, input, select { font-family: var(--ui-font); }
button { cursor: pointer; transition: background var(--ui-motion) ease, box-shadow var(--ui-motion) ease; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #648c8a;
  outline-offset: 3px;
}
#social-toolbar { padding: 4px; border: var(--ui-line); border-radius: 18px; background: var(--ui-paper-strong); box-shadow: var(--ui-shadow-md); }
#social-toolbar button { border-color: transparent; border-radius: 13px; background: transparent; font-weight: 600; }
#social-toolbar button:hover { background: var(--ui-cyan-soft); }
#social-toolbar button[aria-pressed="true"] { background: var(--ui-purple); }
#social-toolbar #chat-toggle { background: var(--ui-cyan); }
#weather, #multiplayer-status { border-radius: 16px; background: var(--ui-paper-strong); font: 500 11px/1.25 var(--ui-font); letter-spacing: .02em; text-transform: none; padding: 8px 12px; }
#multiplayer-status { border-left: 3px solid #a1b89c; }
#minimap-toggle, #block-panel-toggle { border-radius: 14px; background: var(--ui-paper-strong); font: 600 11px/1 var(--ui-font); }
#minimap-toggle:hover, #block-panel-toggle:hover { background: var(--ui-cyan); transform: none; }
#minimap-toggle:active, #block-panel-toggle:active { transform: none; box-shadow: var(--ui-shadow-sm); }
#minimap-canvas { border: var(--ui-line); border-radius: 18px; box-shadow: var(--ui-shadow-md); }
#play-hint, #current-block { border-radius: 16px; background: var(--ui-paper-strong); color: var(--ui-ink); font: 500 12px/1.4 var(--ui-font); box-shadow: var(--ui-shadow-sm); }
#play-hint { padding: 8px 14px; }
#crosshair { width: 14px; height: 14px; }
#crosshair::before { left: 6px; height: 14px; width: 1px; }
#crosshair::after { top: 6px; width: 14px; height: 1px; }
#overlay, #name-gate { background: rgba(80, 110, 117, .25); }
#overlay .panel, #name-form { border-radius: 24px; background: var(--ui-paper-strong); font-family: var(--ui-font); box-shadow: var(--ui-shadow-lg); }
#overlay h1 { font: 500 28px/1.3 var(--ui-font); letter-spacing: .02em; }
#overlay p { color: var(--ui-ink); line-height: 1.8; }
#overlay .start, #name-form button { border-radius: 14px; font: 600 14px/1.2 var(--ui-font); background: var(--ui-cyan); box-shadow: var(--ui-shadow-sm); }
#overlay .start:hover, #name-form button:hover { background: #b9dbd3; transform: none; box-shadow: var(--ui-shadow-md); }
#overlay .start:active, #name-form button:active { transform: none; box-shadow: var(--ui-shadow-sm); }
#overlay[data-started="true"] .panel { border-radius: 18px; }
#name-form label { font-weight: 600; letter-spacing: 0; text-transform: none; }
#name-form input, #name-form select { border-radius: 12px; background: #fffdf9; padding: 10px 12px; }
#conversation-shell { border-radius: 22px; background: var(--ui-paper-strong); font-family: var(--ui-font); }
#conversation-shell-header { background: transparent; border-bottom: var(--ui-line); }
.conversation-tab { border-radius: 12px; border-color: transparent; background: transparent; font-weight: 600; }
.conversation-tab[aria-current="true"] { background: var(--ui-cyan); }
#conversation-shell-collapse, #conversation-shell-close { border: 0; box-shadow: none; border-radius: 12px; background: transparent !important; font-weight: 500; }
#conversation-shell-collapse:hover { background: var(--ui-yellow-soft) !important; }
#conversation-shell-close:hover { background: var(--ui-pink) !important; }
#chat-panel { font: 14px/1.5 var(--ui-font); }
#chat-panel #chat-focus-hint, #chat-mode { font-family: var(--ui-font); font-weight: 500; }
#chat-panel #chat-focus-hint { color: #63787d; border-radius: 8px; }
#chat-panel #chat-mode { color: #63787d; }
#chat-messages { scrollbar-width: thin; }
.chat-message { padding: 8px 10px; border-radius: 12px; margin: 4px 0; background: rgba(219, 213, 235, .22); }
.chat-message.self { background: rgba(201, 229, 223, .38); }
#chat-panel .chat-message strong { font-weight: 600; }
.chat-empty, #chat-panel #chat-text::placeholder { color: #63787d; }
#chat-form { background: transparent; gap: 6px; }
#chat-panel #chat-text { border-radius: 12px; background: #fffdf9; padding: 9px 12px; }
#chat-text:focus { border-color: #6e9e98; box-shadow: 0 0 0 2px rgba(110, 158, 152, .16); }
#chat-panel #chat-form button { border-radius: 12px; font: 600 12px/1 var(--ui-font); padding-inline: 14px; }
#player-list button { border-radius: 12px; font: 500 12px var(--ui-font); background: rgba(219, 213, 235, .3); }
#player-list button:hover { background: var(--ui-purple); }
#chat-return { border-radius: 12px; font-weight: 500; background: transparent; }
#chat-return:hover { background: var(--ui-yellow-soft); }
#hotbar { border-radius: 18px; background: var(--ui-paper-strong); padding: 5px; }
.slot { border: 1px solid transparent; border-radius: 12px; background: transparent; }
.slot:hover { background: var(--ui-cyan-soft); }
.slot.active { border-color: #799f98; background: var(--ui-cyan); box-shadow: none; }
.slot .num { color: var(--ui-ink); text-shadow: none; font: 500 10px var(--ui-font); }
#block-panel { border-radius: 18px; background: var(--ui-paper-strong); font-family: var(--ui-font); }
.block-category h2 { font-weight: 600; letter-spacing: .02em; text-transform: none; }
.block-choice { border-radius: 8px; border-color: transparent; background: transparent; }
.block-choice:hover { background: var(--ui-cyan-soft); box-shadow: none; }
.block-choice.active { border-color: #799f98; background: var(--ui-cyan); box-shadow: none; }
body.mobile-controls #mobile-stick { background: rgba(250, 249, 243, .65); box-shadow: var(--ui-shadow-md); }
body.mobile-controls #mobile-stick::after { background: var(--ui-cyan); }
body.mobile-controls .mobile-action { border-radius: 18px; font: 600 11px/1 var(--ui-font); background: var(--ui-paper-strong); }
body.mobile-controls #mobile-jump { border-radius: 18px; }
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}


#players-panel { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: var(--ui-modal); width: min(340px, calc(100vw - 24px)); max-height: calc(100dvh - 100px); overflow-y: auto; padding: 14px; border: var(--ui-line); border-radius: 22px; background: var(--ui-paper-strong); color: var(--ui-ink); box-shadow: var(--ui-shadow-lg); font: 14px/1.5 var(--ui-font); }
#players-panel[hidden] { display: none; }
#players-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#players-heading { font: 600 15px var(--ui-font); }
#roster-count { margin-left: 6px; color: #63787d; font-size: 12px; }
#players-close { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ui-ink); font-size: 18px; }
#players-close:hover { background: var(--ui-pink); }
.players-hint, #players-empty { color: #63787d; font-size: 12px; margin: 8px 0; }
#players-panel #player-list { display: grid; gap: 6px; }
#player-list .player-self, #players-panel #player-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 12px; text-align: left; font: 500 13px var(--ui-font); }
#player-list .player-self { background: var(--ui-cyan-soft); }
#players-panel #player-list button::before, .player-self::before { content: ''; flex: 0 0 10px; height: 10px; border-radius: 50%; background: var(--player-color, #7ea79c); }
#show-players { padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; color: #63787d; font: 500 12px var(--ui-font); }
#show-players:hover { background: var(--ui-cyan-soft); }
body.roster-open #conversation-shell { display: none; }
@media (max-width: 600px) { #social-toolbar button { padding-inline: 6px; } }

#meeting-panel { position: fixed; left: 16px; top: 82px; z-index: var(--ui-hud, 10); width: 270px; max-height: calc(100dvh - 180px); overflow-y: auto; box-sizing: border-box; padding: 14px; border: var(--ui-line); border-radius: 20px; background: var(--ui-paper-strong); color: var(--ui-ink); box-shadow: var(--ui-shadow-md); font: 12px/1.6 var(--ui-font); }
#meeting-panel[hidden], #meeting-panel [hidden] { display: none; }
#meeting-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
#meeting-panel p { margin: 10px 0; }
#meeting-panel button { min-height: 38px; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--ui-cyan-soft); color: var(--ui-ink); font: 500 12px var(--ui-font); cursor: pointer; }
#meeting-panel button:disabled { opacity: .55; cursor: default; }
#meeting-panel button:hover:not(:disabled) { background: var(--ui-cyan); }
#meeting-fold { min-width: 38px; }
#meeting-join, #meeting-confirm { width: 100%; }
.meeting-buttons { display: flex; gap: 6px; margin: 8px 0; }
#meeting-mark-form { border-top: var(--ui-line); margin-top: 12px; padding-top: 10px; }
#meeting-mark-form label { display: block; }
#meeting-mark-text { width: 100%; box-sizing: border-box; margin-top: 5px; border: var(--ui-line); border-radius: 10px; padding: 9px; background: var(--ui-paper); color: var(--ui-ink); font: 12px var(--ui-font); }
#meeting-mark-notice { color: #63787d; font-size: 11px; }
#meeting-panel #meeting-cancel { background: transparent; margin-top: 8px; }
body.chat-open #meeting-panel, body.roster-open #meeting-panel { display: none; }
@media (max-width: 600px), (max-height: 500px) {
  #meeting-panel { top: 82px; width: min(220px, calc(100vw - 184px)); left: 12px; max-height: calc(100dvh - 260px); padding: 10px; }
  #meeting-panel button { min-height: 44px; }
}
#gamepad-status { position: fixed; right: 16px; bottom: 54px; z-index: 40; max-width: min(480px, calc(100vw - 32px)); padding: 8px 12px; border-radius: 14px; background: var(--ui-paper); color: var(--ui-ink); font: 12px system-ui; pointer-events: none; }
#gamepad-status[hidden] { display: none; }
#world-lobby { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: #e6f0e9; overflow: auto; padding: 24px; }
.world-card { width: min(520px, calc(100vw - 48px)); box-sizing: border-box; border: 0; border-radius: 24px; background: #faf9f4; color: #34504e; padding: 28px; font-family: system-ui; box-shadow: 0 12px 50px #34504e22; }
.world-card label { display: grid; gap: 8px; margin: 14px 0; }
.world-card input { box-sizing: border-box; width: 100%; padding: 12px; border: 1px solid #bbcfca; border-radius: 12px; font: inherit; }
.world-card button { margin: 8px 8px 0 0; padding: 12px 18px; border: 0; border-radius: 12px; background: #c7e3da; color: #34504e; cursor: pointer; font: inherit; }
#world-list { margin: 22px 0; display: grid; gap: 6px; }
#world-error { color: #a13f40; }
body.worlds-lobby #overlay, body.worlds-lobby #social-toolbar, body.worlds-lobby #play-hint { display: none; }
.world-card::backdrop { background: #24453a55; backdrop-filter: blur(3px); }
/* World management: calm paper surfaces, clearly separated destinations. */
.world-management {
  --wm-ink: #304e49; --wm-muted: #778a83; --wm-line: #dfe7df; --wm-accent: #527b69;
  position: fixed; inset: 0; margin: auto; padding: 0; width: min(930px, calc(100vw - 48px));
  height: min(720px, calc(100dvh - 48px)); max-height: none; overflow: hidden;
  border: 1px solid #ffffffb3; border-radius: 26px; background: #f5f7f0; color: var(--wm-ink);
  box-shadow: 0 28px 100px #163a3340; font: 14px/1.5 var(--ui-font, system-ui);
}
.world-management[open] { display: flex; flex-direction: column; }
.world-management::backdrop { background: #233e3d75; backdrop-filter: blur(8px); }
.world-management *, .world-management *::before, .world-management *::after { box-sizing: border-box; }
.world-management [hidden] { display: none !important; }
.world-management h2, .world-management h3, .world-management h4, .world-management p { margin: 0; }
.world-management button { margin: 0; min-height: 42px; padding: 10px 16px; background: transparent; color: var(--wm-ink); font: 500 13px/1.4 var(--ui-font, system-ui); transition: background .15s, box-shadow .15s; }
.world-management button:disabled, .world-management select:disabled { opacity: .5; cursor: default; }
.world-management :is(button,input,select):focus-visible { outline: 3px solid #91b4a0; outline-offset: 3px; }
.world-management svg { width: 22px; height: 22px; flex-shrink: 0; }
.wm-header { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; padding: 23px 28px; border-bottom: 1px solid var(--wm-line); background: #fbfcf7; }
.wm-world-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: #e0ebdd; color: #60836b; }
.wm-world-icon svg { width: 30px; height: 30px; }
.wm-heading { flex: 1; }
.wm-eyebrow { display: block; margin-bottom: 3px; color: var(--wm-muted); font-size: 11px; letter-spacing: .08em; }
.world-management h2 { font-size: 21px; font-weight: 600; letter-spacing: .03em; }
.world-management #world-manage-close { display: grid; place-items: center; width: 40px; padding: 8px; color: var(--wm-muted); border-radius: 50%; }
.world-management #world-manage-close:hover { background: #eaf0e7; }
.wm-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); min-height: 0; flex: 1; }
.wm-nav { display: flex; flex-direction: column; justify-content: space-between; padding: 25px 14px; background: #eff3e9; border-right: 1px solid var(--wm-line); }
.wm-nav [role=tablist] { display: grid; gap: 8px; }
.world-management .wm-nav button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 12px 14px; min-height: 48px; color: #74867a; }
.world-management .wm-nav button[aria-selected=true] { background: #dde9d9; color: #355d49; }
.world-management .wm-nav button:hover:not(:disabled) { background: #e3ecdd; }
.wm-nav-note { padding: 0 14px; color: #92a08f; font-size: 12px; line-height: 1.9; }
.wm-content { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c5d1c2 transparent; padding: 28px 32px 24px; }
.wm-page-heading { margin-bottom: 21px; }
.world-management h3 { font-size: 19px; font-weight: 600; }
.wm-page-heading p { color: var(--wm-muted); font-size: 12px; margin-top: 6px; }
.wm-card { margin-bottom: 16px; padding: 20px; background: #fffef9; border: 1px solid var(--wm-line); border-radius: 18px; }
.wm-basic { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
.world-management label { margin: 0; gap: 9px; font-size: 12px; font-weight: 500; }
.world-management :is(input:not([type=checkbox]),select) { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--wm-ink); border: 1px solid #d4dfd2; border-radius: 10px; background: #f8faf5; font: 13px var(--ui-font, system-ui); }
.world-management input::placeholder { color: #a1ada0; }
.wm-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.world-management h4 { font-size: 14px; font-weight: 600; }
.wm-card-heading p, .wm-invites p { font-size: 12px; color: var(--wm-muted); margin-top: 5px; }
.world-management .wm-rule { display: flex; align-items: center; position: relative; gap: 16px; padding: 12px 0; cursor: pointer; }
.world-management .wm-rule + .wm-rule { border-top: 1px solid #ecf0e6; }
.wm-rule > span:first-child { flex: 1; }
.wm-rule strong { display: block; font-size: 13px; font-weight: 500; }
.wm-rule small { display: block; color: var(--wm-muted); font-size: 11px; line-height: 1.6; margin-top: 3px; }
.world-management .wm-rule input { position: absolute; right: 0; opacity: 0; width: 40px; height: 24px; margin: 0; }
.wm-switch { width: 40px; height: 24px; padding: 3px; background: #dce3d8; border-radius: 20px; flex-shrink: 0; transition: background .2s; }
.wm-switch::before { content: ''; display: block; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px #31523b22; transition: transform .2s; }
.wm-rule input:checked + .wm-switch { background: #7b9b81; }
.wm-rule input:checked + .wm-switch::before { transform: translateX(16px); }
.wm-rule input:focus-visible + .wm-switch { outline: 3px solid #91b4a0; outline-offset: 3px; }
.wm-rule input:disabled + .wm-switch { opacity: .5; }
.wm-spawn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.world-management #world-spawn-here { grid-column: 1 / -1; justify-self: start; }
.world-management .wm-primary { background: #527b69; color: #fff; box-shadow: 0 3px 8px #527b6920; }
.world-management .wm-primary:hover:not(:disabled) { background: #416654; }
.world-management .wm-secondary { background: #eaf0e4; color: #4e7159; }
.world-management .wm-secondary:hover:not(:disabled) { background: #dce8d5; }
.wm-footer { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; gap: 16px; min-height: 76px; padding: 16px 28px; border-top: 1px solid var(--wm-line); background: #fbfcf7; }
.wm-footer [role=status] { color: #6c8370; font-size: 12px; overflow-wrap: anywhere; }
.wm-footer [role=status]:empty { visibility: hidden; }
.wm-count { color: #8c9b87; background: #edf2e7; padding: 3px 9px; border-radius: 12px; font-size: 11px; white-space: nowrap; }
.wm-members-card { padding-bottom: 8px; }
.world-member-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.world-member-row + .world-member-row { border-top: 1px solid #edf0e7; }
.wm-avatar { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; background: #e7eddf; color: #789171; border-radius: 14px; font-size: 14px; }
.wm-member-identity { flex: 1; min-width: 0; }
.wm-member-identity span { display: block; overflow-wrap: anywhere; font-size: 13px; }
.wm-member-identity small { color: #8b9985; font-size: 11px; }
.wm-owner-badge { color: #8a977c; font-size: 11px; background: #f0f1e6; padding: 5px 10px; border-radius: 10px; white-space: nowrap; }
.world-management .world-member-row select { width: 100px; min-height: 38px; flex-shrink: 0; font-size: 12px; }
.world-management .wm-remove { padding: 8px; color: #a38b7f; min-width: 40px; }
.world-management .wm-remove:hover { background: #f8eee7; color: #9e6256; }
.wm-invites { display: grid; gap: 16px; }
.world-management .wm-danger { justify-self: start; border: 1px solid #e5d8cc; color: #a4806b; background: #fcf8f2; }
.world-management .wm-danger:hover:not(:disabled) { background: #f4e9df; }
.wm-backup-banner { display: flex; align-items: center; gap: 14px; padding: 22px; border-radius: 18px; background: #e6eddd; margin-bottom: 22px; }
.wm-backup-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: #f4f8ed; color: #809575; flex-shrink: 0; }
.wm-backup-banner > div:nth-child(2) { flex: 1; }
.wm-backup-banner p { font-size: 11px; color: #85947c; margin-top: 5px; }
.wm-backup-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; }
.wm-backup-row + .wm-backup-row { border-top: 1px solid #edf0e7; }
.wm-backup-label { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.wm-backup-label small { display: block; font-size: 11px; color: #8c9987; margin-top: 4px; }
.wm-empty { padding: 34px 12px; text-align: center; color: #879a80; }
.wm-empty p { margin-top: 8px; font-size: 12px; color: #99a491; }
.world-management .wm-footnote { font-size: 11px; color: #8b9884; padding: 0 4px; }
@media (max-width: 650px) {
  .world-management { width: calc(100vw - 24px); height: calc(100dvh - 24px); border-radius: 22px; }
  .wm-header { padding: 17px 18px; gap: 11px; }
  .wm-world-icon { width: 40px; height: 40px; border-radius: 13px; }
  .world-management h2 { font-size: 18px; }
  .wm-layout { display: flex; flex-direction: column; }
  .wm-nav { padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--wm-line); }
  .wm-nav [role=tablist] { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .world-management .wm-nav button { padding: 10px 4px; justify-content: center; font-size: 12px; gap: 5px; min-height: 44px; white-space: nowrap; }
  .wm-nav button svg { width: 17px; height: 17px; }
  .wm-nav-note { display: none; }
  .wm-content { padding: 21px 16px; min-height: 0; flex: 1; }
  .world-management h3 { font-size: 17px; }
  .wm-card { padding: 16px; border-radius: 16px; }
  .wm-basic { grid-template-columns: 1fr; gap: 16px; }
  .wm-footer { padding: 13px 18px; min-height: 70px; }
  .wm-footer .wm-primary { flex-shrink: 0; }
  .world-member-row { flex-wrap: wrap; gap: 9px; }
  .wm-member-identity { min-width: calc(100% - 60px); }
  .world-member-row > :is(select,.wm-owner-badge) { margin-left: 47px; }
  .wm-backup-banner { flex-wrap: wrap; padding: 18px; }
  .wm-backup-banner .wm-primary { margin-left: 58px; }
}
@media (prefers-reduced-motion: reduce) { .world-management *, .wm-switch::before { transition: none; } }
.wm-switch { pointer-events: none; }
.wm-footer [role=status][data-state=error] { color: #a06052; }
@media (max-width: 650px) {
  .wm-backup-banner { display: grid; grid-template-columns: 44px minmax(0, 1fr); }
  .wm-backup-banner .wm-primary { grid-column: 2; justify-self: start; margin-left: 0; }
}
/* Account and world lobby share the management palette and controls. */
#world-lobby { display: block; padding: 0 32px; background: radial-gradient(ellipse at 10% 10%, #e3ebdc, transparent 58%), #f3f6ee; color: #304e49; font: 14px/1.6 var(--ui-font, system-ui); }
#world-lobby *, #world-lobby *::before, #world-lobby *::after { box-sizing: border-box; }
#world-lobby [hidden] { display: none !important; }
#world-lobby :is(h1,h2,h3,p) { margin: 0; }
#world-lobby svg { width: 24px; height: 24px; flex-shrink: 0; }
.wl-shell { width: min(1100px, 100%); margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.wl-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 32px 0; }
.wl-brand { display: flex; align-items: center; gap: 12px; color: #304e49; text-decoration: none; font-size: 18px; font-weight: 600; }
.wl-brand > svg { width: 44px; height: 44px; padding: 9px; border-radius: 14px; background: #dfeadd; color: #6a8b70; }
.wl-brand small { display: block; font-size: 10px; font-weight: 400; color: #83947e; letter-spacing: .1em; margin-top: 1px; }
.wl-header-note { color: #93a18a; font-size: 12px; }
#world-lobby button { min-height: 44px; border: 0; border-radius: 12px; padding: 11px 18px; background: transparent; color: #52715d; font: 500 13px/1.5 var(--ui-font, system-ui); cursor: pointer; transition: background .15s, box-shadow .15s; }
#world-lobby button:disabled { opacity: .55; cursor: default; }
#world-lobby :is(button,input,a):focus-visible { outline: 3px solid #91b4a0; outline-offset: 3px; }
#world-lobby label { display: grid; gap: 9px; font-size: 12px; font-weight: 500; }
#world-lobby input { width: 100%; min-height: 46px; border: 1px solid #d4dfd2; border-radius: 11px; padding: 12px 13px; background: #f8faf5; color: #304e49; font: 13px var(--ui-font, system-ui); }
#world-lobby input::placeholder { color: #a1ada0; }
#world-lobby .wl-primary { background: #527b69; color: #fff; box-shadow: 0 4px 9px #527b691a; }
#world-lobby .wl-primary:hover:not(:disabled) { background: #416654; }
#world-lobby #world-error { padding: 13px 18px; margin-bottom: 18px; border: 1px solid #e8d4c8; border-radius: 12px; color: #9c6251; background: #fbf1e9; font-size: 13px; }
.wl-auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: center; gap: 80px; flex: 1; padding: 25px 30px 45px; }
.wl-eyebrow { font-size: 12px; letter-spacing: .08em; color: #84977b; }
#world-lobby .wl-story h1 { margin-top: 16px; font-size: clamp(36px, 4vw, 52px); line-height: 1.35; font-weight: 500; letter-spacing: .04em; }
#world-lobby .wl-story > p { color: #85957d; font-size: 13px; line-height: 1.9; margin-top: 20px; }
.wl-landscape { max-width: 450px; margin: 5px 0 12px; }
#world-lobby .wl-landscape svg { width: 100%; height: auto; }
.wl-story-tags { display: flex; gap: 18px; color: #8c9b81; font-size: 11px; }
.wl-story-tags span { display: inline-flex; align-items: center; gap: 7px; }
.wl-story-tags span::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #b4c4a4; }
.wl-auth-card { padding: 30px; border: 1px solid #e0e7db; border-radius: 24px; background: #fffef9; box-shadow: 0 18px 65px #476b3e0b; }
.wl-auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; background: #eef3e8; border-radius: 13px; margin-bottom: 28px; }
#world-lobby .wl-auth-tabs button { min-height: 40px; padding: 8px 14px; color: #8a9980; border-radius: 9px; }
#world-lobby .wl-auth-tabs button[aria-selected=true] { background: #fffef9; color: #3f6850; box-shadow: 0 2px 5px #3857350a; }
#world-lobby .wl-auth-card h2 { font-size: 24px; font-weight: 500; }
#world-lobby #wl-auth-description { margin-top: 7px; font-size: 12px; color: #8b9983; }
#world-auth { display: grid; gap: 19px; margin-top: 26px; }
#world-auth > .wl-primary { margin-top: 5px; }
.wl-password { position: relative; display: block; }
#world-lobby .wl-password input { padding-right: 62px; }
#world-lobby #wl-show-password { position: absolute; right: 4px; top: 1px; padding: 10px; font-size: 11px; color: #8b9c82; }
#world-lobby .wl-auth-footnote { margin-top: 23px; text-align: center; font-size: 11px; color: #a0aa95; }
#world-lobby #wl-invite-notice { margin-top: 16px; padding: 12px; border-radius: 10px; color: #66845f; background: #edf3e5; font-size: 12px; }
.wl-footer { margin-top: auto; padding: 28px 0; text-align: center; color: #a0ac95; font-size: 11px; }
.wl-welcome { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 0 32px; }
#world-lobby .wl-welcome h1 { font-size: 32px; font-weight: 500; margin-top: 6px; }
#world-lobby .wl-welcome p { color: #8b9983; font-size: 13px; margin-top: 8px; }
#world-lobby .wl-quiet { color: #8d9c85; padding: 10px 12px; }
#world-lobby .wl-quiet:hover { background: #e8eee1; }
.wl-world-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 34px; align-items: start; padding-bottom: 32px; }
.wl-create-card { padding: 28px; border: 1px solid #dce6d5; border-radius: 22px; background: #e9f0e1; }
.wl-create-icon { display: grid; place-items: center; width: 48px; height: 48px; background: #f5f8ee; color: #7d9773; border-radius: 15px; margin-bottom: 20px; }
#world-lobby .wl-create-card h2 { font-size: 20px; font-weight: 500; }
#world-lobby .wl-create-card > p { color: #8b9c80; font-size: 12px; margin-top: 9px; line-height: 1.9; }
#world-create { display: grid; gap: 17px; margin-top: 25px; }
#world-create button { display: flex; align-items: center; justify-content: space-between; }
#world-lobby #wl-recovery:empty { display: none; }
#world-lobby .wl-recover { width: 100%; margin-top: 18px; padding: 14px 0 0; border-top: 1px solid #d4dfc9; border-radius: 0; color: #91a082; font-size: 11px; min-height: 36px; }
.wl-worlds > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; padding: 7px 0; }
#world-lobby .wl-worlds h2 { font-size: 18px; font-weight: 500; }
#wl-world-count { padding: 3px 10px; border-radius: 15px; background: #e8eedf; color: #92a086; font-size: 11px; }
#world-lobby #world-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 0; }
#world-lobby .wl-world-card { display: flex; align-items: center; gap: 14px; min-height: 134px; padding: 22px; border: 1px solid #dfe7d8; border-radius: 18px; background: #fffef9; text-align: left; }
#world-lobby .wl-world-card:hover:not(:disabled) { border-color: #b6cbb0; background: #f9fcf3; box-shadow: 0 7px 24px #46693b0b; }
.wl-world-symbol { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: #e8efe0; color: #8a9f7a; flex-shrink: 0; }
.wl-world-info { flex: 1; min-width: 0; }
.wl-world-info strong { display: block; overflow-wrap: anywhere; font-size: 15px; font-weight: 500; color: #355449; line-height: 1.5; margin: 4px 0 5px; }
.wl-world-info small { color: #9aa78f; font-size: 10px; }
.wl-world-role { display: block; font-size: 10px; color: #8ca47e; }
.wl-world-arrow { color: #a8b698; font-size: 18px; }
.wl-empty { grid-column: 1/-1; min-height: 268px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; border: 1px dashed #d3dfc8; border-radius: 20px; background: #f7faf2; color: #a0af93; }
#world-lobby .wl-empty svg { width: 40px; height: 40px; margin-bottom: 17px; }
#world-lobby .wl-empty h3 { font-size: 16px; font-weight: 500; color: #7f9775; }
#world-lobby .wl-empty p { font-size: 12px; margin-top: 8px; }
#world-lobby .wl-friend-hint { color: #a0ad95; font-size: 11px; margin-top: 18px; }
@media (max-width: 850px) {
  .wl-auth-layout { gap: 32px; padding-inline: 0; grid-template-columns: minmax(0,1fr) 350px; }
  .wl-world-layout { grid-template-columns: 280px minmax(0,1fr); gap: 24px; }
  #world-lobby #world-list { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  #world-lobby { padding: 0 22px; }
  .wl-header { padding: 22px 0; }
  .wl-brand { font-size: 16px; }
  .wl-brand > svg { width: 40px; height: 40px; }
  .wl-header-note { display: none; }
  .wl-auth-layout { display: flex; flex-direction: column; align-items: stretch; gap: 25px; padding: 18px 0 0; }
  #world-lobby .wl-story h1 { font-size: 28px; margin-top: 8px; }
  .wl-story h1 br, .wl-landscape, .wl-story-tags { display: none; }
  #world-lobby .wl-story > p { font-size: 12px; margin-top: 10px; }
  .wl-auth-card { padding: 24px; border-radius: 22px; }
  .wl-auth-tabs { margin-bottom: 22px; }
  #world-lobby .wl-auth-card h2 { font-size: 22px; }
  .wl-footer { padding: 24px 0; }
  .wl-welcome { align-items: flex-start; padding-top: 12px; padding-bottom: 26px; }
  #world-lobby .wl-welcome h1 { font-size: 28px; }
  #world-lobby .wl-welcome p { font-size: 12px; }
  .wl-world-layout { grid-template-columns: 1fr; gap: 28px; }
  .wl-create-card { padding: 23px; }
  .wl-create-icon { width: 40px; height: 40px; margin-bottom: 14px; }
  #world-lobby .wl-create-card > p br { display: none; }
  #world-lobby .wl-world-card { min-height: 120px; padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { #world-lobby button { transition: none; } }
#world-lobby .wl-brand > svg { width: 44px; height: 44px; }
@media (max-width: 650px) { #world-lobby .wl-brand > svg { width: 40px; height: 40px; } }
.language-switch { appearance: auto; min-height: 36px; max-width: 110px; padding: 7px 10px; border: 1px solid #d4dfd2; border-radius: 11px; background: #f8faf5; color: #52715d; font: 12px var(--ui-font,system-ui); cursor: pointer; }
.language-switch:focus-visible { outline: 3px solid #91b4a0; outline-offset: 3px; }
#game-language { position: fixed; left: 16px; bottom: 16px; z-index: 45; box-shadow: 0 3px 10px #31533b15; }
body.worlds-lobby #game-language { display: none; }
.wl-header .wl-header-note { margin-left: auto; }
html[lang=en] .world-management .wm-nav button { padding-inline: 10px; font-size: 12px; }
html[lang=en] .world-management .wm-rule small { line-height: 1.5; }
@media (max-width: 650px) {
  html[lang=en] .world-management .wm-nav button { font-size: 11px; gap: 4px; padding-inline: 4px; }
  html[lang=en] .world-management .wm-nav button svg { display: none; }
  #game-language { min-height: 40px; }
}
html[lang=en] #world-lobby .wl-story h1 { font-size: 42px; line-height: 1.25; letter-spacing: 0; }
@media (max-width: 650px) { html[lang=en] #world-lobby .wl-story h1 { font-size: 27px; } }
@media (max-width: 650px) {
  /* Narrow windows cannot reuse a desktop conversation's saved drag position. */
  #conversation-shell { left: 12px !important; right: 12px !important; top: 12px !important; bottom: 12px !important; transform: none !important; width: calc(100vw - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); }
  #conversation-shell-content { flex: 1; min-height: 0; height: auto; max-height: none; overflow: hidden; }
  #conversation-shell #chat-panel { width: 100%; height: 100%; min-height: 0; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; }
  #conversation-shell #chat-messages { min-height: 0; max-height: none; }
  body.chat-open #social-toolbar { display: none; }
  html[lang=en] #social-toolbar { flex-wrap: wrap; justify-content: center; width: calc(100vw - 24px); box-sizing: border-box; }
}
#world-lobby .wl-story { display: flex; flex-direction: column; align-items: center; }
#world-lobby .wl-story .wl-landscape { display: block; width: 100%; margin: 0; }
#world-lobby .wl-story > .wl-story-caption { margin-top: 24px; color: #668164; font-size: 16px; text-align: center; }
@media (max-width: 650px) {
  #world-lobby .wl-story .wl-landscape { width: 210px; }
  #world-lobby .wl-story > .wl-story-caption { font-size: 13px; margin-top: 8px; }
  .wl-auth-layout { gap: 22px; padding-bottom: 24px; }
}
/* The message list owns the flexible space; composing stays at the bottom. */
#conversation-shell-header { flex-shrink: 0; }
#conversation-shell-content { display: flex; flex: 1 1 auto; min-height: 0; max-height: none; overflow: hidden; }
#conversation-shell #chat-panel { flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; }
#conversation-shell #chat-messages { min-height: 0; max-height: none; overflow-y: auto; }
@media (min-width: 651px) { #conversation-shell:not([data-collapsed="true"]) { height: min(72dvh, 560px); } }

/* Wayside message boards share the quiet cream and sage game controls. */
#board-read { position: fixed; left: 50%; bottom: 170px; transform: translateX(-50%); z-index: 38; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 12px 20px; border: 1px solid #c6d7cd; border-radius: 16px; background: #f5f5eced; color: #354e52; font: 600 14px system-ui; cursor: pointer; }
.message-board-dialog { margin: auto; inset: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 28px; border: 1px solid #d5dfd4; border-radius: 24px; background: #f6f5ee; color: #354e52; box-shadow: 0 24px 80px #203a4633; }
.message-board-dialog[open] { display: flex; flex-direction: column; }
.message-board-dialog::backdrop { background: #23425355; }
.message-board-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.message-board-dialog h2 { font-size: 24px; margin: 6px 0; overflow-wrap: anywhere; }
.board-eyebrow, #board-caption, #board-note { color: #6b817e; font-size: 13px; }
#board-close { width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 50%; background: #e5ece3; color: #354e52; font-size: 24px; cursor: pointer; }
#board-messages { min-height: 0; max-height: 36dvh; overflow-y: auto; padding: 0; margin: 12px 0 20px; list-style: none; flex: 1; }
#board-messages li { border-top: 1px solid #dfe6da; padding: 16px 0; }
#board-messages time { float: right; color: #81918a; font-size: 12px; }
#board-messages p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; line-height: 1.6; }
#board-messages .board-empty { color: #7c9087; text-align: center; padding: 28px 16px; }
#board-form { flex-shrink: 0; }
#board-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
#board-input { display: block; box-sizing: border-box; width: 100%; min-height: 48px; resize: vertical; max-height: 20dvh; padding: 14px; border: 1px solid #d2ddd0; border-radius: 12px; color: #354e52; background: #fffef8; font: 15px system-ui; }
#board-form footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
#board-submit { padding: 12px 18px; border: 1px solid #b9d4c7; border-radius: 12px; background: #cde4d8; color: #354e52; font: 600 14px system-ui; cursor: pointer; }
#board-submit:disabled { opacity: .5; cursor: default; }
#board-error { color: #9c5143; font-size: 14px; }
.message-board-dialog :focus-visible { outline: 2px solid #98b9a5; outline-offset: 3px; }
body.mobile-controls #board-read { bottom: 185px; }
@media (max-width: 600px) { .message-board-dialog { padding: 20px; } #social-toolbar { flex-wrap: wrap; justify-content: center; } #board-messages time { float: none; display: block; margin-top: 4px; } }
