/* ==========================================================================
   AI 扑克牌设计大展 · 灵境牌阵 - 核心样式表
   ========================================================================== */

:root {
  --card-w: 210px;
  --bg-dark: #080a0f;
  --bg-card: rgba(18, 22, 34, 0.75);
  --bg-card-hover: rgba(26, 32, 50, 0.9);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(229, 185, 92, 0.35);
  
  --accent-gold: #e5b95c;
  --accent-gold-glow: rgba(229, 185, 92, 0.25);
  --accent-cyan: #00f2fe;
  --accent-purple: #9d4edd;
  
  --current-theme-accent: #e5b95c;
  --current-theme-glow: rgba(229, 185, 92, 0.25);

  --text-main: #f0f2f8;
  --text-muted: #9499ad;
  --text-dim: #646a82;

  --font-serif: "Cinzel", "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 10px 30px rgba(229, 185, 92, 0.2);

  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  font-size: 15px;
  color-scheme: dark;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, var(--current-theme-glow) 0%, transparent 60%),
    radial-gradient(circle at 10% 40%, rgba(157, 78, 221, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #080a0f 0%, #0d1017 50%, #080a0f 100%);
  background-attachment: fixed;
  transition: background 0.8s ease;
}

/* Ambient glow orb behind content */
.ambient-glow {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 70vw;
  height: 400px;
  background: radial-gradient(ellipse at center, var(--current-theme-glow) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
  transition: all 0.8s ease;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(8, 10, 15, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--current-theme-accent);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(8, 10, 15, 0.82);
  border-bottom: 1px solid var(--border-card);
  transition: border-color var(--transition-normal);
}

.header-container {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1b2030, #2c344a);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 15px var(--current-theme-glow);
  transition: all var(--transition-normal);
}

.logo-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  display: block;
  font-family: var(--font-sans);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-card);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #fff;
  background: var(--current-theme-accent);
  box-shadow: 0 4px 16px var(--current-theme-glow);
  font-weight: 600;
}

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

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  padding: 0.5rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.action-btn.btn-special {
  background: linear-gradient(135deg, rgba(229, 185, 92, 0.15), rgba(229, 185, 92, 0.3));
  border-color: var(--accent-gold);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

.action-btn.btn-special:hover {
  background: linear-gradient(135deg, rgba(229, 185, 92, 0.3), rgba(229, 185, 92, 0.5));
  box-shadow: 0 0 20px rgba(229, 185, 92, 0.4);
}

/* Search bar trigger */
.search-trigger {
  min-width: 170px;
  color: var(--text-dim);
  justify-content: space-between;
}
.search-trigger kbd {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
  position: relative;
  z-index: 1;
  padding: 3rem 1.5rem 2rem;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-gold);
  font-size: 0.8rem;
  color: var(--accent-gold);
  margin-bottom: 1.2rem;
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px var(--accent-gold-glow);
}

.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 1rem;
  background: linear-gradient(180deg, #ffffff 40%, rgba(255, 255, 255, 0.65) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: var(--text-muted);
  max-width: 780px;
  margin: 0 auto 2rem;
  font-weight: 400;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  margin-bottom: 2.5rem;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-serif);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Theme Carousel / Quick Selector Bar
   ========================================================================== */

.theme-selector-container {
  max-width: 1540px;
  margin: 0 0 1.6rem;
  padding: 0;
  position: relative;
  z-index: 2;
}

.theme-pills-bar {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.theme-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.1rem;
  border-radius: 14px;
  background: rgba(18, 22, 34, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  user-select: none;
}

.theme-pill:hover {
  background: rgba(28, 35, 54, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  transform: translateY(-2px);
}

.theme-pill.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  border-color: var(--theme-color, var(--current-theme-accent));
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px var(--theme-glow, var(--current-theme-glow));
  font-weight: 600;
}

.pill-icon {
  font-size: 1.1rem;
}

.pill-num {
  font-size: 0.75rem;
  font-family: monospace;
  opacity: 0.6;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.main-view-container {
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  position: relative;
  z-index: 1;
}

.tab-view {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tab-view.active {
  display: block;
}

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

/* ==========================================================================
   Theme View Specific: Header & Banner
   ========================================================================== */

.theme-banner {
  background: linear-gradient(135deg, rgba(22, 27, 40, 0.7) 0%, rgba(12, 15, 24, 0.8) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.theme-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--current-theme-accent), transparent);
}

.theme-info-left h2 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-style-tag {
  font-size: 0.85rem;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 500;
  color: var(--current-theme-accent);
}

.theme-worldview-snippet {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 900px;
  margin-top: 0.75rem;
}

.theme-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.theme-micro-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.theme-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}

/* Controls Bar (Display Mode & Filters) */
.view-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-card);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--current-theme-accent);
  color: #fff;
  font-weight: 600;
}

