/* ============================================================
   GOBLINS & GUNSLINGERS -- MAIN STYLESHEET
   Western-Fantasy TCG Brand Site
   ============================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
    /* Core palette -- pulled from the actual card art */
    --color-bg:           #0d0b09;
    --color-bg-alt:       #15120e;
    --color-surface:      #1c1814;
    --color-surface-2:    #241f19;
    --color-border:       #3a3229;

    /* Brand colors from the card frames */
    --color-teal:         #2a7b7b;
    --color-teal-light:   #3db8b8;
    --color-gold:         #c9a84c;
    --color-gold-bright:  #e8c84a;
    --color-gold-dim:     #8a7234;
    --color-mana-purple:  #7b4fbf;
    --color-mana-glow:    #a06cf0;
    --color-red:          #b83a3a;
    --color-green:        #4a9e4a;
    --color-green-deputy: #5cb85c;
    --color-orange:       #c97a2a;

    /* Text */
    --color-text:         #e8e0d4;
    --color-text-dim:     #a89b8a;
    --color-text-bright:  #f5f0e8;

    /* Typography */
    --font-display:       'Cinzel', Georgia, serif;
    --font-body:          'Crimson Text', Georgia, serif;
    --font-ui:            'Inter', -apple-system, sans-serif;

    /* Spacing */
    --space-xs:   0.5rem;
    --space-sm:   1rem;
    --space-md:   2rem;
    --space-lg:   3rem;
    --space-xl:   5rem;
    --space-xxl:  8rem;

    /* Transitions */
    --transition: 0.3s ease;
    --transition-slow: 0.6s ease;

    /* Card padding -- snug borders */
    --card-pad: 6px;
}

/* ---------- LIGHT MODE OVERRIDES ---------- */
html[data-theme="light"] {
    --color-bg:           #F4EAD4;
    --color-bg-alt:       #EDE2C8;
    --color-surface:      #FFF8EC;
    --color-surface-2:    #F0E6D0;
    --color-border:       #C8B898;
    --color-text:         #2C1810;
    --color-text-dim:     #5C4A3A;
    --color-text-bright:  #1A0E08;
    --color-gold:         #8A6B1A;
    --color-gold-bright:  #A07E20;
    --color-gold-dim:     #6B5215;
}

html[data-theme="light"] .main-nav {
    background: rgba(244, 234, 212, 0.85);
    border-top-color: var(--color-gold-dim);
    border-bottom-color: var(--color-border);
}

html[data-theme="light"] .main-nav.scrolled {
    background: rgba(244, 234, 212, 0.95);
}

html[data-theme="light"] .nav-links a {
    color: var(--color-text-dim);
}

html[data-theme="light"] .hero-overlay {
    background: linear-gradient(
        to bottom,
        rgba(244, 234, 212, 0.2) 0%,
        rgba(244, 234, 212, 0.5) 50%,
        rgba(244, 234, 212, 0.95) 100%
    );
}

html[data-theme="light"] .nav-toggle span {
    background: var(--color-text);
}

html[data-theme="light"] .btn-primary {
    color: #fff;
}

html[data-theme="light"] .keyword {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--color-border);
    color: var(--color-text-dim);
}

html[data-theme="light"] .nav-links {
    background: var(--color-bg);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease, color 0.4s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-gold-bright);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--color-text-bright);
    line-height: 1.2;
}

h1, h2 {
    letter-spacing: 0.04em;
    text-shadow: 0 1px 6px rgba(201, 168, 76, 0.12);
}

/* ---------- TEXTURE OVERLAY ---------- */
/* Subtle CSS noise applied to major sections for a tactile feel */
.factions,
.resources-section,
.card-showcase,
.cta-section,
.card-types-section,
.card-back-section,
.lore-intro,
.faction-lore,
.rpg-section,
.store-products,
.store-notify,
.store-coming-soon-banner {
    position: relative;
}

.factions::before,
.resources-section::before,
.card-showcase::before,
.cta-section::before,
.card-types-section::before,
.card-back-section::before,
.lore-intro::before,
.faction-lore::before,
.rpg-section::before,
.store-products::before,
.store-notify::before,
.store-coming-soon-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

/* ---------- UTILITY ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-narrow {
    max-width: 860px;
}

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 2px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dim));
    color: var(--color-bg);
    border-color: var(--color-gold);
    position: relative;
    overflow: hidden;
}

/* Animated gold shimmer sweep on CTA buttons */
.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.15) 50%, transparent 80%);
    transform: skewX(-25deg);
    animation: btnShimmer 3s ease infinite;
    pointer-events: none;
}

@keyframes btnShimmer {
    0%   { left: -75%; }
    40%  { left: 125%; }
    100% { left: 125%; }
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-gold-bright), var(--color-gold));
    color: var(--color-bg);
    transform: translateY(-2px);
    animation: btnGlow 2s ease infinite;
}

.btn-secondary {
    background: transparent;
    color: var(--color-gold);
    border-color: var(--color-gold-dim);
}

.btn-secondary:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: var(--color-gold);
    color: var(--color-gold-bright);
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(201, 168, 76, 0.15);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 0;
    min-height: 60px;
    transition: all var(--transition);
    background: rgba(13, 11, 9, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 2px solid var(--color-gold-dim);
    border-bottom: 1px solid rgba(58, 50, 41, 0.4);
}

/* Decorative animated gold shimmer bar at top of nav */
.main-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-gold-dim), var(--color-gold), var(--color-gold-dim), transparent);
    background-size: 200% 100%;
    animation: navShimmer 4s ease infinite;
    z-index: 1;
}

@keyframes navShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.main-nav.scrolled {
    background: rgba(13, 11, 9, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem 0;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--color-gold);
    letter-spacing: 0.05em;
    transition: all var(--transition);
}

.nav-logo:hover {
    color: var(--color-gold-bright);
    text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

/* CSS-only mana icon for nav logo -- blue circle with white M */
.nav-logo-mana-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #8090ff, #5B6FDE);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(91, 111, 222, 0.3);
    transition: box-shadow var(--transition);
}

.nav-logo:hover .nav-logo-mana-icon {
    box-shadow: 0 0 16px rgba(91, 111, 222, 0.5), 0 0 30px rgba(91, 111, 222, 0.2);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.nav-links a {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-dim);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0;
    position: relative;
    transition: color var(--transition);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-gold);
    transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-gold);
}

.nav-links a.active::after,
.nav-links a:hover::after {
    width: 100%;
}

