/*
Theme Name: Card Dex
Theme URI: https://picloud-website-builder.duckdns.org
Author: Daryl
Description: A kawaii pastel Pokémon card identifier & collection tracker — snap a photo, get the card ID and live market value, and keep a record of every find. Powered by Gemini vision + the Pokémon TCG API, optimised for Raspberry Pi 5 self-hosting.
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: kawaii-carddex
*/

/* ==========================================================================
   1. KAWAII DESIGN TOKENS
   ========================================================================== */
:root {
    /* Pastel surfaces */
    --bg-cream: #fff7fa;
    --bg-card: #ffffff;
    --bg-blush: #ffeef5;
    --bg-lavender: #f3efff;
    --bg-mint: #eafaf1;

    /* Candy palette */
    --pink: #ff8fb8;
    --pink-deep: #f06292;
    --pink-soft: #ffd3e3;
    --lavender: #a78bfa;
    --lavender-deep: #7c5cd6;
    --mint: #5fd3a2;
    --sunny: #ffd166;
    --sky: #7ecbf0;
    --peach: #ffb499;

    /* Text (WCAG AA on cream/white) */
    --ink: #4a3b52;
    --ink-soft: #6f5f78;
    --ink-muted: #92839b;

    /* Rarity colours */
    --rare-common: #9aa5b1;
    --rare-uncommon: #5fd3a2;
    --rare-rare: #7ecbf0;
    --rare-ultra: #a78bfa;
    --rare-secret: #f06292;
    --rare-gold: #e0a82e;

    /* Lines & shadows */
    --line: #f4dbe7;
    --line-strong: #eccadb;
    --shadow-soft: 0 6px 24px rgba(240, 98, 146, 0.10);
    --shadow-pop: 0 14px 40px rgba(167, 139, 250, 0.18);

    /* Type scale (fluid) */
    --fs-xs: clamp(0.74rem, 0.72rem + 0.1vw, 0.8rem);
    --fs-sm: clamp(0.88rem, 0.85rem + 0.15vw, 0.98rem);
    --fs-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --fs-md: clamp(1.15rem, 1.1rem + 0.3vw, 1.35rem);
    --fs-lg: clamp(1.45rem, 1.3rem + 0.7vw, 1.85rem);
    --fs-xl: clamp(1.9rem, 1.6rem + 1.4vw, 2.6rem);
    --fs-2xl: clamp(2.3rem, 1.8rem + 2.6vw, 3.8rem);

    --font-display: 'Baloo 2', 'Comic Sans MS', cursive;
    --font-body: 'Quicksand', 'Segoe UI', sans-serif;

    /* Spacing */
    --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
    --sp-6: 1.5rem;  --sp-8: 2rem;    --sp-12: 3rem;   --sp-16: 4rem;
    --sp-24: 6rem;

    /* Shape */
    --radius-lg: 28px;
    --radius: 20px;
    --radius-sm: 12px;
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --container: 1240px;

    --z-header: 100;
    --z-menu: 150;
    --z-modal: 200;
}

/* ==========================================================================
   2. BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
    background-color: var(--bg-cream);
    background-image:
        radial-gradient(circle at 8% 12%, rgba(255, 211, 227, 0.55) 0%, transparent 24%),
        radial-gradient(circle at 92% 8%, rgba(243, 239, 255, 0.9) 0%, transparent 26%),
        radial-gradient(circle at 85% 88%, rgba(234, 250, 241, 0.85) 0%, transparent 28%);
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: 500;
    margin: 0;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;   /* never allow sideways scroll from decorative transforms */
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--pink-deep); text-decoration: none; }
a:hover { color: var(--lavender-deep); }
button { font-family: inherit; touch-action: manipulation; }

