:root {
  --ink: #f4efe6;
  --ink-dim: #b8b0a3;
  --ink-faint: #7d766b;
  --gold: #e0c07a;
  --gold-soft: rgba(224, 192, 122, 0.18);
  --line: rgba(244, 239, 230, 0.12);
  --danger: #e07070;
  --ok: #8fb896;
  --surface: rgba(10, 12, 16, 0.42);
  --font-brand: "Syne", "Arial Narrow", sans-serif;
  --font-body: "Outfit", "Segoe UI", sans-serif;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  background: #050607;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Full-bleed atmosphere — keep image visible */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    url("/static/atmosphere.png") left 35% center / cover no-repeat;
  transform: scale(1.04);
  animation: sceneDrift 32s ease-in-out infinite alternate;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(100deg,
      rgba(5,6,7,0.18) 0%,
      rgba(5,6,7,0.28) 42%,
      rgba(5,6,7,0.55) 72%,
      rgba(5,6,7,0.72) 100%);
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 18% 28%, rgba(224,192,122,0.16), transparent 55%),
    linear-gradient(to top, rgba(5,6,7,0.65) 0%, transparent 35%),
    linear-gradient(to right, transparent 55%, rgba(5,6,7,0.35) 100%);
  mix-blend-mode: normal;
}

@keyframes sceneDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1.4%, -0.8%, 0); }
}

a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
a:hover { border-bottom-color: var(--gold); }

.shell {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 1.5rem;
  gap: 2rem;
  align-items: center;
  animation: enter 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.shell.single {
  width: min(720px, calc(100% - 2rem));
  align-items: start;
  padding-top: 3rem;
}

.shell.split {
  grid-template-columns: 1.05fr 0.95fr;
  min-height: calc(100vh - 5rem);
}

@keyframes enter {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.brand-block {
  padding: 1rem 0.5rem 1rem 0;
  text-shadow: 0 2px 28px rgba(0,0,0,0.45);
}

.brand {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(3.4rem, 9vw, 5.6rem);
  letter-spacing: -0.055em;
  line-height: 0.92;
  margin: 0;
  text-wrap: balance;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.35));
}

.brand em {
  font-style: normal;
  color: var(--gold);
  display: inline-block;
  animation: goldPulse 5s ease-in-out infinite;
}

@keyframes goldPulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 0 transparent; }
  50% { opacity: 0.92; text-shadow: 0 0 28px rgba(224,192,122,0.35); }
}

.tagline {
  margin: 1.25rem 0 0;
  max-width: 18ch;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  line-height: 1.35;
  color: var(--ink-dim);
  font-weight: 300;
  letter-spacing: -0.01em;
}

.tagline strong {
  color: var(--ink);
  font-weight: 500;
}

.rail {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.25rem;
  color: var(--ink-faint);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rail span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.rail span::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--gold);
  opacity: 0.7;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(244, 239, 230, 0.16);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  padding: clamp(1.35rem, 3vw, 1.85rem);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.06) inset,
    0 0 0 1px rgba(224,192,122,0.04),
    0 28px 70px rgba(0,0,0,0.4);
  animation: panelIn 0.85s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.1rem;
  bottom: 1.1rem;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--gold), transparent);
  opacity: 0.75;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

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

.panel-head h1,
.panel-title {
  font-family: var(--font-brand);
  font-weight: 650;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  margin: 0;
}

.panel-head p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