/* Play nav link -- highlighted in gold */
.nav-links .nav-play-link {
    color: var(--color-gold) !important;
    font-weight: 600;
    border: 1px solid var(--color-gold-dim);
    border-radius: 4px;
    padding: 4px 12px !important;
    transition: background var(--transition), color var(--transition);
}
.nav-links .nav-play-link:hover {
    background: var(--color-gold);
    color: var(--color-bg) !important;
}
.nav-links .nav-play-link::after {
    display: none !important;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-gold);
    transition: all var(--transition);
}

/* ============================================================
   HERO SECTION (Homepage)
   ============================================================ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg-img {
    width: 100%;
    height: 120%; /* Extra height for parallax travel room */
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(13, 11, 9, 0.3) 0%,
        rgba(13, 11, 9, 0.45) 30%,
        rgba(13, 11, 9, 0.7) 60%,
        rgba(13, 11, 9, 0.98) 100%
    );
}

/* Subtle animated shimmer layer over hero */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(201, 168, 76, 0.03) 25%,
        transparent 50%,
        rgba(123, 79, 191, 0.03) 75%,
        transparent 100%
    );
    background-size: 300% 300%;
    animation: heroShimmer 12s ease infinite;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--space-md);
    max-width: 700px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 900;
    color: var(--color-gold-bright);
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.3), 0 4px 20px rgba(0,0,0,0.5);
    margin-bottom: var(--space-sm);
    line-height: 1.1;
}

.hero-title-sub {
    display: block;
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    font-weight: 400;
    color: var(--color-text-dim);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: var(--space-xs);
    text-shadow: none;
}

.hero-tagline {
    font-size: clamp(1rem, 2.5vw, 1.375rem);
    color: var(--color-text);
    margin-bottom: var(--space-lg);
    font-style: italic;
}

.hero-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.hero-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-dim);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    animation: fadeInUp 1s ease 1s both;
}

.scroll-arrow {
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, var(--color-gold-dim), transparent);
    animation: pulse 2s ease infinite;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* Hero shimmer -- slow diagonal gradient sweep */
@keyframes heroShimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Button glow pulse */
@keyframes btnGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(201, 168, 76, 0.25); }
    50%      { box-shadow: 0 0 24px rgba(201, 168, 76, 0.5), 0 0 48px rgba(201, 168, 76, 0.15); }
}

/* ============================================================
   PAGE HERO (Subpages)
   ============================================================ */
.page-hero {
    position: relative;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: 80px;
}

.page-hero-tall {
    min-height: 50vh;
}

.page-hero-bg {
    position: absolute;
    inset: 0;
}

.page-hero-bg-img {
    width: 100%;
    height: 130%; /* Extra height for parallax travel room */
    object-fit: cover;
    object-position: center;
}

.page-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: var(--space-md);
}

.page-hero-content h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--color-gold-bright);
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.3), 0 4px 20px rgba(0,0,0,0.5);
    margin-bottom: var(--space-xs);
}

.page-hero-content p {
    font-size: clamp(0.95rem, 2vw, 1.2rem);
    color: var(--color-text-dim);
    font-style: italic;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    text-align: center;
    color: var(--color-gold);
    margin-bottom: var(--space-xs);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: var(--space-sm) auto 0;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.3);
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-dim);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto var(--space-lg);
}

/* ============================================================
   FACTION SHOWCASE (Homepage)
   ============================================================ */
.factions {
    padding: var(--space-xxl) 0;
    background: var(--color-bg-alt);
}

.faction-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.faction-card {
    background: var(--color-surface);
    border: 2px solid var(--color-gold-dim);
    border-radius: 8px;
    overflow: hidden;
    transition: all var(--transition);
    cursor: default;
    display: flex;
    flex-direction: column;
}

.faction-card:hover {
    transform: translateY(-12px) scale(1.03);
    border-color: var(--color-gold);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(201, 168, 76, 0.25);
}

.faction-card-inner {
    padding: var(--card-pad) var(--card-pad) 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.faction-icon {
    width: 100%;
    height: 160px;
    margin: 0 0 0.5rem;
    border-radius: 4px;
    overflow: hidden;
    border: none;
    transition: border-color var(--transition);
}

.faction-card:hover .faction-icon {
    /* no separate border needed -- card border handles hover */
}

.faction-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.faction-card h3 {
    font-size: 1.25rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.faction-role {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-dim);
    margin-bottom: var(--space-sm);
}

.faction-desc {
    font-size: 0.95rem;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    line-height: 1.6;
}

.faction-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.keyword {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    color: var(--color-text-dim);
    background: rgba(255,255,255,0.02);
}

/* Faction-specific accent colors on hover -- dramatic glows */
.faction-card[data-faction="humans"]:hover { border-color: var(--color-gold); box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 50px rgba(201,168,76,0.35), inset 0 0 30px rgba(201,168,76,0.03); }
.faction-card[data-faction="goblins"]:hover { border-color: var(--color-green); box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 50px rgba(74,158,74,0.35), inset 0 0 30px rgba(74,158,74,0.03); }
.faction-card[data-faction="devils"]:hover { border-color: var(--color-red); box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 50px rgba(184,58,58,0.35), inset 0 0 30px rgba(184,58,58,0.03); }
.faction-card[data-faction="elves"]:hover { border-color: var(--color-orange); box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 50px rgba(201,122,42,0.35), inset 0 0 30px rgba(201,122,42,0.03); }

/* Wild Card callout -- homepage */
.wild-card-callout {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 2px solid var(--color-teal);
    border-radius: 10px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.wild-card-icon {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface-2);
}

.wild-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.wild-card-text h3 {
    font-size: 1.1rem;
    color: var(--color-teal-light);
    margin-bottom: 0.25rem;
}

.wild-card-text p {
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.6;
}

/* ============================================================
   DUAL RESOURCES SECTION
   ============================================================ */
.resources-section {
    padding: var(--space-xxl) 0;
    background: var(--color-bg);
}

.resources-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    max-width: 900px;
    margin: 0 auto;
}

.resource-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    transition: all var(--transition);
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.resource-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CSS-only mana icon for the resource section -- blue circle with white M */
.mana-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #7083f5, #5B6FDE);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 0 20px rgba(91, 111, 222, 0.3);
}

.gold-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-gold-bright), var(--color-gold-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--color-bg);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

.resource-card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.mana-card:hover {
    border-color: var(--color-mana-purple);
    box-shadow: 0 8px 30px rgba(123, 79, 191, 0.15);
}

.mana-card h3 { color: var(--color-mana-glow); }

.gold-card:hover {
    border-color: var(--color-gold);
    box-shadow: 0 8px 30px rgba(201, 168, 76, 0.15);
}

.gold-card h3 { color: var(--color-gold-bright); }

.resource-card p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text-dim);
}

/* ============================================================
   CARD SHOWCASE (Homepage)
   ============================================================ */
