/* ============================================================
   PTG — The Vault
   Premium Pokemon Card Marketplace · Design System
   Dark theme · Solid colors only
   ============================================================ */

/* === Google Fonts (loaded in HTML head) ===
   Display: Fraunces — variable serif with optical sizing
   Body:    Manrope — geometric sans, refined
   Mono:    JetBrains Mono — card numbers & codes
*/

/* === Design Tokens === */
:root {
    /* Color — Dark (default) */
    --bg-base: #0c0a09;          /* stone-950 — warm near-black */
    --bg-elevated: #1c1917;      /* stone-900 */
    --bg-card: #292524;          /* stone-800 */
    --bg-card-hover: #44403c;    /* stone-700 */
    --border-subtle: #292524;
    --border-default: #44403c;
    --border-strong: #57534e;

    --text-primary: #fafaf9;     /* stone-50 */
    --text-secondary: #d6d3d1;   /* stone-300 */
    --text-muted: #a8a29e;       /* stone-400 */
    --text-faint: #78716c;       /* stone-500 */

    /* Brand & Accents (all solid) */
    --ptg-red: #ef4444;          /* red-500 — primary CTA */
    --ptg-red-dark: #dc2626;     /* red-600 */
    --ptg-red-darker: #991b1b;   /* red-800 */
    --ptg-gold: #fbbf24;         /* amber-400 — rarity */
    --ptg-gold-dark: #d97706;    /* amber-600 */
    --ptg-purple: #a855f7;       /* purple-500 */
    --ptg-blue: #3b82f6;         /* blue-500 */
    --ptg-green: #22c55e;        /* green-500 */
    --ptg-pink: #ec4899;         /* pink-500 */

    /* Rarity tiers — solid colors only */
    --rarity-common:   #78716c;  /* stone-500 */
    --rarity-uncommon: #22c55e;  /* green-500 */
    --rarity-rare:     #3b82f6;  /* blue-500 */
    --rarity-holo:     #a855f7;  /* purple-500 */
    --rarity-ultra:    #fbbf24;  /* amber-400 */
    --rarity-secret:   #ec4899;  /* pink-500 */

    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Manrope', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 1.75rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;

    /* Shadows (no color glows — use neutrals) */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);

    /* Animation */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;

    /* Z-index scale */
    --z-base: 1;
    --z-elevated: 10;
    --z-sticky: 20;
    --z-dropdown: 30;
    --z-modal: 50;
    --z-toast: 100;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-base);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Typography === */
.font-display { font-family: var(--font-display); font-weight: 600; }
.font-mono    { font-family: var(--font-mono); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 var(--space-4);
    line-height: 1.2;
}
h1 { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-weight: 600; }

.text-muted-soft { color: var(--text-muted) !important; }
.text-faint      { color: var(--text-faint) !important; }

/* === Navbar (SaaS frosted-glass) === */
.ptg-navbar {
    background: rgba(12, 10, 9, 0.62);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: background-color 240ms cubic-bezier(0.4, 0, 0.2, 1),
                border-color    240ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow      240ms cubic-bezier(0.4, 0, 0.2, 1);
}
.ptg-navbar.is-scrolled {
    background: rgba(12, 10, 9, 0.88);
    border-bottom-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
}

/* Layout row (overrides inline-flex from the partial) */
.ptg-navbar-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    max-width: 1280px;
    margin: 0 auto;
}
.ptg-navbar > .container.container-ptg {
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 1280px;
}

/* Brand */
.ptg-navbar-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.18rem;
    color: var(--text-primary) !important;
    text-decoration: none;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    flex-shrink: 0;
}
.ptg-navbar-brand:hover { color: var(--text-primary) !important; }
.ptg-navbar-brand .vault-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--ptg-red) 0%, #b91c1c 100%);
    border-radius: 9px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14),
                0 1px 3px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}
