:root {
  --canvas: #f3ead9;
  --canvas-deep: #e6d7bc;
  --text-main: #1f2221;
  --text-muted: #4c544f;
  --panel: rgba(255, 249, 236, 0.86);
  --panel-edge: rgba(76, 84, 79, 0.2);
  --accent: #b2452f;
  --accent-strong: #8f2f1c;
  --accent-soft: #edd6c7;
  --focus: #3f7f66;
  --shadow-soft: 0 14px 40px rgba(57, 47, 28, 0.18);
  --bg-radial-one: rgba(178, 69, 47, 0.2);
  --bg-radial-two: rgba(63, 127, 102, 0.16);
  --orb-one: rgba(178, 69, 47, 0.34);
  --orb-two: rgba(63, 127, 102, 0.25);
  --ornament: rgba(111, 71, 20, 0.2);
  --ghost-bg: rgba(255, 255, 255, 0.45);
  --ghost-border: rgba(76, 84, 79, 0.25);
  --nwn-portrait-ratio: 16 / 25;
}

:root[data-theme="dark"] {
  --canvas: #0f1014;
  --canvas-deep: #1b1620;
  --text-main: #ece6d6;
  --text-muted: #c2b9a4;
  --panel: rgba(24, 24, 30, 0.8);
  --panel-edge: rgba(229, 209, 163, 0.22);
  --accent: #d16b2a;
  --accent-strong: #eb8b4d;
  --accent-soft: rgba(209, 107, 42, 0.2);
  --focus: #5ec4a5;
  --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.38);
  --bg-radial-one: rgba(209, 107, 42, 0.24);
  --bg-radial-two: rgba(102, 52, 145, 0.2);
  --orb-one: rgba(209, 107, 42, 0.35);
  --orb-two: rgba(98, 58, 152, 0.25);
  --ornament: rgba(236, 198, 126, 0.26);
  --ghost-bg: rgba(236, 230, 214, 0.06);
  --ghost-border: rgba(229, 209, 163, 0.24);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text-main);
  background:
    radial-gradient(1000px 460px at 80% -120px, var(--bg-radial-one), transparent 65%),
    radial-gradient(640px 340px at 8% 0%, var(--bg-radial-two), transparent 70%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas-deep) 100%);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.2;
  background-image:
    linear-gradient(45deg, transparent 48%, var(--ornament) 49%, transparent 50%),
    linear-gradient(-45deg, transparent 48%, var(--ornament) 49%, transparent 50%);
  background-size: 34px 34px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: 0.01em;
}

a {
  color: inherit;
}

.scene-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.ambient-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.55;
  animation: float 11s ease-in-out infinite;
}

.ambient-orb--one {
  width: 330px;
  height: 330px;
  top: 5%;
  right: -120px;
  background: var(--orb-one);
}

.ambient-orb--two {
  width: 260px;
  height: 260px;
  left: -95px;
  top: 42%;
  background: var(--orb-two);
  animation-delay: -4s;
}

.site-header {
  padding-top: 1.2rem;
}

.app-nav {
  padding: 0;
}

.app-nav__inner {
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
  padding: 0.45rem 0.75rem;
}

.app-nav__toggle {
  border: 0;
}

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brandmark__sigil {
  width: 2.1rem;
  height: 2.1rem;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
}

.brandmark__label {
  color: var(--text-main);
}

.app-loading .brandmark__sigil {
  opacity: 0;
  transform: scale(0.78) rotate(-24deg);
  filter: blur(2px);
}

.app-ready .brandmark__sigil {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  filter: blur(0);
  transition: opacity 320ms ease, transform 500ms cubic-bezier(0.2, 0.9, 0.2, 1), filter 500ms ease;
}

.app-nav__links {
  gap: 0.3rem;
}

