/* snow — refined */
:root {
  --bg: #060606;
  --surface: #0e0e0e;
  --surface2: #141414;
  --surface3: #1a1a1a;
  --line: #262626;
  --line-strong: #343434;
  --text: #ededed;
  --muted: #8a8a8a;
  --faint: #5c5c5c;
  --accent: #ededed;
  --danger: #d66;
  --ok: #7b9;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --side: 228px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  --space: 1rem;
  --main-max: 1320px;
  --focus-ring: rgba(237, 237, 237, 0.18);
  --hover-bg: rgba(255, 255, 255, 0.04);
  --pressed-bg: rgba(255, 255, 255, 0.07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.42);
  --control-h: 2.25rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.auth-screen,
.layout,
#toast-container,
#modal-root {
  position: relative;
  z-index: 1;
}

.hidden { display: none !important; }

/* auth */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.auth-layout {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

/* Login/register: layout used to share space with an announcements column; when only the
   auth card exists, center it horizontally inside the wide desktop strip. */
.auth-layout > .auth-box:only-child {
  margin-inline: auto;
}

@media (min-width: 960px) {
  .auth-layout {
    max-width: 920px;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }
  .auth-layout .auth-box {
    flex: 0 0 360px;
    max-width: 360px;
  }
  .auth-announce {
    flex: 1;
    min-width: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
  }
}

.auth-announce {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-announce .panel {
  margin: 0;
}

.auth-announce .panel-title {
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.site-setup-body,
.feed-body {
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-feed-list .feed-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.site-feed-list .feed-item:last-child {
  border-bottom: none;
}

.feed-ts {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.feed-item-admin .feed-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.2rem;
}

.feed-item-admin .feed-item-head .feed-ts {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.feed-delete {
  margin-top: 0 !important;
  padding: 0.25rem 0.55rem !important;
  font-size: 0.72rem !important;
  flex-shrink: 0;
}

.main-announce {
  margin-bottom: 1rem;
}

.main-announce .grid-announce {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .main-announce .grid-announce {
    grid-template-columns: 1fr 1fr;
  }
}

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

.auth-box {
  width: 100%;
  max-width: 380px;
  background: rgba(14, 14, 14, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.65rem;
  box-shadow: var(--shadow-md);
}

.wordmark {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.65rem;
}

.auth-box .tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 1.35rem;
  padding: 0.28rem;
  border-bottom: none;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-box .tab {
  flex: 1;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0;
  border-bottom: none;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.auth-box .tab:hover {
  color: var(--text);
  background: var(--hover-bg);
}

.auth-box .tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* generic tabs (non-auth) */
.tabs {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.tab {
  background: none;
  border: none;
  color: var(--faint);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0 0 0.6rem;
  margin-bottom: -1px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.auth-support {
  text-align: center;
  margin-top: 0.5rem;
}

.auth-support a {
  color: var(--accent);
  text-decoration: none;
}

.auth-support a:hover {
  text-decoration: underline;
}

.auth-forgot {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.auth-forgot summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
  user-select: none;
  list-style: none;
}

.auth-forgot summary::-webkit-details-marker {
  display: none;
}

.auth-forgot label,
.auth-forgot input,
.auth-forgot button {
  margin-top: 0;
}

.hint.small {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

/* ── live control: control surface tokens ── */
#live-ui-root {
  --live-track: var(--line);
  --live-track-fill: #b8b8b8;
  --live-thumb: var(--text);
  --live-thumb-border: var(--bg);
  --live-control-h: var(--control-h);
  --live-control-radius: var(--radius);
  --live-focus: var(--focus-ring);
  --live-hover: var(--hover-bg);
  --live-pressed: var(--pressed-bg);
}

/* shared range styling */
#live-ui-root input.live-ui-range {
  --live-range-pct: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.35rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#live-ui-root input.live-ui-range:focus-visible {
  outline: none;
}

#live-ui-root input.live-ui-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--live-focus);
}

#live-ui-root input.live-ui-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--live-focus);
}

#live-ui-root input.live-ui-range::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--live-track-fill) 0%,
    var(--live-track-fill) var(--live-range-pct),
    var(--live-track) var(--live-range-pct),
    var(--live-track) 100%
  );
}

#live-ui-root input.live-ui-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid var(--live-thumb-border);
  background: var(--live-thumb);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#live-ui-root input.live-ui-range:hover::-webkit-slider-thumb {
  transform: scale(1.06);
}

#live-ui-root input.live-ui-range:active::-webkit-slider-thumb {
  transform: scale(0.96);
}

#live-ui-root input.live-ui-range::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: var(--live-track);
}

#live-ui-root input.live-ui-range::-moz-range-progress {
  height: 5px;
  border-radius: 999px 0 0 999px;
  background: var(--live-track-fill);
}