.ptg-navbar-brand .vault-mark-inner {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.05em;
}
.ptg-navbar-brand .brand-text {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.ptg-navbar-brand .brand-name {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.ptg-navbar-brand .brand-sub {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--ptg-gold);
    font-family: var(--font-body);
}

/* Center nav links — auto margins give true centering within the middle slot */
.ptg-navbar .navbar-nav {
    display: flex;
    list-style: none;
    gap: 4px;
    margin: 0 auto;
    padding: 0;
    align-items: center;
}
.ptg-navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.92rem;
    padding: 8px 14px !important;
    border-radius: 8px;
    text-decoration: none;
    transition: color 180ms ease, background-color 180ms ease;
    position: relative;
}
.ptg-navbar .nav-link::after {
    content: "";
    position: absolute;
    left: 14px; right: 14px;
    bottom: 2px;
    height: 2px;
    background: var(--ptg-red);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.ptg-navbar .nav-link:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.04);
}
.ptg-navbar .nav-link:hover::after { transform: scaleX(0.5); }
.ptg-navbar .nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(239, 68, 68, 0.10);
}
.ptg-navbar .nav-link.active::after { transform: scaleX(1); }

/* Right cluster */
.ptg-navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ptg-navbar-cta {
    display: flex;
    align-items: center;
    gap: 14px;
}
.nav-profile-link {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.nav-profile-link.active {
    color: var(--ptg-red);
}

/* Text-link "登入" — no background, accent on hover */
.navbar-link-text {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 8px 4px;
    border-radius: 6px;
    transition: color 180ms ease;
    display: inline-flex;
    align-items: center;
}
.navbar-link-text:hover { color: var(--ptg-red); }
.navbar-link-text:focus-visible {
    outline: 2px solid var(--ptg-red);
    outline-offset: 3px;
}

/* Primary CTA "註冊" — high-contrast pill with subtle lift */
.navbar-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ptg-red);
    color: #fff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    padding: 9px 16px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25),
                inset 0 0 0 1px rgba(255, 255, 255, 0.10);
    transition: transform 160ms ease, box-shadow 200ms ease, background-color 180ms ease;
}
.navbar-cta-primary:hover {
    background: #dc2626;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35),
                inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.navbar-cta-primary:active { transform: translateY(0); }
.navbar-cta-primary svg { transition: transform 160ms ease; }
.navbar-cta-primary:hover svg { transform: translateX(2px); }
.navbar-cta-primary:focus-visible {
    outline: 2px solid var(--ptg-gold);
    outline-offset: 3px;
}

/* Hamburger toggle (mobile) */
.navbar-toggle {
    display: none;
    width: 40px; height: 40px;
    border: 1px solid var(--border-default);
    background: transparent;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.navbar-toggle:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.16); }
.navbar-toggle .icon-close { display: none; }
.navbar-toggle[aria-expanded="true"] .icon-menu  { display: none; }
.navbar-toggle[aria-expanded="true"] .icon-close { display: block; }

/* === Mobile drawer === */
.navbar-drawer {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-sticky) + 1);
    pointer-events: none;
}
.navbar-drawer[aria-hidden="false"] { pointer-events: auto; }
.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 240ms ease;
}
.navbar-drawer[aria-hidden="false"] .drawer-backdrop { opacity: 1; }

.drawer-panel {
    position: absolute;
    top: 0; right: 0;
    height: 100dvh;
    width: min(320px, 86vw);
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-default);
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
.navbar-drawer[aria-hidden="false"] .drawer-panel { transform: translateX(0); }

.drawer-nav {
    display: flex;
    flex-direction: column;
    padding: var(--space-6) var(--space-3) var(--space-3);
    gap: 2px;
    flex: 1;
}
.drawer-link {
    display: block;
    padding: 14px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    transition: background-color 160ms ease, color 160ms ease;
}
.drawer-link:hover,
.drawer-link:focus-visible {
    background: var(--bg-card);
    color: var(--ptg-red);
    outline: none;
}
.drawer-cta {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
}
.drawer-cta .navbar-link-text {
    padding: 12px 14px;
    font-size: 0.95rem;
}
.drawer-cta-primary {
    justify-content: center;
    padding: 12px 16px;
    font-size: 0.95rem;
}

/* === Responsive: ≤ 768px === */
@media (max-width: 768px) {
    .ptg-navbar-row,
    .ptg-navbar > .container.container-ptg {
        padding: 12px 20px;
        gap: 8px;
    }
    .ptg-navbar .navbar-nav { display: none; }
    .ptg-navbar .ptg-navbar-cta { display: none; }
    .navbar-toggle { display: inline-flex; }
    .ptg-navbar-brand .brand-sub { display: none; }
}
@media (min-width: 769px) {
    /* On desktop, hide drawer entirely */
    .navbar-drawer { display: none; }
}