label {
  display: block;
  margin: 1.05rem 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

label:first-of-type { margin-top: 0; }

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

.field-row input {
  border-right: 0;
}

.field-row .suffix {
  display: grid;
  place-items: center;
  padding: 0 0.95rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-left: 0;
  background: rgba(255,255,255,0.02);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.field-row input:focus {
  position: relative;
  z-index: 1;
}

.field-row:focus-within .suffix {
  border-color: rgba(224,192,122,0.55);
  background: rgba(224,192,122,0.05);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.name-status {
  margin: 0.45rem 0 0;
  min-height: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--ink-faint);
  transition: color 0.15s ease;
}

.name-status.checking { color: var(--ink-dim); }
.name-status.muted { color: var(--ink-faint); }
.name-status.free { color: var(--ok); }
.name-status.taken,
.name-status.error { color: #f0a0a0; }

.pw-meter {
  margin-top: 0.55rem;
  height: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.pw-meter span {
  display: block;
  height: 100%;
  width: 0;
  background: #e07070;
  transition: width 0.2s ease, background 0.2s ease;
}

.pw-meter span[data-score="1"] { background: #e09060; }
.pw-meter span[data-score="2"] { background: #d4b56a; }
.pw-meter span[data-score="3"],
.pw-meter span[data-score="4"] { background: var(--ok); }
.pw-meter span[data-ok="1"] { background: var(--ok); }

.pw-hint {
  margin-top: 0.55rem !important;
}

input, textarea {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 0;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

textarea { resize: vertical; min-height: 5rem; }

input::placeholder, textarea::placeholder { color: #5f5a52; }

input:hover, textarea:hover {
  background: rgba(255,255,255,0.045);
}

input:focus, textarea:focus {
  outline: none;
  border-color: rgba(224,192,122,0.55);
  background: rgba(224,192,122,0.05);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.suffix {
  /* used via .field-row .suffix */
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

button, .btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0.9rem 1.35rem;
  background: var(--gold);
  color: #16130e;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

button:hover, .btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  border-bottom-color: transparent;
}

button:active, .btn:active { transform: translateY(0); }

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  filter: none;
}

button.ghost:hover, .btn.ghost:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(224,192,122,0.4);
}

button.danger, .btn.danger {
  background: var(--danger);
  color: #fff;
}

button.sm, .btn.sm {
  padding: 0.48rem 0.8rem;
  font-size: 0.84rem;
}

.hint {
  margin: 1rem 0 0;
  color: var(--ink-faint);
  font-size: 0.86rem;
  line-height: 1.45;
}

.opt {
  color: var(--ink-faint);
  font-weight: 400;
  font-size: 0.85em;
}

.confirm-form {
  margin-top: 1rem;
}

.confirm-form .actions {
  margin-top: 1rem;
}

.error, .flash, .ok-box {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
}

.error, .flash.bad {
  border-color: rgba(224,112,112,0.4);
  color: #f3c4c4;
  background: rgba(224,112,112,0.1);
}

.flash, .ok-box {
  border-color: rgba(143,184,150,0.35);
  color: #d5e8d8;
  background: rgba(143,184,150,0.1);
}

.foot {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto 1.75rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.foot a { color: var(--ink-faint); }
.foot a:hover { color: var(--gold); }

.shell.single ~ .foot,
body:has(.shell.single) .foot {
  width: min(720px, calc(100% - 2rem));
}

/* Site nav (admin) */
.site-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.15rem 0 0;
}

.nav-brand {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  border-bottom: none;
}

.nav-brand em {
  font-style: normal;
  color: var(--gold);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
}

.nav-links > a {
  padding: 0.4rem 0.7rem;
  color: var(--ink-dim);
  border-bottom: none;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-links > a:hover,
.nav-links > a.is-active {
  color: var(--ink);
  background: rgba(224, 192, 122, 0.1);
}

.nav-logout {
  margin: 0 0 0 0.35rem;
  display: inline-flex;
}

body.page-admin .scene {
  background-position: center 40%;
}

body.page-admin .scene::before {
  background:
    linear-gradient(105deg,
      rgba(5,6,7,0.35) 0%,
      rgba(5,6,7,0.45) 45%,
      rgba(5,6,7,0.72) 100%);
}

/* Admin */
.admin-shell {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 1.5rem;
  position: relative;
  z-index: 1;
  animation: enter 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-top .brand {
  font-size: clamp(2.2rem, 5vw, 3rem);
}

.admin-top .tagline {
  margin-top: 0.55rem;
  max-width: 36ch;
  font-size: 1.05rem;
}

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

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

.card-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.card-row:hover {
  border-color: rgba(224,192,122,0.3);
  background: rgba(224,192,122,0.04);
}

.card-row strong {
  font-family: var(--font-brand);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.meta {
  margin-top: 0.3rem;
  color: var(--ink-faint);
  font-size: 0.86rem;
  line-height: 1.4;
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  vertical-align: middle;
  padding: 0.18rem 0.45rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

.badge.pending { color: var(--gold); border-color: rgba(224,192,122,0.4); background: var(--gold-soft); }
.badge.approved { color: var(--ok); border-color: rgba(143,184,150,0.4); }
.badge.rejected, .badge.deleted { color: #e8a0a0; border-color: rgba(224,112,112,0.4); }

.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
}

.tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab:hover {
  color: var(--ink);
  background: rgba(224,192,122,0.06);
}

.tab.is-active {
  color: var(--ink);
  background: rgba(224,192,122,0.14);
}

.tab-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.05rem 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
}

.tab.is-active .tab-count {
  color: var(--gold);
  border-color: rgba(224,192,122,0.35);
}

.tab-panel[hidden] {
  display: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
  align-content: start;
}

.row-actions form { margin: 0; }

.empty {
  color: var(--ink-faint);
  padding: 0.35rem 0;
}

@media (max-width: 860px) {
  .shell.split {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 2rem;
  }
  .brand-block { padding: 0; }
  .tagline { max-width: 28ch; }
  .rail { margin-top: 1.4rem; }
}

@media (max-width: 640px) {
  .card-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .admin-top { flex-direction: column; align-items: start; }
  .site-nav { align-items: start; }
  .nav-links { width: 100%; }
}