h1, h2, h3, .display {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 var(--sp-4);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

.candy-text {
    background: linear-gradient(120deg, var(--pink-deep) 0%, var(--lavender-deep) 60%, var(--sky) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--pink-deep); /* fallback */
}

/* Accessibility */
.skip-link {
    position: absolute;
    left: -9999px; top: 0;
    z-index: calc(var(--z-modal) + 10);
    background: var(--pink-deep);
    color: #fff;
    padding: var(--sp-3) var(--sp-6);
    border-radius: 0 0 var(--radius-sm) 0;
    font-weight: 700;
}
.skip-link:focus { left: 0; }
:focus-visible {
    outline: 3px solid var(--lavender);
    outline-offset: 3px;
    border-radius: 4px;
}
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.kicker {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--lavender-deep);
    margin-bottom: var(--sp-2);
    display: block;
}

.section-heading { text-align: center; margin-bottom: var(--sp-12); }
.section-heading h2 { margin-bottom: var(--sp-2); }
.section-heading .subtitle { color: var(--ink-soft); max-width: 44em; margin-inline: auto; }

/* ==========================================================================
   3. HEADER & NAV
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: rgba(255, 247, 250, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 2px solid var(--line);
}
.header-inner {
    max-width: var(--container);
    margin-inline: auto;
    padding: 0.8rem clamp(1.25rem, 4vw, 3rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-4);
}
.site-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--pink-deep);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.site-logo .logo-mark {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--pink) 0%, var(--pink) 46%, var(--ink) 46%, var(--ink) 54%, #fff 54%);
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(240, 98, 146, 0.35);
    transition: transform 0.4s var(--ease-bounce);
}
.site-logo .logo-mark::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 12px; height: 12px;
    background: #fff;
    border: 3px solid var(--ink);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.site-logo:hover .logo-mark { transform: rotate(20deg) scale(1.08); }

.main-nav ul { display: flex; gap: var(--sp-1); list-style: none; margin: 0; padding: 0; }
.main-nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--ink-soft);
    font-size: var(--fs-sm);
    font-weight: 700;
    border-radius: 50px;
    transition: color 0.18s ease, background 0.18s ease, transform 0.2s var(--ease-bounce);
}
.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a {
    color: var(--pink-deep);
    background: var(--bg-blush);
    transform: translateY(-1px);
}

.header-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.8rem 1.8rem;
    min-height: 48px;
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: var(--fs-base);
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.25s var(--ease-bounce), box-shadow 0.2s ease;
}
.btn-candy {
    background: linear-gradient(135deg, var(--pink-deep), var(--lavender-deep));
    color: #fff;
    box-shadow: 0 6px 18px rgba(240, 98, 146, 0.35);
}
.btn-candy:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 10px 26px rgba(240, 98, 146, 0.45); color: #fff; }
.btn-soft {
    background: #fff;
    border: 2px solid var(--line-strong);
    color: var(--ink-soft);
}
.btn-soft:hover { border-color: var(--lavender); color: var(--lavender-deep); transform: translateY(-2px); }

.identify-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    background: linear-gradient(135deg, var(--pink-deep), var(--lavender-deep));
    border: none;
    border-radius: 50px;
    color: #fff;
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(240, 98, 146, 0.35);
    transition: transform 0.25s var(--ease-bounce), box-shadow 0.2s ease;
}
.identify-trigger-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 20px rgba(240, 98, 146, 0.45); }
.identify-trigger-btn .label-desktop { display: inline; }

/* Hamburger */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px; height: 44px;
    background: #fff;
    border: 2px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 10px;
}
.menu-toggle span {
    display: block; height: 3px; width: 100%;
    background: var(--pink-deep);
    border-radius: 3px;
    transition: transform 0.25s var(--ease-out), opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ==========================================================================
   4. IDENTIFY MODAL
   ========================================================================== */
.identify-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(74, 59, 82, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: center;
    align-items: flex-start;
    padding: 8vh var(--sp-4) var(--sp-6);
    overflow-y: auto;
}
.identify-modal.active { display: flex; }
.identify-modal-content {
    width: 100%;
    max-width: 760px;
    background: var(--bg-cream);
    border-radius: var(--radius-lg);
    border: 3px solid var(--pink-soft);
    padding: clamp(1.5rem, 4vw, 3rem);
    text-align: center;
    box-shadow: var(--shadow-pop);
    animation: bounceIn 0.4s var(--ease-bounce);
    position: relative;
}
@keyframes bounceIn {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.identify-modal h2 { margin-bottom: var(--sp-2); }
.identify-modal .modal-sub { color: var(--ink-soft); margin: 0 0 var(--sp-6); }

.close-modal-btn {
    position: absolute;
    top: 1rem; right: 1rem;
    width: 44px; height: 44px;
    background: #fff;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink-soft);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.25s var(--ease-bounce), color 0.2s ease, border-color 0.2s ease;
}
.close-modal-btn:hover { border-color: var(--pink-deep); color: var(--pink-deep); transform: rotate(90deg); }

.card-dropzone {
    padding: var(--sp-12) var(--sp-8);
    border: 3px dashed var(--lavender);
    border-radius: var(--radius);
    background: var(--bg-lavender);
    color: var(--ink-soft);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.25s var(--ease-bounce);
}
.card-dropzone:hover { transform: scale(1.01); }
.card-dropzone.dragover { border-color: var(--pink-deep); background: var(--bg-blush); }
.card-dropzone .drop-emoji { font-size: 2.6rem; display: block; margin-bottom: var(--sp-2); }
.card-dropzone img.preview {
    max-height: 240px;
    margin: var(--sp-4) auto 0;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
}

/* Camera scanner */
.camera-row { margin-top: var(--sp-4); }
.camera-btn { width: 100%; }
.camera-view { margin-top: var(--sp-4); }
.camera-stage {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #1a1523;
    border: 3px solid var(--lavender);
    box-shadow: var(--shadow-pop);
}
.camera-stage video {
    width: 100%;
    max-height: 58vh;
    object-fit: cover;
    display: block;
}
.camera-frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.camera-frame::before {
    content: "";
    width: min(62%, 46vh);
    aspect-ratio: 63 / 88;              /* real card proportions */
    border: 3px dashed rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    box-shadow: 0 0 0 999px rgba(26, 21, 35, 0.45);
}
.camera-frame span {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 21, 35, 0.75);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 50px;
    white-space: nowrap;
}
.camera-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
}