/* === Hero === */
.ptg-hero {
    padding: var(--space-16) 0 var(--space-12);
    text-align: center;
    position: relative;
}
.ptg-hero .eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--ptg-gold);
    margin-bottom: var(--space-3);
}
.ptg-hero h1 {
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}
.ptg-hero .lead {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
}

/* === Search Bar === */
.ptg-search {
    max-width: 640px;
    margin: var(--space-8) auto 0;
    position: relative;
}
.ptg-search input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    padding: var(--space-4) var(--space-6) var(--space-4) 3.5rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--duration-base) var(--ease-out);
}
.ptg-search input::placeholder { color: var(--text-faint); }
.ptg-search input:focus {
    outline: none;
    border-color: var(--ptg-red);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}
.ptg-search .search-icon {
    position: absolute;
    left: var(--space-5);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    pointer-events: none;
}

/* === Filter Chips === */
.ptg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-subtle);
}
.ptg-chip {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.ptg-chip:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--bg-card);
}
.ptg-chip.active {
    background: var(--ptg-red);
    border-color: var(--ptg-red);
    color: #fff;
}
.ptg-chip .chip-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    opacity: 0.7;
}

/* === Card Grid === */
.ptg-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-6);
    padding: var(--space-8) 0;
}
/* The HTML [hidden] attribute must always win over .ptg-card-grid's
   display:grid (they tie on specificity, but our rule loads later).
   Without this, setting element.hidden = true on #loading-state and
   #market-grid does nothing — the skeleton cards stay visible and the
   pulse animation runs forever, looking like a flicker. */
.ptg-card-grid[hidden] { display: none; }

/* === Specimen Card === */
.ptg-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--duration-base) var(--ease-out),
                box-shadow   var(--duration-base) var(--ease-out);
    position: relative;
}
.ptg-card-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

/* Rarity color accent (left border) */
.ptg-card-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--rarity-common);
    z-index: 2;
}
.ptg-card-item[data-rarity="uncommon"]::before { background: var(--rarity-uncommon); }
.ptg-card-item[data-rarity="rare"]::before      { background: var(--rarity-rare); }
.ptg-card-item[data-rarity="holo"]::before      { background: var(--rarity-holo); }
.ptg-card-item[data-rarity="ultra"]::before     { background: var(--rarity-ultra); }
.ptg-card-item[data-rarity="secret"]::before    { background: var(--rarity-secret); }

/* Card image area — full-bleed card art with 4-corner overlays */
.ptg-card-image {
    aspect-ratio: 2.5 / 3.5;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: var(--space-2);
}
.ptg-card-image .card-art {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: var(--bg-base);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5),
                inset 0 0 0 1px var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--text-faint);
    position: relative;
    transition: transform var(--duration-slow) var(--ease-out);
    z-index: 1;
}
.ptg-card-item:hover .card-art {
    transform: scale(1.04);
}

/* === Four-corner overlays on the card image ===
   All overlays are hidden by default. On hover, only the TR slot
   (set/number + price) is revealed — clean card art at rest. */