.card-showcase {
    padding: var(--space-xxl) 0;
    background: var(--color-bg-alt);
}

.card-frames-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.card-frame-item {
    text-align: center;
}

.card-frame-wrap {
    position: relative;
    margin-bottom: var(--space-sm);
    transition: transform var(--transition);
    background: var(--color-surface);
    border: 2px solid var(--color-gold-dim);
    border-radius: 10px;
    overflow: hidden;
    padding: var(--card-pad);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.card-frame-wrap img {
    max-height: 340px;
    margin: 0 auto;
    border-radius: 4px;
    transition: all var(--transition);
}

.card-frame-item:hover .card-frame-wrap {
    transform: translateY(-8px);
    border-color: var(--color-gold);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(201, 168, 76, 0.15);
}

.card-frame-item:hover .card-frame-wrap img {
    /* no filter needed -- the card border handles the visual lift */
}

.card-frame-item h3 {
    font-size: 1.1rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.card-frame-item p {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    max-width: 200px;
    margin: 0 auto;
}

/* ============================================================
   CTA SECTION
   ============================================================ */
.cta-section {
    padding: var(--space-xxl) 0;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.cta-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.cta-content h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
}

.cta-content p {
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
    font-size: 1.05rem;
}

.cta-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    padding: var(--space-xl) 0 var(--space-lg);
    background: var(--color-bg);
    border-top: 2px solid var(--color-gold-dim);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-gold-dim);
}

/* CSS-only mana icon for footer brand */
.footer-mana-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, #7083f5, #5B6FDE);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 0.6rem;
    color: #fff;
    flex-shrink: 0;
    opacity: 0.7;
}

.footer-nav {
    display: flex;
    gap: var(--space-md);
}

.footer-nav a {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-nav a:hover {
    color: var(--color-gold);
}

.footer-copy {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text-dim);
    opacity: 0.5;
}

/* ============================================================
   RULES PAGE
   ============================================================ */
.rules-content {
    padding: var(--space-xl) 0 var(--space-xxl);
}

.rules-block {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
}

.rules-block:last-child {
    border-bottom: none;
}

.rules-heading {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    font-size: 1.75rem;
    color: var(--color-gold);
    margin-bottom: var(--space-md);
}

.rules-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-gold-dim);
    opacity: 0.4;
    line-height: 1;
}

.rules-body p {
    margin-bottom: var(--space-sm);
    font-size: 1.05rem;
}

.rules-list {
    list-style: none;
    margin: var(--space-sm) 0;
}

.rules-list li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    font-size: 1.05rem;
}

.rules-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.85rem;
    width: 6px;
    height: 6px;
    background: var(--color-gold-dim);
    border-radius: 50%;
}

.rules-note {
    background: var(--color-surface);
    border-left: 3px solid var(--color-gold-dim);
    padding: var(--space-sm) var(--space-md);
    border-radius: 0 4px 4px 0;
    margin-top: var(--space-md);
}

.rules-note code {
    background: rgba(201, 168, 76, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    font-size: 0.9rem;
    color: var(--color-gold);
}

/* Turn phases */
.turn-phases {
    display: grid;
    gap: var(--space-sm);
}

.phase {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-sm) var(--space-md);
    transition: border-color var(--transition);
}

.phase:hover {
    border-color: var(--color-gold-dim);
}

.phase h3 {
    font-size: 1rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.phase p {
    font-size: 0.95rem;
    color: var(--color-text-dim);
    margin-bottom: 0;
}

/* Resources explanation */
.resource-explain {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.resource-explain-item {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
}

/* CSS-only mana icon for inline resource explanation */
.mana-inline-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: radial-gradient(circle, #7083f5, #5B6FDE);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
    margin-top: 4px;
    box-shadow: 0 0 12px rgba(91, 111, 222, 0.25);
}

.gold-inline-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-gold-bright), var(--color-gold-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--color-bg);
    margin-top: 4px;
}

.resource-explain-item h4 {
    font-size: 1.1rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.resource-explain-item p {
    font-size: 0.95rem;
    color: var(--color-text-dim);
}

/* Lane diagram */
.lane-diagram {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-md);
    margin: var(--space-md) 0;
    text-align: center;
}

.lane-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.lane-slot {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
}

.lane-slot.highrise {
    background: rgba(42, 123, 123, 0.2);
    border: 2px solid var(--color-teal);
    color: var(--color-teal-light);
}

.lane-slot.middle {
    background: rgba(201, 168, 76, 0.1);
    border: 2px solid var(--color-gold-dim);
    color: var(--color-gold);
}

.lane-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
}

.lane-label-center {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
    text-align: center;
}

.lane-rules {
    margin-top: var(--space-md);
}

.lane-rules h4 {
    font-size: 1rem;
    color: var(--color-teal-light);
    margin: var(--space-md) 0 var(--space-xs);
}

.lane-rules h4:last-of-type {
    color: var(--color-gold);
}

/* Deputy showcase */
.deputy-showcase {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.deputy-frame-img {
    width: 180px;
    flex-shrink: 0;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}

.deputy-text p {
    margin-bottom: var(--space-sm);
}

/* Keyword grid */
.keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-sm);
}

.keyword-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-sm) var(--space-md);
    transition: border-color var(--transition);
}

.keyword-item:hover {
    border-color: var(--color-gold-dim);
}