/* Text lookup row */
.lookup-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.lookup-input {
    flex: 1;
    padding: 0.9rem 1.3rem;
    font-size: var(--fs-base);
    font-family: var(--font-body);
    font-weight: 600;
    background: #fff;
    border: 2px solid var(--line-strong);
    border-radius: 50px;
    color: var(--ink);
    outline: none;
    min-width: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lookup-input:focus { border-color: var(--lavender); box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.2); }
.lookup-btn {
    padding: 0.9rem 1.6rem;
    border: none;
    border-radius: 50px;
    background: var(--lavender-deep);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s var(--ease-bounce), background 0.2s ease;
    flex-shrink: 0;
}
.lookup-btn:hover { background: var(--pink-deep); transform: scale(1.04); }

/* Result area */
.identify-result {
    margin-top: var(--sp-6);
    text-align: left;
    display: none;
}
.identify-result.visible { display: block; animation: fadeUp 0.4s var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.identify-result .ai-loading { text-align: center; color: var(--ink-muted); padding: var(--sp-6); }
.identify-result .ai-loading .bounce { display: inline-block; animation: bob 1s infinite var(--ease-bounce); font-size: 1.6rem; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.identify-result .ai-error {
    color: #c2185b;
    background: var(--bg-blush);
    border-radius: var(--radius-sm);
    padding: var(--sp-4);
    text-align: center;
    font-weight: 600;
}

/* Matched card rows */
.match-card {
    display: flex;
    gap: var(--sp-4);
    align-items: center;
    background: #fff;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3);
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s var(--ease-bounce), border-color 0.2s ease;
}
.match-card:hover { transform: translateY(-2px); border-color: var(--pink-soft); }
.match-card img.match-thumb { width: 86px; border-radius: 8px; flex-shrink: 0; }
.match-card .match-body { flex: 1; min-width: 0; }
.match-card .match-name { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); color: var(--ink); margin: 0; }
.match-card .match-set { color: var(--ink-soft); font-size: var(--fs-sm); margin: 2px 0; }
.match-card .match-price { font-weight: 700; color: var(--mint); font-size: var(--fs-md); }
.match-card .match-price small { color: var(--ink-muted); font-weight: 600; }
.match-card .save-card-btn {
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 50px;
    background: var(--mint);
    color: #0c4a30;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-sm);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.25s var(--ease-bounce), background 0.2s ease;
}
.match-card .save-card-btn:hover { transform: scale(1.06); background: #4ec392; }
.match-card .save-card-btn[disabled] { background: var(--line); color: var(--ink-muted); cursor: default; transform: none; }
.ai-guess-note {
    background: var(--bg-mint);
    border-radius: var(--radius-sm);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
    margin-bottom: var(--sp-4);
}

/* ==========================================================================
   5. HERO & STATS
   ========================================================================== */
.hero-section {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
    max-width: var(--container);
    margin-inline: auto;
    padding: clamp(3rem, 8vh, 5.5rem) clamp(1.25rem, 4vw, 3rem);
}
.hero-text p { font-size: var(--fs-md); color: var(--ink-soft); max-width: 30em; margin: 0 0 var(--sp-8); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); }

.hero-cards {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 320px;
}
.hero-cards .floaty {
    width: clamp(88px, 17vw, 210px);   /* shrinks far enough for 360px phones */
    aspect-ratio: 63 / 88;               /* real card proportions */
    border-radius: 14px;
    background: linear-gradient(150deg, var(--pink-soft), var(--bg-lavender));
    border: 3px solid #fff;
    box-shadow: var(--shadow-pop);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
}
.hero-cards .floaty:nth-child(1) { transform: rotate(-10deg) translateX(28%); z-index: 1; background: linear-gradient(150deg, #fff0c2, var(--bg-mint)); }
.hero-cards .floaty:nth-child(2) { z-index: 2; animation: floaty 4s ease-in-out infinite; }
.hero-cards .floaty:nth-child(3) { transform: rotate(10deg) translateX(-28%); z-index: 1; background: linear-gradient(150deg, var(--bg-mint), var(--bg-lavender)); }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

.stats-strip {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 4vw, 3rem);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--sp-4);
}
.stat-cell {
    background: #fff;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: var(--sp-6);
    text-align: center;
    box-shadow: var(--shadow-soft);
}
.stat-cell .stat-value {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 800;
    display: block;
    line-height: 1.1;
    color: var(--pink-deep);
}
.stat-cell:nth-child(2) .stat-value { color: var(--lavender-deep); }
.stat-cell:nth-child(3) .stat-value { color: var(--mint); }
.stat-cell:nth-child(4) .stat-value { color: var(--sky); }
.stat-cell .stat-label {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-muted);
    font-weight: 700;
    margin-top: var(--sp-1);
    display: block;
}