.app-nav .nav-link {
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  transition: background-color 200ms ease, color 200ms ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus-visible {
  background: var(--ghost-bg);
  color: var(--text-main);
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.page-shell {
  padding-top: 1.3rem;
  padding-bottom: 2rem;
}

.btn {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.54rem 1.08rem;
  border-width: 1px;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

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

.btn-auth,
.btn-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-auth:hover,
.btn-auth:focus-visible,
.btn-cta:hover,
.btn-cta:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  box-shadow: 0 8px 18px rgba(143, 47, 28, 0.27);
}

.btn-ghost {
  background: var(--ghost-bg);
  border-color: var(--ghost-border);
  color: var(--text-main);
}

.btn-theme {
  background: var(--ghost-bg);
  border-color: var(--ghost-border);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-icon {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  position: relative;
  display: inline-grid;
  place-items: center;
}

.theme-icon__sun,
.theme-icon__moon {
  position: absolute;
  inset: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.theme-icon__sun {
  border-radius: 50%;
  background: currentColor;
  transform: scale(0.86);
  box-shadow:
    0 -0.58rem 0 -0.47rem currentColor,
    0 0.58rem 0 -0.47rem currentColor,
    0.58rem 0 0 -0.47rem currentColor,
    -0.58rem 0 0 -0.47rem currentColor;
}

.theme-icon__moon {
  border-radius: 50%;
  border: 2px solid currentColor;
  transform: translateX(0.11rem) scale(0.93);
}

.theme-icon__moon::after {
  content: "";
  position: absolute;
  inset: -2px;
  transform: translateX(-0.3rem);
  background: var(--ghost-bg);
  border-radius: 50%;
}

:root[data-theme="light"] .theme-icon__moon {
  opacity: 0;
  transform: translateX(0.22rem) scale(0.78);
}

:root[data-theme="dark"] .theme-icon__sun {
  opacity: 0;
  transform: scale(0.58) rotate(70deg);
}

.theme-label {
  font-size: 0.92rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.2rem;
  align-items: stretch;
}

.hero__intro,
.hero__panel,
.feature-card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(7px);
}

.hero__intro {
  padding: 2rem;
}

.eyebrow {
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.08;
}

.lead {
  margin-top: 1rem;
  max-width: 56ch;
  color: var(--text-muted);
}

.hero__actions {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.hero__actions--right {
  justify-content: flex-end;
}

.hero__panel {
  padding: 1.6rem;
}

.hero__panel h2 {
  margin-bottom: 0.8rem;
  font-size: 1.35rem;
}

.home-portrait-collection {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-height: 540px;
  overflow: auto;
  padding-right: 0.2rem;
}

.home-portrait-card {
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 0.9rem;
  padding: 0.6rem;
}

.home-portrait-card__name {
  margin: 0.45rem 0 0.2rem;
  font-size: 1rem;
}

.home-portrait-card__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.hero__panel--carousel h2 {
  margin-bottom: 0.55rem;
}

.hero__panel--carousel .hero__panel-meta {
  margin: 0.2rem 0;
  color: var(--text-muted);
}

.home-portrait-spotlight {
  display: flex;
  justify-content: center;
  align-items: stretch;
  align-self: stretch;
}

.home-portrait-frame {
  width: clamp(120px, 18vw, 160px);
  aspect-ratio: var(--nwn-portrait-ratio);
  margin: 0 0 0.7rem;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid var(--ghost-border);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.18));
}

.home-portrait-frame--spotlight {
  width: auto;
  height: 100%;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--panel-edge);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.home-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
}

.hero__panel--carousel.is-refreshing {
  animation: rise 280ms ease;
}

.home-portrait-frame.is-refreshing {
  animation: rise 280ms ease;
}

.hero__panel ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.hero__panel li + li {
  margin-top: 0.66rem;
}

.feature-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.upload-board {
  margin-top: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(7px);
  padding: 1.4rem;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.1rem;
}

.upload-board__head h2 {
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  margin-bottom: 0.6rem;
}

.upload-board__form {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  align-items: start;
  gap: 0.8rem;
}

.upload-form-section {
  display: grid;
  gap: 0.8rem;
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 1rem;
  padding: 1rem;
}

.upload-form-section--image {
  background: transparent;
}

.modal-content {
  background: var(--panel);
  color: var(--text-main);
  border: 1px solid var(--panel-edge);
  box-shadow: var(--shadow-soft);
}

.modal-header,
.modal-footer {
  border-color: var(--panel-edge);
}

.modal-title {
  font-family: "Fraunces", Georgia, serif;
}

:root[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(220%);
}

.cropper-panel {
  margin-top: 0.2rem;
}

.cropper-stage {
  position: relative;
  width: 100%;
  min-height: 320px;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid var(--ghost-border);
  background: rgba(0, 0, 0, 0.12);
  touch-action: none;
  cursor: crosshair;
}

.cropper-stage.is-empty {
  border: 1px dashed var(--ghost-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.cropper-stage.is-dragover {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cropper-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 0.65rem;
  align-items: start;
}

.cropper-stage img {
  width: 100%;
  height: auto;
  display: block;
}

.cropper-drop-prompt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.cropper-selection {
  position: absolute;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.48);
  border-radius: 0.35rem;
  cursor: move;
}

.cropper-selection-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.5);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.cropper-selection-handle--nw {
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  cursor: nwse-resize;
}

.cropper-selection-handle--n {
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  cursor: ns-resize;
}

.cropper-selection-handle--ne {
  right: 0;
  top: 0;
  transform: translate(50%, -50%);
  cursor: nesw-resize;
}

.cropper-selection-handle--e {
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  cursor: ew-resize;
}

.cropper-selection-handle--se {
  right: 0;
  bottom: 0;
  transform: translate(50%, 50%);
  cursor: nwse-resize;
}

.cropper-selection-handle--s {
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 50%);
  cursor: ns-resize;
}