.keyword-item h4 {
    font-size: 0.95rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.keyword-item p {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin-bottom: 0;
}

/* Rules download */
.rules-download {
    text-align: center;
    padding-top: var(--space-lg);
}

.rules-download .rules-heading {
    justify-content: center;
}

.rules-download .rules-body p {
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
}

/* ============================================================
   CARDS PAGE
   ============================================================ */
.card-types-section {
    padding: var(--space-xl) 0 var(--space-xxl);
}

.card-type-detail {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    margin-bottom: var(--space-xxl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
}

.card-type-detail:last-of-type {
    border-bottom: none;
    margin-bottom: var(--space-lg);
}

.card-type-detail.reverse {
    flex-direction: row-reverse;
}

.card-type-image {
    flex-shrink: 0;
    width: 260px;
    background: var(--color-surface);
    border: 2px solid var(--color-gold-dim);
    border-radius: 10px;
    overflow: hidden;
    padding: var(--card-pad);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-slow);
}

.card-type-image img {
    max-height: 380px;
    margin: 0 auto;
    border-radius: 4px;
    transition: all var(--transition-slow);
}

.card-type-detail:hover .card-type-image {
    border-color: var(--color-gold);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(201, 168, 76, 0.15);
}

.card-type-detail:hover .card-type-image img {
    /* content stays clean inside the rectangular frame */
}

.card-type-info {
    flex: 1;
}

.card-type-info h3 {
    font-size: 1.75rem;
    color: var(--color-gold);
    margin-bottom: var(--space-xs);
}

.card-type-badge {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    margin-bottom: var(--space-sm);
}

.creature-badge { background: rgba(201, 168, 76, 0.15); color: var(--color-gold); border: 1px solid var(--color-gold-dim); }
.spell-badge    { background: rgba(74, 158, 74, 0.15); color: var(--color-green); border: 1px solid var(--color-green); }
.item-badge     { background: rgba(42, 123, 123, 0.15); color: var(--color-teal-light); border: 1px solid var(--color-teal); }
.deputy-badge   { background: rgba(92, 184, 92, 0.15); color: var(--color-green-deputy); border: 1px solid var(--color-green-deputy); }

.card-type-info p {
    font-size: 1.05rem;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    line-height: 1.7;
}

.stat-breakdown {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-sm) var(--space-md);
    margin: var(--space-md) 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.stat-icon-mana,
.stat-icon-gold,
.stat-icon-atk,
.stat-icon-def {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.stat-icon-mana { background: #5B6FDE; color: #fff; }
.stat-icon-gold { background: var(--color-gold); color: var(--color-bg); }
.stat-icon-atk  { background: var(--color-red); color: #fff; }
.stat-icon-def  { background: var(--color-green); color: #fff; }

/* Card back section */
.card-back-section {
    padding: var(--space-xl) 0;
    background: var(--color-bg-alt);
}

.card-back-showcase {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.card-back-image {
    flex-shrink: 0;
    width: 220px;
}

.card-back-image img {
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
    border-radius: 8px;
}

.card-back-info h2 {
    font-size: 1.75rem;
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
}

.card-back-info p {
    font-size: 1.05rem;
    color: var(--color-text-dim);
    line-height: 1.7;
}

/* Store CTA */
.store-cta {
    padding: var(--space-xxl) 0;
    background: var(--color-bg);
    text-align: center;
}

/* ============================================================
   LORE PAGE
   ============================================================ */
.lore-intro {
    padding: var(--space-xl) 0 var(--space-lg);
}

.lore-dropcap-block p {
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

.dropcap {
    float: left;
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 0.8;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    color: var(--color-gold);
    text-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

.faction-lore {
    padding: 0 0 var(--space-xl);
}

.lore-faction-block {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--color-border);
}

.lore-faction-block:last-child {
    border-bottom: none;
}

.lore-faction-block.reverse {
    flex-direction: row-reverse;
}

.lore-faction-art {
    flex-shrink: 0;
    width: 280px;
    height: 350px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid var(--color-border);
    transition: border-color var(--transition);
}

.lore-faction-block:hover .lore-faction-art {
    border-color: var(--color-gold-dim);
}

.lore-faction-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.beast-lore-art img {
    object-fit: contain;
    padding: 20px;
    background: var(--color-surface);
}

/* Lore page -- wild card callout for Beasts */
.lore-wild-card-callout {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
    background: var(--color-surface);
    border: 2px solid var(--color-teal);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.wild-card-callout-icon {
    flex-shrink: 0;
    width: 140px;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface-2);
}

.wild-card-callout-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}

.wild-card-callout-body h2 {
    font-size: 1.75rem;
    color: var(--color-teal-light);
    margin-bottom: var(--space-xs);
}

.wild-card-callout-body p {
    font-size: 1.05rem;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    line-height: 1.7;
}

.wild-card-callout-body p:last-child {
    margin-bottom: 0;
}

.lore-faction-text h2 {
    font-size: 2rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.lore-faction-epithet {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
}

.lore-faction-text p {
    font-size: 1.05rem;
    line-height: 1.75;
    margin-bottom: var(--space-sm);
}

/* RPG section */
.rpg-section {
    padding: var(--space-xxl) 0;
    background: var(--color-bg-alt);
}

.rpg-showcase {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.rpg-cover {
    flex-shrink: 0;
    width: 250px;
}

.rpg-cover img {
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform var(--transition);
}

.rpg-cover:hover img {
    transform: scale(1.03);
}

.rpg-info h2 {
    font-size: 1.75rem;
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
}

.rpg-info p {
    font-size: 1.05rem;
    color: var(--color-text-dim);
    line-height: 1.7;
    margin-bottom: var(--space-sm);
}

/* ============================================================
   STORE PAGE
   ============================================================ */

/* Coming soon notice bar */
.store-coming-soon-banner {
    padding: var(--space-lg) 0;
    background: var(--color-bg-alt);
}

.coming-soon-notice {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-gold-dim);
    border-left: 4px solid var(--color-gold);
    border-radius: 4px;
    padding: var(--space-md) var(--space-lg);
    max-width: 800px;
    margin: 0 auto;
}

.coming-soon-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--color-bg);
    flex-shrink: 0;
}

.coming-soon-notice h2 {
    font-size: 1.25rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.coming-soon-notice p {
    font-size: 0.95rem;
    color: var(--color-text-dim);
    margin: 0;
}

/* Product grid */
.store-products {
    padding: var(--space-xxl) 0;
    background: var(--color-bg);
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    max-width: 1000px;
    margin: 0 auto;
}

.store-product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    transition: all var(--transition);
}

.store-product-card:hover {
    border-color: var(--color-gold);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(201, 168, 76, 0.1);
    transform: translateY(-8px);
}

.store-product-image-wrap {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.store-product-image-wrap img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
    transition: transform var(--transition);
}

.store-product-card:hover .store-product-image-wrap img {
    transform: scale(1.03);
}

/* Coming Soon ribbon -- corner banner style */
.coming-soon-badge {
    position: absolute;
    top: 16px;
    right: -30px;
    background: linear-gradient(135deg, var(--color-gold-bright), var(--color-gold));
    color: var(--color-bg);
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.3rem 2.5rem;
    transform: rotate(45deg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.store-product-info {
    padding: var(--space-md);
}

.store-product-info h3 {
    font-size: 1.25rem;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.store-product-type {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-dim);
    margin-bottom: var(--space-sm);
}

.store-product-desc {
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.65;
    margin-bottom: var(--space-sm);
}

.store-product-price {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--color-text-dim);
    margin-bottom: var(--space-sm);
    font-style: italic;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Notify / Email signup section */
.store-notify {
    padding: var(--space-xxl) 0;
    background: var(--color-bg-alt);
}

.notify-box {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-xl) var(--space-lg);
}

.notify-box h2 {
    font-size: 1.75rem;
    color: var(--color-gold);
    margin-bottom: var(--space-xs);
}

.notify-box > p {
    font-size: 0.95rem;
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
    line-height: 1.7;
}

.notify-form {
    margin-top: var(--space-sm);
}

.notify-input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 460px;
    margin: 0 auto var(--space-sm);
}

.notify-input-group input[type="email"] {
    flex: 1;
    padding: 0.875rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.notify-input-group input[type="email"]::placeholder {
    color: var(--color-text-dim);
    opacity: 0.5;
}

.notify-input-group input[type="email"]:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15), 0 0 12px rgba(201, 168, 76, 0.08);
}

.notify-disclaimer {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--color-text-dim);
    opacity: 0.6;
}

.notify-success p {
    font-size: 1.1rem;
    color: var(--color-gold);
    font-family: var(--font-body);
    font-style: italic;
}

/* ============================================================
   CARD GALLERY
   ============================================================ */
.gallery-section {
    padding: var(--space-xl) 0 var(--space-xxl);
    background: var(--color-bg);
}

.gallery-stats {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
    letter-spacing: 0.05em;
}

.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: var(--color-surface);
    color: var(--color-text-dim);
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

/* Smooth fill from left on hover */
.filter-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dim));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 0;
}
.filter-btn > * { position: relative; z-index: 1; }