/* ==========================================================================
   6. CARD GRID
   ========================================================================== */
.grid-section {
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--sp-6);
}

.dex-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    color: inherit;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s var(--ease-bounce), border-color 0.25s ease, box-shadow 0.25s ease;
}
.dex-card:hover {
    border-color: var(--pink-soft);
    box-shadow: var(--shadow-pop);
    transform: translateY(-6px) rotate(-0.5deg);
}
.dex-card:hover .card-img img { transform: scale(1.05); }

.card-img {
    position: relative;
    aspect-ratio: 63 / 75;
    background:
        radial-gradient(circle at 50% 35%, #fff 0%, var(--bg-lavender) 85%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-img img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: var(--sp-4);
    transition: transform 0.5s var(--ease-out);
}
.card-img .no-image { color: var(--ink-muted); font-size: 2.4rem; }

.dex-card-body { padding: var(--sp-4) var(--sp-6) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.dex-card h3 { margin: 0; font-size: var(--fs-md); color: var(--ink); }
.dex-card .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--ink-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.dex-card p { color: var(--ink-soft); margin: 0; font-size: var(--fs-sm); flex: 1; }

.card-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--sp-2);
    padding-top: var(--sp-3);
    border-top: 2px dashed var(--line);
    font-size: var(--fs-sm);
}
.value-chip { font-weight: 800; color: var(--mint); font-family: var(--font-display); }
.qty-chip { color: var(--ink-muted); font-weight: 700; font-size: var(--fs-xs); }

