:root {
  --ds-bg: #050915;
  --ds-panel-bg: radial-gradient(circle at top left, rgba(20,40,80,0.85), rgba(5,10,25,0.98));
  --ds-border-gold: #f6c85f;
  --ds-gold-soft: rgba(246,200,95,0.4);
  --ds-cyan: #35d6ff;
  --ds-orange: #ff7b3a;
  --ds-red: #ff4860;
  --ds-text-main: #f4f7ff;
  --ds-text-soft: #9aa4c6;
  --ds-radius-lg: 18px;
  --ds-radius-md: 12px;
  --ds-shadow-strong: 0 0 32px rgba(0,0,0,0.75);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  color: var(--ds-text-main);
  background:
    radial-gradient(circle at 10% 0%, #18233a 0, transparent 50%),
    radial-gradient(circle at 90% 100%, #281746 0, transparent 55%),
    radial-gradient(circle at 50% 50%, #0a101d 0, #02030a 70%);
  overflow-x: hidden;
}

/* Background FX */

.bg-orbit {
  position: fixed;
  inset: -30%;
  background:
    radial-gradient(circle at 20% 20%, rgba(0,255,200,0.16) 0, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255,160,60,0.18) 0, transparent 55%);
  mix-blend-mode: screen;
  opacity: 0.9;
  pointer-events: none;
  animation: orbitDrift 26s linear infinite alternate;
  z-index: -3;
}

.bg-orbit.orbit-2 {
  animation-duration: 38s;
  animation-direction: alternate-reverse;
  opacity: 0.6;
}

.bg-scanline {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 100% 3px;
  mix-blend-mode: soft-light;
  opacity: 0.18;
  pointer-events: none;
  z-index: -2;
}

@keyframes orbitDrift {
  0% { transform: translate3d(-2%, -1%, 0) scale(1.05); }
  50% { transform: translate3d(2%, 3%, 0) scale(1.02); }
  100% { transform: translate3d(-1%, 1%, 0) scale(1.08); }
}

/* Header */

.ds-header {
  padding: 18px 7%;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(to right, rgba(3,9,25,0.96), rgba(3,9,25,0.85));
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 12px 28px rgba(0,0,0,0.85);
}

.ds-header-title {
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ds-gold-soft);
  text-shadow: 0 0 12px rgba(246,200,95,0.65);
}

.ds-header-subtitle {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--ds-text-soft);
}

/* Main layout */

.ds-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 26px;
  padding: 30px 7% 26px;
}

.ds-panel {
  position: relative;
  background: var(--ds-panel-bg);
  border-radius: var(--ds-radius-lg);
  padding: 18px 18px 20px;
  border: 1px solid rgba(246,200,95,0.35);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 18px 40px rgba(0,0,0,0.75),
    0 0 32px rgba(5,190,255,0.18);
  overflow: hidden;
}

.ds-panel::before {
  content: "";
  position: absolute;
  inset: -120%;
  background:
    conic-gradient(from 0deg, rgba(246,200,95,0.18), transparent 25%, rgba(53,214,255,0.16), transparent 50%, rgba(255,123,58,0.16), transparent 75%, rgba(246,200,95,0.22));
  opacity: 0.18;
  mix-blend-mode: screen;
  animation: panelSweep 22s linear infinite;
  pointer-events: none;
}

.ds-panel::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--ds-radius-lg) - 1px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
  pointer-events: none;
}

@keyframes panelSweep {
  0% { transform: translate3d(-12%, -4%, 0) rotate(0deg); }
  50% { transform: translate3d(8%, 6%, 0) rotate(90deg); }
  100% { transform: translate3d(-10%, -6%, 0) rotate(180deg); }
}

/* Panel content */

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.panel-title {
  font-size: 0.98rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #fdf6dd;
}

.panel-pill {
  font-size: 0.68rem;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.4), rgba(255,255,255,0.02));
  color: #06060a;
  box-shadow: 0 0 10px rgba(255,255,255,0.45);
}

.pill-passive {
  background: radial-gradient(circle at 0 0, rgba(53,214,255,0.3), rgba(53,214,255,0.04));
  color: var(--ds-text-main);
  border-color: rgba(53,214,255,0.6);
}