.filter-btn:hover {
    border-color: var(--color-gold-dim);
    color: var(--color-gold);
    background: rgba(201, 168, 76, 0.08);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dim));
    color: var(--color-bg);
    border-color: var(--color-gold);
    box-shadow: 0 0 12px rgba(201, 168, 76, 0.2);
}

.filter-btn.active::before {
    transform: scaleX(1);
}

.gallery-search {
    flex-shrink: 0;
}

.gallery-search input {
    padding: 0.5rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    outline: none;
    width: 220px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.gallery-search input::placeholder {
    color: var(--color-text-dim);
    opacity: 0.5;
}

.gallery-search input:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15), 0 0 12px rgba(201, 168, 76, 0.1);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

.gallery-no-results {
    text-align: center;
    padding: var(--space-xxl) var(--space-md);
}

.gallery-no-results p {
    font-size: 1.1rem;
    color: var(--color-text-dim);
    font-style: italic;
}

/* ---- Card Flip Wrapper ---- */
.gallery-card-flip {
    cursor: pointer;
}

.gallery-card-flip-inner {
    position: relative;
}

/* Card back is hidden — front always visible */
.gallery-card-back {
    display: none;
}

.gallery-card-front {
    position: relative;
}

.gallery-card-front.gallery-card {
    height: 100%;
}

/* Individual gallery card */
.gallery-card {
    position: relative;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    /* Premium inner border */
    box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.06);
}

.gallery-card-flip:hover .gallery-card {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(201, 168, 76, 0.15);
}

.gc-frame {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.gc-header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0.875rem 0.25rem;
    gap: 0.5rem;
}

.gc-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-bright);
    line-height: 1.2;
    letter-spacing: 0.02em;
    flex: 1;
}

.gc-costs {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.gc-cost {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.gc-mana {
    background: radial-gradient(circle, #7083f5, #5B6FDE);
    color: #fff;
    box-shadow: 0 0 8px rgba(91, 111, 222, 0.4);
}

.gc-gold {
    background: radial-gradient(circle, var(--color-gold-bright), var(--color-gold-dim));
    color: var(--color-bg);
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
}

.gc-badges {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 0.4rem;
    padding: 0.25rem 0.875rem;
    flex-wrap: wrap;
}

.gc-race-badge,
.gc-type-badge {
    font-family: var(--font-ui);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    border: 1px solid var(--color-border);
    color: var(--color-text-dim);
    background: rgba(255, 255, 255, 0.02);
}

.faction-humans .gc-race-badge   { border-color: var(--color-gold-dim); color: var(--color-gold); }
.faction-goblins .gc-race-badge  { border-color: var(--color-green); color: var(--color-green); }
.faction-devils .gc-race-badge   { border-color: var(--color-red); color: var(--color-red); }
.faction-elves .gc-race-badge    { border-color: var(--color-orange); color: var(--color-orange); }
.faction-beasts .gc-race-badge   { border-color: var(--color-teal); color: var(--color-teal-light); }
.faction-spells .gc-race-badge   { border-color: var(--color-green); color: var(--color-green); }

.gc-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
}

.gc-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1rem;
    color: var(--color-text-bright);
}

.gc-stat-label {
    font-family: var(--font-ui);
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
}

.gc-atk { color: #e85555; }
.gc-def { color: #5cb85c; }

.gc-ability {
    position: relative;
    z-index: 1;
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--color-text);
    border-top: 1px solid var(--color-border);
    flex: 1;
}

.gc-flavor {
    position: relative;
    z-index: 1;
    padding: 0.25rem 0.875rem 0.75rem;
    font-size: 0.8rem;
    font-style: italic;
    line-height: 1.4;
    color: var(--color-text-dim);
    opacity: 0.7;
}

/* Faction-specific card border colors on hover (via flip wrapper) */
.gallery-card-flip:hover .faction-humans   { border-color: var(--color-gold); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(201,168,76,0.25); }
.gallery-card-flip:hover .faction-goblins  { border-color: var(--color-green); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(74,158,74,0.25); }
.gallery-card-flip:hover .faction-devils   { border-color: var(--color-red); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(184,58,58,0.25); }
.gallery-card-flip:hover .faction-elves    { border-color: var(--color-orange); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(201,122,42,0.25); }
.gallery-card-flip:hover .faction-beasts   { border-color: var(--color-teal); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(42,123,123,0.25); }
.gallery-card-flip:hover .faction-spells   { border-color: var(--color-green); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(74,158,74,0.25); }
.gallery-card-flip:hover .faction-neutral  { border-color: var(--color-teal); box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 30px rgba(42,123,123,0.25); }

/* ============================================================
   SCROLL REVEAL ANIMATIONS
   ============================================================ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--color-bg);
        border-left: 1px solid var(--color-border);
        flex-direction: column;
        padding: 5rem var(--space-md) var(--space-md);
        gap: var(--space-sm);
        transition: right var(--transition);
        z-index: 999;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-links a {
        font-size: 1rem;
        padding: 0.5rem 0;
    }

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

    .card-frames-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-type-detail,
    .card-type-detail.reverse {
        flex-direction: column;
        text-align: center;
    }

    .card-type-image {
        width: 200px;
        margin: 0 auto;
    }

    .card-back-showcase {
        flex-direction: column;
        text-align: center;
    }

    .card-back-image {
        width: 180px;
        margin: 0 auto;
    }

    .deputy-showcase {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .deputy-frame-img {
        width: 140px;
    }

    .lore-faction-block,
    .lore-faction-block.reverse {
        flex-direction: column;
        text-align: center;
    }

    .lore-faction-art {
        width: 100%;
        max-width: 300px;
        height: 250px;
        margin: 0 auto;
    }

    .rpg-showcase {
        flex-direction: column;
        text-align: center;
    }

    .rpg-cover {
        width: 200px;
        margin: 0 auto;
    }

    .stat-breakdown {
        text-align: left;
    }

    .faction-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .store-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
    }

    .coming-soon-notice {
        flex-direction: column;
        text-align: center;
    }

    .notify-input-group {
        flex-direction: column;
    }

    .wild-card-callout {
        flex-direction: column;
        text-align: center;
    }

    .lore-wild-card-callout {
        flex-direction: column;
        text-align: center;
    }

    .wild-card-callout-icon {
        width: 100px;
        height: 130px;
        margin: 0 auto;
    }

    /* Gallery responsive -- tablet */
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-search input {
        width: 100%;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Mobile */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

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

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

    .card-frame-wrap img {
        max-height: 280px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 280px;
    }

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

    /* Gallery responsive -- mobile */
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .filter-btn {
        font-size: 0.65rem;
        padding: 0.4rem 0.7rem;
    }

    .lane-slot {
        width: 40px;
        height: 40px;
        font-size: 0.65rem;
    }
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--color-gold);
    background: rgba(201, 168, 76, 0.1);
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

/* Sun icon for dark mode (click to go light) */
.theme-toggle .icon-sun {
    display: block;
    color: var(--color-gold);
}

.theme-toggle .icon-moon {
    display: none;
    color: var(--color-text-dim);
}

html[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* ============================================================
   FACTION REVEAL PANEL (Homepage)
   ============================================================ */
.faction-card {
    cursor: pointer;
}

.faction-card.active {
    border-color: var(--color-gold-bright);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.3);
    transform: translateY(-4px);
}

.faction-card[data-faction="humans"].active { border-color: var(--color-gold); box-shadow: 0 0 36px rgba(201,168,76,0.35); }
.faction-card[data-faction="goblins"].active { border-color: var(--color-green); box-shadow: 0 0 36px rgba(74,158,74,0.35); }
.faction-card[data-faction="devils"].active { border-color: var(--color-red); box-shadow: 0 0 36px rgba(184,58,58,0.35); }
.faction-card[data-faction="elves"].active { border-color: var(--color-orange); box-shadow: 0 0 36px rgba(201,122,42,0.35); }

.faction-reveal-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, margin 0.4s ease;
    opacity: 0;
    margin-top: 0;
    background: var(--color-surface);
    border: 2px solid var(--color-gold-dim);
    border-radius: 8px;
}

.faction-reveal-panel.open {
    max-height: 600px;
    opacity: 1;
    margin-top: var(--space-lg);
}

.faction-reveal-inner {
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    gap: var(--space-xl);
    align-items: flex-start;
}

.faction-reveal-text {
    flex: 1;
}

.faction-reveal-text h2 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    margin-bottom: var(--space-xs);
}

