/* ── EchoForge Accounts Portal ─────────────────────────── */
:root {
    --bg-deep: #0d0d14;
    --bg: #1a1f2e;
    --surface: #242a3a;
    --border: rgba(255, 255, 255, 0.10);
    --text: #f2e9dd;
    --muted: #9a9aab;
    --white: #ffffff;
    --text-dark: #1a1a1a;
    --gold: #d4a04a;
    --gold-light: #e8c47a;
    --gold-dark: #b8862e;
    --blue: #3ba8ff;
    --blue-soft: #7fd3ff;
    --red: #e74c3c;
    --green: #2ecc71;
    --radius: 14px;
    --radius-sm: 10px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-deep);
    background-image:
        radial-gradient(1200px 700px at 15% 10%, rgba(59, 168, 255, 0.08), transparent 60%),
        radial-gradient(900px 600px at 85% 20%, rgba(212, 160, 74, 0.06), transparent 55%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-family: 'Cinzel', Georgia, serif;
    font-weight: 700;
    line-height: 1.2;
}

a { color: var(--blue); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--blue-soft); }

/* ── Nav ──────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(13, 13, 20, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav__brand {
    text-decoration: none;
    display: flex;
    align-items: center;
}
.nav__brand img {
    height: 80px;
    width: auto;
}

.nav__links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav__links a {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav__links a:hover { color: var(--white); }
.nav__links a.active { color: var(--white); }

.nav__user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 0.85rem;
}

.nav__user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-dark);
}

/* ── Main ─────────────────────────────────────────────── */
.main {
    padding-top: 72px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Auth Card (login, register, verify, etc.) ─────────── */
.auth-card {
    background: linear-gradient(135deg, var(--surface), rgba(36, 42, 58, 0.6));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    max-width: 440px;
    width: 90%;
    margin: 60px auto 0;
}

.auth-card__title {
    color: var(--gold);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 4px;
}

.auth-card__subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 28px;
}

.auth-card__icon {
    font-size: 3rem;
    text-align: center;
    margin: 16px 0;
    opacity: 0.6;
}

.auth-card__hint {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 12px;
    line-height: 1.5;
}

.auth-card__footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-card__sep { margin: 0 8px; opacity: 0.4; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Passkey list */
.passkey-list { margin-bottom: 8px; }
.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.passkey-item__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.passkey-item__info span { font-size: 0.8rem; }

/* ── Forms ─────────────────────────────────────────────── */
.form { margin-top: 8px; }

.form__group {
    margin-bottom: 18px;
}

.form__group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.form__optional {
    font-weight: 400;
    opacity: 0.6;
}

.form__group input {
    width: 100%;
    padding: 12px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(13, 13, 20, 0.5);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.form__group input::placeholder { color: rgba(154, 154, 171, 0.5); }
.form__group input:focus { border-color: var(--gold); }

.form__hint {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 4px;
    opacity: 0.7;
}

.form__error {
    color: var(--red);
    font-size: 0.85rem;
    min-height: 0;
    margin-bottom: 4px;
    transition: all 0.15s;
}

.form__error:not(:empty) {
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 6px;
    margin-bottom: 12px;
}

.form__success {
    color: var(--green);
    font-size: 0.85rem;
    min-height: 0;
    margin-bottom: 4px;
}

.form__success:not(:empty) {
    padding: 8px 12px;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 6px;
    margin-bottom: 12px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn--gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--text-dark);
    box-shadow: 0 4px 16px rgba(212, 160, 74, 0.15);
}
.btn--gold:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 160, 74, 0.25);
}

.btn--outline {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
}
.btn--outline:hover {
    border-color: var(--blue);
    background: rgba(59, 168, 255, 0.06);
    color: var(--white);
}

.btn--danger {
    border-color: rgba(231, 76, 60, 0.3);
    color: var(--red);
}
.btn--danger:hover {
    border-color: var(--red);
    background: rgba(231, 76, 60, 0.1);
}

.btn--sm { padding: 8px 16px; font-size: 0.8rem; min-height: 36px; }
.btn--full { width: 100%; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Dashboard ────────────────────────────────────────── */
.dashboard {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.dashboard__header { margin-bottom: 8px; }

.dashboard__title {
    color: var(--white);
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.dashboard__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard__grid--single {
    grid-template-columns: 1fr;
    max-width: 560px;
}

.back-link {
    font-size: 0.85rem;
    color: var(--muted);
    display: inline-block;
    margin-bottom: 8px;
}
.back-link:hover { color: var(--blue); }

/* ── Cards ────────────────────────────────────────────── */
.card {
    background: linear-gradient(135deg, var(--surface), rgba(36, 42, 58, 0.6));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.card__heading {
    color: var(--gold);
    font-size: 1rem;
    margin-bottom: 16px;
}

.card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.card__row:last-of-type { border-bottom: none; }

.card__label { color: var(--muted); font-size: 0.85rem; }
.card__value { color: var(--text); font-size: 0.85rem; font-weight: 500; }

.card .btn { margin-top: 16px; }

/* ── Profile ──────────────────────────────────────────── */
.profile {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.profile__avatar-wrap {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}

.profile__avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-dark);
    overflow: hidden;
}

.profile__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile__avatar-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    opacity: 0;
    transition: opacity 0.15s;
    cursor: pointer;
}

.profile__avatar-wrap:hover .profile__avatar-overlay {
    opacity: 1;
}

.profile__name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
}

.profile__email {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 2px;
}

.profile__badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile__badge--premium {
    background: rgba(212, 160, 74, 0.15);
    color: var(--gold);
    border-color: rgba(212, 160, 74, 0.3);
}

/* ── Games List ───────────────────────────────────────── */
.games-list { min-height: 40px; }

.games-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.games-list__item:last-child { border-bottom: none; }

.games-list__info {
    flex: 1;
    min-width: 0;
}

.games-list__name {
    font-weight: 500;
    font-size: 0.9rem;
}

.games-list__date {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 2px;
}

.games-list__play {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.games-list__play:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 160, 74, 0.25);
    color: var(--text-dark);
}