.card-ovl {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: calc(100% - 2 * var(--space-2));
    padding: 4px 8px;
    background: rgba(12, 10, 9, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 180ms ease;
}
.ptg-card-item:hover .card-ovl-tr,
.ptg-card-item:focus-within .card-ovl-tr { opacity: 1; }
.card-ovl-tl { top: var(--space-2); left: var(--space-2); }
.card-ovl-tr { top: var(--space-2); right: var(--space-2); text-align: right; align-items: flex-end; }
.card-ovl-bl { bottom: var(--space-2); left: var(--space-2); }
.card-ovl-br { bottom: var(--space-2); right: var(--space-2); text-align: right; align-items: flex-end; }

.card-ovl-name {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-ovl-set {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.card-ovl-rarity {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.card-ovl-rarity[data-rarity="rare"]   { color: var(--rarity-rare); }
.card-ovl-rarity[data-rarity="holo"]   { color: var(--rarity-holo); }
.card-ovl-rarity[data-rarity="ultra"]  { color: var(--rarity-ultra); }
.card-ovl-rarity[data-rarity="secret"] { color: var(--rarity-secret); }

.card-ovl-price {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--ptg-gold);
    line-height: 1;
}
.card-ovl-price .currency {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 2px;
}
.card-ovl-seller {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.1;
    /* truncate long usernames */
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-ovl-rating {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--ptg-gold);
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* === Right-click context menu on cards === */
.card-ctx-menu {
    position: fixed;
    z-index: 80;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
    transform-origin: top left;
    transition: opacity 140ms ease, transform 140ms ease;
    pointer-events: none;
}
.card-ctx-menu.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}
.card-ctx-menu .ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    text-align: left;
    transition: background-color 120ms ease, color 120ms ease;
}
.card-ctx-menu .ctx-item:hover:not(:disabled) { background: var(--bg-card); }
.card-ctx-menu .ctx-item:focus-visible { outline: 2px solid var(--ptg-red); outline-offset: -2px; }
.card-ctx-menu .ctx-item:disabled { color: var(--text-faint); cursor: default; }
.card-ctx-menu .ctx-item.danger { color: var(--ptg-red); }
.card-ctx-menu .ctx-item svg { flex-shrink: 0; }
.card-ctx-menu .ctx-sep {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 2px;
}
.card-ctx-menu .ctx-header {
    padding: 6px 10px 4px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Legacy meta classes retained for back-compat (market-search etc.) */
.ptg-card-meta { padding: var(--space-4); }
.ptg-card-set {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
}
.ptg-card-name {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 var(--space-2);
    color: var(--text-primary);
    line-height: 1.3;
}
.ptg-card-rarity-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}
.ptg-card-rarity-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.ptg-card-rarity-badge[data-rarity="holo"]   { color: var(--rarity-holo); }
.ptg-card-rarity-badge[data-rarity="ultra"]  { color: var(--rarity-ultra); }
.ptg-card-rarity-badge[data-rarity="secret"] { color: var(--rarity-secret); }

.ptg-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}
.ptg-card-price {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ptg-gold);
    line-height: 1;
}
.ptg-card-price .currency {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 2px;
}
.ptg-card-seller {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ptg-card-seller .seller-name {
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
}
.ptg-card-seller .seller-rating {
    font-family: var(--font-mono);
    color: var(--ptg-gold);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

/* === Stats Bar === */
.ptg-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    padding: var(--space-6) 0;
    border-bottom: 1px solid var(--border-subtle);
}
.ptg-stat { text-align: center; }
.ptg-stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.ptg-stat-value.accent { color: var(--ptg-gold); }
.ptg-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: var(--space-2);
}

/* === Empty State === */
.ptg-empty {
    text-align: center;
    padding: var(--space-16) var(--space-6);
    color: var(--text-muted);
}
.ptg-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--text-faint);
}

/* === Buttons === */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-6);
    transition: all var(--duration-base) var(--ease-out);
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
}
.btn:focus-visible {
    outline: 2px solid var(--ptg-red);
    outline-offset: 2px;
}
.btn-ptg-primary {
    background: var(--ptg-red);
    color: #fff;
    border-color: var(--ptg-red);
}
.btn-ptg-primary:hover {
    background: var(--ptg-red-dark);
    border-color: var(--ptg-red-dark);
    color: #fff;
    transform: translateY(-1px);
}
.btn-ptg-outline {
    background: transparent;
    border-color: var(--border-default);
    color: var(--text-secondary);
}
.btn-ptg-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-card);
}

/* === Footer === */
.ptg-footer {
    margin-top: var(--space-16);
    padding: var(--space-12) 0 var(--space-8);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}
.ptg-footer-links {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
    margin-top: var(--space-4);
}
.ptg-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--duration-base);
}
.ptg-footer-links a:hover { color: var(--text-primary); }

/* === Toast === */
.ptg-toast-container {
    position: fixed;
    top: 90px;
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.ptg-toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--ptg-red);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    min-width: 280px;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: ptg-toast-in var(--duration-base) var(--ease-out);
}
.ptg-toast.toast-success { border-left-color: var(--ptg-green); }
.ptg-toast.toast-error   { border-left-color: var(--ptg-red); }
.ptg-toast.toast-warning { border-left-color: var(--ptg-gold); }

