:root {
    --bg-0: #060a14;
    --bg-1: #0e1629;
    --panel: rgba(14, 22, 41, 0.94);
    --surface: #131e36;
    --border: rgba(99, 102, 241, 0.25);
    --border-soft: rgba(148, 163, 184, 0.14);
    --text: #f8fafc;
    --muted: #94a3b8;
    --indigo: #6366f1;
    --cyan: #06b6d4;
    --cyan-bright: #22d3ee;
    --mint: #10b981;
    --red: #ef4444;
    --font-head: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: linear-gradient(180deg, #091024 0%, var(--bg-0) 65%);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.sapphire-grid {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.05) 1px, transparent 1px);
    background-size: 36px 36px;
}
.orb { position: fixed; border-radius: 50%; filter: blur(110px); pointer-events: none; z-index: 0; }
.orb-indigo { width: 320px; height: 320px; top: -110px; left: -60px; background: rgba(99, 102, 241, 0.22); }
.orb-cyan { width: 300px; height: 300px; bottom: -100px; right: -50px; background: rgba(6, 182, 212, 0.16); }

.galaxy-bar {
    position: relative; z-index: 2;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.18));
    border-bottom: 1px solid var(--border);
    padding: 7px 12px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.4px; color: #cffafe;
    text-align: center;
}

.gx-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(6, 10, 20, 0.86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-soft);
}
.gx-nav {
    max-width: 750px; margin: 0 auto; padding: 10px 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.gx-brand { display: flex; align-items: center; gap: 10px; }
.gx-emblem {
    width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(34, 211, 238, 0.35);
    display: flex; align-items: center; justify-content: center;
}
.gx-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.gx-title { font-family: var(--font-head); font-size: 15px; font-weight: 700; letter-spacing: 0.4px; }
.cyan-text { color: var(--cyan-bright); }
.gx-sub { font-size: 11px; color: var(--muted); }

.gx-status {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 8px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399; font-size: 11px; font-weight: 700;
    white-space: nowrap;
}
.gx-pulse {
    width: 7px; height: 7px; border-radius: 50%; background: var(--mint);
    animation: pulseGx 1.7s infinite;
}
@keyframes pulseGx {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.8); }
}

.gx-wrap { position: relative; z-index: 2; max-width: 750px; margin: 0 auto; padding: 14px 12px 32px; }

.gx-stepper {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 12px; padding: 0 4px;
}
.gx-step {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.gx-num {
    padding: 2px 7px; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--border-soft);
    font-family: var(--font-mono); font-size: 10.5px;
}
.gx-step.active { color: var(--cyan-bright); }
.gx-step.active .gx-num {
    background: linear-gradient(135deg, var(--indigo), var(--cyan));
    color: #fff; border-color: transparent;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.45);
}
.gx-step.done { color: #34d399; }
.gx-step.done .gx-num { background: var(--mint); color: #052e16; border-color: var(--mint); }
.gx-track { flex: 1; height: 1px; background: var(--border-soft); }

.gx-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.step-pane { display: none; animation: slideFade 0.28s ease; }
.step-pane.active { display: block; }
@keyframes slideFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.gx-head { text-align: center; margin-bottom: 14px; }
.gx-head.compact { margin-bottom: 12px; }
.gx-tag {
    display: inline-block; padding: 4px 10px; border-radius: 7px;
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.6px;
    background: rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(34, 211, 238, 0.35);
    color: #a5f3fc; margin-bottom: 6px;
}
.gx-tag.emerald-tag {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.38);
    color: #34d399;
}
.gx-head h1, .gx-head h2 {
    font-family: var(--font-head);
    font-size: clamp(20px, 4.6vw, 26px);
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}
.gx-head p { font-size: 13px; color: var(--muted); line-height: 1.45; }

.gx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }

.dev-card {
    background: linear-gradient(165deg, rgba(22, 34, 62, 0.9), rgba(10, 16, 32, 0.96));
    border: 1px solid var(--border-soft);
    border-radius: 13px;
    padding: 13px 11px 12px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.dev-card:hover:not(.sold-out) {
    transform: translateY(-2px);
    border-color: var(--cyan-bright);
    box-shadow: 0 12px 28px rgba(6, 182, 212, 0.18);
}
.dev-card.featured {
    border-color: rgba(99, 102, 241, 0.65);
    background: linear-gradient(165deg, rgba(44, 48, 108, 0.45), rgba(10, 16, 32, 0.96));
}
.dev-card.sold-out { opacity: 0.56; cursor: not-allowed; }

.dev-badge {
    font-size: 10px; font-weight: 800; letter-spacing: 0.4px;
    padding: 3px 8px; border-radius: 6px; margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.08); color: var(--text);
}
.dev-card.featured .dev-badge {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.35), rgba(6, 182, 212, 0.35));
    color: #cffafe; border: 1px solid rgba(34, 211, 238, 0.4);
}
.dev-card.fold .dev-badge { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.dev-card.sold-out .dev-badge { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

.dev-img {
    width: 112px; height: 112px; object-fit: contain; margin-bottom: 8px;
    filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.6));
}
.dev-name {
    font-family: var(--font-head);
    font-size: 15px; font-weight: 700; line-height: 1.25;
    min-height: 2.5em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; white-space: normal;
}
.dev-spec { font-size: 11px; color: var(--muted); margin: 2px 0 8px; line-height: 1.3; }
.dev-price-line { display: flex; align-items: baseline; justify-content: center; gap: 7px; margin-bottom: 6px; }
.dev-free { font-size: 18px; font-weight: 800; color: var(--mint); }
.dev-strike { font-size: 12px; color: #64748b; text-decoration: line-through; }
.dev-stock { font-size: 10.5px; font-weight: 700; color: #38bdf8; margin-bottom: 9px; }
.dev-card.sold-out .dev-stock { color: #94a3b8; }

.dev-cta {
    width: 100%; border: 0; border-radius: 9px; padding: 9px 10px;
    font-family: var(--font-body); font-size: 12px; font-weight: 800;
    background: linear-gradient(135deg, var(--indigo), var(--cyan));
    color: #fff; cursor: pointer; margin-top: auto;
}
.dev-card.sold-out .dev-cta { background: #1e293b; color: #94a3b8; cursor: not-allowed; }

.gx-trust { margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gx-trust-item {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-soft);
    border-radius: 9px; padding: 8px 6px; font-size: 11px; font-weight: 600;
    color: #cbd5e1; display: flex; align-items: center; justify-content: center; gap: 5px; text-align: center;
}

/* Step 2 Preview */
.gx-preview {
    position: relative; overflow: hidden;
    background: linear-gradient(145deg, #16223d, #0c1427);
    border: 1px solid var(--border); border-radius: 13px;
    padding: 12px; display: flex; align-items: center; gap: 14px; margin-bottom: 14px;
}
.gx-aura {
    position: absolute; width: 130px; height: 130px; border-radius: 50%;
    left: 10px; top: 50%; transform: translateY(-50%);
    filter: blur(34px); opacity: 0.45; background: #6366f1;
    transition: background 0.25s ease; pointer-events: none;
}
.gx-preview-img { position: relative; z-index: 1; width: 88px; height: 88px; object-fit: contain; flex-shrink: 0; }
.gx-preview-info { position: relative; z-index: 1; min-width: 0; flex: 1; }
.gx-unlocked { display: inline-block; font-size: 10px; font-weight: 800; color: #34d399; margin-bottom: 3px; }
.gx-preview-info h3 { font-family: var(--font-head); font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.gx-spec-line { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.gx-price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gx-free { font-size: 18px; font-weight: 800; color: var(--mint); }
.gx-strike { font-size: 12.5px; color: #64748b; text-decoration: line-through; }
.gx-waiver {
    font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px;
    background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35);
}

.cfg-block { margin-bottom: 13px; }
.cfg-label {
    display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
    color: var(--cyan-bright); margin-bottom: 7px;
}
.swatch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.swatch-btn {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 9px 10px; color: var(--text); font-family: var(--font-body);
    font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left;
}
.swatch-btn.active { border-color: var(--cyan-bright); background: rgba(6, 182, 212, 0.12); }
.swatch-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); flex-shrink: 0; }

.storage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stor-btn {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 9px 6px; color: var(--text); font-family: var(--font-body); cursor: pointer; text-align: center;
}
.stor-btn.active { border-color: var(--cyan-bright); background: rgba(99, 102, 241, 0.18); }
.stor-cap { display: block; font-size: 13.5px; font-weight: 800; }
.stor-sub { display: block; font-size: 10.5px; color: #34d399; font-weight: 700; margin-top: 2px; }

.form-split { display: grid; grid-template-columns: 1fr 1.15fr; gap: 8px; }
.gx-input {
    width: 100%; background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: 10px; padding: 11px 12px; color: var(--text);
    font-family: var(--font-body); font-size: 13px; outline: none;
}
.gx-input:focus { border-color: var(--cyan-bright); }
.form-error { color: #f87171; font-size: 12px; font-weight: 600; margin-top: 6px; min-height: 16px; }

.gx-summary {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-soft);
    border-radius: 11px; padding: 10px 12px; margin-bottom: 13px; font-size: 12.5px;
}
.sum-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.sum-row.total { border-top: 1px solid var(--border-soft); margin-top: 5px; padding-top: 7px; font-size: 14px; font-weight: 800; color: var(--text); }
.mint { color: var(--mint); font-weight: 700; }

.action-bar { display: flex; gap: 9px; }
.btn-back {
    padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-soft);
    background: var(--surface); color: var(--text); font-family: var(--font-body);
    font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-primary {
    flex: 1; padding: 12px 16px; border-radius: 10px; border: 0;
    background: linear-gradient(135deg, var(--indigo), var(--cyan));
    color: #fff; font-family: var(--font-body); font-size: 13.5px; font-weight: 800; cursor: pointer;
}

/* Step 3 Processing & Offers */
.alloc-stage { text-align: center; padding: 14px 4px; }
.gx-spinner {
    width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
    border: 3px solid rgba(34, 211, 238, 0.22); border-top-color: var(--cyan-bright);
    animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.alloc-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.alloc-list {
    text-align: left; background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: 11px; padding: 10px 12px; display: flex; flex-direction: column; gap: 9px;
}
.alloc-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.al-dot { width: 10px; height: 10px; border-radius: 50%; background: #475569; flex-shrink: 0; }
.alloc-item.working { color: var(--cyan-bright); font-weight: 700; }
.alloc-item.working .al-dot { background: var(--cyan-bright); box-shadow: 0 0 8px var(--cyan-bright); }
.alloc-item.done { color: #34d399; font-weight: 600; }
.alloc-item.done .al-dot { background: var(--mint); }
.alloc-item.alert { color: #f87171; font-weight: 700; }
.alloc-item.alert .al-dot { background: var(--red); }

.gx-ticket {
    background: linear-gradient(145deg, #16223e, #0b1224);
    border: 1px solid var(--border); border-radius: 13px;
    padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px;
}
.ticket-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ticket-left img { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.ticket-serial { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--cyan-bright); }
.ticket-model { font-family: var(--font-head); font-size: 14px; font-weight: 700; }
.ticket-meta { font-size: 11.5px; color: var(--muted); }
.ticket-right { text-align: right; flex-shrink: 0; }
.locked-pill {
    display: inline-block; font-size: 10px; font-weight: 800; padding: 3px 8px;
    border-radius: 7px; background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.35);
}
.ticket-user { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gate-header { text-align: center; margin-bottom: 12px; }
.gate-header h2 { font-family: var(--font-head); font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.gate-header p { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.fn-quest-cards-list { display: flex; flex-direction: column; gap: 9px; }
.fn-offer-loading {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 24px 12px; font-size: 12.5px; color: var(--muted);
}
.fn-verifying-spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2.5px solid rgba(34, 211, 238, 0.25); border-top-color: var(--cyan-bright);
    animation: spin 0.8s linear infinite;
}
.quest-card {
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.quest-card.featured {
    border-color: rgba(34, 211, 238, 0.55);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), var(--surface));
}
.quest-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.quest-ico { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #0f172a; }
.quest-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.quest-badge { font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: rgba(99, 102, 241, 0.25); color: #c7d2fe; }
.quest-time { font-size: 10px; color: #34d399; font-weight: 700; }
.quest-title {
    font-size: 13.5px; font-weight: 800; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 2px;
}
.quest-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.quest-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.fn-quest-action-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 13px; border-radius: 9px;
    background: linear-gradient(135deg, var(--indigo), var(--cyan));
    color: #fff; text-decoration: none; font-size: 12px; font-weight: 800; white-space: nowrap;
}
.fn-quest-action-btn.btn-verifying { background: #1e293b; color: #f8fafc; border: 1px solid var(--cyan-bright); }
.quest-free { font-size: 10px; color: var(--muted); }

.verifying-notice {
    margin-top: 12px; padding: 12px; border-radius: 11px;
    background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 12.5px; color: #cbd5e1; gap: 8px;
}

.gx-foot { text-align: center; margin-top: 14px; font-size: 11px; color: #64748b; }

@media (max-width: 540px) {
    .gx-panel { padding: 14px 10px; }
    .gx-grid { gap: 8px; }
    .dev-img { width: 92px; height: 92px; }
    .form-split { grid-template-columns: 1fr; }
    .gx-trust { grid-template-columns: 1fr; gap: 6px; }
    .quest-card { flex-direction: column; align-items: stretch; }
    .quest-action { align-items: stretch; }
    .fn-quest-action-btn { width: 100%; }
}