/* Rarity badges */
.rarity-badge {
    position: absolute;
    top: 10px; left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 0 3px 10px rgba(74, 59, 82, 0.18);
}
.rb-common    { background: var(--rare-common); }
.rb-uncommon  { background: var(--rare-uncommon); }
.rb-rare      { background: var(--rare-rare); }
.rb-holo      { background: linear-gradient(120deg, var(--rare-rare), var(--rare-ultra)); }
.rb-ultra     { background: var(--rare-ultra); }
.rb-secret    {
    background: linear-gradient(120deg, var(--rare-secret), var(--rare-gold));
    animation: shimmerPulse 2.4s ease-in-out infinite;
}
@keyframes shimmerPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(240, 98, 146, 0.5); }
    50%      { box-shadow: 0 0 18px rgba(224, 168, 46, 0.8); }
}
.rb-promo     { background: var(--sunny); color: #6b4d00; }

/* ==========================================================================
   7. FILTERS, PAGINATION, ARCHIVE
   ========================================================================== */
.archive-header {
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem) var(--sp-8);
    text-align: center;
}
.archive-header p { color: var(--ink-soft); max-width: 42em; margin-inline: auto; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    justify-content: center;
    margin-top: var(--sp-8);
}
.filter-bar select, .filter-bar .filter-submit, .filter-bar input[type="search"] {
    padding: 0.6rem 1.1rem;
    min-height: 46px;
    background: #fff;
    border: 2px solid var(--line-strong);
    border-radius: 50px;
    color: var(--ink);
    font-size: var(--fs-sm);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--lavender); outline: none; }
.filter-bar .filter-submit {
    background: var(--pink-deep);
    color: #fff;
    border-color: var(--pink-deep);
    font-family: var(--font-display);
    font-weight: 700;
    padding-inline: 1.6rem;
    transition: transform 0.25s var(--ease-bounce);
}
.filter-bar .filter-submit:hover { transform: scale(1.05); }
.filter-bar .filter-reset { align-self: center; color: var(--ink-muted); font-size: var(--fs-sm); font-weight: 700; padding: 0.6rem; }
.filter-bar .filter-reset:hover { color: var(--pink-deep); }

.dex-pagination { display: flex; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-12); flex-wrap: wrap; }
.dex-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px; min-height: 46px;
    padding: 0 12px;
    background: #fff;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: var(--fs-sm);
}
.dex-pagination .page-numbers.current { background: var(--pink-deep); color: #fff; border-color: var(--pink-deep); }
.dex-pagination .page-numbers:hover:not(.current) { border-color: var(--lavender); color: var(--lavender-deep); }

/* ==========================================================================
   8. SINGLE CARD RECORD
   ========================================================================== */
.card-single {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: clamp(2rem, 5vw, 4rem);
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--sp-12) clamp(1.25rem, 4vw, 3rem);
}
.card-portrait {
    position: sticky;
    top: 100px;
    align-self: start;
    background:
        radial-gradient(circle at 50% 30%, #fff 0%, var(--bg-lavender) 90%);
    border-radius: var(--radius-lg);
    border: 3px solid #fff;
    box-shadow: var(--shadow-pop);
    padding: var(--sp-8);
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-portrait img {
    max-width: 100%;
    max-height: 72vh;
    width: auto; height: auto;
    object-fit: contain;
    border-radius: 12px;
    filter: drop-shadow(0 18px 40px rgba(74, 59, 82, 0.25));
}
.card-portrait .no-image { font-size: 4rem; }

.card-details .crumbs {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    margin-bottom: var(--sp-4);
}
.card-details .crumbs a { color: var(--ink-muted); }
.card-details .crumbs a:hover { color: var(--pink-deep); }
.card-details .rarity-badge { position: static; margin-bottom: var(--sp-4); }

/* Specs grid */
.card-specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--sp-4);
    margin-block: var(--sp-6);
    padding: var(--sp-6);
    background: #fff;
    border-radius: var(--radius);
    border: 2px solid var(--line);
    box-shadow: var(--shadow-soft);
}
.spec-item .spec-label {
    display: block;
    font-size: var(--fs-xs);
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 3px;
}
.spec-item .spec-value { font-size: var(--fs-md); color: var(--ink); font-weight: 700; font-family: var(--font-display); }
.spec-item .spec-value.pink { color: var(--pink-deep); }