#live-ui-root input.live-ui-range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--live-thumb-border);
  background: var(--live-thumb);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

#live-ui-root .live-ui-num-input {
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-height: var(--live-control-h);
  padding: 0.28rem 0.45rem;
  font-size: 0.82rem;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--live-control-radius);
  transition: border-color 0.15s ease, background 0.15s ease;
}

#live-ui-root .live-ui-num-input:hover {
  border-color: #333;
}

#live-ui-root .live-ui-num-input:focus {
  outline: none;
  border-color: var(--faint);
  background: #1a1a1a;
  box-shadow: 0 0 0 3px var(--live-focus);
}

.live-ui-number-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 0.35rem 0.65rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: calc(var(--live-control-radius) + 2px);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.live-ui-number-field:hover {
  background: var(--live-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.live-ui-number-field label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--text);
  font-weight: 450;
}

.live-ui-number-field .live-ui-num-input {
  grid-column: 2;
  grid-row: 1;
  width: 4.75rem;
  max-width: none;
}

.live-ui-number-field input.live-ui-range {
  grid-column: 1 / -1;
  grid-row: 2;
}

.live-ui-rgba-field {
  --live-ui-rgb-ch: 128, 128, 128;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: calc(var(--live-control-radius) + 2px);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.live-ui-rgba-field:hover {
  background: var(--live-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.live-ui-rgba-visual {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-bottom: 0.35rem;
}

.live-ui-rgba-swatch {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.live-ui-rgba-swatch:hover {
  transform: scale(1.03);
}

.live-ui-rgba-swatch-checker {
  position: absolute;
  inset: 0;
  background-color: #2a2a2e;
  background-image:
    linear-gradient(45deg, #3d3d42 25%, transparent 25%),
    linear-gradient(-45deg, #3d3d42 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #3d3d42 75%),
    linear-gradient(-45deg, transparent 75%, #3d3d42 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.live-ui-rgba-swatch-fill {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

input.live-ui-color-hex {
  width: 2.75rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--live-control-radius);
  cursor: pointer;
  background: var(--surface2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input.live-ui-color-hex:hover {
  border-color: #333;
}

input.live-ui-color-hex:focus-visible {
  outline: none;
  border-color: var(--faint);
  box-shadow: 0 0 0 3px var(--live-focus);
}

input.live-ui-color-hex::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input.live-ui-color-hex::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.live-ui-rgba-channels {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.live-ui-rgba-ch {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.5rem;
  align-items: center;
}

.live-ui-rgba-ch-alpha .live-ui-alpha-range-wrap {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 1.05rem;
}

.live-ui-alpha-range-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 5px;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    to right,
    rgba(var(--live-ui-rgb-ch), 0),
    rgb(var(--live-ui-rgb-ch))
  );
}

.live-ui-alpha-range-wrap input.live-ui-range-alpha {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  background: transparent;
}

.live-ui-alpha-range-wrap input.live-ui-range-alpha::-webkit-slider-runnable-track {
  background: transparent;
}

.live-ui-alpha-range-wrap input.live-ui-range-alpha::-moz-range-track {
  background: transparent;
}

.live-ui-alpha-range-wrap input.live-ui-range-alpha::-moz-range-progress {
  background: transparent;
}

.live-ui-rgba-ch-label {
  grid-row: 1 / span 2;
  font-size: 0.72rem;
  color: var(--muted);
}

.live-ui-rgba-ch .live-ui-num-input {
  grid-column: 2;
  width: 100%;
  max-width: 11rem;
}

.live-ui-rgba-ch input.live-ui-range {
  grid-column: 2;
  width: 100%;
}

.live-ui-field.live-ui-rgba-field label:first-child {
  margin-bottom: 0.28rem;
}

.live-ui-rgba-channels-alpha-only {
  margin-top: 0.15rem;
}

.live-ui-keybind-field .live-ui-keybind-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

@media (max-width: 520px) {
  .live-ui-keybind-field .live-ui-keybind-mb-group {
    flex-wrap: wrap;
  }
}

.live-ui-keybind-field .live-ui-keybind-mb-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
}

.live-ui-keybind-mb {
  padding: 0.35rem 0.55rem !important;
  font-size: 0.72rem !important;
  font-weight: 500;
  min-width: 2.15rem;
  width: auto !important;
  flex: 0 0 auto;
  margin-top: 0 !important;
  text-align: center !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--surface2) !important;
  color: var(--muted) !important;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.live-ui-keybind-mb:hover {
  border-color: var(--faint) !important;
  color: var(--text) !important;
  background: var(--live-hover) !important;
}

.live-ui-keybind-mb:active {
  background: var(--live-pressed) !important;
}

.live-ui-keybind-field .live-ui-keybind-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  width: auto;
  max-width: none;
  padding: 0.42rem 0.7rem;
  min-height: var(--live-control-h);
  margin-top: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--live-control-radius);
  background: var(--surface2);
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.live-ui-keybind-field .live-ui-keybind-btn:hover {
  border-color: var(--faint);
  background: var(--live-hover);
}

.live-ui-keybind-field .live-ui-keybind-name {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", monospace;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.2;
}

.live-ui-keybind-field .live-ui-keybind-hint {
  font-size: 0.68rem;
  font-weight: 400;
  white-space: nowrap;
}

.live-ui-keybind-btn.live-ui-keybind-listen {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--live-focus);
}

.live-ui-main-tabs.tabs {
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
  padding: 0.3rem;
  border-bottom: none;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.live-ui-main-tabs .tab {
  padding: 0.45rem 0.9rem;
  margin-bottom: 0;
  border-bottom: none;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.live-ui-main-tabs .tab:hover {
  color: var(--text);
  background: var(--live-hover);
}

.live-ui-main-tabs .tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.live-ui-sub-tabs.tabs {
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.live-ui-sub-tabs .tab {
  padding: 0.35rem 0.7rem;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
  font-size: 0.8rem;
  color: var(--faint);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.live-ui-sub-tabs .tab:hover {
  color: var(--muted);
}

.live-ui-sub-tabs .tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  background: linear-gradient(to bottom, var(--live-hover), transparent);
}

.live-ui-cloud-profiles-mount {
  margin-bottom: 0.65rem;
}

.live-ui-field.live-ui-number-field label:first-child {
  margin: 0;
}

.live-ui-menu-stack {
  min-height: 4rem;
}

.live-ui-main-panel[data-live-main-panel="colors"] .live-ui-sub-panel:not(.hidden) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.55rem 0.75rem;
  align-items: start;
}

.live-ui-main-panel[data-live-main-panel="colors"] .live-ui-control-panel + .live-ui-control-panel {
  margin-top: 0;
}

.live-ui-split-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.85rem;
  align-items: start;
}

@media (min-width: 1100px) {
  .live-ui-split-cards:not(.live-ui-split-cards--player-main) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.live-ui-split-cards .live-ui-control-panel + .live-ui-control-panel {
  margin-top: 0;
}

.live-ui-split-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.live-ui-split-col .live-ui-control-panel + .live-ui-control-panel {
  margin-top: 0;
}

@media (max-width: 768px) {
  .live-ui-split-cards {
    grid-template-columns: 1fr;
  }
}

label.live-ui-native-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: calc(var(--live-control-radius) + 2px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

label.live-ui-native-row:hover {
  background: var(--live-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.live-ui-native-row .live-ui-native-cb {
  -webkit-appearance: none;
  appearance: none;
  width: 2.35rem;
  height: 1.3rem;
  min-width: 2.35rem;
  min-height: 1.3rem;
  max-width: none;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface2);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.live-ui-native-row .live-ui-native-cb::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: left 0.18s ease, background 0.18s ease, transform 0.12s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.live-ui-native-row .live-ui-native-cb:checked {
  background: rgba(232, 232, 232, 0.18);
  border-color: rgba(232, 232, 232, 0.45);
}

.live-ui-native-row .live-ui-native-cb:checked::before {
  left: calc(100% - 0.95rem - 2px);
  background: var(--text);
}

.live-ui-native-row .live-ui-native-cb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--live-focus);
}

.live-ui-native-row .live-ui-native-cb:active::before {
  transform: translateY(-50%) scale(0.92);
}

.live-ui-field-select .live-ui-select,
select.live-ui-select {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-size: 0.86rem;
  min-height: var(--live-control-h);
  padding: 0.42rem 2.1rem 0.42rem 0.65rem;
  background-color: var(--surface2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888888' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  border: 1px solid var(--line);
  border-radius: var(--live-control-radius);
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.live-ui-field-select .live-ui-select:hover,
select.live-ui-select:hover {
  border-color: #333;
  background-color: #1a1a1a;
}

.live-ui-field-select .live-ui-select:focus,
select.live-ui-select:focus {
  outline: none;
  border-color: var(--faint);
  box-shadow: 0 0 0 3px var(--live-focus);
}

.live-ui-field-select {
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: calc(var(--live-control-radius) + 2px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.live-ui-field-select:hover {
  background: var(--live-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.live-ui-field-select label:first-child {
  margin-top: 0;
  margin-bottom: 0.22rem;
}

.live-ui-bitmask-field {
  position: relative;
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: calc(var(--live-control-radius) + 2px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.live-ui-bitmask-field:hover {
  background: var(--live-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.live-ui-bitmask-field .live-ui-bitmask-title {
  display: block;
  margin: 0 0 0.4rem;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 450;
}

.live-ui-bitmask-trigger {
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.86rem;
  min-height: var(--live-control-h);
  padding: 0.42rem 2.1rem 0.42rem 0.65rem;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--live-control-radius);
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.live-ui-bitmask-trigger:hover {
  border-color: #333;
  background: #1a1a1a;
}

.live-ui-bitmask-trigger:focus-visible {
  outline: none;
  border-color: var(--faint);
  box-shadow: 0 0 0 3px var(--live-focus);
}

.live-ui-bitmask-trigger::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  transition: transform 0.15s ease;
}

.live-ui-bitmask-trigger[aria-expanded="true"]::after {
  transform: translateY(-35%) rotate(-135deg);
}

.live-ui-bitmask-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem;
  background: #141414;
  border: 1px solid #2e2e2e;
  border-radius: var(--live-control-radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.live-ui-bitmask-menu.hidden {
  display: none;
}

label.live-ui-bitmask-opt {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  padding: 0.42rem 0.55rem;
  border-radius: 6px;
  transition: background 0.12s ease;
}

label.live-ui-bitmask-opt:hover {
  background: var(--live-hover);
}

label.live-ui-bitmask-opt input.live-ui-bitmask-bit {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface2);
  cursor: pointer;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
}

label.live-ui-bitmask-opt input.live-ui-bitmask-bit:checked {
  background: var(--text);
  border-color: var(--text);
}

label.live-ui-bitmask-opt input.live-ui-bitmask-bit:checked::after {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.12rem;
  width: 0.28rem;
  height: 0.5rem;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

label.live-ui-bitmask-opt input.live-ui-bitmask-bit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--live-focus);
}

.live-ui-native-label {
  color: var(--text);
  flex: 1;
  user-select: none;
  line-height: 1.35;
}

.live-ui-control-panel {
  padding: 1rem 1.1rem;
  background: rgba(14, 14, 14, 0.92);
  border-color: #262626;
}

.live-ui-control-panel:hover {
  border-color: #2e2e2e;
}

.live-ui-card-head .panel-title {
  margin-top: 0;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--faint);
}

.live-ui-card-sub {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
}

.live-ui-control-panel + .live-ui-control-panel {
  margin-top: 0.85rem;
}

.live-ui-fields {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.live-ui-field label:first-child {
  display: block;
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 450;
}

.live-ui-keybind-field {
  padding: 0.5rem 0.65rem;
  border: 1px solid transparent;
  border-radius: calc(var(--live-control-radius) + 2px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.live-ui-keybind-field:hover {
  background: var(--live-hover);
  border-color: rgba(255, 255, 255, 0.04);
}

.live-ui-keybind-field > label:first-child {
  margin-bottom: 0.4rem;
}

#live-ui-root .live-ui-action-btn {
  margin-top: 0;
  min-height: var(--live-control-h);
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--live-control-radius);
  border: 1px solid var(--line);
  background: var(--surface2);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}

#live-ui-root .live-ui-action-btn:hover {
  border-color: var(--faint);
  background: var(--live-hover);
}

#live-ui-root .live-ui-action-btn:active {
  transform: translateY(1px);
  background: var(--live-pressed);
}

.live-ui-actions {
  gap: 0.45rem;
}

.panel > label:not(.form-checkbox-row):not(.live-ui-native-row),
.modal label:not(.form-checkbox-row):not(.live-ui-native-row) {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 1rem 0 0.35rem;
}

.panel > label:not(.form-checkbox-row):first-child,
.modal label:not(.form-checkbox-row):first-child {
  margin-top: 0;
}

.auth-panel > label:first-child:not(.form-checkbox-row),
.panel form > label:first-child:not(.form-checkbox-row),
.panel form > .form-checkbox-row:first-child,
form.panel > .form-checkbox-row:first-child {
  margin-top: 0;
}

/* Panel forms: consistent vertical rhythm */
.panel form,
form.panel,
form.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.panel form > .panel-title,
form.panel > .panel-title {
  margin-bottom: 0;
}

.panel form > label:not(.form-checkbox-row),
form.panel > label:not(.form-checkbox-row),
form.auth-panel > label:not(.form-checkbox-row) {
  margin: 0;
  padding-top: 0.05rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.panel form > input:not([type="checkbox"]):not([type="radio"]),
.panel form > textarea,
.panel form > select,
form.panel > input:not([type="checkbox"]):not([type="radio"]),
form.panel > textarea,
form.panel > select,
form.auth-panel > input,
form.auth-panel > textarea,
form.auth-panel > select {
  margin-top: 0;
}

.panel form > button,
form.panel > button,
form.auth-panel > button {
  align-self: flex-start;
  margin-top: 0;
}

.panel form > button.btn.primary,
form.panel > button.btn.primary,
form.auth-panel > button.btn.primary {
  align-self: stretch;
}

/* Native checkboxes for toggles (outside live-control) */
label.form-checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-size: inherit;
}

input.form-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 2.15rem;
  height: 1.25rem;
  min-width: 2.15rem;
  min-height: 1.25rem;
  margin: 0.05rem 0 0;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface3);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}

input.form-checkbox::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: left 0.18s ease, background 0.18s ease;
  box-shadow: var(--shadow-sm);
}

input.form-checkbox:checked {
  background: rgba(237, 237, 237, 0.16);
  border-color: rgba(237, 237, 237, 0.4);
}

input.form-checkbox:checked::before {
  left: calc(100% - 0.9rem - 2px);
  background: var(--text);
}

input.form-checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
  flex: 1;
}

.form-checkbox-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.form-checkbox-hint {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.tools .panel form {
  gap: 0.55rem;
}

input, textarea, select {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  min-height: var(--control-h);
  max-width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

select {
  padding-right: 2.1rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a8a' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}

input:hover, textarea:hover, select:hover {
  border-color: var(--line-strong);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--faint);
  background: var(--surface3);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea { min-height: 80px; resize: vertical; }

input, select, textarea, .btn {
  touch-action: manipulation;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  line-height: 1.45;
}

.hint.dev-hint {
  margin-top: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}

/* mobile nav (hidden on desktop) */
.side-toggle,
.side-backdrop,
.side-close {
  display: none;
}

/* layout */
.layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.side {
  width: var(--side);
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(12px);
}

.side-head {
  flex-shrink: 0;
  padding: 1.35rem 1.15rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.side-head .wordmark {
  margin-bottom: 0;
  font-size: 0.78rem;
}

.role {
  font-size: 0.72rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.side-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.65rem 0.5rem;
}

.nav-section {
  padding: 0.25rem 0 0.55rem;
}

.nav-section + .nav-section {
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
  padding-top: 0.65rem;
}

.nav-section .nav-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--faint);
  padding: 0.5rem 0.85rem 0.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section .nav-label:first-child {
  padding-top: 0.1rem;
}

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 450;
  line-height: 1.35;
  padding: 0.45rem 0.85rem;
  margin: 0.1rem 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--hover-bg);
}

.nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 500;
}

.side-foot {
  flex-shrink: 0;
  padding: 0.9rem 1rem 1.15rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.user-bar {
  width: 100%;
}

.user-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.user-bar-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
  line-height: 1.25;
}

.user-bar-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.user-bar-web {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--faint);
  word-break: break-word;
}

.user-bar-discord {
  font-size: 0.88rem;
  color: var(--faint);
  word-break: break-word;
}

.user-bar-discord::before {
  content: "·";
  margin-right: 0.55rem;
  color: var(--line);
  font-weight: 400;
}

.side-foot .discord-avatar,
.side-foot .discord-avatar--empty {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.user {
  display: block;
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 1.85rem 2.15rem 2.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: calc(100vw - var(--side));
}

.main-inner {
  max-width: var(--main-max);
  margin: 0 auto;
  width: 100%;
}

/* ── page layouts: fill width on desktop ── */
.page-dashboard {
  display: grid;
  gap: 0.85rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .page-dashboard {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  }

  .page-dashboard .main-announce {
    margin-bottom: 0;
  }

  .page-dashboard .grid-announce {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

.page-grid-2 {
  display: grid;
  gap: 0.85rem;
  align-items: start;
}

@media (min-width: 900px) {
  .page-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-grid-2 > .span-full {
    grid-column: 1 / -1;
  }
}

.page-grid-2-asym {
  display: grid;
  gap: 0.85rem;
  align-items: start;
}

@media (min-width: 960px) {
  .page-grid-2-asym {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  }
}

.form-grid-2 {
  display: grid;
  gap: 0.85rem;
}

form.panel.form-grid-2,
form.form-grid-2 {
  display: grid;
  align-items: start;
}

@media (min-width: 720px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.form-field label {
  margin: 0;
}

.form-span-2 {
  grid-column: 1 / -1;
}

.panel-license .grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .panel-license .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .panel-license .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.live-ui-top {
  display: grid;
  gap: 0.85rem;
  align-items: start;
  margin-bottom: 0.85rem;
}

@media (min-width: 960px) {
  .live-ui-top {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  }
}

.live-ui-top .live-ui-cloud-profiles-mount {
  margin-bottom: 0;
}

.config-library-layout .panel {
  margin-top: 0;
  margin-bottom: 0;
}

.config-library-main {
  min-width: 0;
}

.page-grid-2 > .panel {
  margin-bottom: 0;
}

.page-grid-2-asym > .panel {
  margin-bottom: 0;
}

.link-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.link-stack .btn.text {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
}

.link-stack .btn.text:hover {
  background: var(--hover-bg);
  border-color: var(--line-strong);
}

/* page */
.ph {
  margin-bottom: 1.65rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.ph h1 {
  font-size: 1.42rem;
  font-weight: 550;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.ph h2 {
  font-size: 1.25rem;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.ph p {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.4rem;
  max-width: 70ch;
  line-height: 1.5;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.2rem;
  margin-bottom: 0.85rem;
  background: rgba(14, 14, 14, 0.92);
  backdrop-filter: blur(8px);
  transition: border-color 0.15s ease;
}

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

.panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel h2.panel-title {
  font-size: 0.72rem;
}

.panel.danger {
  border-color: var(--danger);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}

.grid.two {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 640px) {
  .grid.two { grid-template-columns: 1fr; }
}

.cell {
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface2);
  transition: border-color 0.15s ease;
}

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

.cell .k {
  display: block;
  font-size: 0.72rem;
  color: var(--faint);
  margin-bottom: 0.25rem;
}

.cell .v {
  font-size: 0.875rem;
}

.cell code {
  font-size: 0.8rem;
  color: var(--text);
}

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}

@media (min-width: 1200px) {
  .tools {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}

@media (min-width: 900px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .stats {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

.stat {
  padding: 0.95rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  background: var(--surface2);
  transition: border-color 0.15s ease;
}

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

.stat b {
  display: block;
  font-size: 1.35rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat span {
  font-size: 0.72rem;
  color: var(--faint);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.48rem 0.9rem;
  min-height: var(--control-h);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  margin-top: 0.75rem;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease, opacity 0.12s ease;
}

.btn:hover {
  border-color: var(--line-strong);
  background: var(--surface3);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  width: 100%;
}

.btn.primary:hover {
  opacity: 0.92;
  background: var(--text);
  border-color: var(--text);
}

.btn.secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn.secondary:hover {
  background: var(--hover-bg);
  border-color: var(--faint);
}

.panel form .btn,
form.panel .btn,
form.auth-panel .btn {
  margin-top: 0;
}

.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn.ok {
  border-color: var(--ok);
  color: var(--ok);
}

.btn.text {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.35rem 0;
  margin: 0;
  min-height: auto;
  width: 100%;
  text-align: left;
  font-weight: 450;
}

.btn.text:hover {
  color: var(--text);
  background: none;
}

.side-foot .btn.text {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--muted);
  min-height: var(--control-h);
}

.side-foot .btn.text:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--hover-bg);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.row-actions .meta {
  margin-bottom: 0;
}

/* badges */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tag.ok {
  border-color: rgba(119, 187, 153, 0.45);
  color: var(--ok);
  background: rgba(119, 187, 153, 0.08);
}

.tag.bad {
  border-color: rgba(221, 102, 102, 0.45);
  color: var(--danger);
  background: rgba(221, 102, 102, 0.08);
}

/* table */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface2);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th, td {
  text-align: left;
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--faint);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.2);
}

tr:last-child td { border-bottom: none; }

tr.clickable { cursor: pointer; }

tr.clickable:hover td {
  background: var(--hover-bg);
}

.discord-user-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.discord-user-cell .discord-avatar,
.discord-user-cell .discord-avatar--empty {
  width: 40px;
  height: 40px;
}

.account-name-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.5rem;
  min-width: 0;
}

.account-name-cell .account-web {
  font-weight: 500;
  color: var(--text);
}

.account-name-cell .account-discord {
  font-size: 0.92em;
  color: var(--faint);
}

.account-name-cell .account-discord::before {
  content: "·";
  margin-right: 0.45rem;
  color: var(--line);
}

.discord-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--line);
  border: 1px solid var(--line);
}

.discord-avatar--empty {
  display: inline-block;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid var(--line);
}

td code { font-size: 0.78rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface2);
}

.toolbar input {
  flex: 1;
  min-width: 160px;
  margin: 0;
}

.toolbar .btn {
  margin-top: 0;
  flex-shrink: 0;
}

.meta {
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 1rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.back-link:hover { color: var(--text); }

.panel form .btn:not(.primary) {
  width: auto;
}

.tools .panel .btn {
  margin-top: 0;
}

/* ticket chat */
.staff-chats-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 1rem;
  align-items: stretch;
}

.staff-chat-rooms {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 70vh;
  overflow-y: auto;
}

.staff-chat-room-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.staff-chat-room-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.staff-chat-room-btn.active {
  background: var(--hover-bg);
  box-shadow: inset 3px 0 0 var(--text);
}

.staff-chat-room-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--faint);
  margin-top: 0.2rem;
}

.staff-chat-empty {
  padding: 1rem;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  max-height: 520px;
  padding: 0;
  overflow: hidden;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.chat-user {
  color: var(--faint);
  font-size: 0.78rem;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 200px;
}

.chat-msg {
  max-width: 85%;
  font-size: 0.85rem;
}

.chat-msg.mine {
  align-self: flex-end;
  text-align: right;
}

.chat-msg.theirs {
  align-self: flex-start;
}

.chat-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--faint);
  margin-bottom: 0.2rem;
}

.chat-bubble {
  display: inline-block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface2);
  text-align: left;
  word-break: break-word;
  line-height: 1.45;
}

.chat-msg.mine .chat-bubble {
  background: var(--surface3);
  border-color: var(--line-strong);
}

.chat-img {
  max-width: 220px;
  max-height: 160px;
  border-radius: var(--radius);
  margin-top: 0.35rem;
  border: 1px solid var(--line);
}

.chat-file {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
}

.chat-compose {
  border-top: 1px solid var(--line);
  padding: 0.75rem 1rem;
}

.chat-compose textarea {
  margin: 0 0 0.5rem;
  min-height: 56px;
}

.chat-compose-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chat-compose .btn {
  margin-top: 0;
}

.file-btn {
  cursor: pointer;
}

.tickets-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0.75rem;
  align-items: start;
}

@media (max-width: 768px) {
  .tickets-layout {
    grid-template-columns: 1fr;
  }
}

.ticket-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 520px;
  overflow-y: auto;
  background: var(--surface);
}

.ticket-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.ticket-row:hover,
.ticket-row.active {
  background: var(--hover-bg);
}

.ticket-row.active {
  box-shadow: inset 3px 0 0 var(--text);
}

.ticket-row small {
  display: block;
  color: var(--faint);
  margin-top: 0.2rem;
}

.ticket-row .tag {
  margin-top: 0.35rem;
}

/* misc */
.empty {
  color: var(--faint);
  font-size: 0.875rem;
  padding: 1.5rem 0;
}

.empty a { color: var(--text); }

.loading {
  padding: 4rem 0;
  text-align: center;
  color: var(--faint);
  font-size: 0.875rem;
}

.list-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}

.list-item:last-child { border-bottom: none; }

#toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toast {
  font-size: 0.84rem;
  padding: 0.7rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 420px;
  white-space: pre-line;
  box-shadow: var(--shadow-md);
  line-height: 1.4;
}

.toast.error {
  border-color: rgba(221, 102, 102, 0.5);
  background: rgba(221, 102, 102, 0.06);
}

.toast.success {
  border-color: rgba(119, 187, 153, 0.5);
  background: rgba(119, 187, 153, 0.06);
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  max-width: 440px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  box-shadow: var(--shadow-md);
}

.modal h3 {
  font-size: 0.95rem;
  font-weight: 550;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.keybox {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0.5rem 0;
  max-height: 180px;
  overflow: auto;
}

pre.json {
  font-size: 0.75rem;
  overflow: auto;
  max-height: 280px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* database browser */
.db-layout {
  display: grid;
  grid-template-columns: 140px 160px 1fr;
  gap: 0.75rem;
  align-items: start;
}

@media (max-width: 900px) {
  .db-layout { grid-template-columns: 1fr; }
}

.db-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 420px;
  overflow-y: auto;
}

.db-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}

.db-list button:hover { color: var(--text); background: var(--surface2); }
.db-list button.active { color: var(--text); background: var(--surface2); }
.db-list button:last-child { border-bottom: none; }

.db-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
  max-height: 520px;
  overflow-y: auto;
}