.cropper-selection-handle--sw {
  left: 0;
  bottom: 0;
  transform: translate(-50%, 50%);
  cursor: nesw-resize;
}

.cropper-selection-handle--w {
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: ew-resize;
}

.variant-preview-rail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.variant-preview-card {
  margin: 0;
  padding: 0.45rem;
  border: 1px solid var(--ghost-border);
  border-radius: 0.7rem;
  background: var(--ghost-bg);
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  cursor: pointer;
}

.variant-preview-card figcaption {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.variant-preview-card canvas {
  width: 64px;
  height: 100px;
  border-radius: 0.3rem;
  border: 1px solid var(--ghost-border);
  background: rgba(0, 0, 0, 0.12);
}

.variant-preview-card.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.variant-preview-card.is-disabled {
  opacity: 0.58;
}

.variant-preview-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.upload-locked {
  background: var(--ghost-bg);
  border: 1px dashed var(--ghost-border);
  border-radius: 0.95rem;
  padding: 1.1rem;
}

.upload-locked h3 {
  font-size: 1.12rem;
  margin-bottom: 0.5rem;
}

.upload-locked p {
  margin: 0;
  color: var(--text-muted);
}

.upload-locked .hero__actions {
  margin-top: 1rem;
}

.field-row {
  display: grid;
  gap: 0.32rem;
}

.field-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.cropper-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.cropper-header-row .field-label {
  margin-right: auto;
}

.cropper-header-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
  text-align: right;
}

.field-input {
  width: 100%;
  border-radius: 0.78rem;
  border: 1px solid var(--ghost-border);
  background: var(--ghost-bg);
  color: var(--text-main);
  padding: 0.62rem 0.72rem;
  font-size: 0.95rem;
  line-height: 1.25;
}

.field-input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.server-suggestions {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
  border: 1px solid var(--ghost-border);
  border-radius: 0.78rem;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.server-suggestions__item {
  padding: 0.46rem 0.62rem;
  border-radius: 0.58rem;
  cursor: pointer;
}

.server-suggestions__item:hover,
.server-suggestions__item.is-active {
  background: var(--ghost-bg);
}

.server-selection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: default;
}