/* Value panel */
.value-panel {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-6);
    padding: var(--sp-4) var(--sp-6);
    background: linear-gradient(120deg, var(--bg-mint), #fff);
    border: 2px solid rgba(95, 211, 162, 0.4);
    border-radius: var(--radius-sm);
}
.value-panel .value-block .value-amount {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 800;
    color: #1d7a4f;
    line-height: 1.1;
    display: block;
}
.value-panel .value-block .value-note { font-size: var(--fs-xs); color: var(--ink-muted); font-weight: 600; }
.value-panel .profit-up { color: #1d7a4f; }
.value-panel .profit-down { color: #c2185b; }

.entry-content { font-size: var(--fs-md); line-height: 1.8; color: var(--ink-soft); }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content blockquote {
    border-left: 4px solid var(--pink-soft);
    margin-inline: 0;
    padding-left: var(--sp-6);
    color: var(--ink);
    font-style: italic;
}

.related-section {
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem);
    border-top: 2px dashed var(--line-strong);
}

/* ==========================================================================
   9. DECIPHER GUIDE
   ========================================================================== */
.guide-wrap {
    max-width: 900px;
    margin-inline: auto;
    padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem);
}
.guide-hero { text-align: center; margin-bottom: var(--sp-12); }
.guide-hero p { color: var(--ink-soft); max-width: 40em; margin-inline: auto; font-size: var(--fs-md); }

.guide-section {
    background: #fff;
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: var(--sp-8);
    box-shadow: var(--shadow-soft);
}
.guide-section h2 {
    font-size: var(--fs-lg);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}
.guide-section h2 .g-emoji { font-size: 1.4em; }
.guide-section p, .guide-section li { color: var(--ink-soft); }
.guide-section strong { color: var(--ink); }

/* Card number anatomy diagram */
.number-anatomy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    font-weight: 800;
    background: var(--bg-lavender);
    border-radius: var(--radius);
    padding: var(--sp-8);
    margin-block: var(--sp-6);
}
.number-anatomy .num-part { position: relative; padding-bottom: 2.2em; }
.number-anatomy .num-card { color: var(--pink-deep); }
.number-anatomy .num-slash { color: var(--ink-muted); padding-bottom: 0; }
.number-anatomy .num-total { color: var(--lavender-deep); }
.number-anatomy .num-label {
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--ink-soft);
    background: #fff;
    border-radius: 50px;
    padding: 4px 12px;
    box-shadow: var(--shadow-soft);
}

/* Rarity table (scrolls inside its card on narrow phones instead of
   stretching the whole page) */
.rarity-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
@media (max-width: 700px) {
    .rarity-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .rarity-table td { min-width: 120px; }
    .rarity-table tr td:first-child { min-width: 48px; }
}
.rarity-table th {
    text-align: left;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-muted);
    padding: 0 var(--sp-4);
}
.rarity-table td {
    background: var(--bg-cream);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
    vertical-align: middle;
}
.rarity-table tr td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-size: 1.2rem; text-align: center; width: 64px; }
.rarity-table tr td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rarity-table .r-name { font-weight: 800; color: var(--ink); font-family: var(--font-display); white-space: nowrap; }

.symbol-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-soft);
    font-size: 1.1rem;
}

/* Reg mark chips */
.regmark-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.regmark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-cream);
    border: 2px solid var(--line);
    border-radius: 50px;
    padding: 6px 14px 6px 6px;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--ink-soft);
}
.regmark .mark-letter {
    width: 30px; height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: #fff;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 800;
}
.regmark.legal .mark-letter { background: var(--mint); color: #0c4a30; }

.tip-box {
    background: var(--bg-blush);
    border: 2px dashed var(--pink-soft);
    border-radius: var(--radius);
    padding: var(--sp-4) var(--sp-6);
    margin-top: var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--ink-soft);
}
.tip-box strong { color: var(--pink-deep); }

