:root {
  --chart: #58a632;
  --grid: #2a313b;
  color-scheme: dark;
  --bg: #12151a;
  --panel: #1a1f26;
  --panel-2: #222832;
  --border: #2d3540;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --accent: #6fbf3f;
  --accent-ink: #0d1a05;
  --danger: #e0533d;
  --warn: #e7b04a;
  --info: #4aa3e7;
  --radius: 10px;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }
.error { color: var(--danger); margin: 6px 0 0; min-height: 0; }
.error:empty { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px;
  padding: 9px 14px; cursor: pointer; background: var(--panel-2); color: var(--text);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:focus-visible, input:focus-visible, .seg button:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 6px; padding: 24px; }
.login-title { font-size: 22px; }
.login-card label { margin-top: 8px; font-weight: 600; font-size: 14px; }
.login-card .btn.primary { margin-top: 12px; }
input {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; width: 100%;
}
.password-row { display: flex; gap: 8px; }

/* App layout */
.app {
  min-height: 100%;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo { width: 20px; height: 20px; border-radius: 4px; background: linear-gradient(#5b8c32 0 60%, #866043 60%); }
.user { display: flex; align-items: center; gap: 8px; }
.view { max-width: 1180px; margin: 0 auto; padding: 16px; }
.dashboard { display: grid; gap: 16px; align-items: start; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.perf-card, .wide { grid-column: 1 / -1; }
/* Home: status, players and activity stacked beside the chat; charts below. */
#view-home { grid-template-areas: "status chat chat" "players chat chat" "activity chat chat" "perf perf perf"; grid-template-rows: auto auto 1fr auto; }
#view-home > .status-card { grid-area: status; }
#view-home > .players-card { grid-area: players; }
#view-home > .activity-card { grid-area: activity; }
#view-home > .chat-card { grid-area: chat; align-self: stretch; display: flex; flex-direction: column; }
#view-home > .perf-card { grid-area: perf; }
.chat-card .chat-log { flex: 1; min-height: 300px; height: auto; max-height: 560px; }
@media (max-width: 1000px) {
  .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-home { grid-template-areas: "status players" "chat chat" "perf perf" "activity activity"; grid-template-rows: none; }
}
@media (max-width: 700px) {
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  #view-home { grid-template-areas: "status" "players" "chat" "perf" "activity"; }
  .chat-card .chat-log { height: 360px; flex: none; }
}

/* Status */
.status-line { display: flex; align-items: center; gap: 10px; }
.pill { font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: var(--panel-2); }
.pill::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: currentColor; vertical-align: 1px; }
.pill[data-state="online"] { color: var(--accent); }
.pill[data-state="offline"] { color: var(--muted); }
.pill[data-state="starting"], .pill[data-state="stopping"] { color: var(--warn); }
.pill[data-state="starting"]::before, .pill[data-state="stopping"]::before { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .pill::before { animation: none !important; } }
.address { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.address code { background: var(--bg); padding: 5px 8px; border-radius: 6px; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.motd { margin: 8px 0 0; font-style: italic; }
.motd:empty { display: none; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.controls .btn.primary, .controls .btn.danger { flex: 1; }
.controls .btn.ghost { width: 100%; }

/* Players */
.players, .activity { list-style: none; margin: 0; padding: 0; }
.players li {
  display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px;
}
.players img { width: 24px; height: 24px; border-radius: 4px; image-rendering: pixelated; background: var(--panel-2); }
.players .pname { font-weight: 600; }
.players .dim { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.players .dim[data-dim="nether"] { color: #ff8a73; }
.players .dim[data-dim="end"] { color: #c9a8ff; }
.activity li { font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: 0; }
.activity time { color: var(--muted); font-size: 12px; margin-right: 6px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; background: transparent; color: var(--text); border: 0; padding: 5px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
/* Console */
/* Console (Admin tab) */
.console-log {
  margin: 0; height: 360px; overflow: auto; padding: 10px 12px; background: #0b0d10; color: #d6dde6; border-radius: 6px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all;
}
.console-form { display: flex; gap: 8px; margin-top: 8px; }
.console-form input { font-family: ui-monospace, monospace; font-size: 13px; padding: 6px 9px; }

/* Phones */
@media (max-width: 800px) {
  .dashboard { padding: 12px; gap: 12px; }
  #whoami { display: none; }
  .brand { font-size: 16px; min-width: 0; }
  .brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar { padding: 8px 16px; gap: 8px; }
}

/* Mod manager */
.mods {
  width: min(760px, calc(100% - 32px)); max-height: min(820px, calc(100% - 32px)); padding: 0;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgb(0 0 0 / .6);
}
.mods[open] { display: flex; flex-direction: column; }
.mods::backdrop { background: rgb(0 0 0 / .6); }
.mods-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 8px; }
.mods-head h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 2px; }
.mods-head p { margin: 0; }
.mods-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 18px 8px;
  padding: 8px 12px; border-radius: 8px; background: rgb(231 176 74 / .12); color: var(--warn); font-size: 14px;
}
.tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.tabs [role=tab] {
  font: inherit; font-weight: 600; background: none; border: 0; color: var(--muted); padding: 8px 12px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tabs [role=tab][aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { color: var(--muted); font-weight: 500; }
.mods-msg { margin: 8px 18px 0; font-size: 14px; }
.notice { color: var(--accent); }
.notice:empty { display: none; }
.mods-panel { overflow-y: auto; padding: 10px 18px 18px; min-height: 280px; }
.mods-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.mods-toolbar input { flex: 1; min-width: 160px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.mod-list { list-style: none; margin: 0; padding: 0; }
.mod { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.mod:last-child { border-bottom: 0; }
.mod-icon {
  width: 40px; height: 40px; flex: none; border-radius: 8px; background: var(--panel-2); object-fit: cover;
  display: grid; place-items: center; font-weight: 700; color: var(--muted);
}
.mod-main { flex: 1; min-width: 0; }
.mod-title { font-weight: 600; }
.mod-title a { color: inherit; text-decoration: none; }
.mod-title a:hover { text-decoration: underline; }
.mod-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.mod-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.badge.client { color: var(--info); }
.badge.update { color: var(--accent); }
.badge.pending { color: var(--warn); }
.badge.approved { color: var(--accent); }
.badge.declined { color: var(--danger); }
#mods-player-note { margin: 0; }
.mod-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.more { width: 100%; margin-top: 10px; }
.btn.has-dot, .tabbar a.has-dot { position: relative; }
.btn.has-dot::after, .tabbar a.has-dot::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn);
}
@media (max-width: 800px) {
  .mod { flex-wrap: wrap; }
  .mod-actions { flex-direction: row; width: 100%; padding-left: 52px; }
}

/* Section tabs */
.tabbar a.has-dot::after { top: 6px; right: 2px; }
.mods-card p { margin: 0; }
.tabbar { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--panel); overflow-x: auto; }
.tabbar a {
  color: var(--muted); text-decoration: none; font-weight: 600; padding: 10px 12px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabbar a:hover { color: var(--text); }
.tabbar a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabbar a:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 140px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack label { font-size: 14px; font-weight: 600; }
textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
select { width: auto; }
.select-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch input { width: auto; accent-color: var(--accent); }
.list { list-style: none; margin: 10px 0 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
/* The text column keeps a readable width; buttons wrap below it when the row is narrow. */
.list .grow { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.list img { width: 24px; height: 24px; border-radius: 4px; image-rendering: pixelated; }
.notice:empty, .error:empty { display: none; }

/* Chat */
.chat-log {
  list-style: none; margin: 0 0 10px; padding: 0 4px 0 0; height: 360px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; font-size: 14px;
}
.chat-log li { padding: 3px 0; overflow-wrap: anywhere; }
.chat-log time { color: var(--muted); font-size: 12px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.chat-log .who { font-weight: 600; }
.chat-log .web-tag { font-size: 11px; color: var(--info); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-right: 4px; }
.chat-log .event { color: var(--muted); font-style: italic; }
.chat-log .empty { color: var(--muted); margin: auto; text-align: center; }
.chat-form { display: flex; gap: 8px; }

/* Performance charts */
.perf-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .perf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .perf-grid { grid-template-columns: minmax(0, 1fr); } }
.chart { position: relative; }
.chart-label { font-size: 13px; color: var(--muted); }
.chart-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.chart svg { display: block; width: 100%; height: 110px; overflow: visible; touch-action: pan-y; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart); opacity: .1; }
.chart .end { fill: var(--chart); stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart-tip {
  position: absolute; top: 0; pointer-events: none; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; white-space: nowrap; transform: translateX(-50%);
}
.chart-tip strong { display: block; font-size: 14px; }
.chart-tip span { color: var(--muted); }
.status-tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 3px; }
.status-tag.good { color: var(--accent); background: rgb(111 191 63 / .12); }
.status-tag.warn { color: var(--warn); background: rgb(231 176 74 / .12); }
.status-tag.bad { color: var(--danger); background: rgb(224 83 61 / .12); }
.sr-table { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Stats */
.stats-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 800px) { .stats-layout { grid-template-columns: minmax(0, 1fr); } }
.board { list-style: none; margin: 0 0 8px; padding: 0; }
.board li { margin: 0; }
.board button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.board button:hover, .board button[aria-pressed="true"] { background: var(--panel-2); }
.board .rank { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.board img { width: 28px; height: 28px; border-radius: 5px; image-rendering: pixelated; }
.board .name { flex: 1; font-weight: 600; }
.board .value { font-variant-numeric: tabular-nums; font-weight: 600; }
.board .bar { height: 4px; border-radius: 2px; background: var(--chart); margin-top: 4px; }
.board .who { flex: 1; min-width: 0; }
.profile-card .profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.profile-card .profile-head img { width: 56px; height: 56px; border-radius: 8px; image-rendering: pixelated; }
.profile-card h3 { margin: 0; font-size: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tile { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.tile dt { font-size: 12px; color: var(--muted); }
.tile dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.top-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.top-lists h4 { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.top-lists ol { margin: 0; padding-left: 18px; font-size: 13px; }
.top-lists li span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Join */
.join { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.steps { padding-left: 20px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.steps code { background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.welcome { margin: 0 0 12px; white-space: pre-line; }
.welcome:empty { display: none; }
.join-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
.rules { white-space: pre-line; }
.rules ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* Worlds */
.badge.current { color: var(--accent); }
.worlds-backup { margin-top: 10px; color: var(--muted); }
.new-world { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.new-world summary { cursor: pointer; font-weight: 600; }
.new-world form { margin-top: 10px; max-width: 480px; }

/* Invites */
.login-card a { color: var(--info); }
.invite-new {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgb(111 191 63 / .1);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
}
.invite-new code, .invite-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; }
.invite-new code { background: var(--bg); padding: 4px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.badge.open { color: var(--accent); }
.badge.used { color: var(--info); }
.badge.expired, .badge.revoked { color: var(--muted); }

.top-lists .player-link { color: var(--info); font-weight: 600; text-decoration: none; }
.top-lists .player-link:hover { text-decoration: underline; }
.top-lists .player-name { font-weight: 600; }

/* Accounts */
.account { display: grid; gap: 16px; max-width: 820px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.account > .card:first-child { grid-column: 1 / -1; }
@media (max-width: 700px) { .account { grid-template-columns: minmax(0, 1fr); } }
.account .tiles { margin: 0; }
.account .tile dd { font-size: 16px; overflow-wrap: anywhere; }
a.whoami { text-decoration: none; }
a.whoami:hover { color: var(--text); }
.list select { padding: 4px 8px; font-size: 13px; }
.badge.you { color: var(--info); }

/* Config files */
.config-pick select { flex: 1; min-width: 200px; max-width: 100%; }
.config-pick input[type=search] { flex: 0 1 220px; min-width: 140px; }
.config-form { margin-top: 12px; }
.config-props { margin-top: 8px; max-height: 560px; overflow-y: auto; padding-right: 4px; }
.prop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 260px); gap: 6px 16px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.prop:last-child { border-bottom: 0; }
.prop.changed { background: rgb(231 176 74 / .14); box-shadow: inset 3px 0 0 var(--warn); }
.prop-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prop-name code { font-weight: 600; overflow-wrap: anywhere; }
.prop-input { display: flex; justify-content: flex-end; }
.prop-input input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
.prop-input input[readonly] { opacity: .7; }
@media (max-width: 600px) { .prop { grid-template-columns: minmax(0, 1fr); } .prop-input { justify-content: flex-start; } }
.config-editor {
  width: 100%; margin-top: 12px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; overflow: auto; tab-size: 2;
  max-height: 70vh;
}
.config-actions { margin-top: 12px; }
.config-history { flex-basis: 100%; }
.config-history summary { cursor: pointer; color: var(--muted); }

/* Mods marketplace */
.market { display: flex; flex-direction: column; gap: 16px; }
.market-title { font-size: 24px; margin: 0 0 4px; }
.market-hero-head p { margin: 0; }
.market-search { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.market-search input { flex: 1 1 260px; font-size: 16px; padding: 10px 12px; }
.market-search select { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font: inherit; font-size: 13px; cursor: pointer; padding: 4px 10px; border-radius: 999px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.market-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1000px) { .market-layout { grid-template-columns: minmax(0, 1fr); } }
.market-main { min-width: 0; }
.market-note { margin: 0 0 10px; }
.market-main .notice, .market-main .error { margin: 0 0 10px; }
.market-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.market-item { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.market-item-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.market-item-head .mod-icon { width: 48px; height: 48px; flex: none; }
.market-item-title { min-width: 0; }
.market-item-title .mod-title { font-size: 16px; overflow-wrap: anywhere; }
.market-desc {
  margin: 0; font-size: 14px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.market-item-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.market-item-foot .badges { margin: 0; }
.market-item-foot .btn { flex: none; }
.market-side { display: flex; flex-direction: column; gap: 16px; }
.market-side p { margin: 0 0 6px; }
.market-list .mod-icon { width: 32px; height: 32px; font-size: 14px; flex: none; }
.market-list .badge { display: inline-block; margin-top: 3px; }
.market-list .mod-title { font-size: 14px; }
.market-installed-card .market-list { max-height: 420px; overflow-y: auto; }
.market-state { flex: none; font-size: 13px; font-weight: 700; padding: 4px 8px; white-space: nowrap; }
.market-state.installed { color: var(--accent); }
.market-state.requested { color: var(--info); }
@media (max-width: 700px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .chip { flex: none; }
}

/* Startup settings */
.startup-details > summary { cursor: pointer; font-weight: 600; }
.startup-details[open] > summary { margin-bottom: 12px; }
.startup-form { display: flex; flex-direction: column; gap: 6px; }
.startup-form > label { font-size: 14px; font-weight: 600; margin-top: 6px; }
.startup-grid { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: end; }
.startup-grid > label:not(.switch) { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.startup-grid select { width: 100%; }
.startup-nogui { grid-column: 1 / -1; }
.startup-preview { margin: 8px 0 4px; display: flex; flex-direction: column; gap: 4px; }
.startup-preview code { background: var(--bg); padding: 8px 10px; border-radius: 6px; overflow-wrap: anywhere; font-size: 12px; }

/* Minecraft account link */
.mc-card { grid-column: 1 / -1; }
.mc-card p { margin: 0; }
.mc-linked-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mc-head { width: 48px; height: 48px; image-rendering: pixelated; }
.mc-of { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.mc-of img { width: 18px; height: 18px; image-rendering: pixelated; }
#mc-code { font-family: ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; max-width: 220px; }
kbd { border: 1px solid currentColor; padding: 0 5px; font-size: .9em; }

/* Faction tags (Factions mod) */
.faction-tag {
  display: inline-block; font-weight: 700; font-size: .85em; line-height: 1.35; padding: 0 6px; margin: 0 6px 0 0;
  border-radius: 3px; vertical-align: 1px; white-space: nowrap; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .25);
}
.players .faction-tag, .board .faction-tag, .profile-card h3 .faction-tag { margin: 0 0 0 8px; }
.chat-prefix { font-weight: 700; margin-right: 6px; }
.faction-slot:empty { display: none; }
.players li { flex-wrap: wrap; row-gap: 4px; }
.players .faction-tag { margin-left: 0; }

/* Faction page */
.faction { display: flex; flex-direction: column; gap: 16px; }
.faction-head p { margin: 6px 0 0; }
.faction-name { margin: 0; font-size: 26px; }
.faction-name .faction-tag { font-size: 24px; padding: 2px 12px; margin: 0; }
.faction-motd { margin: 10px 0 0; font-weight: 600; }
.faction-card .tiles { margin: 14px 0 0; }
.faction-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 900px) { .faction-layout { grid-template-columns: minmax(0, 1fr); } }
.faction-chat-card .chat-log { height: 420px; }
.faction-chat-card > p { margin: 0 0 10px; }
.presence { font-size: 13px; font-weight: 700; padding: 1px 8px; white-space: nowrap; }
.presence.on { color: var(--accent); }
.presence.on::before { content: "● "; }
.presence.off { color: var(--muted); }
.mini-head { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; image-rendering: pixelated; }
.tile-rank { font-size: 12px; opacity: .85; margin-top: 2px; }
.mystats-card { grid-column: 1 / -1; }
.auto-wl { margin-top: 10px; font-size: 14px; }
.faction-chat-card code { white-space: nowrap; }
.tile dd.tile-rank { font-size: 12px; font-weight: 400; }
