/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #0f0f13; color: #e2e2e8; line-height: 1.6; }
a { color: #7c6aff; text-decoration: none; }
a:hover { color: #a594ff; }
img { max-width: 100%; display: block; }

/* ===== LAYOUT ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-content { padding: 40px 20px; }

/* ===== NAVBAR ===== */
.navbar { background: #16161e; border-bottom: 1px solid #2a2a3a; position: sticky; top: 0; z-index: 100; }
.nav-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { font-size: 1.4rem; font-weight: 800; color: #fff; }
.logo span { color: #7c6aff; }
.nav-links { list-style: none; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-links a { color: #b0b0c0; font-size: 0.9rem; padding: 6px 10px; border-radius: 6px; transition: color .2s; }
.nav-links a:hover { color: #fff; }
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; background: none; border: none; color: #e2e2e8; font-size: 1.4rem; cursor: pointer; margin-left: auto; }

/* ===== BUTTONS ===== */
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: all .2s; }
.btn-primary { background: #7c6aff; color: #fff; }
.btn-primary:hover { background: #6a58e8; color: #fff; }
.btn-outline { background: transparent; color: #7c6aff; border: 1.5px solid #7c6aff; }
.btn-outline:hover { background: #7c6aff; color: #fff; }
.btn-danger { background: #e84040; color: #fff; }
.btn-danger:hover { background: #c93535; color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; text-align: center; }
.btn-sm { display: inline-block; padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; border: none; background: #7c6aff; color: #fff; }
.btn-sm.btn-outline { background: transparent; color: #7c6aff; border: 1.5px solid #7c6aff; }
.btn-sm.btn-primary { background: #7c6aff; color: #fff; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 0.85rem; color: #888; padding: 4px 8px; border-radius: 4px; }
.btn-icon.btn-danger:hover { background: #e84040; color: #fff; }

/* ===== FLASH ===== */
.flash { padding: 12px 0; font-weight: 500; }
.flash-success { background: #1a3a1a; border-bottom: 2px solid #3c9e3c; color: #6fcf6f; }
.flash-error { background: #3a1a1a; border-bottom: 2px solid #9e3c3c; color: #cf6f6f; }

/* ===== HERO ===== */
.hero { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); padding: 80px 20px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 900; color: #fff; line-height: 1.2; }
.hero h1 span { color: #7c6aff; }
.hero-sub { font-size: 1.1rem; color: #b0b0c0; margin: 16px auto; max-width: 520px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

/* ===== STATS BAR ===== */
.stats-bar { background: #1e1e2a; border-bottom: 1px solid #2a2a3a; padding: 20px; }
.stats-grid { display: flex; justify-content: center; gap: 48px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: #7c6aff; }
.stat span:last-child { font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: .05em; }

/* ===== SECTIONS ===== */
.section { padding: 60px 20px; }
.section.bg-alt { background: #13131a; }
.section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 28px; color: #fff; }
.see-all { font-size: 0.9rem; font-weight: 400; margin-left: 12px; }

/* ===== GAME CARDS ===== */
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; max-width: 600px; }
.game-card { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 16px; padding: 36px 24px; text-align: center; transition: all .2s; }
.game-card:hover { border-color: #7c6aff; transform: translateY(-3px); }
.game-card.op:hover { border-color: #ff6b35; }
.game-card.poke:hover { border-color: #ffd700; }
.game-icon { font-size: 2.5rem; margin-bottom: 12px; }
.game-card h3 { color: #fff; font-size: 1.1rem; margin-bottom: 4px; }
.game-card p { color: #888; font-size: 0.85rem; }

/* ===== FEATURES ===== */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.feature { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 16px; padding: 28px; }
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature h3 { color: #fff; margin-bottom: 8px; }
.feature p { color: #888; font-size: 0.9rem; }

/* ===== CARD GRID ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.card-item { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 12px; overflow: hidden; transition: all .2s; display: block; }
.card-item:hover { border-color: #7c6aff; transform: translateY(-2px); }
.card-img { position: relative; aspect-ratio: 3/4; background: #16161e; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder { font-size: 2.5rem; color: #444; }
.card-placeholder-lg { font-size: 6rem; color: #444; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 3/4; background: #16161e; }
.card-info { padding: 10px; }
.card-num { font-size: 0.7rem; color: #666; }
.card-name { font-size: 0.85rem; font-weight: 600; color: #e2e2e8; line-height: 1.3; }
.card-set { font-size: 0.75rem; color: #888; margin-top: 2px; }
.card-price { font-size: 0.9rem; font-weight: 700; color: #7c6aff; margin-top: 4px; }
.card-seller, .card-dist { font-size: 0.75rem; color: #888; }
.card-cond { font-size: 0.75rem; color: #aaa; }

/* ===== BADGES ===== */
.badge { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 100px; background: #2a2a3a; color: #aaa; }
.badge-onepiece { background: #3d1f0a; color: #ff6b35; }
.badge-pokemon { background: #3d3500; color: #ffd700; }
.rarity-badge { position: absolute; bottom: 4px; right: 4px; font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.7); color: #ffd700; }

/* ===== SETS ===== */
.sets-section { margin-bottom: 48px; }
.game-heading { font-size: 1.4rem; font-weight: 700; color: #fff; margin-bottom: 20px; border-left: 4px solid #7c6aff; padding-left: 12px; }
.lang-heading { font-size: 1rem; font-weight: 600; color: #aaa; margin: 20px 0 12px; text-transform: uppercase; letter-spacing: .06em; }
.sets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.set-card { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 12px; overflow: hidden; transition: all .2s; display: block; }
.set-card:hover { border-color: #7c6aff; transform: translateY(-2px); }
.set-placeholder { height: 100px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; background: #16161e; color: #444; }
.set-info { padding: 12px; }
.set-name { font-size: 0.9rem; font-weight: 600; color: #e2e2e8; }
.set-meta { font-size: 0.75rem; color: #888; margin-top: 2px; }
.set-date { font-size: 0.7rem; color: #666; margin-top: 2px; }

/* ===== FILTER / SEARCH ===== */
.search-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.search-input { flex: 1; min-width: 200px; background: #1e1e2a; border: 1px solid #2a2a3a; color: #e2e2e8; padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; }
.search-input:focus { outline: none; border-color: #7c6aff; }
.select-sm { background: #1e1e2a; border: 1px solid #2a2a3a; color: #e2e2e8; padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; }
.results-count { color: #888; font-size: 0.85rem; margin-bottom: 20px; }

.filter-tabs { display: flex; gap: 8px; margin-bottom: 32px; flex-wrap: wrap; }
.tab { padding: 8px 18px; border-radius: 100px; background: #1e1e2a; border: 1px solid #2a2a3a; color: #aaa; font-size: 0.85rem; font-weight: 500; transition: all .2s; }
.tab:hover, .tab.active { background: #7c6aff; border-color: #7c6aff; color: #fff; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.page-btn { padding: 8px 14px; border-radius: 8px; background: #1e1e2a; border: 1px solid #2a2a3a; color: #aaa; font-size: 0.85rem; }
.page-btn:hover, .page-btn.active { background: #7c6aff; border-color: #7c6aff; color: #fff; }

/* ===== CARD DETAIL ===== */
.card-detail-layout { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start; margin-bottom: 48px; }
.card-detail-img img { border-radius: 12px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,.5); }
.card-detail-info .badge { margin-bottom: 12px; }
.card-detail-info h1 { font-size: 1.8rem; color: #fff; margin-bottom: 8px; }
.card-alt-name { color: #888; font-size: 0.9rem; }
.card-attrs { margin: 20px 0; border-collapse: collapse; width: 100%; }
.card-attrs th { color: #888; font-weight: 500; font-size: 0.85rem; text-align: left; padding: 6px 12px 6px 0; width: 100px; }
.card-attrs td { color: #e2e2e8; font-size: 0.9rem; padding: 6px 0; }
.price-highlight { color: #7c6aff; font-weight: 700; font-size: 1.1rem; }
.card-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.input-sm { width: 60px; background: #1e1e2a; border: 1px solid #2a2a3a; color: #e2e2e8; padding: 8px; border-radius: 8px; font-size: 0.85rem; }

/* ===== LISTINGS TABLE ===== */
.listings-section { margin-top: 40px; }
.listings-section h2 { font-size: 1.2rem; font-weight: 700; color: #fff; margin-bottom: 16px; }
.listings-table-wrap { overflow-x: auto; }
.listings-table { width: 100%; border-collapse: collapse; }
.listings-table th { text-align: left; color: #888; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #2a2a3a; padding: 8px 12px; }
.listings-table td { padding: 10px 12px; border-bottom: 1px solid #1a1a24; font-size: 0.9rem; }
.cond-badge { background: #2a2a3a; color: #aaa; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; }
.price-col { color: #7c6aff; font-weight: 700; }

/* ===== LISTING DETAIL ===== */
.listing-price-box { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 12px; padding: 20px; margin: 20px 0; }
.big-price { font-size: 2rem; font-weight: 800; color: #7c6aff; display: block; }
.listing-qty { color: #888; font-size: 0.9rem; }
.market-ref { display: block; font-size: 0.8rem; color: #666; margin-top: 4px; }
.listing-desc { margin: 20px 0; background: #1e1e2a; border-radius: 8px; padding: 16px; }
.listing-desc h3 { color: #aaa; font-size: 0.85rem; margin-bottom: 8px; }
.listing-desc p { font-size: 0.9rem; color: #ccc; }

/* ===== PORTFOLIO ===== */
.portfolio-summary { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.summary-stat { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 12px; padding: 20px 28px; text-align: center; }
.stat-label { display: block; font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.stat-val { font-size: 1.5rem; font-weight: 800; color: #fff; }
.text-green { color: #6fcf6f; }
.text-red { color: #cf6f6f; }
.portfolio-filter { margin-bottom: 16px; }
.portfolio-table-wrap { overflow-x: auto; }
.portfolio-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.portfolio-table th { text-align: left; color: #888; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #2a2a3a; padding: 8px 12px; white-space: nowrap; }
.portfolio-table td { padding: 10px 12px; border-bottom: 1px solid #1a1a24; vertical-align: middle; }
.portfolio-card-cell { display: flex; align-items: center; gap: 10px; }
.thumb { width: 36px; height: 50px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

/* ===== AUTH ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 120px); padding: 40px 20px; }
.auth-box { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 1.6rem; color: #fff; margin-bottom: 4px; }
.auth-sub { color: #888; font-size: 0.9rem; margin-bottom: 28px; }
.auth-switch { margin-top: 20px; text-align: center; color: #888; font-size: 0.9rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #aaa; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; background: #16161e; border: 1px solid #2a2a3a; color: #e2e2e8;
    padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #7c6aff;
}
.form-group small { display: block; color: #666; font-size: 0.78rem; margin-top: 4px; }
.form-note { color: #888; font-size: 0.85rem; margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-card { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 16px; padding: 32px; max-width: 640px; }
.form-card h2 { color: #fff; font-size: 1.1rem; margin-bottom: 20px; }
.form-card hr { border: none; border-top: 1px solid #2a2a3a; margin: 28px 0; }

/* ===== SELL PAGE ===== */
.card-search-wrap { position: relative; }
.search-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #1e1e2a; border: 1px solid #7c6aff; border-radius: 8px; max-height: 240px; overflow-y: auto; z-index: 50; margin-top: 4px; }
.search-result-item { padding: 10px 14px; cursor: pointer; font-size: 0.9rem; border-bottom: 1px solid #2a2a3a; }
.search-result-item:hover { background: #2a2a3a; }
.selected-card { display: flex; align-items: center; gap: 12px; background: #16161e; border: 1px solid #2a2a3a; border-radius: 8px; padding: 12px; }
.location-row { display: flex; gap: 10px; }
.location-row input { flex: 1; }

/* ===== PROFILE ===== */
.profile-header { display: flex; gap: 28px; align-items: flex-start; margin-bottom: 40px; padding: 28px; background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 16px; }
.avatar-placeholder { width: 80px; height: 80px; border-radius: 50%; background: #7c6aff; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.profile-avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.profile-meta h1 { color: #fff; font-size: 1.5rem; }
.profile-username { color: #888; font-size: 0.9rem; margin-bottom: 6px; }
.profile-bio { color: #aaa; font-size: 0.9rem; margin: 8px 0; }
.profile-stats { font-size: 0.85rem; color: #888; margin-top: 8px; }

/* ===== NEARBY ===== */
.nearby-controls { background: #1e1e2a; border: 1px solid #2a2a3a; border-radius: 12px; padding: 24px; margin-bottom: 28px; }
.status-msg { background: #1e1e2a; border-radius: 8px; padding: 12px 16px; color: #888; margin-bottom: 20px; }
.card-dist { color: #7c6aff; font-size: 0.75rem; }

/* ===== MISC ===== */
.breadcrumb { font-size: 0.85rem; color: #666; margin-bottom: 20px; }
.breadcrumb a { color: #888; }
.page-title { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 8px; }
.page-meta { color: #888; font-size: 0.9rem; margin-bottom: 28px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-sub { color: #888; margin-bottom: 28px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.empty-state { text-align: center; padding: 60px 20px; color: #888; }
.empty-state p { margin-bottom: 16px; }
.error-code { font-size: 6rem; font-weight: 900; color: #7c6aff; }
.error-msg { font-size: 1.2rem; color: #888; margin-bottom: 24px; }
.text-center { text-align: center; }

/* ===== FOOTER ===== */
.footer { background: #16161e; border-top: 1px solid #2a2a3a; padding: 28px 20px; text-align: center; color: #666; font-size: 0.85rem; }
.footer-links { margin-top: 8px; }
.footer-links a { color: #888; margin: 0 6px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: #16161e; border-bottom: 1px solid #2a2a3a; padding: 16px; gap: 4px; }
    .nav-links.open { display: flex; }
    .nav-links li { width: 100%; }
    .nav-links a { display: block; padding: 10px 12px; }
    .card-detail-layout { grid-template-columns: 1fr; }
    .card-detail-img { max-width: 280px; margin: 0 auto; }
    .form-row { grid-template-columns: 1fr; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .portfolio-summary { justify-content: center; }
}