.mode-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  margin-left: auto;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
}

/* ==========================================================================
   3D Card Grid Mode
   ========================================================================== */

.cards-grid {
  display: grid;
  /* Fixed card width: resizing the window only changes cards per row, never card size */
  grid-template-columns: repeat(auto-fill, var(--card-w));
  justify-content: center;
  gap: 1.6rem 1.2rem;
  perspective: 1200px;
}

.card-wrapper {
  perspective: 1000px;
}

.playing-card {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
  will-change: transform;
}

.playing-card:hover {
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7), 0 0 30px var(--current-theme-glow);
}

/* Card Flipping */
.playing-card.is-flipped {
  transform: rotateY(180deg) !important;
}

.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #11141c;
  transition: border-color 0.3s ease;
}

.playing-card:hover .card-face {
  border-color: rgba(229, 185, 92, 0.45);
}

.card-face-front {
  z-index: 2;
  transform: rotateY(0deg);
  position: relative;
}

/* Specular light sheen highlight (no dark overlay!) */
.card-face-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 5;
}

.playing-card:hover .card-face-front::after {
  opacity: 1;
}

.card-face-back {
  transform: rotateY(180deg);
  background: #0d1017;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.3s ease;
}

/* Brighten & enhance artwork clarity on hover */
.playing-card:hover .card-face-front .card-img {
  transform: scale(1.025);
  filter: brightness(1.06) contrast(1.03);
}

/* Quick Action Overlay on Card Hover: Transparent, no dark mask! */
.card-quick-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.85rem;
  pointer-events: none;
}

.card-top-badges {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: auto;
}

/* Front face: no rank label, only the flip button in the corner */
.card-top-badges.is-end {
  justify-content: flex-end;
}