.games-list__play svg {
    width: 12px;
    height: 12px;
}

/* ── Social Links ────────────────────────────────────── */
.social-list { min-height: 40px; }

.social-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.social-item:last-child { border-bottom: none; }

.social-item__icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--white);
}
.social-item__icon--discord { background: #5865F2; }
.social-item__icon--twitter { background: #1DA1F2; }
.social-item__icon--twitch  { background: #9146FF; }
.social-item__icon--youtube { background: #FF0000; }
.social-item__icon--github  { background: #333; }

.social-item__info { flex: 1; min-width: 0; }

.social-item__platform {
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.social-item__username {
    font-size: 0.75rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.social-item__verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #5865F2;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    margin-left: 4px;
    vertical-align: middle;
}

.social-item__action {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.social-item__action:hover {
    border-color: var(--blue);
    color: var(--blue);
}
.social-item__action--connect {
    border-color: rgba(59, 168, 255, 0.3);
    color: var(--blue);
}
.social-item__action--disconnect {
    border-color: rgba(231, 76, 60, 0.2);
    color: var(--red);
}
.social-item__action--disconnect:hover {
    border-color: var(--red);
}

/* ── Referral ────────────────────────────────────────── */
.referral-code {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.referral-code__value {
    flex: 1;
    padding: 8px 12px;
    background: rgba(13, 13, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--gold-light);
    letter-spacing: 0.1em;
    user-select: all;
}

.referral-code__copy {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.referral-code__copy:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.referral-link {
    font-size: 0.75rem;
    color: var(--muted);
    word-break: break-all;
    margin-bottom: 12px;
    opacity: 0.7;
}

.referral-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.referral-stat__label { font-size: 0.85rem; color: var(--muted); }
.referral-stat__value { font-size: 1rem; font-weight: 600; color: var(--gold); }

/* ── Sessions ─────────────────────────────────────────── */
.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.session-item:last-child { border-bottom: none; }

.session-item__info {
    display: flex;
    flex-direction: column;
}

.session-item__device {
    font-size: 0.85rem;
    color: var(--text);
}

.session-item__ip {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

.session-item__date {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ── TOTP / 2FA ───────────────────────────────────────── */
.qr-container {
    text-align: center;
    margin: 20px 0;
}

.qr-container img {
    border-radius: 8px;
    background: white;
    padding: 8px;
}

.totp-manual {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--muted);
}

.totp-manual summary {
    cursor: pointer;
    color: var(--blue);
}

.totp-secret {
    display: block;
    margin-top: 8px;
    padding: 10px;
    background: rgba(13, 13, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--gold-light);
    user-select: all;
}

.totp-enabled {
    color: var(--green);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.totp-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Recovery Codes ───────────────────────────────────── */
.recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 20px 0;
}

.recovery-code {
    padding: 8px 12px;
    background: rgba(13, 13, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-align: center;
    color: var(--gold-light);
    user-select: all;
}

.recovery-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 400px;
    width: 90%;
}

.modal__title {
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ── Game Stats ────────────────────────────────────────── */
.games-list__stats {
    font-size: 0.72rem;
    color: var(--gold-light);
    margin-top: 2px;
    font-family: 'Inter', sans-serif;
}

/* ── News ──────────────────────────────────────────────── */
.news-list { min-height: 40px; }

.news-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.news-item:last-child { border-bottom: none; }

.news-item__date {
    font-size: 0.68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-item__title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 2px;
}
.news-item__title a { color: var(--gold-light); }
.news-item__title a:hover { color: var(--gold); }

.news-item__body {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Toggle Switch ────────────────────────────────────── */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--surface);
    border-radius: 22px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: 0.2s;
}
.toggle__slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--muted);
    border-radius: 50%;
    transition: 0.2s;
}
.toggle input:checked + .toggle__slider {
    background: var(--gold-dark);
    border-color: var(--gold);
}
.toggle input:checked + .toggle__slider::before {
    background: var(--white);
    transform: translateX(18px);
}
.toggle input:disabled + .toggle__slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Utilities ─────────────────────────────────────────── */
.muted { color: var(--muted); font-size: 0.85rem; }
.small { font-size: 0.75rem; margin-top: 4px; }
.text-center { text-align: center; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .dashboard__grid { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 20px; margin-top: 40px; }
    .nav { padding: 12px 16px; }
}

@media (max-width: 480px) {
    .recovery-codes { grid-template-columns: 1fr; }
    .profile { flex-direction: column; text-align: center; }
}
