/* ══════════════════════════════════════════════
   LDS PORTAIL — style.css v6 corrigé
   Optimisé, propre, cohérent
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;800;900&family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg-deep: #050510;
  --bg-card: rgba(14, 13, 30, 0.92);
  --bg-card-soft: rgba(18, 17, 38, 0.76);

  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.1);
  --line-hover: rgba(143, 92, 255, 0.32);

  --text: #ede8ff;
  --text-dim: #9e95c7;
  --text-soft: #c9c1e8;

  --purple: #9060ff;
  --purple-deep: #5a32b8;
  --purple-soft: #b08cff;
  --blue: #5cb8ff;
  --green: #6eeaa7;
  --red: #ff6b8a;
  --discord: #5865f2;

  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 28px;

  --shadow-card:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(143, 92, 255, 0.06);
  --shadow-glow: 0 0 30px rgba(143, 92, 255, 0.18);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: 'Outfit', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-deep);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 10%, rgba(143, 92, 255, 0.12), transparent),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(92, 184, 255, 0.07), transparent),
    radial-gradient(ellipse 45% 45% at 50% 50%, rgba(215, 140, 255, 0.04), transparent);
  animation: bgDrift 20s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

@keyframes bgDrift {
  0% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.08) translate(-2%, 3%); }
  100% { transform: scale(1) translate(2%, -2%); }
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15px, 30px) scale(1.15); }
}

@keyframes brandReveal {
  from {
    opacity: 0;
    transform: translateY(-12px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes navSlideIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmerRotate {
  to { transform: rotate(360deg); }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

@keyframes serverPulse {
  0% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 0.85; }
}

@keyframes particleFloat {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

@keyframes cardPop {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

/* ═══ Sidebar ═══ */
.sidebar {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 16px;
  background: linear-gradient(180deg, rgba(10, 9, 22, 0.97), rgba(6, 5, 14, 0.99));
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: -60px;
  left: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(143, 92, 255, 0.15), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: orbFloat 8s ease-in-out infinite alternate;
}

.brand {
  padding: 8px 6px 14px;
}

.brand h1 {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 2.8rem;
  letter-spacing: 0.14em;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 20px rgba(143, 92, 255, 0.3),
    0 0 60px rgba(143, 92, 255, 0.1);
  animation: brandReveal 1s var(--ease) both;
}

.brand-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeUp 0.6s var(--ease) 0.3s forwards;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  position: relative;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text-dim);
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  transition:
    transform 0.25s var(--ease),
    background 0.25s var(--ease),
    color 0.25s var(--ease);
  overflow: hidden;
  opacity: 0;
  animation: navSlideIn 0.5s var(--ease) forwards;
}

.nav-btn:nth-child(1) { animation-delay: 0.15s; }
.nav-btn:nth-child(2) { animation-delay: 0.22s; }
.nav-btn:nth-child(3) { animation-delay: 0.29s; }
.nav-btn:nth-child(4) { animation-delay: 0.36s; }

.nav-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  border-radius: 3px;
  background: var(--purple);
  transition: transform 0.25s var(--ease-bounce);
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(3px);
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(143, 92, 255, 0.14), rgba(143, 92, 255, 0.03));
}

.nav-btn.active::before {
  transform: translateY(-50%) scaleY(1);
}

.side-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  animation: fadeUp 0.6s var(--ease) 0.5s forwards;
}

.code-btn,
.btn,
.ghost-btn,
.mini,
.search-clear {
  outline: none;
}

.code-btn:focus-visible,
.btn:focus-visible,
.ghost-btn:focus-visible,
.mini:focus-visible,
.nav-btn:focus-visible,
.subrule-head:focus-visible,
.search-clear:focus-visible,
.subcategory-link-card:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  box-shadow: 0 0 0 3px rgba(143, 92, 255, 0.22);
}

.code-btn,
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: 0 6px 20px rgba(143, 92, 255, 0.2);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease),
    background 0.25s var(--ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.code-btn:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(143, 92, 255, 0.3);
}

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

.code-btn {
  position: relative;
  overflow: hidden;
}

.code-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent 50%);
  opacity: 0;
  transition: opacity 0.25s;
}

