:root {
  --bg-obsidian: #04060c;
  --bg-card: rgba(10, 15, 28, 0.88);
  --border-gold: rgba(245, 208, 122, 0.28);
  --gold-bright: #f8dfa2;
  --gold-mid: #d4a656;
  --text-main: #f4f6fb;
  --text-muted: #94a3b8;
}

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

body.adm-body {
  min-height: 100vh;
  background: var(--bg-obsidian);
  color: var(--text-main);
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

.adm-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 166, 86, 0.16), transparent 55%),
    radial-gradient(circle at 18% 80%, rgba(56, 189, 248, 0.12), transparent 50%),
    radial-gradient(circle at 82% 80%, rgba(168, 85, 247, 0.12), transparent 50%),
    linear-gradient(180deg, #04060c 0%, #070b16 100%);
}

.adm-wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}

.adm-kicker {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--gold-bright);
  margin-bottom: 6px;
}

/* Login */
.adm-login-card {
  max-width: 420px;
  margin: 64px auto 0;
  padding: 32px 28px;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.78), 0 0 36px rgba(212, 166, 86, 0.12);
  backdrop-filter: blur(14px);
}

.adm-login-head h1 {
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
}

.adm-login-head p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.adm-login-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.adm-link {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.adm-link:hover {
  color: var(--gold-bright);
}

/* Dashboard Header */
.adm-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(245, 208, 122, 0.2);
}

.adm-header h1 {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 900;
  color: #ffffff;
}

.adm-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.adm-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cards & Grid */
.adm-card {
  padding: 22px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  margin-bottom: 20px;
}

.adm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 20px;
  align-items: start;
}

.adm-grid .adm-card {
  margin-bottom: 0;
}

.adm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.adm-card-head h2 {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
}

.adm-muted {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Forms */
.adm-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.adm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adm-field label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.adm-req {
  color: #f87171;
}

.adm-field input[type="text"],
.adm-field input[type="password"],
.adm-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(5, 8, 16, 0.85);
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.adm-field input:focus,
.adm-field select:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(245, 208, 122, 0.16);
}

.adm-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.adm-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 4px 0;
}

.adm-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e2e8f0;
  cursor: pointer;
}

.adm-check input {
  width: 16px;
  height: 16px;
  accent-color: #d4a656;
}

.adm-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  font-size: 13px;
  font-weight: 600;
}

.adm-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* Buttons */
.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

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

.adm-btn:active {
  transform: translateY(0);
}

.adm-btn-full {
  width: 100%;
}

.adm-btn-gold {
  background: linear-gradient(135deg, #f8dfa2 0%, #d4a656 100%);
  color: #080b14;
  box-shadow: 0 8px 22px rgba(212, 166, 86, 0.28);
}

.adm-btn-gold:hover {
  box-shadow: 0 10px 28px rgba(245, 208, 122, 0.44);
}

.adm-btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

.adm-btn-ghost:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

.adm-btn-danger-outline {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.adm-btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #f87171;
  color: #ffffff;
}

.adm-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}

/* Switch */
.adm-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.adm-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.adm-switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.adm-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
}

.adm-switch input:checked + .adm-switch-track {
  background: rgba(212, 166, 86, 0.45);
  border-color: var(--gold-bright);
}

.adm-switch input:checked + .adm-switch-track::after {
  transform: translateX(18px);
  background: var(--gold-bright);
}

.adm-switch-label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

/* Live Preview Stage */
.adm-preview-stage {
  padding: 20px;
  border-radius: 12px;
  background: radial-gradient(circle at center, rgba(56, 189, 248, 0.08), rgba(4, 6, 12, 0.9));
  border: 1px dashed rgba(245, 208, 122, 0.28);
  text-align: center;
}

.adm-preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.adm-preview-empty {
  font-size: 13px;
  color: var(--text-muted);
}

/* Gateway Button Mirror Styles (Ornate Plaque) */
@property --dl-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes gwDlRimSpin {
  to { --dl-angle: 360deg; }
}

@keyframes gwDlSlowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes gwDlPulse {
  0%, 100% {
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.82),
      0 0 28px rgba(var(--dl-rgb), 0.36),
      0 0 58px rgba(var(--dl-rgb), 0.14);
  }
  50% {
    box-shadow:
      0 20px 50px rgba(0, 0, 0, 0.88),
      0 0 42px rgba(var(--dl-rgb), 0.58),
      0 0 84px rgba(var(--dl-rgb), 0.24);
  }
}