.faction-reveal-text .faction-epithet {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
    display: block;
}

.faction-reveal-text .faction-lore-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-text);
    margin-bottom: var(--space-md);
}

.faction-reveal-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--space-md);
}

.faction-reveal-traits .trait {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--color-gold-dim);
    border-radius: 3px;
    color: var(--color-gold);
    background: rgba(201, 168, 76, 0.06);
}

/* Faction-specific panel accent colors */
.faction-reveal-panel[data-active="humans"] { border-color: var(--color-gold); }
.faction-reveal-panel[data-active="humans"] .faction-reveal-text h2 { color: var(--color-gold-bright); }

.faction-reveal-panel[data-active="goblins"] { border-color: var(--color-green); }
.faction-reveal-panel[data-active="goblins"] .faction-reveal-text h2 { color: var(--color-green); }
.faction-reveal-panel[data-active="goblins"] .trait { border-color: var(--color-green); color: var(--color-green); background: rgba(74, 158, 74, 0.08); }

.faction-reveal-panel[data-active="devils"] { border-color: var(--color-red); }
.faction-reveal-panel[data-active="devils"] .faction-reveal-text h2 { color: var(--color-red); }
.faction-reveal-panel[data-active="devils"] .trait { border-color: var(--color-red); color: var(--color-red); background: rgba(184, 58, 58, 0.08); }

.faction-reveal-panel[data-active="elves"] { border-color: var(--color-orange); }
.faction-reveal-panel[data-active="elves"] .faction-reveal-text h2 { color: var(--color-orange); }
.faction-reveal-panel[data-active="elves"] .trait { border-color: var(--color-orange); color: var(--color-orange); background: rgba(201, 122, 42, 0.08); }

@media (max-width: 768px) {
    .faction-reveal-inner {
        flex-direction: column;
        padding: var(--space-md);
        gap: var(--space-md);
    }
    .faction-reveal-panel.open {
        max-height: 900px;
    }
}

/* ============================================================
   INTERACTIVE LANE BOARD (How to Play)
   ============================================================ */
.game-board-wrap {
    margin: var(--space-md) 0;
    perspective: 800px;
}

.game-board {
    background:
        radial-gradient(ellipse at center, rgba(42, 123, 123, 0.05) 0%, transparent 60%),
        linear-gradient(160deg, #191510 0%, #120f0b 50%, #1a1510 100%);
    border: 3px solid var(--color-gold-dim);
    border-radius: 12px;
    padding: var(--space-lg) var(--space-md);
    position: relative;
    overflow: visible;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(201, 168, 76, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* Felt texture overlay */
.game-board::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 100px 100px;
}

/* Player zone labels */
.board-player-zone {
    text-align: center;
    padding: var(--space-xs) 0;
}

.board-player-label {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--color-text-dim);
    margin-bottom: 0.25rem;
}

.board-hp {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--color-red);
    padding: 0.3rem 0.8rem;
    background: rgba(184, 58, 58, 0.1);
    border: 1px solid rgba(184, 58, 58, 0.3);
    border-radius: 4px;
}

.board-hp-heart {
    font-size: 0.9rem;
}

/* Lane rows */
.board-lane-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    position: relative;
}

.board-lane-row-label {
    position: absolute;
    left: 0;
    font-family: var(--font-ui);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-dim);
    opacity: 0.6;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
}

/* Divider between player sides */
.board-divider {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--color-gold-dim), transparent);
    margin: var(--space-sm) 0;
    position: relative;
}

.board-divider-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-surface);
    padding: 0 var(--space-sm);
    font-family: var(--font-ui);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-gold-dim);
    white-space: nowrap;
}

/* Lane slots */
.board-slot {
    width: 72px;
    height: 100px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
    user-select: none;
}

