/* ─────────────────────────────────────────
   AVADAO Portal — portal.css
   Extends the main style.css design tokens.
   No token overrides — fully compatible.
   ───────────────────────────────────────── */

/* ════════════════════════════════════════
   PORTAL HERO
════════════════════════════════════════ */

.portal-hero {
    padding-top: 100px; /* clear the fixed header */
    padding-bottom: 56px;
    background: var(--hero-bg);
    border-bottom: 1px solid var(--border);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.portal-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--lime-dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--lime-dim) 1px, transparent 1px);
    background-size: 44px 44px;
    pointer-events: none;
}

.portal-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px;
}

.portal-eyebrow {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--lime);
    margin-bottom: 18px;
}

.portal-hero h1 {
    font-family: var(--sans);
    font-weight: 800;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    line-height: 1.05;
    color: var(--hero-text);
    margin-bottom: 18px;
}

.lime { color: var(--lime); }

.portal-hero-sub {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--hero-dim);
    max-width: 480px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

/* ── Wallet chip (connected state in hero) ── */
.wallet-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border-med);
    border-radius: 99px;
    padding: 8px 16px 8px 10px;
    font-family: var(--mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.wallet-chip:hover { border-color: var(--lime-border); }

.wallet-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--lime);
    flex-shrink: 0;
}

.wallet-addr { color: var(--text-dim); }

/* ════════════════════════════════════════
   PORTAL BODY LAYOUT
════════════════════════════════════════ */

.portal-body {
    padding: 48px 20px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.portal-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    align-items: start;
}

@media (max-width: 860px) {
    .portal-layout {
        grid-template-columns: 1fr;
    }
    .portal-sidebar {
        order: -1; /* sidebar above games on mobile */
    }
}

/* ── Section label (matches main site style) ── */
.section-label {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-dimmer);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ════════════════════════════════════════
   GAME GRID
════════════════════════════════════════ */

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.game-card:hover {
    border-color: var(--lime-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow-red);
}
.game-card.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.game-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    position: relative;
    overflow: hidden;
}
.game-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, var(--surface) 100%);
}
.game-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.game-info { padding: 12px 14px 14px; }

.game-title {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 4px;
}

.game-desc {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 10px;
}

.game-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tag {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--surface2);
    color: var(--text-dimmer);
    border: 1px solid var(--border);
}
.tag.avax {
    background: var(--lime-dim);
    border-color: var(--lime-border);
    color: var(--lime);
}
.tag.nft  { background: rgba(138,80,255,0.1); border-color: rgba(138,80,255,0.3); color: #a78bfa; }

/* ════════════════════════════════════════
   SIDEBAR CARDS
════════════════════════════════════════ */

.portal-sidebar { display: flex; flex-direction: column; gap: 16px; }

.portal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.portal-card-title {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dimmer);
    margin-bottom: 16px;
}

/* ── Profile card ── */
.profile-cta p {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 14px;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.profile-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lime), rgba(192,230,19,0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sans);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--bg);
    flex-shrink: 0;
}

.profile-name {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.profile-wallet-addr {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-dimmer);
    margin-top: 2px;
}

.username-row {
    display: flex;
    gap: 8px;
}

/* ── Portal input ── */
.portal-input {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--border-med);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.portal-input:focus { border-color: var(--lime-border); }
.portal-input::placeholder { color: var(--text-dimmer); }

/* ── Leaderboard ── */
.lb-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.lb-tab {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-med);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
}
.lb-tab:hover { border-color: var(--lime-border); color: var(--lime); }
.lb-tab.active { background: var(--lime-mid); border-color: var(--lime-border); color: var(--lime); }

.lb-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.lb-entry:last-child { border-bottom: none; }

.lb-rank {
    width: 22px;
    text-align: right;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-dimmer);
    flex-shrink: 0;
}
.lb-rank.gold   { color: #fbbf24; font-weight: 700; }
.lb-rank.silver { color: #94a3b8; font-weight: 700; }
.lb-rank.bronze { color: #b87333; font-weight: 700; }

.lb-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lime), rgba(192,230,19,0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sans);
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--bg);
    flex-shrink: 0;
}

.lb-name {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lb-name.is-me { color: var(--lime); }

.lb-score {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--lime);
    font-weight: 700;
    flex-shrink: 0;
}

.lb-empty {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dimmer);
    text-align: center;
    padding: 24px 0;
}

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */

.btn-portal {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    padding: 11px 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.18s;
    white-space: nowrap;
}
.btn-lime {
    background: var(--lime);
    color: var(--bg);
}
.btn-lime:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-med);
}
.btn-ghost:hover { border-color: var(--lime-border); color: var(--lime); }
.btn-sm { padding: 7px 14px; font-size: 0.68rem; }

/* ════════════════════════════════════════
   GAME LAUNCHER OVERLAY
════════════════════════════════════════ */

#launcher {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: var(--bg2);
    flex-direction: column;
}
#launcher.open { display: flex; }

.launcher-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    height: 52px;
}

.launcher-title {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.95rem;
    flex: 1;
}

.launcher-status {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--lime);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--lime);
    animation: blink 2s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.25; }
}

#game-frame {
    flex: 1;
    width: 100%;
    border: none;
}

/* Leaderboard panel inside launcher */
.launcher-lb-panel {
    position: absolute;
    top: 52px; right: 0; bottom: 0;
    width: 320px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 24px 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 10;
}
.launcher-lb-panel.open {
    transform: translateX(0);
}

/* ════════════════════════════════════════
   MODALS
════════════════════════════════════════ */

.modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10,11,13,0.88);
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(6px);
}
.modal-bg.open { display: flex; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border-med);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 420px;
    width: 100%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-box h2 {
    font-family: var(--sans);
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 10px;
}
.modal-box p {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */

#portal-toast {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 1100;
    background: var(--surface);
    border: 1px solid var(--border-med);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-family: var(--mono);
    font-size: 0.75rem;
    transform: translateY(80px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 320px;
}
#portal-toast.show { transform: translateY(0); opacity: 1; }
#portal-toast.success { border-color: var(--lime-border); color: var(--lime); }
#portal-toast.error   { border-color: rgba(255,80,80,0.4); color: #ff6b6b; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 600px) {
    .launcher-lb-panel { width: 100%; }
    .modal-box { padding: 24px 18px; }
    .portal-body { padding: 32px 14px 60px; }
}
