/* ==========================================================================
   Kith and Kin — Mythic+ Night Stylesheet
   Theme: Kith & Kin Crimson & Silver on Pitch Black
   ========================================================================== */

:root {
  /* Theme Colors - Styled off the Kith & Kin Painted Guild Logo */
  --bg-darkest: #050507;
  --bg-darker: #08080c;
  --bg-card: rgba(10, 10, 14, 0.94);
  --bg-card-hover: rgba(16, 16, 22, 0.98);
  --border-card: rgba(220, 38, 38, 0.22);
  --border-gold: #c89e47;
  --border-gold-glow: rgba(200, 158, 71, 0.6);
  --border-crimson: #dc2626;
  --border-crimson-glow: rgba(220, 38, 38, 0.5);
  --crimson-primary: #dc2626;
  --crimson-dark: #991b1b;
  --crimson-glow: rgba(220, 38, 38, 0.45);
  --silver-white: #f8fafc;
  --silver-muted: #94a3b8;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-gold: #f5d061;
  --keystone-cyan: #00f0ff;
  --keystone-purple: #a855f7;

  /* WoW Class Colors (Official Hex) */
  --class-dk: #C41E3A;
  --class-dh: #A330C9;
  --class-druid: #FF7C0A;
  --class-evoker: #33937F;
  --class-hunter: #AAD372;
  --class-mage: #3FC7EB;
  --class-monk: #00FF98;
  --class-paladin: #F48CBA;
  --class-priest: #FFFFFF;
  --class-rogue: #FFF468;
  --class-shaman: #0070DD;
  --class-warlock: #8788EE;
  --class-warrior: #C69B6D;

  /* Role Colors */
  --role-tank: #3b82f6;
  --role-tank-bg: rgba(59, 130, 246, 0.18);
  --role-healer: #10b981;
  --role-healer-bg: rgba(16, 185, 129, 0.18);
  --role-dps: #ef4444;
  --role-dps-bg: rgba(239, 68, 68, 0.18);

  /* Fonts */
  --font-fantasy: 'Cinzel', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-darkest);
  background-image: 
    radial-gradient(circle at 50% -8%, rgba(185, 28, 28, 0.22) 0%, transparent 60%),
    radial-gradient(circle at 10% 25%, rgba(127, 29, 29, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 70%, rgba(248, 250, 252, 0.03) 0%, transparent 40%),
    linear-gradient(180deg, #050507 0%, #020204 100%);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 2rem;
}

.site-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: -0.4rem 0 1rem;
  padding: 0.45rem;
  border: 1px solid rgba(220, 38, 38, 0.32);
  border-radius: 999px;
  background: rgba(6, 6, 8, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  width: fit-content;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.site-nav a:hover {
  color: #fff;
}

.site-nav a.is-current {
  color: #ffffff;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.55);
}

/* ==========================================================================
   Header, Guild Crest & Watermark
   ========================================================================== */

.guild-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 2.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

/* Atmospheric Guild Logo Watermark */
.guild-header::before {
  content: '';
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 380px;
  height: 380px;
  background-image: url('assets/kith-and-kin-logo.jpg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center right;
  opacity: 0.12;
  mix-blend-mode: screen;
  pointer-events: none;
  filter: contrast(135%) drop-shadow(0 0 25px rgba(220, 38, 38, 0.45));
  mask-image: radial-gradient(circle at 65% 50%, black 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 65% 50%, black 25%, transparent 78%);
}

.guild-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #7f1d1d 20%, #ef4444 50%, #f8fafc 65%, #7f1d1d 85%, transparent 100%);
}

.guild-crest {
  flex-shrink: 0;
}

/* Guild Emblem Badge */
.guild-emblem {
  width: 148px;
  height: 148px;
  position: relative;
  border-radius: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  user-select: none;
}

.guild-emblem:hover {
  transform: scale(1.05);
}

.guild-emblem:active,
.guild-emblem.is-pulsing {
  transform: scale(0.96);
  animation: emblemPulseShockwave 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.emblem-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  border: 2px solid rgba(220, 38, 38, 0.65);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.85), 0 0 24px rgba(185, 28, 28, 0.5);
  position: relative;
  z-index: 2;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.guild-emblem:hover .emblem-img {
  border-color: #ef4444;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.95), 0 0 32px rgba(239, 68, 68, 0.75);
}

.emblem-glow {
  position: absolute;
  inset: -10px;
  border-radius: 30px;
  background: radial-gradient(circle, rgba(220, 38, 38, 0.45) 0%, rgba(185, 28, 28, 0) 70%);
  z-index: 1;
  pointer-events: none;
  animation: emblemAura 4s ease-in-out infinite alternate;
}

.emblem-ring {
  position: absolute;
  inset: -6px;
  border: 1px dashed rgba(248, 250, 252, 0.3);
  border-radius: 28px;
  z-index: 1;
  pointer-events: none;
  transition: border-color 0.3s ease;
}

.guild-emblem:hover .emblem-ring {
  border-color: rgba(239, 68, 68, 0.6);
}

@keyframes emblemAura {
  0% {
    opacity: 0.5;
    transform: scale(0.97);
  }
  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes emblemPulseShockwave {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.header-titles {
  flex-grow: 1;
  position: relative;
  z-index: 2;
}

.guild-subtitle {
  font-family: var(--font-fantasy);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-gold);
  margin-bottom: 0.2rem;
}

.guild-title {
  font-family: var(--font-fantasy);
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.brand-kith {
  color: #ef4444;
  background: linear-gradient(180deg, #f87171 0%, #dc2626 50%, #991b1b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.4));
  font-weight: 900;
}

.brand-amp {
  color: #b91c1c;
  font-size: 1.8rem;
  font-family: var(--font-fantasy);
  margin: 0 0.15rem;
  opacity: 0.9;
}

.brand-kin {
  color: #f8fafc;
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 60%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.25));
  font-weight: 900;
}

.guild-title .highlight {
  color: var(--text-gold);
  text-shadow: 0 0 15px rgba(245, 208, 97, 0.4);
}

.guild-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.discord-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.25s ease;
  user-select: none;
}

.discord-sync-badge .sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  display: inline-block;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.discord-sync-badge.syncing .sync-dot {
  background: #eab308;
  box-shadow: 0 0 8px #eab308;
  animation: pulseSyncDot 1s infinite alternate;
}

.discord-sync-badge.offline .sync-dot {
  background: #64748b;
  box-shadow: none;
}

.discord-sync-badge.error .sync-dot {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

@keyframes pulseSyncDot {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}


/* ==========================================================================
   Layout Grid
   ========================================================================== */

.main-layout {
  display: grid;
  grid-template-columns: minmax(430px, 485px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1440px) {
  .main-layout {
    grid-template-columns: 520px 1fr;
  }
}

@media (max-width: 1080px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Common Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-title {
  font-family: var(--font-fantasy);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  background: rgba(200, 158, 71, 0.15);
  color: var(--text-gold);
  border: 1px solid rgba(200, 158, 71, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.badge-warning {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(234, 179, 8, 0.5);
  color: #fde047;
}

/* ==========================================================================
   Roster Panel
   ========================================================================== */

.roster-panel {
  display: flex;
  flex-direction: column;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.roster-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-pill {
  padding: 0.45rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-pill strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.1rem;
}

.metric-pill.tank strong { color: var(--role-tank); }
.metric-pill.healer strong { color: var(--role-healer); }
.metric-pill.dps strong { color: var(--role-dps); }
.metric-pill.groups strong { color: var(--text-gold); }

.roster-search-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.6rem;
  font-size: 0.85rem;
  opacity: 0.6;
  pointer-events: none;
}

.form-input-sm.search-field {
  padding-left: 2rem;
  padding-right: 1.8rem;
  background: rgba(8, 12, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  font-size: 0.82rem;
  width: 100%;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  transition: all 0.2s ease;
}

.form-input-sm.search-field:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 8px rgba(200, 158, 71, 0.35);
  outline: none;
}

.btn-clear-search {
  position: absolute;
  right: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.btn-clear-search:hover {
  color: #fff;
}

.filter-controls-wrap {
  display: flex;
  gap: 0.5rem;
}

.filter-controls-wrap select {
  flex: 1;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-weight: 600;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #fff;
}

.roster-controls-subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.attendance-bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-selector {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.roster-list-container {
  max-height: 600px;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

.roster-list-container::-webkit-scrollbar {
  width: 6px;
}
.roster-list-container::-webkit-scrollbar-thumb {
  background: rgba(200, 160, 80, 0.3);
  border-radius: 4px;
}

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

/* Individual Player Card in Roster */
.player-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 4px solid var(--border-gold);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.player-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(200, 158, 71, 0.3);
}

.player-row.inactive {
  opacity: 0.62; /* still readable: names were below 3:1 contrast at 0.45 */
  filter: grayscale(0.5);
  border-left-color: #555 !important;
}

.player-left-col {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.player-attend-check {
  display: flex;
  align-items: center;
}

.player-attend-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--border-gold);
  cursor: pointer;
}

.player-main-col {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.player-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.player-name {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.realm-pill {
  font-size: 0.68rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  font-family: var(--font-main);
  text-transform: capitalize;
}

.class-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.player-badges-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.player-key-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

.key-owned-pill {
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #fde047;
  padding: 0.12rem 0.48rem;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.01em;
}

.role-badge-group {
  display: flex;
  gap: 0.25rem;
}

.role-icon-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.role-icon-mini:hover {
  transform: scale(1.15);
}

.role-icon-mini.active-tank {
  background: var(--role-tank-bg);
  border-color: var(--role-tank);
}

.role-icon-mini.active-healer {
  background: var(--role-healer-bg);
  border-color: var(--role-healer);
}

.role-icon-mini.active-dps {
  background: var(--role-dps-bg);
  border-color: var(--role-dps);
}

.role-icon-mini.inactive {
  opacity: 0.2;
}

.key-range-pill {
  font-size: 0.75rem;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: var(--keystone-cyan);
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-weight: 600;
}

.util-icon-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.util-icon-tag.lust {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.util-icon-tag.brez {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.party-utility-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.72rem;
  flex-wrap: wrap;
}

.party-util-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.25;
}

.party-util-badge.ready {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.party-util-badge.missing {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  opacity: 0.85;
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.4);
}

.player-avatar-placeholder {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
}

.ilvl-pill {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #c084fc;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.io-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid currentColor;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.party-metrics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
}

.party-avg-io {
  font-weight: 700;
  color: #facc15;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.party-avg-ilvl {
  font-weight: 700;
  color: #c084fc;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.slot-stat-badge {
  font-size: 0.7rem;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
}

.slot-stat-badge.ilvl {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
}

.slot-stat-badge.io {
  background: rgba(0, 0, 0, 0.4);
  font-weight: 700;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.8;
}

.player-actions:hover {
  opacity: 1;
}

.btn-action-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-action-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.btn-action-icon.delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   Generator Panel & Keystone Trigger
   ========================================================================== */

.generator-panel {
  display: flex;
  flex-direction: column;
}

/* Grouping Strategy Collapsible Section */
.strategy-card {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1.1rem 1.4rem;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.strategy-header:hover {
  background: rgba(255, 255, 255, 0.025);
}

.strategy-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.strategy-icon {
  font-size: 1.4rem;
  color: var(--text-gold);
}

.strategy-chevron {
  color: var(--text-gold);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.strategy-card.is-collapsed .settings-box {
  display: none;
}

.settings-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
  .guild-header {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
    padding: 1.5rem 1rem;
  }
  .settings-box {
    grid-template-columns: 1fr;
  }
}

.setting-item label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-gold);
  margin-bottom: 0.4rem;
}

.setting-item.checkbox-item {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-main) !important;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--border-gold);
}

/* Launch Keystone Button */
.launch-action-bar {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(220, 38, 38, 0.18);
}

.btn-form-groups,
.btn-keystone {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.85rem 2.8rem;
  border-radius: 10px;
  border: 1px solid #ef4444;
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  color: #ffffff;
  font-family: var(--font-fantasy);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(185, 28, 28, 0.4), 0 2px 6px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-form-groups:hover,
.btn-keystone:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  border-color: #f87171;
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.55), 0 3px 8px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-form-groups:active,
.btn-keystone:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.35);
}

.btn-form-groups-icon {
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
}

.btn-form-groups-text {
  line-height: 1;
}

/* ==========================================================================
   Results: Dungeon Groups Grid
   ========================================================================== */

.groups-section {
  padding: 1.5rem;
}

.groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title {
  font-family: var(--font-fantasy);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

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

.btn-discord {
  background: #5865F2;
  color: #fff;
  border: 1px solid #7289da;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-discord:hover {
  background: #4752c4;
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

/* Party Card */
.party-card {
  background: rgba(14, 18, 28, 0.95);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  animation: partyCardSpawn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

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

.party-card:hover {
  border-color: rgba(200, 158, 71, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.party-card.is-locked {
  border-color: #eab308;
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.2);
}

.party-header {
  padding: 0.65rem 0.85rem;
  background: linear-gradient(90deg, rgba(200, 158, 71, 0.15) 0%, rgba(20, 26, 40, 0.9) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.party-badge-title,
.party-title-line {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.party-num {
  font-family: var(--font-fantasy);
  font-size: 0.82rem;
  color: var(--text-gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  font-weight: 700;
}

.party-name {
  font-family: var(--font-fantasy);
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-card-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.party-sub-meta {
  padding: 0.35rem 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  min-height: 34px;
  gap: 0.5rem;
}

.party-sub-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.party-sub-key-area {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.party-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  line-height: 1.25;
}

.party-status-indicator.waiting {
  background: rgba(253, 230, 138, 0.12);
  border: 1px solid rgba(253, 230, 138, 0.35);
  color: #fde68a;
}

.party-status-indicator.in-key {
  background: rgba(134, 239, 172, 0.12);
  border: 1px solid rgba(134, 239, 172, 0.4);
  color: #86efac;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--border-card);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.status-pill.in-key {
  background: rgba(134, 239, 172, 0.12);
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.45);
}

.status-pill.waiting {
  background: rgba(253, 230, 138, 0.12);
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.35);
}

.party-key-target {
  color: var(--keystone-cyan);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.party-dungeon {
  color: var(--text-gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

/* Party Member Slots */
.party-members {
  padding: 0.6rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.party-member-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.party-member-row:hover {
  background: rgba(255, 255, 255, 0.045);
}

.party-member-row.role-tank {
  border-left: 3px solid var(--role-tank);
}

.party-member-row.role-healer {
  border-left: 3px solid var(--role-healer);
}

.party-member-row.role-dps {
  border-left: 3px solid var(--role-dps);
}

.slot-role-tag {
  font-size: 1.15rem;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.slot-player-details {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.slot-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.slot-player-name {
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.slot-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.slot-meta-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.slot-key-range {
  font-size: 0.74rem;
  color: var(--keystone-cyan);
  font-weight: 600;
  white-space: nowrap;
}

.party-footer {
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.empty-state h4 {
  font-family: var(--font-fantasy);
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 0.4rem;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
  font-size: 0.9rem;
}

/* Bench / Reserves Container */
.bench-container {
  margin-top: 2rem;
  padding: 1.25rem;
  background: rgba(30, 20, 15, 0.4);
  border: 1px solid rgba(200, 120, 60, 0.35);
  border-radius: 10px;
}

.bench-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.bench-header h4 {
  font-family: var(--font-fantasy);
  font-size: 1.1rem;
  color: #fca5a5;
}

.bench-advice {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.bench-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.bench-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ==========================================================================
   Buttons & Forms
   ========================================================================== */

button {
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}

.btn-primary {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  color: #ffffff;
  border-color: #ef4444;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(185, 28, 28, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  border-color: #f87171;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.6);
  color: #ffffff;
}

.btn-accent {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border-color: #38bdf8;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.btn-accent:hover {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.55);
}

.btn-gold {
  background: linear-gradient(180deg, rgba(245, 208, 97, 0.25) 0%, rgba(180, 83, 9, 0.4) 100%);
  color: #fef08a;
  border: 1px solid rgba(245, 208, 97, 0.5);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245, 208, 97, 0.2);
}

.btn-gold:hover {
  background: linear-gradient(180deg, rgba(245, 208, 97, 0.4) 0%, rgba(217, 119, 6, 0.55) 100%);
  border-color: #fef08a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(245, 208, 97, 0.45);
}

.btn-link-sm {
  background: none;
  border: none;
  color: var(--text-gold);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link-sm:hover {
  color: #fff;
}

/* Dungeon Chips Grid & Exclusions */
.dungeon-pool-box {
  margin-top: 0.5rem;
}

.dungeon-pool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.dungeon-pool-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dungeon-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.4rem;
}

.dungeon-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-size: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.dungeon-chip:hover {
  border-color: rgba(245, 208, 97, 0.4);
  background: rgba(245, 208, 97, 0.08);
}

.dungeon-chip.active {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.dungeon-chip.excluded {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
  text-decoration: line-through;
  opacity: 0.65;
}

.dungeon-chip .chip-status {
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

/* Keystone Roulette Box */
.keystone-roulette-card {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(245, 208, 97, 0.05), rgba(15, 23, 42, 0.6));
  border: 1px solid rgba(245, 208, 97, 0.25);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.roulette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.roulette-controls {
  margin-top: 0.9rem;
}

.keystone-roulette-card.is-collapsed .roulette-controls {
  display: none;
}

.roulette-chevron {
  color: var(--text-gold);
  font-size: 0.8rem;
}

.player-exclude-chip {
  border: 1px solid rgba(245, 208, 97, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.player-exclude-chip.is-out {
  opacity: 0.45;
  text-decoration: line-through;
}

.player-exclude-chip.no-key {
  opacity: 0.72;
}

.roulette-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.roulette-icon {
  font-size: 1.4rem;
}

.roulette-title h4 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-gold);
  font-weight: 700;
}

.roulette-title p {
  margin: 0.1rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.roulette-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}

.roulette-row .form-group-sm label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.roulette-btn {
  height: 32px;
  white-space: nowrap;
}

.roulette-result-banner {
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(245, 208, 97, 0.12);
  border: 1px solid rgba(245, 208, 97, 0.4);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: bannerFadeIn 0.3s ease;
}

@keyframes bannerFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-sigil {
  font-size: 1.1rem;
}

.result-text {
  font-weight: 700;
  color: #fef08a;
  font-size: 0.95rem;
}

.result-holders {
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Party Card Interactive Dungeon Bar */
.party-dungeon-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.party-dungeon-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 208, 97, 0.12);
  border: 1px solid rgba(245, 208, 97, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-gold);
}

.btn-mini-roll {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mini-roll:hover {
  background: rgba(245, 208, 97, 0.2);
  border-color: var(--text-gold);
  color: var(--text-gold);
}

.btn-mini-roll:disabled {
  opacity: 0.45;
  cursor: default;
}

.party-left-out {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.party-dungeon-select {
  background: #0f172a;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 0.72rem;
  padding: 0.18rem 0.35rem;
  cursor: pointer;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-gold);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--text-gold);
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #fff;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(10, 14, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select-sm {
  background: rgba(10, 14, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus, .form-select-sm:focus {
  outline: none;
  border-color: var(--border-gold);
  box-shadow: 0 0 8px rgba(200, 158, 71, 0.35);
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-gold);
  margin-bottom: 0.35rem;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.col-half {
  flex: 1;
}

/* Role Selector Checkbox Pills */
.role-selector-pills {
  display: flex;
  gap: 0.6rem;
}

.role-checkbox-pill {
  flex: 1;
  cursor: pointer;
  position: relative;
}

.role-checkbox-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.role-checkbox-pill .pill-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
}

.role-checkbox-pill input:checked + .pill-content {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.role-checkbox-pill.tank input:checked + .pill-content {
  background: var(--role-tank-bg);
  border-color: var(--role-tank);
  color: #93c5fd;
}

.role-checkbox-pill.healer input:checked + .pill-content {
  background: var(--role-healer-bg);
  border-color: var(--role-healer);
  color: #6ee7b7;
}

.role-checkbox-pill.dps input:checked + .pill-content {
  background: var(--role-dps-bg);
  border-color: var(--role-dps);
  color: #fca5a5;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 500px;
  background: #111520;
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 25px rgba(200, 158, 71, 0.2);
  animation: modalEnter 0.2s ease-out;
}

.modal-wide {
  max-width: 650px;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-fantasy);
  color: #fff;
  font-size: 1.25rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal form, .modal-body {
  padding: 1.5rem;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.modal-footer {
  padding-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1a2233;
  color: #fff;
  border: 1px solid var(--border-gold);
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

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

/* ==========================================================================
   Carry & Shitter Alt Badges & Modal Options
   ========================================================================== */

.carry-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.carry-pill.need {
  background: rgba(249, 115, 22, 0.2);
  border: 1px solid rgba(249, 115, 22, 0.5);
  color: #fdba74;
}

.carry-pill.stronk {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #d8b4fe;
}

.shitter-pill {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(180, 83, 9, 0.25);
  border: 1px solid rgba(217, 119, 6, 0.6);
  color: #fde047;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.leader-pill {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(245, 208, 97, 0.2);
  border: 1px solid rgba(245, 208, 97, 0.6);
  color: #fef08a;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.reserve-pill {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #cbd5e1;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.carry-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.radio-pill-item {
  position: relative;
  display: flex;
  cursor: pointer;
}

.radio-pill-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill-item .pill-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  transition: all 0.18s ease;
}

.radio-pill-item input:checked + .pill-box {
  background: rgba(212, 160, 23, 0.18);
  border-color: var(--border-gold);
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 160, 23, 0.2);
}

.radio-pill-item.need input:checked + .pill-box {
  background: rgba(249, 115, 22, 0.22);
  border-color: #f97316;
  color: #fdba74;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.25);
}

.radio-pill-item.stronk input:checked + .pill-box {
  background: rgba(168, 85, 247, 0.22);
  border-color: #a855f7;
  color: #e9d5ff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.25);
}

.shitter-checkbox-wrap {
  background: rgba(120, 53, 15, 0.15);
  border: 1px dashed rgba(217, 119, 6, 0.45);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 0.65rem;
}

.shitter-checkbox-wrap .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.shitter-label-text {
  font-weight: 700;
  color: #fde047;
  font-size: 0.9rem;
}

.party-util-badge.shitter-group {
  background: rgba(180, 83, 9, 0.3);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fef08a;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.party-util-badge.carry-assist {
  background: rgba(168, 85, 247, 0.22);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #f3e8ff;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.guild-footer {
  text-align: center;
  margin-top: 2.5rem;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(220, 38, 38, 0.2);
  display: flex;
  justify-content: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
}

.footer-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(220, 38, 38, 0.5);
  box-shadow: 0 0 14px rgba(185, 28, 28, 0.35);
  object-fit: cover;
  flex-shrink: 0;
}

.footer-copy p {
  margin: 0;
  color: var(--text-main);
  font-size: 0.88rem;
}

.guild-footer strong {
  color: #ef4444;
  font-weight: 700;
}

.footer-realm {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

/* ==========================================================================
   Event Selector & Management Bar
   ========================================================================== */

.event-bar-wrapper {
  margin-bottom: 1.25rem;
}

.event-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(245, 208, 97, 0.25);
  border-radius: 10px;
  gap: 1rem;
  flex-wrap: wrap;
}

.event-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 260px;
}

.event-label {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-gold);
  font-size: 0.95rem;
  white-space: nowrap;
}

.event-select {
  flex: 1;
  max-width: 380px;
  background: #0f172a;
  border: 1px solid rgba(245, 208, 97, 0.35);
  color: #fff;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
}

.event-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   Party-Specific Keystone Roulette & Held Keys
   ========================================================================== */

.roulette-group-pick-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.roulette-group-pick-row label {
  font-weight: 700;
  color: var(--text-gold);
  white-space: nowrap;
  font-size: 0.9rem;
}

.group-held-keys-wrap {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.group-keys-header {
  margin-bottom: 0.5rem;
}

.keys-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
}

.group-keys-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.party-held-key-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 208, 97, 0.12);
  border: 1px solid rgba(245, 208, 97, 0.35);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

.party-held-key-badge.key-excluded {
  opacity: 0.45;
  text-decoration: line-through;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.holder-name {
  color: #fff;
}

.holder-key {
  color: var(--text-gold);
  font-weight: 700;
}

.pill-excluded-tag {
  color: #ef4444;
  font-size: 0.72rem;
  font-weight: 600;
}

.no-keys-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.group-filter-wrap {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.group-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.filter-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #cbd5e1;
}

.group-dungeon-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.45rem;
}

.roulette-action-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.roulette-no-group-prompt {
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #fde047;
  font-size: 0.85rem;
  text-align: center;
}

/* ==========================================================================
   Key Level Range Checkbox Pills (Player Modal)
   ========================================================================== */

.key-bracket-pills {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.bracket-checkbox-pill {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}

.bracket-checkbox-pill input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.bracket-pill-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.bracket-checkbox-pill input:checked + .bracket-pill-content {
  background: rgba(245, 208, 97, 0.15);
  border-color: var(--border-gold);
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 208, 97, 0.2);
}

.bracket-pill-content strong {
  color: var(--text-gold);
}

/* ==========================================================================
   Collapsible Player Cards (Guild Sign-ups & Active Dungeon Parties)
   ========================================================================== */

/* Guild Sign-ups Roster Row Collapsible */
.player-row.is-collapsed {
  padding: 0.5rem 0.75rem;
}

.player-row.is-collapsed .player-details-collapsible {
  display: none;
}

.player-header-row.player-toggle-trigger {
  cursor: pointer;
  user-select: none;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-header-row.player-toggle-trigger:hover .player-name {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.player-header-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.player-expand-chevron {
  font-size: 0.78rem;
  color: var(--text-gold);
  transition: transform 0.2s ease;
  display: inline-block;
  padding: 0.1rem 0.25rem;
}

.player-row:not(.is-collapsed) .player-expand-chevron {
  transform: rotate(90deg);
}

.player-details-collapsible {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.io-badge-compact {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.key-owned-pill-mini {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fde047;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 0.06rem 0.38rem;
  border-radius: 4px;
  white-space: nowrap;
}

.player-roles-summary {
  font-size: 0.85rem;
  letter-spacing: -0.05em;
  margin: 0 0.15rem;
  white-space: nowrap;
}

.player-actions-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Active Dungeon Party Member Row Collapsible */
.party-member-row.is-collapsed {
  padding: 0.4rem 0.65rem;
}

.party-member-row.is-collapsed .slot-details-collapsible {
  display: none;
}

.slot-toggle-trigger {
  cursor: pointer;
  user-select: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slot-toggle-trigger:hover .slot-player-name {
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.slot-top-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
}

.slot-top-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.slot-expand-chevron {
  font-size: 0.75rem;
  color: var(--text-gold);
  transition: transform 0.2s ease;
  display: inline-block;
  margin-left: 0.25rem;
}

.party-member-row:not(.is-collapsed) .slot-expand-chevron {
  transform: rotate(90deg);
}

.slot-details-collapsible {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.slot-key-mini {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fde047;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 0.04rem 0.32rem;
  border-radius: 4px;
  white-space: nowrap;
}

.party-card.is-mine-group {
  border-color: var(--border-gold);
  box-shadow: 0 0 20px rgba(245, 208, 97, 0.35);
}

.party-card.is-mine-group .party-num {
  color: #fde047;
  font-weight: 800;
}

/* ==========================================================================
   Player Stats & History Dossier Modal
   ========================================================================== */

.player-stats-modal-card {
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #090a0f;
  border: 1px solid rgba(220, 38, 38, 0.45);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(185, 28, 28, 0.3);
}

.stats-modal-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stats-modal-avatar-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid rgba(220, 38, 38, 0.65);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.35);
  flex-shrink: 0;
}

.stats-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stats-avatar-ph {
  font-size: 1.6rem;
}

.stats-modal-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.stats-modal-body {
  overflow-y: auto;
  padding: 1.25rem 1.5rem !important;
}

/* Vital Stats Grid */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 600px) {
  .stats-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.stat-meta {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-fantasy);
}

/* Frequent Companions Box */
.stats-teammates-box {
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.stats-box-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fca5a5;
  display: block;
  margin-bottom: 0.4rem;
}

.stats-buddies-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.buddy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
}

.buddy-count {
  color: var(--text-gold);
  font-size: 0.7rem;
  font-weight: 800;
}

/* External Links */
.stats-external-links {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stats-ext-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  user-select: none;
}

.stats-ext-btn.rio {
  background: rgba(234, 88, 12, 0.15);
  border: 1px solid rgba(234, 88, 12, 0.4);
  color: #fb923c;
}

.stats-ext-btn.rio:hover {
  background: rgba(234, 88, 12, 0.25);
  border-color: #f97316;
  box-shadow: 0 0 12px rgba(234, 88, 12, 0.3);
}

.stats-ext-btn.wcl {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #f87171;
}

.stats-ext-btn.wcl:hover {
  background: rgba(220, 38, 38, 0.25);
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.3);
}

/* Tabs */
.stats-tabs {
  display: flex;
  gap: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
}

.stats-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-fantasy);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stats-tab-btn:hover {
  color: #fff;
}

.stats-tab-btn.is-active {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
  color: #ffffff;
}

/* Run Cards List */
.stats-runs-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.run-card-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.run-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.run-note-callout {
  margin-top: 0.25rem;
  padding: 0.45rem 0.75rem;
  background: rgba(220, 38, 38, 0.08);
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.run-note-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f87171;
}

.run-note-content {
  color: #f1f5f9;
}

.run-note-locked {
  margin-top: 0.25rem;
  padding: 0.35rem 0.65rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-unlock-note {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #fde047;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-unlock-note:hover {
  background: rgba(234, 179, 8, 0.3);
  color: #fff;
  border-color: #fde047;
}

.run-card-row:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.3);
}

.run-main-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.run-level-tag {
  font-family: var(--font-fantasy);
  font-size: 0.88rem;
  font-weight: 800;
  color: #fde047;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 0.08rem 0.4rem;
  border-radius: 5px;
  white-space: nowrap;
}

.run-stars {
  color: #facc15;
  font-size: 0.82rem;
  letter-spacing: -0.05em;
}

.run-overtime {
  color: #f87171;
  font-size: 0.72rem;
  font-weight: 600;
}

.run-dungeon-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-best-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #000;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.run-meta-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.run-time {
  font-family: monospace;
  color: #e2e8f0;
}

.run-score {
  color: #38bdf8;
  font-weight: 700;
}

.run-badge-timed {
  color: #4ade80;
  font-weight: 700;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.run-badge-depleted {
  color: #f87171;
  font-weight: 700;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.run-group-tag {
  font-size: 0.72rem;
  color: var(--text-gold);
}

.stats-run-link {
  color: #fca5a5;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  border-bottom: 1px dotted rgba(252, 165, 165, 0.5);
  transition: color 0.15s ease;
}

.stats-run-link:hover {
  color: #fff;
  border-bottom-color: #fff;
}

.stats-loading,
.stats-no-data {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.stats-spinner {
  display: inline-block;
  animation: spin 2s infinite linear;
}

/* Player triggerable button in actions row */
.stats-player-btn {
  background: rgba(220, 38, 38, 0.18) !important;
  border-color: rgba(220, 38, 38, 0.4) !important;
  color: #fca5a5 !important;
}

.stats-player-btn:hover {
  background: rgba(220, 38, 38, 0.35) !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}

/* ==========================================================================
   Smart Run Matcher Modal
   ========================================================================== */

.match-preview-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.match-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.match-preview-key {
  font-family: var(--font-fantasy);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.match-preview-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.match-preview-links {
  margin-top: 0.2rem;
}

.auto-match-party-btn {
  background: rgba(234, 179, 8, 0.15) !important;
  border: 1px solid rgba(234, 179, 8, 0.4) !important;
  color: #fde047 !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
}

.auto-match-party-btn:hover {
  background: rgba(234, 179, 8, 0.3) !important;
  border-color: #fde047 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.4) !important;
}

/* ==========================================================================
   Guild Chronicler (End-of-Night AI Recap & Discord Exporter)
   ========================================================================== */

.chronicler-modal-card {
  max-width: 680px;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.chronicler-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(18, 5, 5, 0.75);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 8px;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.chronicler-tone-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-gold);
  font-weight: 700;
}

.chronicler-tone-wrap select {
  background: #0d0e12;
  color: #f8fafc;
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.chronicler-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: 0.02em;
}

.badge-gemini {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-openai {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-rule {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.chronicler-key-section {
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.chronicler-content-box {
  background: #08090d;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
  min-height: 280px;
  max-height: 52vh;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  color: #e2e8f0;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

.chronicler-content-box::-webkit-scrollbar {
  width: 7px;
}
.chronicler-content-box::-webkit-scrollbar-thumb {
  background: rgba(220, 38, 38, 0.4);
  border-radius: 4px;
}

.chronicler-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
}

.chronicler-spinner {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  animation: pulse 1.8s infinite ease-in-out;
}

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

.chronicler-content-box .recap-h2 {
  font-family: var(--font-fantasy);
  color: var(--text-gold);
  font-size: 1.35rem;
  margin: 0.4rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.chronicler-content-box .recap-h3 {
  font-family: var(--font-fantasy);
  color: #fff;
  font-size: 1.15rem;
  margin: 1rem 0 0.4rem;
}

.chronicler-content-box .recap-h4 {
  font-family: var(--font-fantasy);
  color: #fca5a5;
  font-size: 1rem;
  margin: 0.8rem 0 0.3rem;
}

.chronicler-content-box .recap-p {
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.chronicler-content-box .recap-quote {
  border-left: 3px solid #dc2626;
  background: rgba(220, 38, 38, 0.08);
  padding: 0.5rem 0.85rem;
  margin: 0.6rem 0 0.9rem;
  font-style: italic;
  color: #f8fafc;
  border-radius: 0 6px 6px 0;
}

.chronicler-content-box .recap-ul {
  padding-left: 1.3rem;
  margin: 0.4rem 0 0.8rem;
}

.chronicler-content-box .recap-li {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.recap-error {
  padding: 1.5rem;
  text-align: center;
  color: #fca5a5;
}

/* ==========================================================================
   Participation Leaderboard & Hall of Champions
   ========================================================================== */

.leaderboard-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.leaderboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
}

.leaderboard-toolbar-left,
.leaderboard-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mode-toggle-btn {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid var(--border-crimson);
  color: #fff;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.mode-toggle-btn:hover {
  background: rgba(220, 38, 38, 0.3);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
}

.mode-toggle-btn.is-demo {
  background: rgba(245, 208, 97, 0.15);
  border-color: var(--border-gold);
  color: var(--text-gold);
}

.mode-toggle-btn.is-demo:hover {
  background: rgba(245, 208, 97, 0.28);
  box-shadow: 0 0 12px var(--border-gold-glow);
}

/* Scoring Rules Grid */
.rules-card {
  padding: 1.25rem;
  margin-bottom: 2rem;
  background: linear-gradient(180deg, rgba(20, 20, 28, 0.95) 0%, rgba(12, 12, 16, 0.95) 100%);
  border: 1px solid rgba(245, 208, 97, 0.25);
}

.rules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.rules-header h2 {
  font-family: var(--font-fantasy);
  color: var(--text-gold);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.rule-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.rule-item:hover {
  border-color: rgba(245, 208, 97, 0.35);
}

.rule-icon {
  font-size: 1.6rem;
  line-height: 1;
  padding-top: 0.1rem;
}

.rule-info strong {
  display: block;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.rule-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(245, 208, 97, 0.18);
  color: var(--text-gold);
  border: 1px solid rgba(245, 208, 97, 0.3);
  margin-bottom: 0.25rem;
}

.rule-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Top 3 Podium (Golden Dais) */
.podium-container {
  margin-bottom: 2.5rem;
}

.podium-title {
  text-align: center;
  font-family: var(--font-fantasy);
  color: var(--text-gold);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
  text-shadow: 0 0 15px rgba(245, 208, 97, 0.3);
}

.podium-grid {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.podium-card {
  flex: 1;
  min-width: 240px;
  max-width: 310px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.podium-card:hover {
  transform: translateY(-5px);
}

.podium-1 {
  order: 2;
  padding-top: 2rem;
  padding-bottom: 2rem;
  border: 2px solid var(--border-gold);
  background: linear-gradient(180deg, rgba(30, 24, 12, 0.98) 0%, rgba(14, 14, 18, 0.98) 100%);
  box-shadow: 0 0 35px rgba(245, 208, 97, 0.25), 0 12px 35px rgba(0, 0, 0, 0.8);
}

.podium-2 {
  order: 1;
  border: 1px solid rgba(226, 232, 240, 0.4);
  background: linear-gradient(180deg, rgba(22, 24, 30, 0.98) 0%, rgba(12, 12, 16, 0.98) 100%);
}

.podium-3 {
  order: 3;
  border: 1px solid rgba(217, 119, 6, 0.4);
  background: linear-gradient(180deg, rgba(28, 20, 15, 0.98) 0%, rgba(12, 12, 16, 0.98) 100%);
}

.podium-medal {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 10px rgba(245, 208, 97, 0.5));
}

.podium-1 .podium-medal {
  font-size: 3.4rem;
  animation: floatMedal 3s ease-in-out infinite;
}

@keyframes floatMedal {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.podium-name {
  font-family: var(--font-fantasy);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  display: block;
}

.podium-1 .podium-name {
  font-size: 1.7rem;
}

.podium-class {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.podium-title-tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}

.podium-1 .podium-title-tag {
  background: rgba(245, 208, 97, 0.2);
  color: var(--text-gold);
  border: 1px solid rgba(245, 208, 97, 0.4);
}

.podium-2 .podium-title-tag {
  background: rgba(226, 232, 240, 0.15);
  color: #e2e8f0;
  border: 1px solid rgba(226, 232, 240, 0.3);
}

.podium-3 .podium-title-tag {
  background: rgba(217, 119, 6, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.podium-points {
  font-family: var(--font-fantasy);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-gold);
  line-height: 1;
  margin-bottom: 0.3rem;
  text-shadow: 0 0 15px rgba(245, 208, 97, 0.4);
}

.podium-1 .podium-points {
  font-size: 2.8rem;
}

.podium-pts-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.podium-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}

.podium-chip {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  white-space: nowrap;
}

/* Standings Controls & Table */
.standings-panel {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
}

.standings-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.filter-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.filter-search-input {
  width: 100%;
  padding: 0.5rem 0.85rem 0.5rem 2.2rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-search-input:focus {
  border-color: var(--border-gold);
}

.filter-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.6;
}

.filter-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.is-active {
  background: rgba(220, 38, 38, 0.2);
  border-color: var(--border-crimson);
  color: #fff;
}

.filter-pill.is-active {
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.35);
}

/* Standings Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
  text-align: left;
}

.lb-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-row {
  background: rgba(14, 14, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.lb-row:hover {
  background: rgba(24, 24, 34, 0.95);
  border-color: rgba(245, 208, 97, 0.25);
  transform: scale(1.003);
}

.lb-row td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

.lb-row td:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.lb-row td:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.lb-rank {
  font-family: var(--font-fantasy);
  font-weight: 800;
  font-size: 1.15rem;
  color: #cbd5e1;
  white-space: nowrap;
}

.lb-rank.rank-1 { color: #f5d061; font-size: 1.35rem; }
.lb-rank.rank-2 { color: #e2e8f0; font-size: 1.25rem; }
.lb-rank.rank-3 { color: #fbbf24; font-size: 1.2rem; }

.lb-player-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid;
  flex-shrink: 0;
}

.lb-player-info strong {
  display: block;
  font-size: 0.95rem;
  cursor: pointer;
}

.lb-player-info small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lb-roles {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.lb-role-tag {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.lb-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.lb-badge-icon {
  font-size: 1.15rem;
  cursor: help;
  transition: transform 0.15s;
}

.lb-badge-icon:hover {
  transform: scale(1.25);
}

.lb-breakdown-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.breakdown-chip {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  white-space: nowrap;
}

.lb-points-val {
  font-family: var(--font-fantasy);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-gold);
  white-space: nowrap;
}

/* ==========================================================================
   Discord App Preview Modal & Mockup Container
   ========================================================================== */

.discord-modal-dialog {
  max-width: 680px;
  background: #313338;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85);
  color: #dbdee1;
}

.discord-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #2b2d31;
  border-bottom: 1px solid #1f2023;
}

.discord-channel-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #f2f3f5;
  font-size: 0.95rem;
}

.discord-channel-hash {
  color: #80848e;
  font-size: 1.2rem;
  font-weight: 800;
}

.discord-channel-topic {
  color: #949ba4;
  font-weight: 400;
  font-size: 0.8rem;
  border-left: 1px solid #3f4147;
  padding-left: 0.5rem;
}

.discord-message-area {
  padding: 1.25rem 1rem;
  background: #313338;
}

.discord-msg-row {
  display: flex;
  gap: 1rem;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.discord-msg-content {
  flex: 1;
}

.discord-msg-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.discord-bot-name {
  font-weight: 700;
  color: #f2f3f5;
  font-size: 0.95rem;
}

.discord-bot-badge {
  background: #5865f2;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.discord-timestamp {
  color: #949ba4;
  font-size: 0.72rem;
}

.discord-embed-card {
  background: #2b2d31;
  border-left: 4px solid #f5d061;
  border-radius: 4px;
  padding: 0.85rem 1rem;
  margin-top: 0.45rem;
  max-width: 540px;
}

.discord-embed-title {
  color: #f5d061;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.discord-embed-desc {
  color: #dbdee1;
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
  font-style: italic;
}

.discord-embed-field {
  margin-bottom: 0.85rem;
}

.discord-field-name {
  font-weight: 800;
  color: #f2f3f5;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.discord-field-val {
  color: #dbdee1;
  font-size: 0.82rem;
  line-height: 1.45;
}

.discord-codeblock {
  background: #1e1f22;
  border: 1px solid #111214;
  border-radius: 4px;
  padding: 0.5rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.75rem;
  color: #dbdee1;
  white-space: pre;
  overflow-x: auto;
}

.discord-embed-footer {
  color: #949ba4;
  font-size: 0.7rem;
  margin-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.45rem;
}

.discord-action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.discord-btn-comp {
  background: #4e5058;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.discord-btn-comp:hover {
  background: #6d6f78;
}

.discord-btn-primary {
  background: #5865f2;
}

.discord-btn-primary:hover {
  background: #4752c4;
}

.discord-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #2b2d31;
  border-top: 1px solid #1f2023;
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #141922;
  border: 1px solid var(--border-gold);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px var(--border-gold-glow);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastFadeIn 0.3s ease;
}

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

@media (max-width: 800px) {
  .podium-grid {
    flex-direction: column;
    align-items: stretch;
  }
  .podium-1 { order: 1; }
  .podium-2 { order: 2; }
  .podium-3 { order: 3; }
  .leaderboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}



/* The hidden attribute must win over component display rules. */
[hidden] { display: none !important; }

/* Keyboard users: always show where focus is. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--text-gold);
  outline-offset: 2px;
}

/* Respect the OS "reduce motion" setting. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.last-change-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Drag & drop in formed groups
   ========================================================================== */
.drag-handle {
  cursor: grab;
  touch-action: none; /* lets a finger drag the handle instead of scrolling */
  user-select: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.35rem 0.2rem;
  flex-shrink: 0;
}
.drag-handle:hover { color: var(--text-gold, #f5d061); }
body.is-dragging-player, body.is-dragging-player * { cursor: grabbing !important; user-select: none; }
.is-drag-source { opacity: 0.4; }
.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  pointer-events: none;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  background: #1c1419;
  border: 1px solid var(--text-gold, #f5d061);
  color: var(--text-gold, #f5d061);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.party-member-row.empty-slot {
  border-style: dashed;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  min-height: 2.6rem;
}
.empty-slot .slot-role-tag { margin-bottom: 0; opacity: 0.6; }
.drop-hover {
  outline: 2px solid var(--text-gold, #f5d061);
  outline-offset: 1px;
  background: rgba(245, 208, 97, 0.08) !important;
}
.bench-container.drop-hover { outline-offset: 3px; }
.waiting-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.75rem; }
.waiting-title { width: 100%; font-size: 0.8rem; color: var(--text-muted, #94a3b8); }
.waiting-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem 0.25rem 0.25rem;
  border-radius: 999px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.82rem;
}
@media (pointer: coarse) {
  .drag-handle { font-size: 1.35rem; padding: 0.45rem 0.35rem; }
}

/* ==========================================================================
   Phone layout fixes (Control Center)
   ========================================================================== */
.panel-toolbar { flex-wrap: wrap; }
.roster-show-more { display: block; width: 100%; margin: 0.5rem 0 0.25rem; }
@media (max-width: 600px) {
  .guild-header { padding: 1rem 0.85rem; gap: 0.6rem; }
  .guild-emblem { width: 84px; height: 84px; }
  .guild-emblem .emblem-img { width: 84px; height: 84px; }
  .guild-subtitle { font-size: 0.68rem; }
  .guild-title { font-size: 1.6rem; line-height: 1.15; }
  .guild-tagline { display: none; }
  .header-actions { flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
  .panel-toolbar { justify-content: flex-start; width: 100%; }
  .panel-toolbar .btn { flex: 1 1 auto; }
  .roster-controls-subbar { flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem 0.85rem; }
  .sort-selector { flex: 1 1 100%; }
  .sort-selector select { flex: 1; min-width: 0; max-width: 100%; }
  .empty-state { padding: 1.5rem 0.75rem; overflow-wrap: anywhere; }
  .empty-state p { max-width: 100%; }
}
.suggest-note { font-size: 0.8rem; color: var(--text-muted, #94a3b8); margin: -0.25rem 0 0.5rem; }
.manual-log summary { cursor: pointer; color: var(--text-gold, #f5d061); font-weight: 600; padding: 0.35rem 0; }
.waiting-list { padding: 0.5rem; border-radius: 8px; border: 1px dashed rgba(255,255,255,0.12); }

/* Party rows: remove button + spots this class can't fill while dragging */
.slot-remove-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #94a3b8);
  border-radius: 5px;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
}
.slot-remove-btn:hover { color: #fff; background: rgba(220, 38, 38, 0.5); border-color: rgba(220, 38, 38, 0.8); }
.drop-invalid { opacity: 0.3; filter: grayscale(1); }
.slot-top-right { display: flex; align-items: center; gap: 0.4rem; }
.drop-invalid { opacity: 0.25; filter: grayscale(1); outline: 1px dashed rgba(220, 38, 38, 0.6); outline-offset: -2px; cursor: not-allowed; }

/* One-line utility badges on party cards */
.party-utility-bar { flex-wrap: nowrap; overflow: hidden; }

/* ✕ remove chooser */
.kk-choice-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.kk-choice { background: #141014; border: 1px solid rgba(245, 208, 97, 0.4); border-radius: 10px; padding: 1rem; width: min(360px, 100%); display: flex; flex-direction: column; gap: 0.5rem; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.kk-choice h4 { margin: 0 0 0.25rem; font-family: Cinzel, serif; color: var(--text-gold, #f5d061); }
.kk-choice .btn { flex-direction: column; align-items: flex-start; text-align: left; width: 100%; }
.kk-choice .btn small { font-weight: 400; opacity: 0.75; font-size: 0.75rem; }
.kk-choice .btn-ghost { align-items: center; }

/* Weekly night bar */
.night-bar { flex-wrap: wrap; }
.night-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.night-meta { color: var(--text-muted, #94a3b8); font-size: 0.85rem; }
.night-form { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin-top: 0.75rem; }
.night-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--text-gold, #f5d061); font-weight: 600; }
.night-help { grid-column: 1 / -1; margin: 0; font-size: 0.78rem; color: var(--text-muted, #94a3b8); }
.night-actions { grid-column: 1 / -1; display: flex; gap: 0.5rem; }

/* View-only mode (not logged in as an officer) */
.officer-gate-actions { display: flex; gap: 0.5rem; }
.officer-login-btn { white-space: nowrap; }
body.kk-viewer .drag-handle,
body.kk-viewer .slot-remove-btn,
body.kk-viewer .attend-checkbox,
body.kk-viewer .move-player { opacity: 0.35; }
body.kk-viewer #generateGroupsBtn::after { content: ' 🔒'; }
.officer-bnet-btn { justify-content: center; text-decoration: none; background: #148eff; border-color: #148eff; }
.officer-pass summary { cursor: pointer; color: var(--text-muted, #94a3b8); font-size: 0.85rem; }
.officer-pass[open] { display: grid; gap: 0.5rem; }
.officer-gate-card a:not(.btn) { color: var(--text-gold, #f5d061); }

/* Log in / Log out in the top bar */
.nav-account-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(245, 208, 97, 0.45);
  background: rgba(245, 208, 97, 0.08);
  color: var(--text-gold, #f5d061);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.nav-account-btn:hover { background: rgba(245, 208, 97, 0.18); }
.nav-account-btn[data-state="in"] .nav-account-name { color: #fff; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.nav-account-btn[data-state="in"] .nav-account-action { opacity: 0.8; font-weight: 600; }
@media (max-width: 600px) {
  .site-nav { flex-wrap: wrap; border-radius: 18px; }
  .nav-account-btn { margin-left: 0; }
  .nav-account-btn .nav-account-name { max-width: 6rem; }
}
.party-rename-btn { margin-left: 0.4rem; background: transparent; border: 1px solid rgba(245, 208, 97, 0.4); color: var(--text-gold, #f5d061); border-radius: 6px; font-size: 0.72rem; padding: 0.1rem 0.45rem; cursor: pointer; }
.party-rename-btn:hover { background: rgba(245, 208, 97, 0.12); }