.board-slot-label {
    font-family: var(--font-ui);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.board-slot.highrise-slot {
    background: rgba(42, 123, 123, 0.08);
    border: 2px solid rgba(42, 123, 123, 0.4);
    color: var(--color-teal-light);
    box-shadow: 0 0 12px rgba(42, 123, 123, 0.06);
}

.board-slot.highrise-slot:hover {
    border-color: var(--color-teal-light);
    background: rgba(42, 123, 123, 0.15);
    box-shadow: 0 0 20px rgba(42, 123, 123, 0.2);
    transform: translateY(-2px);
}

.board-slot.middle-slot {
    background: rgba(201, 168, 76, 0.06);
    border: 2px solid rgba(201, 168, 76, 0.3);
    color: var(--color-gold);
    box-shadow: 0 0 12px rgba(201, 168, 76, 0.04);
}

.board-slot.middle-slot:hover {
    border-color: var(--color-gold);
    background: rgba(201, 168, 76, 0.12);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
    transform: translateY(-2px);
}

/* Slot selected state */
.board-slot.selected {
    transform: translateY(-3px) scale(1.05);
    z-index: 2;
}

.board-slot.highrise-slot.selected {
    border-color: var(--color-teal-light);
    background: rgba(42, 123, 123, 0.25);
    box-shadow: 0 0 24px rgba(42, 123, 123, 0.35);
}

.board-slot.middle-slot.selected {
    border-color: var(--color-gold-bright);
    background: rgba(201, 168, 76, 0.2);
    box-shadow: 0 0 24px rgba(201, 168, 76, 0.3);
}

/* Attack target highlights */
.board-slot.attack-target {
    animation: targetPulse 1s ease infinite;
}

.board-slot.highrise-slot.attack-target {
    border-color: #5DE8E8;
    box-shadow: 0 0 20px rgba(42, 123, 123, 0.4);
}

.board-slot.middle-slot.attack-target {
    border-color: var(--color-gold-bright);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
}

@keyframes targetPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Attack arrows -- SVG overlay */
.board-attack-arrows {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.board-attack-arrows line {
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 8, 4;
    animation: arrowDash 0.8s linear infinite;
}

.board-attack-arrows line.arrow-teal {
    stroke: var(--color-teal-light);
    filter: drop-shadow(0 0 4px rgba(42, 123, 123, 0.5));
}

.board-attack-arrows line.arrow-gold {
    stroke: var(--color-gold-bright);
    filter: drop-shadow(0 0 4px rgba(201, 168, 76, 0.5));
}

.board-attack-arrows line.arrow-red {
    stroke: var(--color-red);
    filter: drop-shadow(0 0 4px rgba(184, 58, 58, 0.5));
}

/* Arrow endpoint markers */
.board-attack-arrows circle {
    fill: currentColor;
}

@keyframes arrowDash {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -12; }
}

/* HP attack target glow */
.board-hp.attack-target {
    animation: hpTargetPulse 1s ease infinite;
    border-color: var(--color-red);
    box-shadow: 0 0 16px rgba(184, 58, 58, 0.4);
}

@keyframes hpTargetPulse {
    0%, 100% { box-shadow: 0 0 16px rgba(184, 58, 58, 0.4); }
    50% { box-shadow: 0 0 28px rgba(184, 58, 58, 0.7); }
}

/* Tooltip */
.board-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg);
    border: 1px solid var(--color-gold-dim);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-text);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.board-slot:hover .board-tooltip {
    opacity: 1;
}

/* Board legend */
.board-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.board-legend-item h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.board-legend-item h4 .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-dot-teal { background: var(--color-teal-light); }
.legend-dot-gold { background: var(--color-gold); }

.board-legend-item p {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    line-height: 1.6;
    margin: 0;
}

.board-legend-item ul {
    list-style: none;
    margin: 0.5rem 0 0;
}

.board-legend-item ul li {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    padding: 0.2rem 0 0.2rem 1rem;
    position: relative;
}

.board-legend-item ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6rem;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-gold-dim);
}

/* Board click instruction */
.board-instruction {
    text-align: center;
    margin-top: var(--space-sm);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
    opacity: 0.6;
}

@media (max-width: 768px) {
    .board-slot {
        width: 52px;
        height: 72px;
        font-size: 0.6rem;
    }
    .board-slot-label {
        font-size: 0.4rem;
    }
    .board-lane-row {
        gap: 6px;
    }
    .board-lane-row-label {
        display: none;
    }
    .board-legend {
        grid-template-columns: 1fr;
    }
    .board-tooltip {
        display: none;
    }
}

@media (max-width: 480px) {
    .board-slot {
        width: 42px;
        height: 60px;
        font-size: 0.55rem;
        border-radius: 5px;
    }
    .game-board {
        padding: var(--space-sm);
    }
}

/* ============================================================
   CARD BUILDER PAGE
   ============================================================ */
.card-builder-section {
    padding: var(--space-xl) 0 var(--space-xxl);
}

.card-builder-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--space-xl);
    align-items: start;
}

.card-builder-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.builder-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.builder-field label {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-gold);
    font-weight: 600;
}

.builder-field input,
.builder-field select,
.builder-field textarea {
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition);
}

.builder-field input:focus,
.builder-field select:focus,
.builder-field textarea:focus {
    border-color: var(--color-gold-dim);
}

.builder-field textarea {
    resize: vertical;
    min-height: 70px;
}

.builder-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a89b8a'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.builder-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.builder-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.builder-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* Card preview area */
.card-preview-area {
    position: sticky;
    top: 100px;
}