@keyframes gwDlSheen {
  0%, 54% { left: -135%; opacity: 0; }
  62% { opacity: 1; }
  100% { left: 165%; opacity: 0; }
}

@keyframes gwDlSpark {
  0% { transform: translateY(10px) scale(0.4); opacity: 0; }
  25% { opacity: 0.95; }
  80% { opacity: 0.6; }
  100% { transform: translateY(-48px) scale(1.1); opacity: 0; }
}

@keyframes gwDlBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

.gw-download-btn {
  --dl-accent: #f8dfa2;
  --dl-rgb: 245, 208, 122;
  --dl-text-mid: #f8dfa2;
  --dl-text-bot: #d4a048;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: min(100%, 440px);
  padding: 11px 20px 11px 16px;
  border-radius: 14px;
  gap: 15px;
  isolation: isolate;
  overflow: hidden;
  text-decoration: none;
  color: #ffffff;
  background: #060913;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.82),
    0 0 34px rgba(var(--dl-rgb), 0.45),
    0 0 70px rgba(var(--dl-rgb), 0.18);
  animation: gwDlPulse 2.8s ease-in-out infinite;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
}

.gw-download-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.88),
    0 0 48px rgba(var(--dl-rgb), 0.72),
    0 0 92px rgba(var(--dl-rgb), 0.32);
}

.gw-dl-rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(
    from var(--dl-angle),
    rgba(var(--dl-rgb), 0.25) 0deg,
    var(--dl-accent) 45deg,
    #ffffff 65deg,
    var(--dl-accent) 85deg,
    rgba(var(--dl-rgb), 0.22) 140deg,
    rgba(var(--dl-rgb), 0.22) 220deg,
    var(--dl-accent) 265deg,
    #ffffff 285deg,
    var(--dl-accent) 305deg,
    rgba(var(--dl-rgb), 0.25) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
  animation: gwDlRimSpin 4s linear infinite;
}

.gw-dl-plate {
  position: absolute;
  inset: 2px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 75% 110% at 50% 50%, rgba(var(--dl-rgb), 0.28) 0%, rgba(var(--dl-rgb), 0.08) 52%, transparent 80%),
    repeating-linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.035) 0px,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 6px
    ),
    radial-gradient(rgba(var(--dl-rgb), 0.16) 1px, transparent 1px),
    linear-gradient(180deg, #141c30 0%, #090d18 52%, #05070e 100%);
  background-size: auto, auto, 14px 14px, auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -14px 28px rgba(0, 0, 0, 0.78),
    inset 0 0 32px rgba(var(--dl-rgb), 0.24);
  pointer-events: none;
  z-index: 0;
}

.gw-dl-filigree {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  color: var(--dl-accent);
  pointer-events: none;
  z-index: 1;
  opacity: 0.72;
}

.gw-dl-sparks {
  position: absolute;
  inset: 2px;
  overflow: hidden;
  border-radius: 12px;
  pointer-events: none;
  z-index: 2;
}

.gw-dl-sparks i {
  position: absolute;
  bottom: 0;
  left: var(--sx, 50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px var(--dl-accent), 0 0 14px rgba(var(--dl-rgb), 0.9);
  animation: gwDlSpark var(--st, 2.8s) ease-out var(--sd, 0s) infinite;
}

.gw-dl-sheen {
  position: absolute;
  top: 0;
  left: -135%;
  width: 52%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: skewX(-24deg);
  animation: gwDlSheen 3.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

.gw-dl-corners {
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 3;
}

.gw-dl-corners i {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: rgba(var(--dl-rgb), 0.72);
  border-style: solid;
}

.gw-dl-corners .c-tl { top: 0; left: 0; border-width: 2px 0 0 2px; border-top-left-radius: 4px; }
.gw-dl-corners .c-tr { top: 0; right: 0; border-width: 2px 2px 0 0; border-top-right-radius: 4px; }
.gw-dl-corners .c-bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-bottom-left-radius: 4px; }
.gw-dl-corners .c-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-bottom-right-radius: 4px; }