.rank-badge {
  white-space: nowrap;
  background: rgba(10, 14, 22, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.28rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  border: 1px solid var(--border-gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-card-flip {
  background: rgba(10, 14, 22, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-card-flip:hover {
  background: var(--current-theme-accent);
  color: #000;
  border-color: var(--current-theme-accent);
  transform: rotate(180deg) scale(1.1);
}

/* Card details bar underneath the card */
.card-meta-bar {
  margin-top: 0.8rem;
  padding: 0 0.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.meta-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.meta-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Poker Fan Out Mode (Realistic Playing Card Fan Table)
   ========================================================================== */

.poker-fan-container {
  display: none;
  min-height: 600px;
  padding: 3rem 1rem 2.5rem;
  position: relative;
  background: radial-gradient(ellipse at center 75%, rgba(20, 32, 26, 0.55) 0%, rgba(9, 13, 20, 0.85) 75%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
  justify-content: center;
  align-items: center;
}

.poker-fan-container.active {
  display: flex;
}

.fan-cards-wrapper {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 520px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.fan-card-item {
  position: absolute;
  bottom: 150px;
  width: 185px;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transform-origin: 50% 115%;
  transform: translate(var(--base-x, 0px), var(--base-y, 0px)) rotate(var(--base-rot, 0deg));
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: visible;
  will-change: transform;
}

.fan-card-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  transition: filter 0.25s ease;
}

/* Smooth lift without angle jitter */
.fan-card-item:hover {
  transform: translate(var(--base-x, 0px), calc(var(--base-y, 0px) - 55px)) rotate(var(--base-rot, 0deg)) scale(1.08) !important;
  z-index: 100 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 35px var(--current-theme-glow);
  border-color: var(--accent-gold);
}

.fan-card-item:hover img {
  filter: brightness(1.06) contrast(1.03);
}

.fan-card-badge {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 22, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.fan-card-item:hover .fan-card-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(4px);
}

.fan-controls-hint {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.5);
  padding: 0.35rem 1.1rem;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Mosaic Poster Mode (4x4 Full Master View)
   ========================================================================== */

.mosaic-view-container {
  display: none;
  background: rgba(14, 18, 28, 0.6);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.mosaic-view-container.active {
  display: block;
}

.mosaic-image-wrapper {
  max-width: 900px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 30px var(--current-theme-glow);
  border: 1px solid var(--border-gold);
  cursor: zoom-in;
  position: relative;
}

.mosaic-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.mosaic-caption {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   View 2: Character Cross-Theme Matrix (角色平行图鉴)
   ========================================================================== */

.models-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.model-nav-card {
  background: rgba(18, 22, 34, 0.6);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 0.55rem 0.4rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.model-nav-card:hover {
  background: rgba(28, 35, 54, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.model-nav-card.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  border-color: var(--model-color, var(--accent-gold));
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.5), 0 0 12px var(--model-glow, var(--accent-gold-glow));
}

.model-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 auto 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}

/* Official model marks: one monochrome style, tinted ring carries the brand colour */
.model-icon {
  width: 56%;
  height: 56%;
  display: block;
  fill: currentColor;
}

.model-hero-avatar {
  color: #fff;
}

.model-nav-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

.model-nav-rank {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Model Profile Header */
.model-hero-banner {
  background: linear-gradient(135deg, rgba(22, 28, 44, 0.7) 0%, rgba(12, 15, 24, 0.8) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  box-shadow: var(--shadow-md);
}

.model-hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 2px solid var(--border-gold);
  box-shadow: 0 0 20px var(--accent-gold-glow);
}

.model-hero-info h2 {
  font-size: 1.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.model-hero-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.4rem;
  max-width: 800px;
}

/* 9 Variations Parallel Grid */
.parallel-variations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--card-w));
  justify-content: center;
  gap: 1.6rem 1.2rem;
  perspective: 1200px;
}

.variation-card-box {
  perspective: 1000px;
  cursor: pointer;
}

.variation-card-box .var-card-thumbnail {
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #11141c;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}

.variation-card-box:hover .var-card-thumbnail {
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7), 0 0 30px var(--current-theme-glow);
  border-color: rgba(229, 185, 92, 0.45);
}

/* Specular light sheen on hover (matching main grid) */
.variation-card-box .var-card-thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 5;
}

.variation-card-box:hover .var-card-thumbnail::after {
  opacity: 1;
}

.variation-card-box .var-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.3s ease;
}

.variation-card-box:hover .var-card-thumbnail img {
  transform: scale(1.025);
  filter: brightness(1.06) contrast(1.03);
}

.var-theme-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.6rem;
}

.var-theme-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.var-theme-style {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.var-role-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-top: 0.3rem;
}

.var-desc-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.15rem;
}

/* ==========================================================================
   View 3: Puzzles / Posters Grid (全套拼图大赏)
   ========================================================================== */

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

.puzzle-item-card {
  background: rgba(18, 22, 34, 0.7);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.puzzle-item-card:hover {
  border-color: var(--theme-color, var(--accent-gold));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px var(--theme-glow, var(--accent-gold-glow));
  transform: translateY(-4px);
}

.puzzle-card-preview {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 6;
  margin-bottom: 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.puzzle-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.puzzle-meta-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.puzzle-meta-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ==========================================================================
   View 4: Compare Workshop (双卡比对工坊)
   ========================================================================== */

.compare-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.compare-column {
  background: rgba(18, 22, 34, 0.7);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
}

.compare-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.custom-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-card);
  color: #fff;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.custom-select option {
  background: #11141c;
  color: #fff;
}

.compare-card-preview {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1.5rem;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-gold);
}

.compare-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-card-details h3 {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.compare-card-details .compare-role {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

.compare-card-details .compare-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ==========================================================================
   View 5: Lore & Worldview Reader (设定集与世界观)
   ========================================================================== */

.lore-browser-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
}

.lore-sidebar {
  background: rgba(18, 22, 34, 0.6);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1rem;
  height: fit-content;
}

.lore-nav-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.lore-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.lore-nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-gold);
  border-left: 3px solid var(--accent-gold);
  font-weight: 600;
}

.lore-content-panel {
  background: rgba(18, 22, 34, 0.7);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  min-height: 600px;
  line-height: 1.8;
  color: #d1d5db;
}

.lore-content-panel h1 {
  font-size: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.8rem;
}

.lore-content-panel h2 {
  font-size: 1.35rem;
  color: var(--accent-gold);
  margin: 2rem 0 1rem;
}

.lore-content-panel p {
  margin-bottom: 1.2rem;
  font-size: 0.98rem;
}

.lore-table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.lore-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.lore-table-wrapper th,
.lore-table-wrapper td {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.lore-table-wrapper th {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

/* ==========================================================================
   Card Detail Dialog (<dialog closedby="any">)
   ========================================================================== */

dialog.modal-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 95vw;
  max-height: 95vh;
  margin: auto;
  outline: none;
  overflow: visible;
}

dialog.modal-dialog::backdrop {
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal-content-container {
  background: #10131d;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px var(--current-theme-glow);
  width: min(1240px, 94vw);
  max-height: 90vh;
  display: grid;
  grid-template-columns: 520px 1fr;
  overflow: hidden;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* Modal Left: 3D Flippable Card Stage */
.modal-card-stage {
  background: radial-gradient(circle at center, #181d2a 0%, #0d1017 100%);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-card);
  position: relative;
}

.stage-card-wrapper {
  perspective: 1200px;
  /* As large as the column allows, but the whole card + buttons must fit the dialog height */
  width: min(420px, calc((90vh - 10rem) * 2 / 3));
  aspect-ratio: 2 / 3;
}

.stage-playing-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.stage-playing-card.flipped {
  transform: rotateY(180deg);
}

.stage-card-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.stage-card-face.back {
  transform: rotateY(180deg);
}

.stage-card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-actions-bar {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

/* Modal Right: Card Dossier Details */
.modal-dossier-scroll {
  padding: 2.5rem;
  overflow-y: auto;
  max-height: 90vh;
}

.modal-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-gold-glow);
  color: var(--accent-gold);
  border: 1px solid var(--border-gold);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.modal-char-title {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-company-tag {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-weight: 400;
}

.modal-role-banner {
  font-size: 1.15rem;
  color: var(--accent-gold);
  font-weight: 600;
  margin: 0.5rem 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-card);
}

.modal-desc-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1.2rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #e2e8f0;
  margin-bottom: 2rem;
}

.cross-theme-links {
  margin-top: 1.5rem;
}

.cross-theme-links h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.theme-switch-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.switch-badge {
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.switch-badge:hover, .switch-badge.current {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: var(--accent-gold);
}

.modal-nav-arrows {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-card);
}

/* ==========================================================================
   Draw Card Experience Modal (灵感抽牌)
   ========================================================================== */

#drawDialog .modal-content-container {
  grid-template-columns: 1fr;
  max-width: 640px;
  text-align: center;
  padding: 2.5rem 2rem;
  background: linear-gradient(180deg, #161b29 0%, #0d1017 100%);
}

.draw-card-stage {
  perspective: 1000px;
  /* Large card, capped so title + card + description still fit the dialog height */
  width: min(360px, calc((90vh - 22rem) * 2 / 3), 70vw);
  aspect-ratio: 2 / 3;
  margin: 1.5rem auto;
}

.draw-card-element {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 14px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.draw-card-element.reveal {
  transform: rotateY(180deg);
}

.draw-sparkle {
  animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 20px rgba(229, 185, 92, 0.3); }
  100% { box-shadow: 0 0 45px rgba(229, 185, 92, 0.8); }
}

/* ==========================================================================
   Global Search Modal
   ========================================================================== */

#searchDialog .modal-content-container {
  grid-template-columns: 1fr;
  max-width: 680px;
  padding: 1.5rem;
  background: #11141c;
}

.search-input-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  margin-bottom: 1.2rem;
}

.search-input-box input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  width: 100%;
  outline: none;
}

.search-results-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.search-item-thumb {
  width: 48px;
  height: 72px;
  border-radius: 4px;
  object-fit: cover;
}

.search-item-info h4 {
  font-size: 0.95rem;
  color: #fff;
}

.search-item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* ==========================================================================
   Rich Text in Descriptions (formatted from Markdown)
   ========================================================================== */
.modal-desc-box p + p,
.compare-desc p + p,
#drawDesc p + p {
  margin-top: 0.75em;
}