.code-btn:hover::after {
  opacity: 1;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.status-badge {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 6px rgba(158, 149, 199, 0.4);
  transition: all 0.3s var(--ease);
}

.status-dot.staff-active {
  background: var(--green);
  box-shadow: 0 0 10px rgba(110, 234, 167, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

main {
  position: relative;
  min-height: 0;
  height: 100vh;
  padding: 32px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 92, 255, 0.2) transparent;
}

main::-webkit-scrollbar {
  width: 6px;
}

main::-webkit-scrollbar-track {
  background: transparent;
}

main::-webkit-scrollbar-thumb {
  background: rgba(143, 92, 255, 0.2);
  border-radius: 3px;
}

.page {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
  min-height: fit-content;
}

.page.active {
  display: block;
  animation: pageEnter 0.5s var(--ease) both;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  line-height: 1.1;
}

.accent-purple { color: var(--purple-soft); }
.accent-blue { color: var(--blue); }

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
}

/* ═══ Home ═══ */
.home-shell {
  display: grid;
  gap: 22px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(21, 18, 45, 0.96), rgba(10, 10, 22, 0.98)),
    url('https://images.unsplash.com/photo-1511497584788-876760111969?w=1600&q=80') center/cover no-repeat;
  box-shadow: var(--shadow-card);
  padding: 34px;
  min-height: 420px;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(143, 92, 255, 0.22), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(92, 184, 255, 0.12), transparent 30%),
    linear-gradient(110deg, rgba(5, 5, 16, 0.1), rgba(5, 5, 16, 0.72));
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: center;
}

.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hero-right {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.hero-logo {
  display: block;
  width: 100%;
  max-width: 210px;
  max-height: 210px;
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 12px rgba(143, 92, 255, 0.14))
    drop-shadow(0 0 26px rgba(143, 92, 255, 0.08));
  user-select: none;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #d8cffd;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
}

.hero-left h2 {
  font-size: clamp(2.1rem, 3.6vw, 3.5rem);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: -0.04em;
  max-width: 560px;
  margin-bottom: 18px;
}

.hero-left h2 span {
  color: var(--purple-soft);
  text-shadow: 0 0 24px rgba(143, 92, 255, 0.2);
}

.hero-sub {
  max-width: 680px;
  color: #cbc2ec;
  font-size: 1.04rem;
  line-height: 1.75;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-inline-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}