.card-preview-title {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-gold);
    text-align: center;
    margin-bottom: var(--space-sm);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.card-preview-frame {
    width: 350px;
    height: 490px;
    margin: 0 auto;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.card-preview-frame-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.card-preview-frame-bg img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

/* Card preview text overlays */
.card-preview-name {
    position: absolute;
    top: 22px;
    left: 46px;
    right: 46px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    z-index: 2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-preview-art {
    position: absolute;
    top: 50px;
    left: 26px;
    right: 26px;
    height: 200px;
    background: var(--color-surface-2);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    overflow: hidden;
}

.card-preview-art-placeholder {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
    opacity: 0.5;
}

.card-preview-ability {
    position: absolute;
    top: 270px;
    left: 30px;
    right: 30px;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: #1a1a1a;
    z-index: 2;
    line-height: 1.5;
    max-height: 70px;
    overflow: hidden;
}

.card-preview-flavor {
    position: absolute;
    top: 350px;
    left: 30px;
    right: 30px;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-style: italic;
    color: #333;
    z-index: 2;
    line-height: 1.4;
    max-height: 50px;
    overflow: hidden;
}

/* Stat orbs on card preview */
.card-preview-stat {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 0.9rem;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.card-preview-mana {
    top: 12px;
    right: 10px;
    background: radial-gradient(circle, #7083f5, #5B6FDE);
    color: #fff;
}

.card-preview-gold {
    top: 12px;
    left: 10px;
    background: radial-gradient(circle, var(--color-gold-bright), var(--color-gold-dim));
    color: var(--color-bg);
}

.card-preview-attack {
    bottom: 12px;
    left: 10px;
    background: radial-gradient(circle, #e04848, var(--color-red));
    color: #fff;
}

.card-preview-defense {
    bottom: 12px;
    right: 10px;
    background: radial-gradient(circle, #5cb85c, var(--color-green));
    color: #fff;
}

.card-preview-type-badge {
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-ui);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #555;
    z-index: 2;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .card-builder-layout {
        grid-template-columns: 1fr;
    }

    .card-preview-area {
        position: static;
        order: -1;
    }

    .card-preview-frame {
        width: 280px;
        height: 392px;
    }

    .card-preview-name { top: 18px; left: 36px; right: 36px; font-size: 0.8rem; }
    .card-preview-art { top: 40px; left: 20px; right: 20px; height: 160px; }
    .card-preview-ability { top: 216px; left: 24px; right: 24px; font-size: 0.6rem; }
    .card-preview-flavor { top: 280px; left: 24px; right: 24px; font-size: 0.6rem; }
    .card-preview-stat { width: 28px; height: 28px; font-size: 0.75rem; }
    .card-preview-mana { top: 10px; right: 8px; }
    .card-preview-gold { top: 10px; left: 8px; }
    .card-preview-attack { bottom: 10px; left: 8px; }
    .card-preview-defense { bottom: 10px; right: 8px; }

    .builder-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   TASK 2 -- FACTION COLOR SCHEME TRANSITIONS (Card Gallery)
   The --accent-color custom property is set via JS when a
   faction filter is clicked. All themed elements transition
   smoothly to the new color.
   ============================================================ */
.gallery-section {
    --accent-color: var(--color-gold);
    --accent-glow: rgba(201, 168, 76, 0.15);
    transition: --accent-color 0.4s ease;
}

/* Apply accent to section title */
.gallery-section .section-title {
    color: var(--accent-color);
    transition: color 0.4s ease;
}

.gallery-section .section-title::after {
    background: var(--accent-color);
    transition: background 0.4s ease;
}

/* Active filter button uses accent */
.filter-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transition: background 0.4s ease, border-color 0.4s ease, color 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transition: border-color 0.4s ease, color 0.4s ease, background 0.3s ease;
}

/* Gallery stats count color */
.gallery-stats {
    transition: color 0.4s ease;
}

/* Card back border glow matches accent on hover */
.gallery-card-flip:hover .gallery-card-back {
    box-shadow: 0 8px 30px var(--accent-glow);
}

/* ============================================================
   TASK 3 -- PARALLAX ELEMENTS
   ============================================================ */
.parallax-element {
    will-change: transform;
}

/* ============================================================
   TASK 4 -- COMPREHENSIVE MOBILE RESPONSIVENESS FIXES
   ============================================================ */

/* -- Hamburger menu animation to X -- */
.nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* -- Ensure all buttons are tap-friendly (44px minimum) -- */
.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-btn {
    min-height: 44px;
}

/* nav-toggle tap target size -- display controlled by existing base + media query */

.theme-toggle {
    min-width: 44px;
    min-height: 44px;
}

/* -- Mobile overlay backdrop for open menu -- */
@media (max-width: 768px) {
    .nav-links {
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
    }

    .nav-links.open {
        right: 0;
    }

    /* Ensure nav links are tap-friendly */
    .nav-links a {
        padding: 0.75rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-toggle {
        display: flex;
    }

    /* Footer nav wraps nicely */
    .footer-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-sm);
    }

    /* Board horizontal scroll on small screens */
    .game-board-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-sm);
    }

    .game-board {
        min-width: 360px;
    }
}

/* -- Small mobile (375px target) -- */
@media (max-width: 480px) {
    /* Hero text must be readable */
    .hero-content {
        padding: var(--space-sm);
    }

    .hero-tagline {
        font-size: 0.95rem;
    }

    /* Page hero tighter */
    .page-hero {
        min-height: 30vh;
    }

    .page-hero-content h1 {
        font-size: 1.75rem;
    }

    .page-hero-content p {
        font-size: 0.9rem;
    }

    /* Gallery filters scroll horizontally */
    .gallery-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
    }

    .gallery-filters::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Card gallery 1 column with card flip */
    .gallery-grid {
        grid-template-columns: 1fr;
        max-width: 340px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Faction reveal panel full width */
    .faction-reveal-inner {
        padding: var(--space-sm);
    }

    .faction-reveal-text .faction-lore-body {
        font-size: 0.95rem;
    }

    /* Store product cards stack with full width */
    .store-product-card {
        max-width: 100%;
    }

    .store-product-image-wrap {
        aspect-ratio: 4 / 3;
    }

    /* Rules block tighter */
    .rules-heading {
        font-size: 1.35rem;
    }

    .rules-number {
        font-size: 2rem;
    }

    /* Notify form */
    .notify-box {
        padding: var(--space-md);
    }

    .notify-box h2 {
        font-size: 1.35rem;
    }

    /* Lore dropcap smaller on mobile */
    .dropcap {
        font-size: 3rem;
    }

    /* Ensure no horizontal overflow */
    body {
        overflow-x: hidden;
    }

    .container {
        padding: 0 var(--space-sm);
    }

    /* Board: allow horizontal scroll with visible scrollbar hint */
    .game-board {
        min-width: 320px;
    }

    .board-slot {
        width: 38px;
        height: 54px;
        font-size: 0.5rem;
        border-radius: 4px;
    }

    .board-slot-label {
        display: none;
    }

    .board-lane-row {
        gap: 4px;
    }

    .board-hp {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
    }

    /* Section spacing reduction */
    .factions,
    .resources-section,
    .card-showcase,
    .cta-section {
        padding: var(--space-xl) 0;
    }
}

/* -- Tablet (768px) -- */
@media (min-width: 481px) and (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* -- Desktop large (1440px+) -- */
@media (min-width: 1280px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* -- Reduced motion: disable parallax and card flip animation -- */
@media (prefers-reduced-motion: reduce) {
    .parallax-element {
        transform: none !important;
    }

    .gallery-card-flip-inner {
        transition: none;
    }

    .gallery-card-flip:hover .gallery-card-flip-inner {
        transform: rotateY(180deg);
    }
}

/* -- Card back face height matches front dynamically -- */
.gallery-card-back {
    aspect-ratio: auto;
}
