:root {
    --bg-top: #1a1033;
    --bg-bottom: #0d1b2a;
    --card: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --gold: #f5c451;
    --gold-dim: #c99a2e;
    --accent: #7b5cff;
    --accent-glow: rgba(123, 92, 255, 0.45);
    --text: #f4f0ff;
    --text-muted: #a89ec8;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bottom) 55%, #061018 100%);
    color: var(--text);
}

.app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: calc(12px + var(--safe-top)) 12px calc(8px + var(--safe-bottom));
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #3d2a8f);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 0 20px var(--accent-glow);
}

.profile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.handle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.currencies {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.82rem;
    border: 1px solid var(--card-border);
    background: var(--card);
    backdrop-filter: blur(8px);
}

.pill-gold {
    border-color: rgba(245, 196, 81, 0.35);
    box-shadow: inset 0 0 12px rgba(245, 196, 81, 0.08);
}

.pill-score {
    color: #dfe8ff;
}

.main-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.game-root {
    flex: 1;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: radial-gradient(circle at 50% 20%, #1f2a44, #0a0f18 70%);
}

.bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    padding: 8px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--card-border);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.nav-item-active {
    color: var(--text);
    background: rgba(123, 92, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(123, 92, 255, 0.35);
}

.nav-icon {
    font-size: 1.2rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(90px + var(--safe-bottom));
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(20, 24, 40, 0.95);
    border: 1px solid var(--card-border);
    font-size: 0.85rem;
    z-index: 100;
    animation: toast-in 0.25s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
