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

:root {
    --bg: #f6f8ff;
    --surface: #ffffff;
    --surface-muted: #eef2ff;
    --text: #111827;
    --text-muted: #4b5563;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #ec4899;
    --accent-muted: #be185d;
    --success: #10b981;
    --highlight-bg: linear-gradient(135deg, rgba(236, 242, 255, 0.92), rgba(237, 233, 254, 0.92));
    --highlight-border: rgba(79, 70, 229, 0.22);
    --border: #d1d5db;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #eef2ff 0%, #ffffff 100%);
    color: var(--text);
    min-height: 100vh;
}

body.dark {
    background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
    color: #e2e8f0;
    --bg: #0f172a;
    --surface: #111827;
    --surface-muted: #1f2937;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --accent: #fb7185;
    --accent-muted: #fda4af;
    --success: #34d399;
    --highlight-bg: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(17,24,39,0.6));
    --highlight-border: rgba(99,102,241,0.12);
    --border: #334155;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

button {
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.hidden {
    display: none;
}

.top-bar {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.2rem 0 0;
    display: flex;
    justify-content: flex-end;
}

.welcome-page,
.store-page {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0 0 4rem;
}

.hero-card {
    background: var(--surface);
    border: 1px solid rgba(79, 70, 229, 0.14);
    box-shadow: var(--shadow);
    border-radius: 32px;
    padding: 4rem;
    display: grid;
    place-items: center;
    min-height: 60vh;
}

.hero-content {
    max-width: 740px;
    text-align: center;
}

.hero-content h1 {
    font-size: clamp(2.8rem, 4vw, 4.2rem);
    margin-bottom: 1rem;
    line-height: 1.05;
}

.hero-content p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2rem;
    line-height: 1.75;
}

button.primary {
    background: var(--primary);
    color: #fff;
    padding: 1rem 2rem;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.18);
}

button.secondary {
    background: var(--surface);
    color: var(--text);
    padding: 0.9rem 1.6rem;
    border: 1px solid var(--border);
}

button.secondary:hover {
    background: var(--surface-muted);
}

.store-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: center;
}

.store-header h1 {
    font-size: clamp(2rem, 3vw, 2.7rem);
}

.subtitle {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.status-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, auto));
    gap: 1rem;
    align-items: center;
}

.status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem 1.2rem;
    min-width: 140px;
}

.status-card span {
    display: block;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.status-card strong {
    font-size: 1.25rem;
}

.status-card.highlighted {
    background: var(--highlight-bg);
    border-color: var(--highlight-border);
}

.categories {
    display: grid;
    gap: 2rem;
}

.category {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.category-header h2 {
    margin-bottom: 0.4rem;
}

.category-header p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.item-card {
    background: var(--surface-muted);
    border-radius: 24px;
    padding: 1rem;
    display: grid;
    gap: 1rem;
    min-height: 320px;
}

.item-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 18px;
    background: rgba(255,255,255,0.7);
}

.item-details {
    display: grid;
    gap: 0.75rem;
}

.item-card h3 {
    font-size: 1.1rem;
}

.item-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.price {
    font-weight: 700;
    font-size: 1.1rem;
}

.buy-btn {
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    min-width: 110px;
}

.buy-btn.purchased {
    background: var(--success);
}

.receipt-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.receipt-header h2 {
    margin-bottom: 0.35rem;
}

.receipt-header p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.receipt-card {
    background: var(--surface-muted);
    border-radius: 20px;
    padding: 1.2rem 1.3rem;
}

.receipt-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.receipt-summary span {
    color: var(--text-muted);
}

.receipt-summary strong {
    font-size: 1.1rem;
}

.receipt-list {
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.85rem 1rem;
    background: var(--surface);
}

.receipt-empty {
    color: var(--text-muted);
    padding: 0.75rem 0.9rem;
}

@media (max-width: 820px) {
    .store-header {
        align-items: stretch;
    }

    .status-panel {
        grid-template-columns: 1fr;
    }
}