.server-selection-remove {
  margin-left: auto;
  padding: 0.22rem 0.58rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

.field-help {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.field-status {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.field-status[data-server-status="idle"],
.field-status[data-server-status="loading"] {
  color: var(--text-muted);
}

.field-status[data-server-status="ok"] {
  color: #2f7a5f;
}

.field-status[data-server-status="error"] {
  color: #9f2c1d;
}

.working-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: grid;
  place-items: center;
  z-index: 1200;
  padding: 1rem;
}

.working-modal__panel {
  width: min(28rem, 100%);
  border-radius: 0.95rem;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.2rem;
}

.working-modal__panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.working-modal__panel p {
  margin: 0;
  color: var(--text-muted);
}

:root[data-theme="dark"] .field-status[data-server-status="ok"] {
  color: #6ae7bb;
}

:root[data-theme="dark"] .field-status[data-server-status="error"] {
  color: #ff8f7d;
}

.feature-card {
  padding: 1.25rem;
}

.feature-card h3 {
  font-size: 1.22rem;
}

.feature-card p {
  margin-top: 0.72rem;
  margin-bottom: 0;
  color: var(--text-muted);
}

.site-footer {
  margin-top: 0.75rem;
  padding: 0.7rem 0 1.35rem;
  color: var(--text-muted);
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  border-top: 1px solid rgba(76, 84, 79, 0.24);
  padding-top: 0.95rem;
  font-size: 0.94rem;
}

.site-footer__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-footer__legal {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.site-version {
  font-size: 0.82rem;
  color: var(--text-muted);
  border: 1px solid var(--ghost-border);
  border-radius: 999px;
  padding: 0.2rem 0.58rem;
  background: var(--ghost-bg);
}

.site-footer a {
  text-decoration: none;
  font-weight: 700;
}

.page-panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(7px);
  padding: 1.5rem;
}

.app-loading .hero .eyebrow,
.app-loading .hero h1,
.app-loading .hero .lead,
.app-loading .hero .hero__actions,
.app-loading .hero .hero__panel,
.app-loading .feature-card,
.app-loading .page-panel {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(3px);
}

.app-ready .hero .eyebrow,
.app-ready .hero h1,
.app-ready .hero .lead,
.app-ready .hero .hero__actions,
.app-ready .hero .hero__panel,
.app-ready .feature-card,
.app-ready .page-panel {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition: opacity 420ms ease, transform 520ms ease, filter 520ms ease;
}

.app-ready .hero .eyebrow {
  transition-delay: 120ms;
}

.app-ready .hero h1 {
  transition-delay: 210ms;
}

.app-ready .hero .lead {
  transition-delay: 310ms;
}

.app-ready .hero .hero__actions {
  transition-delay: 430ms;
}

.app-ready .hero .hero__panel {
  transition-delay: 500ms;
}

.app-ready .feature-card:nth-child(1) {
  transition-delay: 540ms;
}

.app-ready .feature-card:nth-child(2) {
  transition-delay: 620ms;
}

.app-ready .feature-card:nth-child(3) {
  transition-delay: 700ms;
}

.app-ready .page-panel {
  transition-delay: 260ms;
}

.page-title {
  font-size: clamp(1.6rem, 2.5vw, 2.3rem);
  margin-bottom: 0.8rem;
}

.page-copy {
  margin-bottom: 0;
  color: var(--text-muted);
  max-width: 70ch;
}

.admin-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.admin-quick-panel {
  padding: 1rem 1.1rem;
}

.admin-quick-panel .page-title {
  font-size: 1.15rem;
  margin: 0 0 0.3rem;
}

.admin-quick-value {
  margin: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
}

.admin-quick-copy {
  margin: 0.28rem 0 0;
  color: var(--text-muted);
}

.admin-progress-panel {
  margin-bottom: 1rem;
}

.admin-progress-panel.is-hidden {
  display: none;
}

.admin-progress-bar {
  width: 100%;
  height: 0.9rem;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 78%, black 22%);
  border: 1px solid var(--panel-edge);
}

.admin-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 240ms ease;
}

.admin-progress-status {
  margin: 0.75rem 0 0.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.25rem;
}

.admin-stat-card {
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--accent) 12%);
  border-radius: 0.9rem;
  padding: 0.9rem;
}

.admin-stat-card h2 {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-stat-value {
  margin: 0.35rem 0;
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  line-height: 1.1;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-stat-value--small {
  font-size: 1rem;
  line-height: 1.35;
}

.admin-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 1rem;
  align-items: start;
}

.admin-card {
  background: color-mix(in srgb, var(--surface) 96%, black 4%);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.admin-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
}

.admin-list {
  max-height: 220px;
  overflow: auto;
  padding-right: 0.35rem;
}

.admin-user-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--panel-edge);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--panel) 88%, transparent 12%);
}

.admin-user-row__identity {
  min-width: 0;
}

.admin-user-row__handle {
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
}

.admin-user-row__meta {
  margin: 0.18rem 0 0;
  color: var(--text-muted);
  word-break: break-word;
}

.admin-user-row__actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.admin-user-row__badge {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent 86%);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 700;
}

.admin-primary-panel {
  min-width: 0;
}

.admin-secondary-panel {
  min-width: 0;
}

.admin-add-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.admin-add-form .hero__actions {
  grid-column: auto;
  margin-top: 0;
}

.portrait-filters.admin-add-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.portrait-filters.admin-add-form .hero__actions {
  grid-column: auto;
  margin-top: 0;
}

.field-input-with-unit {
  display: grid;
  align-items: center;
}

.field-input-with-unit .field-input {
  grid-area: 1 / 1;
  padding-right: 2.6rem;
}