.db-editor label {
  margin-top: 0.65rem;
  font-size: 0.72rem;
}

.db-editor input,
.db-editor textarea {
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
}

.db-cell-trunc {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal.wide {
  max-width: 640px;
}

/* ——— phones & tablets ——— */
@media (max-width: 768px) {
  html { font-size: 16px; }

  input, textarea, select {
    font-size: 16px;
  }

  .auth-screen {
    align-items: flex-start;
    padding-top: max(2rem, env(safe-area-inset-top));
  }

  .layout {
    flex-direction: row;
    height: 100dvh;
    overflow: hidden;
  }

  .side-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    position: fixed;
    top: max(0.65rem, env(safe-area-inset-top));
    left: max(0.65rem, env(safe-area-inset-left));
    z-index: 60;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .side-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: currentColor;
    border-radius: 1px;
  }

  .side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .side-backdrop.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 100%;
    height: 100dvh;
    z-index: 56;
    border-right: 1px solid var(--line);
    border-bottom: none;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .side.open {
    transform: translateX(0);
  }

  .side-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: max(0.75rem, env(safe-area-inset-top));
    right: 0.75rem;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface2);
    color: var(--text);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .side-head {
    padding-right: 3rem;
  }

  .side-body {
    max-height: none;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }

  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .main {
    flex: 1;
    width: 100%;
    max-width: 100%;
    padding: calc(3.25rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .ph h1 {
    font-size: 1.2rem;
  }

  .panel {
    padding: 1rem;
  }

  .tools {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input {
    min-width: 0;
    width: 100%;
  }

  .toolbar .btn {
    width: 100%;
  }

  .row-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .btn.text {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .chat-panel {
    min-height: min(420px, 55dvh);
    max-height: min(520px, 65dvh);
  }

  .chat-msg {
    max-width: 92%;
  }

  .chat-img {
    max-width: min(220px, 100%);
    height: auto;
  }

  .chat-compose-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }

  .tickets-layout {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .tickets-layout:not(.ticket-chat-open) .ticket-chat {
    display: none;
  }

  .tickets-layout.ticket-chat-open .ticket-list {
    display: none;
  }

  .ticket-list {
    max-height: min(280px, 40dvh);
  }

  .ticket-chat-back {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-right: 0.5rem;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
  }

  #toast-container {
    left: max(0.75rem, env(safe-area-inset-left));
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .toast {
    max-width: none;
    width: 100%;
  }

  .modal-bg {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .modal {
    max-height: 90dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .modal.wide {
    max-width: 100%;
  }

  table {
    font-size: 0.78rem;
  }

  th, td {
    padding: 0.5rem 0.55rem;
    white-space: nowrap;
  }

  td code {
    word-break: break-all;
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .chat-compose-actions {
    flex-direction: column;
  }

  .chat-compose-actions .btn {
    width: 100%;
    flex: none;
  }
}

/* library cards */
.library-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
}

.library-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.05rem 1.15rem;
  background: rgba(14, 14, 14, 0.92);
  backdrop-filter: blur(8px);
  transition: border-color 0.15s ease;
  height: 100%;
}

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

.library-card h3 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.library-card .meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.library-card .desc {
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.library-card code {
  font-size: 0.85rem;
}

/* user detail */
.detail-section {
  margin-bottom: 1.25rem;
}

.detail-section h2 {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.75rem;
  text-transform: lowercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.detail-grid .cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  background: rgba(7, 7, 7, 0.5);
}

.detail-grid .k {
  display: block;
  font-size: 0.72rem;
  color: var(--faint);
  margin-bottom: 0.25rem;
}

.detail-grid .v {
  font-size: 0.88rem;
  word-break: break-word;
}

.detail-grid .v code {
  font-size: 0.8rem;
}

.pw-cell code {
  color: var(--ok);
}

.sub-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sub-list .sub-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  font-size: 0.84rem;
  background: var(--surface2);
  transition: border-color 0.15s ease;
}

.sub-list .sub-item:hover {
  border-color: var(--line-strong);
}

tr.db-row {
  cursor: pointer;
}

.db-cell-trunc {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr.db-row.active {
  background: rgba(255, 255, 255, 0.06);
}

.db-edit-panel {
  margin-top: 1rem;
  border-color: var(--muted);
}

.db-edit-panel textarea {
  min-height: 8rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

/* staff ticket back button — desktop hidden */
.ticket-chat-back {
  display: none;
}

@media (min-width: 769px) {
  .side-toggle,
  .side-backdrop,
  .side-close {
    display: none !important;
  }
}

.config-page-tabs {
  margin-bottom: 1rem;
}

.config-tab-panel.hidden {
  display: none;
}

.live-ui-world-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 900px) {
  .live-ui-world-split {
    grid-template-columns: 1fr;
  }
}

.live-ui-world-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 22rem;
  overflow: auto;
  margin-top: 0.5rem;
}

button.live-ui-world-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--live-control-radius);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

button.live-ui-world-row:hover {
  border-color: #383838;
  background: var(--live-hover);
}

button.live-ui-world-row.selected {
  border-color: rgba(232, 232, 232, 0.45);
  background: rgba(232, 232, 232, 0.06);
  box-shadow: inset 3px 0 0 var(--text);
}

button.live-ui-world-row:active {
  transform: scale(0.995);
}

.live-ui-world-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.live-ui-world-meta {
  font-size: 0.78rem;
}

.live-ui-cond-row.hidden {
  display: none !important;
}
