/* ── Hide Alpine elements until ready ────────────── */
[x-cloak] { display: none !important; }

/* ── Reset & Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0e0e1a;
    --bg-card: #161627;
    --bg-hover: #1e1e35;
    --border: #2a2a44;
    --text: #d4d4e0;
    --text-dim: #7a7a9a;
    --gold: #c4a35a;
    --gold-dim: #8a7340;
    --accent: #5865F2;
    --accent-hover: #4752C4;
    --green: #57F287;
    --red: #ED4245;
    --radius: 8px;
}

html {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    width: 100vw;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header / Nav styles are in nav.css ──────────── */

/* .login-prompt and .btn-discord are in nav.css */

/* ── Page content ────────────────────────────────── */
.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 28px 0 16px;
}

.page-header .page-title {
    margin: 0;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 28px 0 16px;
    color: var(--text);
}

.balance-inline {
    font-size: 15px;
    color: var(--gold);
    font-weight: 600;
}

/* ── Item Grid ───────────────────────────────────── */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, transform 0.1s;
}

.item-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-1px);
}

.item-card.owned {
    border-color: var(--green);
    opacity: 0.75;
}

.item-card.featured {
    border-color: var(--gold);
}

.item-preview {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg);
    border-radius: 4px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.item-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.item-preview .placeholder {
    color: var(--text-dim);
    font-size: 32px;
}

.item-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.item-description {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.35;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-price {
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 12px;
}

.item-footer {
    margin-top: auto;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: background 0.15s, opacity 0.15s;
    width: 100%;
}

.btn-buy {
    background: var(--gold);
    color: var(--bg);
}

.btn-buy:hover {
    background: #d4b36a;
}

.btn-buy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-owned {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
    cursor: default;
}

/* ── Inventory list ──────────────────────────────── */
.inv-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
}

.inv-item-icon {
    width: 48px;
    height: 48px;
    background: var(--bg);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.inv-item-icon img {
    max-width: 100%;
    max-height: 100%;
}

.inv-item-info { flex: 1; }

.inv-item-name {
    font-weight: 600;
    font-size: 14px;
}

.inv-item-meta {
    font-size: 12px;
    color: var(--text-dim);
}

/* ── Messages / Alerts ───────────────────────────── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-success { background: var(--green); color: var(--bg); }
.toast-error { background: var(--red); color: white; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

/* ── Banners ─────────────────────────────────────── */
.error-banner {
    background: #2d1215;
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 16px 0;
    color: var(--red);
    font-size: 14px;
}

.success-banner {
    background: #122d15;
    border: 1px solid var(--green);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 16px 0;
    color: var(--green);
    font-size: 14px;
}

/* ── Spinner ─────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Confirmation page ──────────────────────────── */
.confirmation-wrapper {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

.confirmation-card {
    text-align: center;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.confirmation-icon {
    font-size: 48px;
    color: var(--gold);
    margin-bottom: 8px;
}

.confirmation-icon-info {
    color: var(--accent);
}

.confirmation-heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.confirmation-runes {
    font-size: 32px;
    font-weight: 700;
    color: var(--gold);
    margin: 4px 0;
}

.confirmation-sub {
    font-size: 15px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.confirmation-balance {
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
    margin-top: 4px;
}

.confirmation-reassurance {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 8px;
    line-height: 1.5;
}

.confirmation-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    width: 100%;
}

.confirmation-btn-primary {
    max-width: 260px;
}

.confirmation-btn-secondary {
    font-size: 13px;
    color: var(--text-dim);
}

.confirmation-btn-secondary:hover {
    color: var(--text);
}

/* ── Subscription Warnings ───────────────────────── */
.sub-warning {
    border-radius: 8px;
    padding: 12px 18px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.sub-warning a {
    font-weight: 600;
}

.sub-warning-error {
    background: rgba(237, 66, 69, 0.08);
    border: 1px solid var(--red);
    color: var(--red);
}

.sub-warning-cancel {
    background: rgba(254, 231, 92, 0.08);
    border: 1px solid #FEE75C;
    color: #FEE75C;
}

/* ── Rune Packs ──────────────────────────────────── */
.runes-subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 24px;
}

.pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.pack-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 16px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    transition: border-color 0.15s, transform 0.1s;
}

.pack-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-1px);
}

.pack-card.pack-best {
    border-color: var(--gold);
}

.pack-badge {
    position: absolute;
    top: -10px;
    background: var(--gold);
    color: var(--bg);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 10px;
    border-radius: 10px;
}

.pack-runes {
    font-size: 28px;
    font-weight: 700;
    color: var(--gold);
}

.pack-label {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}

.pack-bonus {
    font-size: 12px;
    color: var(--green);
    font-weight: 500;
}

.pack-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 4px 0;
}

.btn-buy-pack {
    background: var(--accent);
    color: white;
    width: 100%;
    margin-top: 4px;
}

.btn-buy-pack:hover {
    background: var(--accent-hover);
}

.btn-buy-pack:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Section divider + titles ──────────────────── */
.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.section-divider {
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* ── Subscription toggle ──────────────────────── */
.sub-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px;
    margin-bottom: 20px;
}

.sub-toggle button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sub-toggle button.active {
    background: var(--accent);
    color: white;
}

/* ── Tier cards ───────────────────────────────── */
.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.tier-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 16px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    transition: border-color 0.15s, transform 0.1s;
}

.tier-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.tier-card.tier-active {
    border-color: var(--green);
}

.tier-current {
    position: absolute;
    top: -10px;
    background: var(--green);
    color: var(--bg);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 10px;
    border-radius: 10px;
}

.tier-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.tier-runes {
    font-size: 22px;
    font-weight: 700;
    color: var(--gold);
}

.tier-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 2px 0;
}

.tier-savings {
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
}

.btn-tier {
    background: var(--accent);
    color: white;
    width: 100%;
    margin-top: 8px;
    text-decoration: none;
    display: block;
}

.btn-tier:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.btn-tier:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-tier-manage {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
}

.btn-tier-manage:hover {
    background: rgba(87, 242, 135, 0.1);
    color: var(--green);
}

.btn-tier-upgrade {
    background: var(--accent);
    color: #fff;
}

.btn-tier-disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

/* ── Account page ────────────────────────────── */
.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
    margin: 0 auto;
}

.account-status {
    text-align: center;
    margin-bottom: 24px;
}

.account-tier-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.account-tier-runes {
    font-size: 18px;
    color: var(--gold);
    font-weight: 600;
}

.account-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.account-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.account-detail-label {
    color: var(--text-dim);
    font-size: 14px;
}

.account-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.account-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-cancel-notice {
    text-align: center;
    color: var(--red);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.btn-manage {
    background: var(--accent);
    color: white;
}

.btn-manage:hover {
    background: var(--accent-hover);
}

.btn-manage:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.account-empty {
    text-align: center;
    padding: 40px 20px;
}

.account-empty p {
    color: var(--text-dim);
    margin-bottom: 16px;
}

.btn-subscribe-link {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
}

.btn-subscribe-link:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

/* ── Footer ─────────────────────────────────────── */
.site-footer {
    margin-top: 60px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.footer-inner a {
    color: var(--text-dim);
    text-decoration: none;
}

.footer-inner a:hover {
    color: var(--text);
}

.footer-sep {
    opacity: 0.4;
}