.gw-dl-emblem {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(var(--dl-rgb), 0.34) 0%, rgba(var(--dl-rgb), 0.08) 65%, rgba(4, 6, 12, 0.85) 100%);
  border: 1px solid rgba(var(--dl-rgb), 0.65);
  box-shadow: 0 0 18px rgba(var(--dl-rgb), 0.4), inset 0 0 12px rgba(var(--dl-rgb), 0.25);
  color: var(--dl-accent);
  z-index: 4;
}

.gw-dl-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gw-dl-ring--outer { animation: gwDlSlowSpin 14s linear infinite; }
.gw-dl-ring--inner { animation: gwDlSlowSpin 9s linear reverse infinite; }

.gw-dl-icon {
  position: relative;
  width: 20px;
  height: 20px;
  color: #ffffff;
  filter: drop-shadow(0 0 8px rgba(var(--dl-rgb), 0.85));
}

.gw-download-btn:hover .gw-dl-icon {
  animation: gwDlBob 0.85s ease-in-out infinite;
}

.gw-dl-copy {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.gw-dl-label {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.015em;
  line-height: 1.15;
  white-space: nowrap;
  background: linear-gradient(180deg, #ffffff 0%, var(--dl-text-mid) 58%, var(--dl-text-bot) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.95));
}

.gw-dl-sub {
  font-family: 'Cinzel', 'Pretendard Variable', sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--dl-accent);
  margin-top: 3px;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(var(--dl-rgb), 0.7);
}

.gw-dl-sub::before { content: '✦ '; opacity: 0.85; }
.gw-dl-sub::after { content: ' ✦'; opacity: 0.85; }

.gw-dl-arrow {
  position: relative;
  z-index: 4;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(var(--dl-rgb), 0.16);
  border: 1px solid rgba(var(--dl-rgb), 0.55);
  color: var(--dl-accent);
  transition: transform 0.28s ease, background 0.28s ease, color 0.28s ease, border-color 0.28s ease;
}

.gw-dl-arrow svg { width: 17px; height: 17px; }

.gw-download-btn:hover .gw-dl-arrow {
  transform: translateX(3px);
  background: var(--dl-accent);
  border-color: #ffffff;
  color: #060913;
}

.gw-dl--gold { --dl-accent: #f8dfa2; --dl-rgb: 245, 208, 122; --dl-text-mid: #f8dfa2; --dl-text-bot: #d4a048; }
.gw-dl--cyan { --dl-accent: #38bdf8; --dl-rgb: 56, 189, 248; --dl-text-mid: #bae6fd; --dl-text-bot: #38bdf8; }
.gw-dl--emerald { --dl-accent: #4ade80; --dl-rgb: 34, 197, 94; --dl-text-mid: #bbf7d0; --dl-text-bot: #4ade80; }
.gw-dl--purple { --dl-accent: #c084fc; --dl-rgb: 168, 85, 247; --dl-text-mid: #e9d5ff; --dl-text-bot: #c084fc; }
.gw-dl--crimson { --dl-accent: #fb7185; --dl-rgb: 244, 63, 94; --dl-text-mid: #fecdd3; --dl-text-bot: #fb7185; }

/* Registered List */
.adm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-item {
  padding: 14px;
  border-radius: 12px;
  background: rgba(5, 8, 16, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-item.is-disabled {
  opacity: 0.56;
}

.adm-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.adm-item-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.adm-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.adm-swatch--gold { background: #f8dfa2; box-shadow: 0 0 8px #f8dfa2; }
.adm-swatch--cyan { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.adm-swatch--emerald { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.adm-swatch--purple { background: #c084fc; box-shadow: 0 0 8px #c084fc; }
.adm-swatch--crimson { background: #fb7185; box-shadow: 0 0 8px #fb7185; }

.adm-item-label {
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
}

.adm-item-sub {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold-bright);
}

.adm-item-state {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.adm-item-state.is-off {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.28);
}

.adm-item-url {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.adm-item-url.is-missing-url {
  color: #fbbf24;
  font-weight: 600;
}

.adm-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.adm-list-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* Toast */
.adm-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(10, 15, 28, 0.96);
  border: 1px solid rgba(245, 208, 122, 0.55);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.adm-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.adm-toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}

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