/* Editor */

.editor-shell {
  position: relative;
  z-index: 1;
  border-radius: var(--ds-radius-md);
  padding: 14px 14px 16px;
  background:
    linear-gradient(to bottom right, rgba(5,10,30,0.95), rgba(4,12,38,0.98));
  box-shadow:
    0 0 0 1px rgba(246,200,95,0.45),
    0 0 32px rgba(246,200,95,0.35);
  margin-bottom: 16px;
}

.editor-shell::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.26), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(246,200,95,0.26), transparent 55%);
  opacity: 0.09;
  mix-blend-mode: screen;
  pointer-events: none;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(244,247,255,0.78);
  margin-bottom: 4px;
}

.ds-input,
.ds-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(246,200,95,0.65);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.12), rgba(5,8,20,0.98));
  color: var(--ds-text-main);
  padding: 9px 11px;
  font-size: 0.9rem;
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.7),
    0 0 16px rgba(0,0,0,0.85);
  margin-bottom: 10px;
}

.ds-input::placeholder,
.ds-textarea::placeholder {
  color: rgba(210,220,255,0.4);
}

.ds-input:focus,
.ds-textarea:focus {
  border-color: var(--ds-cyan);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.7),
    0 0 20px rgba(53,214,255,0.45);
}

.ds-textarea {
  min-height: 170px;
  resize: vertical;
}

/* Buttons */

.button-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.ds-btn {
  position: relative;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid rgba(255,255,255,0.32);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.45), rgba(0,0,0,0.9));
  color: #05060a;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    background 0.15s ease-out,
    color 0.15s ease-out;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 10px 20px rgba(0,0,0,0.9);
}

.ds-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.5), transparent 60%);
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 0.15s ease-out;
  pointer-events: none;
}

.ds-btn:hover::before {
  opacity: 1;
}

.ds-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(0,0,0,1),
    0 14px 26px rgba(0,0,0,0.95);
}

.ds-btn-primary {
  background: radial-gradient(circle at 0 0, #ffe6c0, #ff7b3a);
  color: #1b0900;
  border-color: rgba(255,255,255,0.45);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 10px 24px rgba(255,123,58,0.5);
}

.ds-btn-secondary {
  background: radial-gradient(circle at 0 0, #cfe7ff, #35d6ff);
  color: #00141e;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 10px 24px rgba(53,214,255,0.45);
}

.ds-btn-danger {
  background: radial-gradient(circle at 0 0, #ffd2dc, #ff4860);
  color: #200006;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 10px 24px rgba(255,72,96,0.55);
}

/* Archive */

.ds-panel-archive {
  min-height: 260px;
}

.archive-list {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.archive-empty {
  font-size: 0.86rem;
  color: var(--ds-text-soft);
  text-align: center;
  padding: 30px 10px;
}

.archive-item {
  border-radius: 14px;
  padding: 10px 11px 9px;
  margin-bottom: 9px;
  background:
    linear-gradient(135deg, rgba(8,18,36,0.96), rgba(12,28,58,0.98));
  border: 1px solid rgba(246,200,95,0.4);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 10px 24px rgba(0,0,0,0.85),
    0 0 24px rgba(53,214,255,0.24);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  cursor: default;
}

.archive-item.active {
  border-color: var(--ds-cyan);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 0 26px rgba(53,214,255,0.7);
}

.archive-title {
  font-size: 0.9rem;
}

.archive-meta {
  font-size: 0.74rem;
  color: var(--ds-text-soft);
}

.archive-actions {
  display: flex;
  gap: 6px;
}

.archive-icon-btn {
  border-radius: 999px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,0.35);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.5), rgba(0,0,0,0.95));
  color: #06060a;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.1s ease-out,
    box-shadow 0.1s ease-out,
    background 0.1s ease-out;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.9),
    0 8px 18px rgba(0,0,0,0.85);
}

