/* Player portal. Builds on style.css + stats.css (tiles, meters, tables). */

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Sign-in / states */

.portal-gate {
    display: grid;
    place-items: center;
    min-height: 52vh;
    text-align: center;
}

.gate-panel {
    width: min(560px, 100%);
    padding: clamp(32px, 6vw, 52px) clamp(22px, 5vw, 44px);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(116, 192, 252, 0.14), transparent 60%),
        var(--panel);
}

.gate-panel .stats-title {
    margin-top: 12px;
    font-size: clamp(2rem, 5.5vw, 3.2rem);
}
.gate-panel .section-sub { margin: 14px auto 0; }

.cfx-btn { margin-top: 30px; }
.cfx-btn svg { width: 18px; height: 18px; }
.cfx-btn[disabled] { opacity: 0.6; pointer-events: none; }

.gate-error {
    min-height: 1.4em;
    margin-top: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bad);
}

.gate-notes {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--panel-border);
    list-style: none;
    font-size: 0.8rem;
    color: var(--text-faint);
}

.gate-notes a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 3px; }
.gate-notes a:hover { color: var(--text); }

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    animation: dot 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text {
    font-size: 0.85rem;
    color: var(--text-faint);
}

#view-loading { gap: 16px; align-content: center; }

/* ---------------------------------------------------------------- Account header */

.account-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.account-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(116, 192, 252, 0.4);
    background: var(--surface);
    object-fit: cover;
}

.account-name {
    margin-top: 4px;
    font-size: 1.5rem;
    font-weight: 800;
}

.account-meta {
    font-size: 0.8rem;
    color: var(--text-faint);
}

.empty-panel { padding: 28px; }
.empty-panel .chart-sub { margin-top: 8px; max-width: 640px; line-height: 1.6; }

/* ---------------------------------------------------------------- Character tabs */

.char-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.char-tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dim);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.char-tab:hover { color: var(--text); background: var(--surface-hover); }

.char-tab[aria-selected="true"] {
    color: var(--text);
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--c) 55%, transparent);
}

.char-tab i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c);
}

.char-tab .live {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #06120a;
    background: var(--ok);
}

/* ---------------------------------------------------------------- Character */

.char-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.char-name {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.char-job {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dim);
}

.char-job i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c);
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.badge svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.badge.ok { color: var(--ok); border-color: rgba(81, 207, 102, 0.3); }

.char-row { margin-top: 14px; }
.char-panel { padding: 22px 24px; }
.character > .char-panel { margin-top: 14px; }
.char-panel .block-title { margin-bottom: 14px; }

.profile {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    font-size: 0.9rem;
}

.profile dt { color: var(--text-faint); font-weight: 600; }
.profile dd { color: var(--text); font-weight: 600; }

.need + .need { margin-top: 16px; }

.need-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
}

.need-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.need .meter { margin-top: 8px; }
.need.low .meter-fill { background: var(--warn); }
.need.critical .meter-fill { background: var(--bad); }

.needs-note {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--text-faint);
}

.amount-in { color: var(--text); }
.amount-out { color: var(--text-dim); }

.char-panel .data-table { margin-top: 0; }
.char-panel .chart-empty { min-height: 80px; }

@media (max-width: 640px) {
    .account-head { flex-direction: column; align-items: flex-start; }
    .char-head { flex-direction: column; align-items: flex-start; }
    #char-bank .data-table th:nth-child(3),
    #char-bank .data-table td:nth-child(3) { display: none; } /* drop the balance column on phones */
}