@keyframes ptg-toast-in {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* === Utility === */
.container-ptg { max-width: 1280px; margin: 0 auto; padding: 0 var(--space-6); }

.skeleton {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* === Light Theme Override === */
[data-theme="light"] {
    --bg-base: #fafaf9;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5f4;
    --border-subtle: #e7e5e4;
    --border-default: #d6d3d1;
    --border-strong: #a8a29e;

    --text-primary: #0c0a09;
    --text-secondary: #292524;
    --text-muted: #57534e;
    --text-faint: #78716c;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.14);
}
[data-theme="light"] .ptg-navbar             { background: rgba(250, 250, 249, 0.65); }
[data-theme="light"] .ptg-navbar.is-scrolled  { background: rgba(250, 250, 249, 0.88); border-bottom-color: rgba(15, 23, 42, 0.06); box-shadow: 0 6px 28px rgba(15, 23, 42, 0.06); }
[data-theme="light"] .ptg-navbar-brand .vault-mark { background: linear-gradient(135deg, var(--ptg-red) 0%, #b91c1c 100%); }
[data-theme="light"] .ptg-navbar .nav-link:hover { background: rgba(15, 23, 42, 0.04); }
[data-theme="light"] .ptg-navbar .nav-link.active { background: rgba(239, 68, 68, 0.10); }
[data-theme="light"] .ptg-card-image .card-art { background: #f5f5f4; box-shadow: inset 0 0 0 1px var(--border-default); }

/* === Theme Toggle === */
.ptg-theme-toggle {
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}
.ptg-theme-toggle:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: var(--bg-card);
}
.ptg-theme-toggle .icon-sun { display: none; }
.ptg-theme-toggle .icon-moon { display: block; }
[data-theme="light"] .ptg-theme-toggle .icon-sun { display: block; }
[data-theme="light"] .ptg-theme-toggle .icon-moon { display: none; }

/* === Card Hover Overlay === */
.ptg-card-hover-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-3);
    display: flex;
    gap: var(--space-2);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-default);
    transform: translateY(100%);
    transition: transform var(--duration-base) var(--ease-out);
    z-index: 5;
}
.ptg-card-item:hover .ptg-card-hover-actions,
.ptg-card-item:focus-within .ptg-card-hover-actions {
    transform: translateY(0);
}
.hover-action-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}
.hover-action-btn:hover {
    border-color: var(--ptg-red);
    color: var(--ptg-red);
    background: var(--bg-base);
}
.hover-action-btn.primary {
    background: var(--ptg-red);
    border-color: var(--ptg-red);
    color: #fff;
}
.hover-action-btn.primary:hover {
    background: var(--ptg-red-dark);
    border-color: var(--ptg-red-dark);
    color: #fff;
}

/* === Auth Form Pages === */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
}
.auth-card h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-2);
}
.auth-card .auth-subtitle {
    color: var(--text-muted);
    margin-bottom: var(--space-6);
    font-size: 0.9rem;
}
.auth-form .form-group {
    margin-bottom: var(--space-4);
}
.auth-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-form .form-control {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--duration-base) var(--ease-out);
}
.auth-form .form-control:focus {
    outline: none;
    border-color: var(--ptg-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.auth-form .btn {
    width: 100%;
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
}
.auth-form .form-row {
    display: flex;
    gap: var(--space-3);
}
.auth-form .form-row > * { flex: 1; }

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-6);
}
.auth-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--duration-base) var(--ease-out);
    font-size: 0.9rem;
}
.auth-tab.active {
    color: var(--ptg-red);
    border-bottom-color: var(--ptg-red);
}
.auth-tab:hover { color: var(--text-primary); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-6) 0;
    color: var(--text-faint);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}