.field-input-with-unit .field-input[type="number"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.field-input-with-unit .field-input[type="number"]::-webkit-outer-spin-button,
.field-input-with-unit .field-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-input-unit {
  grid-area: 1 / 1;
  justify-self: end;
  margin-right: 0.85rem;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.portrait-filters--stacked {
  grid-template-columns: 1fr;
}

.admin-encoding-form {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.admin-encoding-form .field-row {
  width: 100%;
  min-width: 0;
}

.admin-encoding-form .field-input-with-unit {
  width: 100%;
  min-width: 0;
}

.admin-encoding-form .hero__actions {
  grid-column: 1 / -1;
  margin-top: 0.1rem;
}

.admin-encoding-form .hero__actions .btn {
  width: 100%;
}

.admin-queue-form .hero__actions .btn {
  width: 100%;
}

.admin-section-divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--panel-edge);
}

.admin-section-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.admin-section-title--with-help {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.admin-help-icon {
  position: relative;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--panel-edge);
  background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.73rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.admin-help-icon::before {
  content: "";
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  border-left: 0.34rem solid transparent;
  border-right: 0.34rem solid transparent;
  border-bottom: 0.34rem solid color-mix(in srgb, var(--panel) 78%, black 22%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.admin-help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 0.65rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, 72vw);
  padding: 0.55rem 0.65rem;
  border-radius: 0.6rem;
  border: 1px solid color-mix(in srgb, var(--panel-edge) 74%, var(--accent) 26%);
  background: color-mix(in srgb, var(--panel) 78%, black 22%);
  color: var(--text-main);
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  opacity: 0;
  visibility: hidden;
  z-index: 15;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.admin-help-icon:hover::before,
.admin-help-icon:hover::after,
.admin-help-icon:focus-visible::before,
.admin-help-icon:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.admin-help-icon:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.policy-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.policy-card {
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 0.9rem;
  padding: 1rem;
}

.policy-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.45rem;
}

.policy-card p {
  margin: 0;
  color: var(--text-muted);
}

.portrait-filters {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.portrait-filters .hero__actions {
  grid-column: 1 / -1;
  margin-top: 0.1rem;
}

.portrait-results {
  margin-top: 1rem;
}

.portrait-collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
}

.portrait-card {
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 0.9rem;
  padding: 0.65rem;
}

.portrait-card__frame {
  width: 100%;
  aspect-ratio: var(--nwn-portrait-ratio);
  border-radius: 0.7rem;
  overflow: hidden;
  border: 1px solid var(--ghost-border);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.18));
  margin: 0;
}

.portrait-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
}

.portrait-card__name {
  margin: 0.5rem 0 0.25rem;
  font-size: 1rem;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portrait-card__meta {
  margin: 0.12rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.portrait-spotlight {
  margin-bottom: 0.9rem;
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 0.9rem;
  padding: 0.95rem;
}

.portrait-spotlight.is-refreshing {
  animation: rise 280ms ease;
}

.portrait-spotlight .eyebrow {
  margin-bottom: 0.45rem;
}

.portrait-spotlight__character {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.portrait-spotlight__meta {
  margin: 0.15rem 0;
  color: var(--text-muted);
}

.portrait-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--panel-edge);
  border-radius: 0.9rem;
  background: var(--ghost-bg);
}

.portrait-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.portrait-table th,
.portrait-table td {
  padding: 0.72rem 0.78rem;
  text-align: left;
  border-bottom: 1px solid var(--panel-edge);
}

.portrait-table th {
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-thumb-btn {
  padding: 0;
  border: 1px solid var(--ghost-border);
  border-radius: 0.5rem;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  display: inline-block;
}

.profile-thumb-btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.profile-thumb-image {
  width: 40px;
  height: 64px;
  object-fit: contain;
  object-position: center top;
  display: block;
}

.profile-preview-modal-body {
  display: flex;
  justify-content: center;
}

.profile-preview-modal-image {
  width: min(100%, 340px);
  aspect-ratio: var(--nwn-portrait-ratio);
  object-fit: contain;
  object-position: center top;
  border-radius: 0.8rem;
  border: 1px solid var(--ghost-border);
  background: rgba(0, 0, 0, 0.12);
}

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

.portrait-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.25);
}

.portrait-table code {
  color: var(--text-main);
  font-size: 0.82rem;
}

.profile-replace-form {
  display: grid;
  gap: 0.45rem;
  min-width: 220px;
}

.profile-replace-form .field-input {
  font-size: 0.84rem;
  padding: 0.45rem 0.52rem;
}

:root[data-theme="dark"] .portrait-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.portrait-table tbody tr.is-spotlight {
  background: rgba(178, 69, 47, 0.15);
}

:root[data-theme="dark"] .portrait-table tbody tr.is-spotlight {
  background: rgba(209, 107, 42, 0.2);
}