.modal-desc-box strong,
.compare-desc strong,
.var-desc-text strong,
#drawDesc strong,
.lore-content-panel strong {
  color: var(--accent-gold);
  font-weight: 600;
}

/* Keep button labels on one line (prevents vertical wrapping on narrow screens) */
.nav-tab-btn,
.action-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Header: wrap to two rows when one row no longer fits (avoids horizontal page scroll) */
@media (max-width: 1320px) {
  .header-container {
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 1024px) {
  .modal-content-container {
    grid-template-columns: 1fr;
    max-height: 92vh;
  }
  .modal-card-stage {
    border-right: none;
    border-bottom: 1px solid var(--border-card);
    padding: 1.5rem;
  }
  .stage-card-wrapper {
    width: min(300px, 62vw);
  }
  .compare-container {
    grid-template-columns: 1fr;
  }
  .lore-browser-layout {
    grid-template-columns: 1fr;
  }
  .theme-banner {
    grid-template-columns: 1fr;
  }
  .theme-banner-actions {
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
  }
  .header-container {
    gap: 0.75rem;
  }
  .logo-text span {
    display: none;
  }
  .header-actions {
    order: 2;
    width: 100%;
    gap: 0.5rem;
  }
  .header-actions .action-btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 0.5rem 0.6rem;
  }
  .search-trigger kbd {
    display: none;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  :root {
    --card-w: 150px;
  }
  .cards-grid {
    gap: 1.2rem;
  }
  .hero-section {
    padding: 2rem 1rem 1.5rem;
  }
  .theme-banner {
    padding: 1.5rem;
  }
  .poker-fan-container {
    display: none !important;
  }
  .mode-btn[data-mode="fan"] {
    display: none;
  }
}

@media (max-width: 340px) {
  :root {
    --card-w: 125px;
  }
}
