:root {
  color-scheme: dark;
  --editor-bg: #101419;
  --editor-bg-soft: #141a20;
  --editor-surface: #182029;
  --editor-surface-strong: #202a34;
  --editor-surface-raised: #24313d;
  --editor-border: #344452;
  --editor-border-soft: rgba(157, 174, 189, 0.2);
  --editor-text: #edf3f7;
  --editor-text-soft: #bac7d1;
  --editor-muted: #8fa1af;
  --editor-accent: #7e170a;
  --editor-accent-strong: #d91c03;
  --editor-accent-soft: rgba(224, 82, 63, 0.16);
  --editor-link: #7dd3fc;
  --editor-success: #42d392;
  --editor-warning: #f3b84f;
  --editor-danger: #ec270d;
  --editor-radius: 8px;
  --editor-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --bg: var(--editor-bg);
  --bg0: var(--editor-bg);
  --bg1: var(--editor-bg-soft);
  --ui-bg: rgba(24, 32, 41, 0.9);
  --ui-bg-2: rgba(17, 24, 32, 0.78);
  --panel: var(--editor-surface);
  --panel2: var(--editor-surface-strong);
  --panel-2: var(--editor-surface-strong);
  --surface: var(--editor-surface);
  --surface-soft: var(--editor-surface);
  --surface-strong: var(--editor-surface-strong);
  --card: var(--editor-surface);
  --card2: var(--editor-surface-strong);
  --border: var(--editor-border);
  --line: var(--editor-border);
  --line2: var(--editor-border-soft);
  --line-soft: var(--editor-border-soft);
  --text: var(--editor-text);
  --txt: var(--editor-text);
  --text2: var(--editor-text-soft);
  --muted: var(--editor-muted);
  --field: #111820;
  --field-border: var(--editor-border);
  --field-text: var(--editor-text);
  --tab: var(--editor-surface);
  --tab-active: var(--editor-surface-raised);
  --tab-border: var(--editor-border);
  --accent: var(--editor-accent);
  --accent2: var(--editor-accent-strong);
  --accent-2: var(--editor-accent-strong);
  --red: var(--editor-accent);
  --red-weak: var(--editor-accent-soft);
  --cyan: var(--editor-link);
  --info: var(--editor-link);
  --green: var(--editor-success);
  --good: var(--editor-success);
  --ok: var(--editor-success);
  --success: var(--editor-success);
  --amber: var(--editor-warning);
  --warn: var(--editor-warning);
  --warning: var(--editor-warning);
  --bad: var(--editor-danger);
  --danger: var(--editor-danger);
  --focus: rgba(125, 211, 252, 0.22);
}

html {
  min-height: 100%;
  background: var(--editor-bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.08), transparent 32rem),
    linear-gradient(180deg, var(--editor-bg-soft), var(--editor-bg) 28rem);
  color: var(--editor-text);
}

body.browser-shop-body,
body.shop-only-body,
body.items-editor-body,
body.image-admin-body,
body.im-body,
body.missing-items-body,
body.min-h-screen {
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.08), transparent 32rem),
    linear-gradient(180deg, var(--editor-bg-soft), var(--editor-bg) 28rem) !important;
  color: var(--editor-text) !important;
}

a {
  color: var(--editor-link);
}

.editor-global-shell {
  position: sticky;
  top: 0;
  z-index: 10000;
  width: min(1500px, calc(100% - 24px));
  margin: 12px auto 18px;
  padding: 10px;
  border: 1px solid var(--editor-border);
  border-radius: var(--editor-radius);
  background: rgba(24, 32, 41, 0.94);
  box-shadow: var(--editor-shadow);
  backdrop-filter: blur(14px);
}

.editor-global-menu,
.editor-section-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-global-menu {
  justify-content: space-between;
}

.editor-global-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--editor-accent);
  color: #fff;
  font: 800 0.86rem/1.1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.editor-global-links,
.editor-section-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.editor-global-link,
.editor-section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--editor-text-soft);
  font: 700 0.78rem/1.1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.editor-global-link:hover,
.editor-section-link:hover,
.editor-global-link:focus-visible,
.editor-section-link:focus-visible {
  border-color: var(--editor-border);
  background: var(--editor-surface-raised);
  color: var(--editor-text);
  outline: none;
}

.editor-global-link.is-active,
.editor-section-link.is-active {
  border-color: rgba(224, 82, 63, 0.5);
  background: var(--editor-accent-soft);
  color: #fff;
}

.editor-section-menu {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--editor-border-soft);
  justify-content: flex-start;
}

.editor-section-link {
  min-height: 30px;
  font-weight: 650;
}

.topbar,
.shop-topbar,
.items-editor-topbar,
.ia-topbar,
.im-topbar,
header.topbar,
header[class*="topbar"] {
  border-color: var(--editor-border) !important;
  background: rgba(24, 32, 41, 0.94) !important;
  color: var(--editor-text) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.panel,
.card,
.ia-panel,
.im-panel,
.scum-slot,
.admin-table,
.category-admin-panel,
.simple-card,
.bp-panel,
.encountercalc,
.encounter-card,
.encounter-pill,
.field,
.container,
.section,
.box,
.content,
main,
table,
form {
  border-color: var(--editor-border-soft);
}

.panel,
.card,
.ia-panel,
.im-panel,
.scum-slot,
.admin-table,
.simple-card,
.bp-panel,
.encountercalc,
.encounter-card,
.encounter-pill {
  background: rgba(24, 32, 41, 0.88) !important;
  border-color: var(--editor-border-soft) !important;
  color: var(--editor-text);
}

button,
.btn,
.button,
input[type="button"],
input[type="submit"],
input[type="file"]::file-selector-button {
  border-color: rgba(224, 82, 63, 0.46) !important;
  background: var(--editor-accent) !important;
  color: #fff !important;
}

button:hover,
.btn:hover,
.button:hover,
input[type="button"]:hover,
input[type="submit"]:hover {
  background: var(--editor-accent-strong) !important;
}

button.secondary,
.btn.secondary,
.button.secondary,
a.secondary {
  border-color: var(--editor-border) !important;
  background: var(--editor-surface-raised) !important;
  color: var(--editor-text) !important;
}

input,
select,
textarea {
  border-color: var(--editor-border) !important;
  background: #111820 !important;
  color: var(--editor-text) !important;
}

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

table {
  background-color: rgba(24, 32, 41, 0.78);
  color: var(--editor-text);
}

th {
  background-color: var(--editor-surface-strong);
  color: var(--editor-text);
}

td {
  border-color: var(--editor-border-soft);
}

@media (max-width: 860px) {
  .editor-global-shell {
    position: static;
    width: min(100% - 16px, 1500px);
    margin-top: 8px;
    padding: 8px;
  }

  .editor-global-menu {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-global-brand {
    justify-content: center;
    width: 100%;
  }

  .editor-global-links,
  .editor-section-menu {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
}