.server-directory-toolbar {
  margin-top: 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.server-directory-toolbar__search {
  min-width: min(420px, 100%);
}

.server-directory-toolbar__cache {
  margin: 0;
}

.server-directory-table-wrap {
  margin-top: 0.9rem;
}

.server-directory-table td:nth-child(2),
.server-directory-table td:nth-child(3),
.server-directory-table td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.server-sort-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.server-sort-button::after {
  content: "";
  opacity: 0.45;
  font-size: 0.72rem;
}

th.server-directory-sortable[aria-sort="ascending"] .server-sort-button::after {
  content: "▲";
  opacity: 0.9;
}

th.server-directory-sortable[aria-sort="descending"] .server-sort-button::after {
  content: "▼";
  opacity: 0.9;
}

.server-sort-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.2rem;
}

.btn-compact {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}

.server-activity-metrics {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.server-activity-metric {
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 0.8rem;
  padding: 0.7rem 0.8rem;
}

.server-activity-metric__label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.server-activity-metric__value {
  margin: 0.25rem 0 0;
  font-size: 1.42rem;
  font-weight: 700;
}

.server-activity-controls {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.server-activity-controls .hero__actions {
  grid-column: 1 / -1;
}

.server-activity-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
}

.server-activity-chart-card {
  position: relative;
  background: var(--ghost-bg);
  border: 1px solid var(--ghost-border);
  border-radius: 0.9rem;
  padding: 0.8rem;
}

.server-activity-chart-card h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.server-activity-chart-card svg {
  width: 100%;
  height: auto;
  display: block;
}

.server-chart-bg {
  fill: color-mix(in srgb, var(--panel) 88%, transparent 12%);
  stroke: var(--panel-edge);
}

.server-chart-grid {
  stroke: var(--panel-edge);
  stroke-width: 1;
}

.server-chart-axis {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.server-chart-empty {
  text-anchor: middle;
  fill: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.server-chart-point,
.server-chart-bar {
  cursor: pointer;
}

.server-chart-point {
  transition: r 120ms ease;
}

.server-chart-point:hover {
  r: 5;
}

.server-chart-tooltip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -100%);
  z-index: 3;
  border-radius: 0.55rem;
  border: 1px solid var(--panel-edge);
  background: color-mix(in srgb, var(--panel) 90%, black 10%);
  color: var(--text-main);
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.3rem 0.5rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

.journey-strip {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.journey-step {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
}

.journey-step__index {
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
}

.journey-step h3 {
  font-size: 1.04rem;
  margin-bottom: 0.4rem;
}

.journey-step p {
  margin: 0;
  color: var(--text-muted);
}

:root[data-theme="dark"] .site-footer a {
  color: #f4cfa0;
}

.btn:focus-visible,
.nav-link:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-20px) scale(1.05);
  }
}

@media (max-width: 991px) {
  .app-nav__inner {
    border-radius: 1rem;
    padding: 0.7rem 0.85rem;
  }

  .app-nav__links {
    margin-top: 0.6rem;
  }

  .btn-auth {
    margin-top: 0.7rem;
    display: inline-block;
  }

  .nav-actions {
    margin-top: 0.7rem;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .home-portrait-frame {
    margin-left: auto;
    margin-right: auto;
  }

  .home-portrait-spotlight {
    align-self: auto;
  }

  .home-portrait-frame--spotlight {
    width: clamp(120px, 30vw, 170px);
    height: auto;
  }

  .home-portrait-collection {
    grid-template-columns: 1fr;
    max-height: none;
  }

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

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

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

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

  .variant-preview-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .portrait-filters.admin-add-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .portrait-filters.admin-add-form .hero__actions {
    grid-column: auto;
    margin-top: 0;
  }

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

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

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

  .admin-encoding-form {
    grid-template-columns: 1fr;
  }

  .admin-user-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-user-row__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .server-activity-controls {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-loading .brandmark__sigil,
  .app-loading .hero .eyebrow,
  .app-loading .hero h1,
  .app-loading .hero .lead,
  .app-loading .hero .hero__actions,
  .app-loading .hero .hero__panel,
  .app-loading .feature-card,
  .app-loading .page-panel,
  .app-ready .brandmark__sigil,
  .app-ready .hero .eyebrow,
  .app-ready .hero h1,
  .app-ready .hero .lead,
  .app-ready .hero .hero__actions,
  .app-ready .hero .hero__panel,
  .app-ready .feature-card,
  .app-ready .page-panel {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}