.archive-icon-btn.edit {
  background: radial-gradient(circle at 0 0, #ddf1ff, #35d6ff);
}

.archive-icon-btn.delete {
  background: radial-gradient(circle at 0 0, #ffd6de, #ff4860);
}

.archive-icon-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(0,0,0,1),
    0 12px 22px rgba(0,0,0,0.95);
}

/* Footer */

.ds-footer {
  padding: 10px 7% 18px;
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ds-text-soft);
  border-top: 1px solid rgba(255,255,255,0.04);
  background: linear-gradient(to right, rgba(2,6,14,0.96), rgba(2,6,14,0.9));
  backdrop-filter: blur(14px);
}

.footer-right {
  color: var(--ds-cyan);
}

/* Particle layer */

.particle-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 0 12px rgba(255,255,255,0.9);
  opacity: 0.8;
}

.p1 { top: 12%; left: 18%; animation: floatDot 18s linear infinite; }
.p2 { top: 32%; left: 82%; animation: floatDot 23s linear infinite reverse; }
.p3 { top: 64%; left: 12%; animation: floatDot 26s linear infinite; }
.p4 { top: 78%; left: 72%; animation: floatDot 21s linear infinite reverse; }
.p5 { top: 44%; left: 52%; animation: floatDot 19s linear infinite; }
.p6 { top: 8%; left: 60%; animation: floatDot 29s linear infinite reverse; }

@keyframes floatDot {
  0% { transform: translate3d(0, 0, 0); opacity: 0.9; }
  40% { opacity: 0.4; }
  100% { transform: translate3d(40px, -60px, 0); opacity: 0.9; }
}

/* Responsive */

@media (max-width: 900px) {
  .ds-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .ds-panel {
    max-width: 680px;
    margin: 0 auto;
  }
  .ds-footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

/* Character Codex layout */

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-bottom: 14px;
}

.field-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alignment-block {
  margin: 10px 0 14px;
}

.alignment-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.align-pill {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.35);
  background: radial-gradient(circle at 0 0, rgba(10,12,20,0.9), rgba(3,5,16,0.95));
  color: var(--ds-text-soft);
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(0,0,0,0.6);
  transition:
    background 0.14s ease-out,
    box-shadow 0.14s ease-out,
    transform 0.12s ease-out,
    color 0.12s ease-out,
    border-color 0.14s ease-out;
}

.align-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.8);
}

.align-pill.align-light {
  border-color: rgba(246,200,95,0.7);
}

.align-pill.align-shadow {
  border-color: rgba(144,104,255,0.7);
}

.align-pill.align-flux {
  border-color: rgba(53,214,255,0.8);
}

.align-pill.align-neutral {
  border-color: rgba(180,194,220,0.7);
}

.align-pill.align-active.align-light {
  background: radial-gradient(circle at 0 0, #fff5d2, #f6c85f);
  color: #1b1200;
  box-shadow: 0 0 18px rgba(246,200,95,0.9);
}

.align-pill.align-active.align-shadow {
  background: radial-gradient(circle at 0 0, #f5e9ff, #7a4dff);
  color: #070017;
  box-shadow: 0 0 18px rgba(122,77,255,0.9);
}

.align-pill.align-active.align-flux {
  background: radial-gradient(circle at 0 0, #e5fbff, #35d6ff);
  color: #001017;
  box-shadow: 0 0 18px rgba(53,214,255,0.9);
}

.align-pill.align-active.align-neutral {
  background: radial-gradient(circle at 0 0, #f1f5ff, #94a3c4);
  color: #020309;
  box-shadow: 0 0 18px rgba(148,163,196,0.9);
}

/* Archive styling tweaks for character roster */

.archive-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.archive-meta {
  font-size: 0.72rem;
  color: var(--ds-text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.archive-align {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.archive-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.archive-btn {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.28);
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.16), rgba(5,10,20,0.95));
  color: var(--ds-text-main);
  font-size: 0.7rem;
  padding: 3px 10px;
  cursor: pointer;
}

.archive-btn-danger {
  border-color: rgba(255,72,96,0.7);
  color: #ffd6de;
}

.archive-item.active {
  box-shadow:
    0 0 0 1px rgba(246,200,95,0.6),
    0 0 20px rgba(246,200,95,0.5),
    var(--ds-shadow-strong);
}

/* Responsive adjustments */

@media (max-width: 900px) {
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