/* ==========================================================================
   10. PAGES, SEARCH, 404, FOOTER
   ========================================================================== */
.page-content-wrap { max-width: 820px; margin-inline: auto; padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem); }

.error-404 {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-16) var(--sp-6);
}
.error-404 .error-code {
    font-family: var(--font-display);
    font-size: clamp(5rem, 16vw, 10rem);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(120deg, var(--pink-deep), var(--lavender-deep), var(--sky));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.error-404 .error-emoji { font-size: 3.4rem; animation: bob 2s infinite ease-in-out; }
.error-404 p { color: var(--ink-soft); max-width: 34em; }

.site-footer { background: #fff; border-top: 2px solid var(--line); margin-top: var(--sp-24); }
.footer-inner {
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--sp-16) clamp(1.25rem, 4vw, 3rem) var(--sp-8);
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--sp-12);
}
.footer-brand p { color: var(--ink-muted); font-size: var(--fs-sm); max-width: 30em; }
.footer-col h4 {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-muted);
    margin: 0 0 var(--sp-4);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.footer-col a { color: var(--ink-soft); font-size: var(--fs-sm); font-weight: 600; }
.footer-col a:hover { color: var(--pink-deep); }
.footer-bottom {
    border-top: 2px dashed var(--line);
    padding: var(--sp-6) clamp(1.25rem, 4vw, 3rem);
    text-align: center;
    color: var(--ink-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
}

/* ==========================================================================
   11. SCROLL REVEAL & MOTION SAFETY
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
    .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out); }
    .reveal.revealed { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   12. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .card-single { grid-template-columns: 1fr; }
    .card-portrait { position: relative; top: 0; max-width: 420px; margin-inline: auto; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
    .menu-toggle { display: flex; }
    .main-nav {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: min(320px, 85vw);
        background: var(--bg-cream);
        border-left: 2px solid var(--line-strong);
        padding: 6rem var(--sp-8) var(--sp-8);
        transform: translateX(100%);
        transition: transform 0.3s var(--ease-out);
        z-index: var(--z-menu);
        overflow-y: auto;
    }
    .main-nav.open { transform: translateX(0); box-shadow: -16px 0 50px rgba(74, 59, 82, 0.25); }
    .main-nav ul { flex-direction: column; gap: var(--sp-2); }
    .main-nav a { font-size: var(--fs-md); padding: 0.85rem 1rem; }
    .nav-overlay { display: none; position: fixed; inset: 0; z-index: calc(var(--z-menu) - 1); background: rgba(74, 59, 82, 0.4); }
    .nav-overlay.open { display: block; }

    .hero-section { grid-template-columns: 1fr; text-align: center; }
    .hero-text p { margin-inline: auto; }
    .hero-actions { justify-content: center; }
    .hero-cards { min-height: 200px; margin-top: var(--sp-6); max-width: 100%; }
    .hero-cards .floaty { width: clamp(84px, 24vw, 150px); font-size: 2.2rem; }
    .identify-trigger-btn .label-desktop { display: none; }
    .identify-trigger-btn { padding: 0.6rem; width: 44px; justify-content: center; }
}
@media (max-width: 560px) {
    .footer-inner { grid-template-columns: 1fr; gap: var(--sp-8); }
    .lookup-row { flex-direction: column; }
    .match-card { flex-wrap: wrap; }
    .rarity-table tr td:first-child { width: 48px; }
}

/* ==========================================================================
   13. WORDPRESS CORE COMPAT
   ========================================================================== */
.alignwide { margin-inline: calc(-1 * var(--sp-8)); }
.alignfull { margin-inline: calc(50% - 50vw); width: 100vw; }
.wp-caption { max-width: 100%; }
.wp-caption-text { color: var(--ink-muted); font-size: var(--fs-xs); text-align: center; margin-top: var(--sp-2); }
.sticky { /* required class */ }
.bypostauthor { /* required class */ }
