:root {
  color-scheme: light;
  --bg: #faf9f5;
  --surface: #fffdf8;
  --surface-2: #f3efe7;
  --surface-3: #eee8dc;
  --text: #181715;
  --muted: #6f6a60;
  --muted-2: #8d867a;
  --line: #ded6c8;
  --line-strong: #cfc4b2;
  --accent: #cc785c;
  --accent-strong: #a8573d;
  --accent-soft: #f4ded4;
  --info: #47718c;
  --info-soft: #dce9ed;
  --success: #3f7b63;
  --success-soft: #dce9df;
  --warn: #b87724;
  --warn-soft: #f5e4c8;
  --danger: #b84c3d;
  --danger-soft: #f2d5cf;
  --radius: 8px;
}

* { box-sizing: border-box; }

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: none;
}

body.welcome-workspace-open { overflow: hidden; }
html.welcome-workspace-open { overflow: hidden; scrollbar-gutter: auto; }
body.secondary-workspace-open { overflow: hidden; }
html.secondary-workspace-open { overflow: hidden; scrollbar-gutter: auto; }

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

button:hover { border-color: var(--accent); background: #fff7f2; }
button:active { transform: translateY(1px); }
button:disabled,
button:disabled:hover {
  opacity: .48;
  cursor: not-allowed;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}
button:disabled:active {
  transform: none;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(204, 120, 92, .24);
  outline-offset: 2px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf6;
  font-weight: 700;
}

button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.ghost { background: transparent; color: var(--text); }
button.warn { background: var(--warn-soft); border-color: #d7ae6a; color: #6f4310; font-weight: 700; }
button.warn:hover { background: #efd6aa; border-color: var(--warn); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fffaf6; font-weight: 700; }
button.danger:hover { background: #973b31; border-color: #973b31; }

button.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  padding: 0;
  flex: 0 0 auto;
}

button.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.icon-button .icon-label {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

button.icon-button.map-library-tool {
  width: auto;
  min-width: 0;
  padding: 0 10px;
}

button.icon-button.map-library-tool .icon-label {
  width: auto;
}

button.icon-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf6;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefa;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

textarea { resize: vertical; }

label span {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fffaf6;
  font-weight: 900;
}

.brand h1,
.topbar h1 {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.12;
}

.brand p,
.topbar p {
  color: var(--muted);
  margin-top: 4px;
}

.stack { display: grid; gap: 14px; }
.error { min-height: 20px; color: var(--danger); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px 20px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--line);
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.server-switch {
  display: inline-flex;
}

.server-switch select {
  min-width: 128px;
  height: 34px;
  padding: 0 34px 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 12px 0 0;
  padding: 6px;
  background: rgba(255, 253, 248, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tabs.solo-mode {
  grid-template-columns: minmax(0, 1fr);
}

.tabs button {
  min-width: 0;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tabs button:hover {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-strong);
}

.tabs button.active {
  color: #fffaf6;
  background: var(--accent);
  border-color: var(--accent);
}

.view { display: none; }
.view.active { display: grid; gap: 12px; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 96px;
  padding: 24px 0 8px;
}

.view-head h2 {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0;
}

.view-copy {
  margin-top: 8px;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metrics article,
.panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metrics article {
  padding: 14px;
  min-height: 86px;
  border-top-width: 4px;
}

.metrics article:nth-child(1) { border-top-color: var(--success); }
.metrics article:nth-child(2) { border-top-color: var(--info); }
.metrics article:nth-child(3) { border-top-color: var(--accent); }
.metrics article:nth-child(4) { border-top-color: var(--warn); }

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.panel {
  padding: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr);
  gap: 10px;
  align-items: start;
}

.server-panel {
  grid-row: span 2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
  font-weight: 700;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.kv dd.health-ok {
  color: var(--success);
  font-weight: 800;
}

.kv dd.health-degraded {
  color: var(--danger);
  font-weight: 800;
}

.server-restart-row {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 2px 0 4px;
  padding: 8px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.server-restart-toggle {
  min-width: 140px;
}

.server-restart-confirm {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 420px);
  padding: 12px;
  border: 1px solid #dfaaa1;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff7f4 0%, #f7e4de 100%);
}

.server-restart-confirm .meta {
  text-align: center;
}

.server-restart-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.server-settings-form {
  display: grid;
  grid-template-columns: minmax(120px, .95fr) minmax(180px, 1.35fr) minmax(96px, .72fr) minmax(170px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.server-settings-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.server-settings-form .check-field {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.server-settings-form .check-field input {
  width: 16px;
  height: 16px;
}

.server-settings-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.server-settings-form button {
  white-space: nowrap;
}

.inline-form,
.search,
.table-filters {
  display: grid;
  gap: 8px;
}

.table-filters {
  grid-template-columns: minmax(200px, 1.5fr) minmax(140px, .8fr) auto;
}

.inline-form,
.search {
  grid-template-columns: 1fr auto;
}

.player-filters,
.chat-filters {
  grid-template-columns: minmax(220px, 1.6fr) minmax(140px, .7fr) auto auto;
}

.toolbar-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffefa;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font: inherit;
}

.table-filters {
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, .7fr) minmax(140px, .8fr) auto;
}

.command-filters {
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, .7fr) minmax(140px, .8fr) auto auto;
}

.audit-filters {
  grid-template-columns: minmax(180px, 1.4fr) minmax(160px, .9fr) auto auto;
}

.page-toolbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface);
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.card:hover {
  border-color: var(--line-strong);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.name {
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.badge-rejected {
  color: #59554e;
  background: #ebe6dd;
  border-color: #d0c7ba;
}

.localized-token {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.localized-token code {
  color: var(--muted-2);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.badge.online {
  color: #255443;
  background: var(--success-soft);
  border-color: #b7d4c1;
}

.badge.banned {
  color: #7b2e25;
  background: var(--danger-soft);
  border-color: #dfaaa1;
}

.badge.cooldown {
  color: #695017;
  background: #fff2be;
  border-color: #e3c96f;
}

.badge.solo-live {
  color: #255443;
  background: var(--success-soft);
  border-color: #b7d4c1;
}

.badge.solo-failed {
  color: #7b2e25;
  background: var(--danger-soft);
  border-color: #dfaaa1;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-actions button { min-height: 34px; }

.data-table {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.table-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-pager {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.table-pager button {
  min-height: 32px;
  padding: 0 10px;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  color: var(--text);
  font-size: 13px;
}

tbody tr {
  transition: background-color .15s ease;
}

tbody tr:hover {
  background: #fff7f2;
}

td code,
.meta code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #3a342e;
  overflow-wrap: anywhere;
}

.map-validation-note {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.map-validation-note.rejected {
  color: #4d4942;
  background: linear-gradient(180deg, #f4f1ea 0%, #ebe5da 100%);
  border-color: #d3c9bc;
}

.code-token {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

table.players-table,
table.chat-table,
table.commands-table,
table.audit-table {
  table-layout: auto;
}

table.players-table {
  min-width: 1160px;
}

table.chat-table {
  min-width: 1240px;
}

table.chat-table th,
table.chat-table td {
  padding: 6px 8px;
}

table.chat-table button {
  min-height: 30px;
  padding: 0 10px;
}

table.commands-table,
table.audit-table {
  min-width: 960px;
}

.chat-player {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.chat-player .badges {
  flex-wrap: nowrap;
  min-height: 0;
  padding: 0;
}

.chat-badge {
  padding: 1px 6px;
  font-size: 11px;
}

.anon-name {
  --anon-color: #5f6368;
  max-width: 16ch;
  color: var(--anon-color);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-team {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-message {
  max-width: 56ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 180px;
}

.row-actions button {
  min-height: 30px;
  padding: 0 9px;
}

.drag-handle {
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.maps-table tr.dragging {
  opacity: .55;
}

.maps-table tr.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: #fff7f2;
}

.table-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  color: var(--muted);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dialog-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

dialog {
  width: min(720px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

dialog::backdrop { background: rgba(24, 23, 21, .46); }

.dialog {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.dialog-body {
  display: grid;
  gap: 12px;
  max-height: 52vh;
  overflow: auto;
}

.dialog-body section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.dialog-body h2 {
  margin-bottom: 8px;
  font-size: 14px;
}

.presentation-editor textarea {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.presentation-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 54px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.presentation-fields p {
  margin: 6px 0;
  color: var(--muted);
}

.welcome-setting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.welcome-builder-workspace {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  --palette-width: 220px;
  --inspector-width: 290px;
}

.welcome-builder-shell {
  height: 100vh;
  padding: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  display: grid;
  gap: 0;
}

.welcome-builder-head {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(420px, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.welcome-builder-titlebar,
.welcome-builder-tools,
.welcome-view-switch,
.welcome-zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.welcome-builder-titlebar h2 { margin: 0; font-size: 16px; }
.welcome-builder-titlebar .eyebrow { font-size: 9px; }
.welcome-builder-tools { justify-content: flex-end; }
.welcome-view-switch { justify-content: center; }
.welcome-view-switch .active,
.welcome-builder-tools .active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.welcome-zoom-control button { min-width: 38px; padding: 0 9px; }
.welcome-zoom-control button:nth-child(2) { min-width: 62px; }

.welcome-builder-grid {
  display: grid;
  grid-template-columns: var(--palette-width) minmax(420px, 1fr) var(--inspector-width) minmax(360px, .9fr);
  gap: 0;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns .18s ease;
}

.welcome-palette,
.welcome-canvas-panel,
.welcome-inspector,
.welcome-preview-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-width: 0 1px 0 0;
  border-radius: 0;
  background: var(--surface-2);
}

.welcome-palette,
.welcome-inspector {
  padding: 14px;
  overflow: auto;
}

.welcome-palette h3,
.welcome-inspector h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.welcome-palette-item {
  width: 100%;
  margin: 4px 0;
  text-align: left;
  cursor: grab;
  border-style: dashed;
}

.welcome-page-list {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}

.welcome-page-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.welcome-page-item > button:first-child {
  flex: 1;
  text-align: left;
}

.welcome-page-select {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px 8px;
}

.welcome-page-select > span:last-child { min-width: 0; display: grid; }
.welcome-page-select strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.welcome-page-select small { color: var(--muted); font-size: 9px; }
.welcome-page-thumb {
  display: grid;
  align-content: center;
  gap: 3px;
  width: 30px;
  height: 38px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.welcome-page-thumb i { display: block; height: 2px; background: var(--line-strong); }
.welcome-page-thumb i:nth-child(2) { width: 72%; }

.welcome-page-item .active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--surface);
}

.welcome-page-select.drag-over { border-top: 3px solid var(--accent); }

.welcome-canvas-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.welcome-canvas-viewport {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 120px max(140px, calc((100% - 640px) / 2));
  background-color: #ebe7df;
  background-image: radial-gradient(#c9c1b4 .8px, transparent .8px);
  background-size: 16px 16px;
  scrollbar-gutter: stable;
  cursor: grab;
}

.welcome-canvas-viewport.panning { cursor: grabbing; user-select: none; }

.welcome-canvas-toolbar,
.welcome-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.welcome-canvas {
  width: 640px;
  min-height: 520px;
  margin: 0 auto;
  padding: 30px 34px 70px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: visible;
  background: var(--surface);
  box-shadow: 0 16px 45px rgba(63, 54, 43, .14);
  zoom: var(--welcome-canvas-zoom, 1);
}

.welcome-canvas.drop-active {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

.welcome-block-card,
.welcome-button-row-card {
  position: relative;
  margin: 7px 0;
  padding: 10px 38px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.welcome-button-row-card { padding-right: 96px; }

.welcome-block-card.selected,
.welcome-button-row-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.welcome-block-card.dragging { opacity: .45; }
.welcome-block-card.drag-over { border-top: 3px solid var(--accent); }

.welcome-block-kind {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.welcome-block-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 26px;
  padding: 4px 6px;
}

.welcome-button-row-preview {
  display: flex;
  gap: 6px;
}

.welcome-button-row-preview span {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  text-align: center;
  font-size: 11px;
}

.welcome-row-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 3px;
}
.welcome-row-actions button { min-width: 25px; min-height: 25px; padding: 2px 5px; }

.welcome-inspector-body {
  display: grid;
  gap: 10px;
}

.welcome-inspector-body label {
  display: grid;
  gap: 5px;
}

.welcome-inspector-body textarea { min-height: 120px; resize: vertical; }
.welcome-inspector-body select,
.welcome-inspector-body input,
.welcome-inspector-body textarea { width: 100%; }

.welcome-field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.welcome-field-chips button { padding: 5px 7px; font-size: 11px; }

.welcome-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.welcome-builder-workspace.mode-edit .welcome-preview-panel { display: none; }
.welcome-builder-workspace.mode-edit .welcome-builder-grid {
  grid-template-columns: var(--palette-width) minmax(520px, 1fr) var(--inspector-width);
}

.welcome-builder-workspace.mode-preview .welcome-palette,
.welcome-builder-workspace.mode-preview .welcome-canvas-panel,
.welcome-builder-workspace.mode-preview .welcome-inspector { display: none; }
.welcome-builder-workspace.mode-preview .welcome-builder-grid { grid-template-columns: 1fr; }
.welcome-builder-workspace.palette-collapsed { --palette-width: 0px; }
.welcome-builder-workspace.palette-collapsed .welcome-palette { visibility: hidden; padding: 0; border: 0; overflow: hidden; }
.welcome-builder-workspace.inspector-collapsed { --inspector-width: 0px; }
.welcome-builder-workspace.inspector-collapsed .welcome-inspector { visibility: hidden; padding: 0; border: 0; overflow: hidden; }

.welcome-preview-toolbar > div:first-child {
  display: grid;
}

.segmented-control { display: flex; gap: 4px; }
.segmented-control .active { border-color: var(--accent); color: var(--accent-strong); }

.welcome-game-stage {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px 12px;
  background:
    linear-gradient(rgba(10, 17, 25, .72), rgba(10, 17, 25, .72)),
    radial-gradient(circle at 30% 20%, #475c64, #1d2930 58%, #11181c);
}

.welcome-game-stage.mobile .mindustry-menu-preview { width: min(300px, 100%); }

.mindustry-menu-preview {
  width: min(430px, 100%);
  color: #f5f5f5;
  font-family: Arial, sans-serif;
  text-shadow: 1px 1px 0 #111;
}

.mindustry-menu-title {
  padding: 11px 15px;
  border: 2px solid #555b60;
  border-bottom: 0;
  background: rgba(32, 37, 42, .97);
  text-align: center;
  font-weight: 700;
}

.mindustry-menu-body {
  min-height: 110px;
  padding: 18px 16px;
  border: 2px solid #555b60;
  background: rgba(24, 29, 33, .96);
  text-align: center;
  line-height: 1.45;
  white-space: pre-wrap;
}

.mindustry-menu-buttons { display: grid; gap: 4px; margin-top: 5px; }
.mindustry-menu-button-row { display: flex; gap: 4px; }
.mindustry-menu-button-row button {
  flex: 1;
  min-height: 38px;
  border: 2px solid #61676c;
  border-radius: 0;
  background: #363c41;
  color: #fff;
  font-weight: 700;
}

.m-color-accent { color: #ffd37f; }
.m-color-white { color: #fff; }
.m-color-lightgray { color: #b0b0b0; }
.m-color-gray { color: #777; }
.m-color-green { color: #84f491; }
.m-color-scarlet { color: #ff7f7f; }
.m-color-orange { color: #ffa665; }
.m-color-yellow { color: #fff17f; }
.m-color-cyan { color: #7fffff; }

.welcome-builder-actions { justify-content: flex-end; }
.welcome-builder-actions .meta { margin-right: auto; }
.welcome-builder-actions {
  min-height: 58px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

@media (max-width: 1100px) {
  .welcome-builder-head { grid-template-columns: 1fr auto; }
  .welcome-view-switch { order: 3; grid-column: 1 / -1; }
  .welcome-builder-workspace { --palette-width: 190px; --inspector-width: 240px; }
  .welcome-builder-grid { grid-template-columns: var(--palette-width) minmax(380px, 1fr) var(--inspector-width); }
  .welcome-preview-panel { display: none; }
  .welcome-builder-workspace.mode-preview .welcome-preview-panel { display: grid; }
}

@media (max-width: 760px) {
  .welcome-builder-head { display: flex; flex-wrap: wrap; }
  .welcome-builder-tools { overflow-x: auto; justify-content: flex-start; width: 100%; }
  .welcome-builder-shell { height: 100vh; }
  .welcome-builder-grid { display: block; overflow: auto; }
  .welcome-palette,
  .welcome-canvas-panel,
  .welcome-inspector,
  .welcome-preview-panel { margin-bottom: 10px; min-height: 260px; }
  .welcome-canvas-panel { height: 430px; }
  .welcome-preview-panel { height: 430px; }
}

.expand-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.expand-row summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
}

.expand-row summary::-webkit-details-marker {
  display: none;
}

.expand-row summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent-strong);
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.expand-row[open] summary::before {
  content: "-";
}

.expand-row[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.expand-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.expand-cue {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}

.session-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.session-item {
  display: grid;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.session-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 10px;
  color: var(--muted);
  font-size: 12px;
}

.session-meta code {
  overflow-wrap: anywhere;
}

.vote-result-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.vote-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 12px;
}

.vote-result-grid strong {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: .04em;
}

.vote-result-grid span {
  font-size: 13px;
}

.vote-result-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vote-voter-list {
  display: grid;
  gap: 6px;
}

.vote-voter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.vote-voter-main {
  min-width: 0;
}

.vote-choice {
  white-space: nowrap;
}

.vote-choice-agree {
  background: rgba(48, 124, 84, .14);
  border-color: rgba(48, 124, 84, .24);
  color: #25694b;
}

.vote-choice-disagree {
  background: rgba(171, 58, 48, .14);
  border-color: rgba(171, 58, 48, .24);
  color: #8e2b24;
}

.vote-choice-abstain,
.vote-choice-none {
  background: rgba(106, 92, 74, .12);
  border-color: rgba(106, 92, 74, .2);
  color: var(--muted);
}

.other-list {
  display: grid;
  gap: 12px;
  padding: 10px;
}

.other-block {
  display: grid;
  gap: 8px;
}

.other-block h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.confirm-dialog {
  width: min(460px, calc(100% - 24px));
}

.confirm-message {
  color: var(--text);
  line-height: 1.6;
}

.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}

.subsection-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.rotation-mode-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.rotation-random-status {
  color: #2c6130;
  font-size: 13px;
  font-weight: 800;
}

#rotationRandomModeBtn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf6;
}

.map-filters {
  grid-template-columns: minmax(190px, 1fr) 120px 135px 130px minmax(225px, .9fr) minmax(210px, .82fr) auto;
}

.map-library-filters {
  grid-template-columns: minmax(220px, 1fr) 130px 140px 120px auto;
}

.map-grade {
  min-width: 46px;
  justify-content: center;
  font-weight: 800;
}

.map-grade-s { background: #f7e6a1; border-color: #dfbb42; color: #725106; }
.map-grade-a { background: #dcefd5; border-color: #9fc78f; color: #2c6130; }
.map-grade-b { background: #d9e9f6; border-color: #91bce0; color: #28577d; }
.map-grade-c { background: #ece7df; border-color: #c9bdaa; color: #665947; }
.map-grade-d { background: #eee; border-color: #bbb; color: #444; }
.map-grade-e { background: #e2e2e2; border-color: #9c9c9c; color: #292929; }
.map-grade-1v1 { background: #222; border-color: #222; color: #fff; }
.map-grade-unrated { color: var(--muted); }

.pending-grade {
  margin-left: 4px;
  border-style: dashed;
  color: var(--muted);
}

.rating-actions { gap: 6px; }

.resource-rating-actions {
  min-width: 310px;
}

.map-number {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.compact-select {
  width: auto;
  min-width: 136px;
  min-height: 40px;
  padding: 8px 30px 8px 10px;
}

.map-number-range,
.map-jump-control {
  display: grid;
  align-items: center;
  min-width: 0;
}

.map-number-range {
  grid-template-columns: minmax(90px, 1fr) auto minmax(90px, 1fr);
  gap: 5px;
}

.map-number-range span {
  color: var(--muted-2);
}

.map-jump-control {
  grid-template-columns: minmax(105px, 1fr) auto;
  gap: 5px;
}

.map-jump-control button {
  padding-inline: 10px;
}

.recommendation-entry {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #d12626;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(94, 0, 0, .24);
}

.secondary-workspace {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background: #f3f3f1;
  color: #161616;
}

.secondary-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.secondary-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 22px;
  border-bottom: 1px solid #c8c8c5;
}

.secondary-head h2 {
  margin: 0 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -.02em;
}

.secondary-head .eyebrow {
  margin: 16px 0 3px;
  color: #555;
  letter-spacing: .12em;
}

.secondary-back {
  border-color: #aaa;
  color: #222;
}

.recommendation-page-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.recommendation-content {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding-top: 24px;
}

.recommendation-summary {
  position: sticky;
  top: 22px;
  align-self: start;
  display: grid;
  gap: 3px;
  padding: 18px;
  border: 1px solid #bcbcb8;
  background: #1b1b1b;
  color: #fff;
}

.recommendation-summary span {
  color: #aaa;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.recommendation-summary strong {
  font: 500 42px/1 Georgia, "Times New Roman", serif;
}

.recommendation-list {
  display: grid;
  gap: 12px;
}

.recommendation-card,
.recommendation-empty {
  border: 1px solid #c7c7c3;
  border-radius: 3px;
  background: #fff;
}

.recommendation-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .035);
}

.recommendation-card.status-approved { border-left: 4px solid #202020; }
.recommendation-card.status-rejected { border-left: 4px solid #a7a7a7; opacity: .82; }

.recommendation-card-head,
.recommendation-player,
.recommendation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.recommendation-card-head { align-items: flex-start; }

.recommendation-card-head h3 {
  margin: 2px 0 0;
  color: #161616;
  font-size: 20px;
}

.recommendation-map-id {
  color: #686868;
  font: 800 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .06em;
}

.recommendation-player {
  padding: 12px 0;
  border-top: 1px solid #e2e2df;
  border-bottom: 1px solid #e2e2df;
}

.recommendation-player > div {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.recommendation-player span,
.recommendation-reason > span,
.recommendation-resolution > span {
  color: #737373;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.recommendation-player code {
  color: #888;
  font-size: 11px;
}

.recommendation-reason p {
  margin: 7px 0 0;
  color: #252525;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.recommendation-note textarea {
  border-color: #c8c8c5;
  border-radius: 2px;
  background: #fafafa;
}

.recommendation-actions {
  justify-content: flex-end;
}

.recommendation-approve {
  border-color: #171717;
  background: #171717;
  color: #fff;
  font-weight: 800;
}

.recommendation-approve:hover {
  border-color: #000;
  background: #000;
}

.recommendation-reject {
  border-color: #8b8b88;
  background: #fff;
  color: #222;
  font-weight: 800;
}

.recommendation-progress {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid #555;
  border-radius: 999px;
  background: #2b2b2b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.recommendation-progress.failed,
.recommendation-error {
  border-color: #aaa;
  background: #ededeb;
  color: #3a3a3a;
}

.recommendation-error {
  padding: 10px 12px;
  border: 1px solid #c8c8c5;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.recommendation-resolution {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  padding-top: 4px;
}

.recommendation-resolution p {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  color: #555;
  white-space: pre-wrap;
}

.recommendation-in-pool {
  background: #252525;
  border-color: #252525;
  color: #fff;
}

.recommendation-empty {
  padding: 48px 24px;
  color: #666;
  text-align: center;
}

.grade-action.active,
.icon-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.detail-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-section h3 { margin: 0 0 8px; font-size: 14px; }
.detail-description { margin: 0; white-space: pre-wrap; line-height: 1.65; color: var(--muted); }

.maps-table td:first-child,
.maps-table th:first-child {
  white-space: nowrap;
}

.rotation-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.rotation-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.rotation-summary strong {
  overflow-wrap: anywhere;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-decoration: none;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.confirm-actions {
  grid-template-columns: 1fr 1fr;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  border: 1px solid var(--text);
  color: #fffaf6;
}

.solo-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.solo-room-card {
  display: grid;
  gap: 12px;
}

.solo-room-head {
  align-items: flex-start;
}

.solo-room-head .badges {
  justify-content: flex-end;
}

.solo-room-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 12px;
}

.solo-room-meta strong,
.solo-roster h3 {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.solo-room-meta span {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.solo-roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.solo-roster section {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.solo-room-error {
  padding: 10px 12px;
  border: 1px solid #dfaaa1;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: #7b2e25;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1280px) and (min-width: 721px) {
  .map-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #resourceMapQuery,
  .map-number-range,
  .map-jump-control {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .login-shell { padding: 16px; }
  .login-panel { padding: 22px; }
  .app-shell { padding: 12px 10px 22px; }
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
	  .topbar-actions {
	    width: 100%;
	    justify-content: space-between;
	  }
	  .server-switch {
	    flex: 1 1 150px;
	  }
	  .server-switch select {
	    width: 100%;
	  }
  .topbar h1, .brand h1 { font-size: 22px; }
  .view-head {
    min-height: 78px;
    padding-top: 18px;
  }
  .view-head h2 { font-size: 28px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid,
  .table-filters,
  .player-filters,
  .chat-filters,
  .map-filters,
  .map-library-filters {
    grid-template-columns: 1fr;
  }
  .inline-form,
  .server-settings-form,
  .search {
    grid-template-columns: 1fr;
  }
  .table-page {
    align-items: flex-start;
    flex-direction: column;
  }
  .table-pager {
    justify-content: flex-start;
  }
  .actions { grid-template-columns: 1fr 1fr; }
  .row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .solo-room-grid,
  .solo-roster {
    grid-template-columns: 1fr;
  }
  .subsection-head,
  .secondary-head,
  .recommendation-card-head,
  .recommendation-player,
  .recommendation-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar-icons,
  .rotation-mode-control,
  .recommendation-page-tools {
    width: 100%;
  }
  .compact-select { width: 100%; }
  .secondary-shell { width: min(100% - 20px, 1180px); padding-top: 14px; }
  .recommendation-content { grid-template-columns: 1fr; gap: 12px; }
  .recommendation-summary { position: static; grid-template-columns: 1fr auto; align-items: center; }
  .recommendation-summary strong { font-size: 30px; }
  .recommendation-player > div { grid-template-columns: 1fr; gap: 3px; }
  .recommendation-card { padding: 15px; }
}

@media (max-width: 420px) {
  .metrics { grid-template-columns: 1fr; }
  .tabs { gap: 5px; }
  .tabs button {
    padding: 0 4px;
    font-size: 13px;
  }
  .kv { grid-template-columns: 74px 1fr; }
  .actions { grid-template-columns: 1fr; }
}