.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 0.875rem;
    color: var(--text-muted);
}
.auth-footer a { color: var(--ptg-red); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.code-sent-banner {
    background: var(--bg-base);
    border: 1px solid var(--ptg-green);
    border-left: 3px solid var(--ptg-green);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}
.code-sent-banner strong { color: var(--ptg-green); }

/* === Auth form field controls === */
.auth-form .auth-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-form input.form-control {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--duration-base) var(--ease-out);
}
.auth-form input.form-control:focus {
    outline: none;
    border-color: var(--ptg-red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.auth-form .form-hint {
    margin: var(--space-2) 0 0;
    font-size: 0.75rem;
    color: var(--text-faint);
}
.auth-form .auth-submit {
    width: 100%;
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
    margin-top: var(--space-4);
}
.auth-form .auth-link {
    background: transparent;
    border: none;
    color: var(--ptg-blue);
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color var(--duration-base);
}
.auth-form .auth-link:hover { color: var(--text-primary); text-decoration: underline; }
.auth-form .auth-link:disabled { color: var(--text-faint); cursor: not-allowed; text-decoration: none; }

/* Back link / button — compact ghost with arrow */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: color var(--duration-base) var(--ease-out),
                border-color var(--duration-base) var(--ease-out),
                background-color var(--duration-base) var(--ease-out);
}
.btn-back:hover {
    color: var(--text-primary) !important;
    border-color: var(--border-default);
    background: var(--bg-card);
}
.btn-back svg { flex-shrink: 0; }

.auth-code-input {
    font-family: var(--font-mono) !important;
    font-size: 1.5rem !important;
    letter-spacing: 0.5em;
    text-align: center;
    padding: var(--space-4) var(--space-3) !important;
}

/* === Multi-step form === */
.step-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 var(--space-2);
    color: var(--text-primary);
}
.step-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0 0 var(--space-4);
}
.step-hint strong { color: var(--text-secondary); }
.step-hint .auth-link { color: var(--ptg-blue); }

.step-error {
    margin: var(--space-3) 0 0;
    padding: var(--space-2) var(--space-3);
    background: rgba(239, 68, 68, 0.10);
    border-left: 3px solid var(--ptg-red);
    color: var(--ptg-red);
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* === Button spinner (loading) === */
.btn-spinner {
    display: inline-flex;
    align-items: center;
}
@keyframes ptg-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* === Auth tab panel === */
.auth-tab-panel { animation: ptg-fade-in var(--duration-base) var(--ease-out); }
@keyframes ptg-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === Responsive === */
@media (max-width: 768px) {
    .ptg-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--space-4);
    }
    .ptg-hero { padding: var(--space-8) 0 var(--space-6); }
    .ptg-card-meta { padding: var(--space-3); }
    .ptg-card-name { font-size: 0.95rem; }
    .ptg-card-price { font-size: 1.05rem; }
}

/* === Accessibility === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

::selection {
    background: var(--ptg-red);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--ptg-gold);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* === Cookie consent banner (OneTrust-style) === */
.ot-sdk-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    padding: 16px 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.55;
}
.ot-sdk-container[hidden] { display: none !important; }
.ot-sdk-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    max-width: 1280px;
    margin: 0 auto;
}
.ot-sdk-columns { box-sizing: border-box; }
.ot-sdk-eight   { flex: 1 1 480px; min-width: 0; }
.ot-sdk-three   { flex: 0 0 auto; min-width: 280px; }
.banner_logo { display: none; } /* no logo asset; reserved for future */
#onetrust-policy-text {
    color: #4b5563;
    font-size: 13px;
}
#onetrust-policy-text a {
    color: #1d4ed8;
    text-decoration: underline;
}
#onetrust-policy-text a:hover { text-decoration: none; }
#onetrust-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
#onetrust-button-group button {
    border: 1px solid #1d4ed8;
    background: #ffffff;
    color: #1d4ed8;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#onetrust-button-group button:hover { background: #eff6ff; }
#onetrust-pc-btn-handler { /* secondary */ }
#onetrust-reject-all-handler { /* secondary */ }
#onetrust-accept-btn-handler {
    background: #1d4ed8;
    color: #ffffff;
}
#onetrust-accept-btn-handler:hover {
    background: #1e40af;
    color: #ffffff;
}
@media (max-width: 640px) {
    .ot-sdk-container { padding: 12px 16px; }
    .ot-sdk-eight, .ot-sdk-three { flex: 1 1 100%; }
    #onetrust-button-group { justify-content: stretch; }
    #onetrust-button-group button { flex: 1 1 auto; }
}
@media (prefers-color-scheme: dark) {
    .ot-sdk-container {
        background: #1f2937;
        color: #f3f4f6;
        border-top-color: #374151;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
    }
    #onetrust-policy-text { color: #d1d5db; }
    #onetrust-policy-text a { color: #93c5fd; }
    #onetrust-button-group button {
        background: #1f2937;
        color: #93c5fd;
        border-color: #93c5fd;
    }
    #onetrust-button-group button:hover { background: #111827; }
    #onetrust-accept-btn-handler { background: #1d4ed8; color: #ffffff; }
    #onetrust-accept-btn-handler:hover { background: #2563eb; color: #ffffff; }
}