.mini-stat-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.mini-stat-value {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.server-status-inline.online::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(110, 234, 167, 0.7);
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
  animation: serverPulse 1.4s ease-in-out infinite;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.home-card {
  position: relative;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 16, 36, 0.92), rgba(10, 10, 22, 0.96));
  box-shadow: var(--shadow-card);
  transition:
    transform 0.25s var(--ease),
    border-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.home-card::before {
  content: "";
  position: absolute;
  inset: auto -10% -60% auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 92, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.home-card:hover {
  transform: translateY(-5px);
  border-color: var(--line-hover);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.home-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.home-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 1.1rem;
}

.home-arrow {
  font-size: 1.25rem;
  color: #b8acee;
}

.home-card h3 {
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.home-card p {
  color: var(--text-dim);
  line-height: 1.65;
  font-size: 0.93rem;
}

.home-card-discord .home-icon {
  background: rgba(88, 101, 242, 0.14);
  color: #bfc6ff;
  border-color: rgba(88, 101, 242, 0.2);
}

/* ═══ Search / Header ═══ */
.section-header,
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.section-header .section-title,
.page-header .section-title {
  margin-bottom: 0;
}

.search-bar,
.search-wrap {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-bar input,
.search-input,
.input,
.textarea,
.select {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease),
    background 0.25s;
}

.search-bar input {
  padding: 12px 42px 12px 42px;
  border-radius: 999px;
}

.search-bar input::placeholder,
.search-input::placeholder,
.input::placeholder,
.textarea::placeholder {
  color: var(--text-dim);
}

.search-bar input:focus,
.search-input:focus,
.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(143, 92, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(143, 92, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.textarea {
  min-height: 140px;
  max-height: 420px;
  resize: vertical;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 92, 255, 0.25) transparent;
}

.textarea::-webkit-scrollbar {
  width: 6px;
}

.textarea::-webkit-scrollbar-track {
  background: transparent;
}

.textarea::-webkit-scrollbar-thumb {
  background: rgba(143, 92, 255, 0.25);
  border-radius: 999px;
}

.select {
  cursor: pointer;
}

.select option {
  background: #12112a;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.search-clear:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.search-clear.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
}

/* ═══ Cards ═══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.category-card,
.lore-card {
  position: relative;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  transition:
    transform 0.3s var(--ease),
    border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
  overflow: hidden;
  opacity: 0;
  animation: cardPop 0.5s var(--ease) forwards;
}

.category-card:nth-child(1), .lore-card:nth-child(1) { animation-delay: 0.05s; }
.category-card:nth-child(2), .lore-card:nth-child(2) { animation-delay: 0.12s; }
.category-card:nth-child(3), .lore-card:nth-child(3) { animation-delay: 0.19s; }
.category-card:nth-child(4), .lore-card:nth-child(4) { animation-delay: 0.26s; }
.category-card:nth-child(5), .lore-card:nth-child(5) { animation-delay: 0.33s; }
.category-card:nth-child(6), .lore-card:nth-child(6) { animation-delay: 0.40s; }

.category-card::before,
.lore-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(143, 92, 255, 0.06), transparent 30%);
  opacity: 0;
  transition: opacity 0.4s;
  animation: shimmerRotate 6s linear infinite;
  pointer-events: none;
}

.category-card:hover::before,
.lore-card:hover::before {
  opacity: 1;
}

.category-card::after,
.lore-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--radius-lg) - 1px);
  background:
    linear-gradient(180deg, rgba(10, 10, 22, 0.72), rgba(14, 13, 30, 0.9)),
    var(--bg-card);
  z-index: 0;
}

.category-card > *,
.lore-card > * {
  position: relative;
  z-index: 1;
}

.card-bg-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.14;
  filter: saturate(0.9) contrast(1.05);
  pointer-events: none;
}

.category-card:hover,
.lore-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-hover);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.index-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-weight: 900;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: 0 4px 16px rgba(143, 92, 255, 0.3);
}

.category-card h4,
.lore-card h4 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.category-card p,
.lore-card p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.6;
  font-size: 0.9rem;
}

/* ═══ Reader ═══ */
.reader {
  display: none;
  margin-top: 16px;
}

.reader.active {
  display: block;
  animation: pageEnter 0.4s var(--ease);
}

.card-panel {
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.reader-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.reader-top h3 {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.ghost-btn {
  border: 1px solid rgba(143, 92, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  color: #fff;
  background: rgba(143, 92, 255, 0.08);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  transition:
    background 0.25s var(--ease),
    border-color 0.25s var(--ease),
    transform 0.25s var(--ease);
}

.ghost-btn:hover {
  background: rgba(143, 92, 255, 0.16);
  border-color: rgba(143, 92, 255, 0.35);
  transform: translateX(-2px);
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(92, 184, 255, 0.08);
  color: var(--blue);
  border: 1px solid rgba(92, 184, 255, 0.14);
}

.reader-body {
  color: #d8d1f0;
  line-height: 1.9;
  font-size: 0.98rem;
}

/* ═══ Rule sections ═══ */
.subrules {
  display: grid;
  gap: 10px;
}

.rule-section {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.rule-section:last-child {
  margin-bottom: 0;
}

.rule-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.rule-section-head h4 {
  font-size: 1.08rem;
  font-weight: 800;
  margin: 0;
}

.rule-section-text {
  color: var(--text-dim);
  line-height: 1.8;
  margin: 0;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.rule-chip.category {
  background: rgba(143, 92, 255, 0.14);
  color: #ceb8ff;
  border: 1px solid rgba(143, 92, 255, 0.22);
}

.rule-chip.subcategory {
  background: rgba(92, 184, 255, 0.12);
  color: #bfe6ff;
  border: 1px solid rgba(92, 184, 255, 0.2);
}

.rule-chip.rule {
  background: rgba(110, 234, 167, 0.1);
  color: #bff6d7;
  border: 1px solid rgba(110, 234, 167, 0.18);
}

.subrule {
  background: rgba(18, 17, 35, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.25s var(--ease);
}

.subrule:hover {
  border-color: rgba(143, 92, 255, 0.15);
}

.subrule.open {
  border-color: rgba(143, 92, 255, 0.2);
}

.subrule-head {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 16px 20px;
  text-align: left;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.subrule-head:hover {
  background: rgba(255, 255, 255, 0.02);
}

.subrule-arrow {
  color: var(--text-dim);
  transition: transform 0.25s var(--ease);
  font-size: 1.1rem;
}

.subrule.open .subrule-arrow {
  transform: rotate(180deg);
}

.subrule-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
}

.subrule-content {
  padding: 0 20px 18px;
  color: #c4bce0;
  line-height: 1.85;
  font-size: 0.95rem;
}

.subcategory-stack {
  display: grid;
  gap: 14px;
}

.subcategory-count {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.subcategory-link-card {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: rgba(10, 10, 22, 0.45);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition:
    transform 0.25s var(--ease),
    background 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.subcategory-link-card:hover {
  border-color: rgba(143, 92, 255, 0.22);
  background: rgba(18, 16, 34, 0.6);
  transform: translateY(-2px);
}

.subcategory-link-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.subcategory-link-head h5 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
}

.subcategory-link-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.subcategory-link-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subcategory-link-arrow {
  color: #d9cbff;
  font-size: 1.15rem;
  font-weight: 800;
}

/* ═══ Staff ═══ */
.staff-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.staff-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(110, 234, 167, 0.08);
  color: var(--green);
  border: 1px solid rgba(110, 234, 167, 0.14);
  font-weight: 700;
  font-size: 0.9rem;
}

.staff-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 18px;
  align-items: start;
  min-height: 0;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: #c8c0e4;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-hint {
  margin-top: -4px;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.6;
}

.staff-toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.staff-search {
  width: 100%;
}

.staff-filter {
  height: 100%;
}

.staff-list {
  display: grid;
  gap: 12px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 92, 255, 0.15) transparent;
}

.list-item {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  transition:
    border-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.list-item:hover {
  border-color: rgba(143, 92, 255, 0.15);
  transform: translateY(-1px);
}

.list-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.list-item h4 {
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

.list-item small {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0;
  color: var(--purple-soft);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(143, 92, 255, 0.08);
  border: 1px solid rgba(143, 92, 255, 0.14);
}

.list-item p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.55;
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-parent-label {
  margin-bottom: 8px;
  color: #cbb7ff;
  font-size: 0.82rem;
  font-weight: 700;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini {
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition:
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.mini:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mini:active {
  transform: translateY(1px);
}

.mini.danger {
  color: var(--red);
  background: rgba(255, 107, 138, 0.1);
  border: 1px solid rgba(255, 107, 138, 0.12);
}

.mini.danger:hover {
  background: rgba(255, 107, 138, 0.18);
}

.empty-preview {
  color: var(--text-dim);
  opacity: 0.7;
  font-style: italic;
}

/* ═══ Modal ═══ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 5, 16, 0.7);
  backdrop-filter: blur(12px);
}

.overlay.open {
  display: flex;
}

.overlay.open .modal {
  animation: modalPop 0.35s var(--ease-bounce);
}

.modal {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(18, 16, 40, 0.98), rgba(8, 8, 18, 0.99));
  box-shadow: var(--shadow-card), 0 0 80px rgba(143, 92, 255, 0.08);
}

.modal h3 {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.modal p {
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.shake {
  animation: shake 0.4s var(--ease);
}

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: 0 8px 32px rgba(143, 92, 255, 0.3);
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s var(--ease-bounce);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ═══ Particles ═══ */
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  animation: particleFloat linear infinite;
}

.hidden {
  display: none !important;
}

/* ═══ Rich text / pseudo markdown ═══ */
.rich-line,
.rich-h1,
.rich-h2,
.rich-h3 {
  white-space: normal;
}

.rich-line {
  line-height: 1.85;
  margin: 0 0 8px;
}

.rich-spacer {
  height: 12px;
}

.rich-h1 {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.2;
  color: #fff;
  margin: 10px 0 12px;
  letter-spacing: -0.02em;
}

.rich-h2 {
  font-size: 1.26rem;
  font-weight: 850;
  line-height: 1.25;
  color: #f3eeff;
  margin: 10px 0 10px;
}

.rich-h3 {
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.3;
  color: #e7dcff;
  margin: 8px 0 8px;
}

.subrule-content strong,
.reader-body strong,
.rule-section-text strong {
  color: #fff;
  font-weight: 800;
}

/* ═══ Responsive ═══ */
@media (max-width: 1100px) {
  .home-grid,
  .staff-grid {
    grid-template-columns: 1fr;
  }

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

  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 18px;
  }

  .hero-logo {
    max-width: 180px;
    max-height: 180px;
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
  }

  .sidebar::before {
    display: none;
  }

  .brand {
    padding: 0;
  }

  .brand h1 {
    font-size: 1.6rem;
  }

  .brand-sub {
    display: none;
  }

  .nav {
    flex-direction: row;
    gap: 4px;
    flex-wrap: wrap;
  }

  .nav-btn {
    padding: 10px 12px;
    font-size: 0.82rem;
    gap: 6px;
  }

  .nav-btn::before {
    display: none;
  }

  .side-footer {
    flex-direction: row;
    margin-top: 0;
    gap: 6px;
    flex-wrap: wrap;
  }

  .code-btn {
    font-size: 0.8rem;
    padding: 10px 12px;
  }

  .status-badge {
    font-size: 0.76rem;
    padding: 8px 10px;
  }

  main {
    padding: 16px;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .section-header,
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrap,
  .search-bar {
    width: 100%;
  }

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

  .modal-actions,
  .row,
  .staff-toolbar,
  .list-item-top {
    flex-direction: column;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .btn,
  .ghost-btn,
  .code-btn {
    width: 100%;
  }

  .subcategory-link-head,
  .reader-top,
  .staff-top {
    flex-direction: column;
    align-items: stretch;
  }

  .subcategory-link-side {
    justify-content: space-between;
    width: 100%;
  }
}

.staff-grid,
.card-panel,
.reader,
#page-staff,
#page-lore,
#page-reglement {
  min-height: 0;
}

@media (max-width: 820px) {
  .hero-panel {
    padding: 24px 20px;
  }

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

  .hero-right {
    order: -1;
    margin-bottom: 6px;
  }

  .hero-logo {
    max-width: 150px;
    max-height: 150px;
  }

  .hero-left h2 {
    max-width: 100%;
  }
}