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

/* ─── Variables ─── */
:root {
    --bg:       #0f1419;
    --surface:  #1a1f2e;
    --surface2: rgba(30, 39, 54, 0.7);
    --border:   #2d3a4f;
    --accent:   #5b9bd5;
    --gold:     #ffd700;
    --muted:    #8b92a8;
    --text:     #ffffff;
    --radius:   14px;
    --nav-h:    70px;
}

/* ─── Base ─── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ─── Modal ─── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.9);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.modal.hidden { display: none; }

.modal-box {
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    width: min(340px, 90vw);
}
.modal-box h2 { margin-bottom: 24px; font-size: 18px; }

.lang-btn {
    display: block; width: 100%;
    padding: 14px; margin: 8px 0;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: .2s;
}
.lang-btn:hover { background: var(--accent); border-color: var(--accent); }

/* ─── App layout ─── */
.app {
    display: flex; flex-direction: column;
    max-width: 480px; margin: 0 auto;
    min-height: 100dvh;
}

/* ─── Header ─── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px 8px;
    flex-shrink: 0;
}
.header-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.app-title { text-align: center; }
.title-main { font-size: 17px; font-weight: 700; display: block; }
.title-sub  { font-size: 11px; color: var(--muted); }

.icon-btn {
    background: none; border: none;
    color: var(--text); font-size: 15px;
    cursor: pointer; padding: 6px 8px;
    border-radius: 8px; transition: .2s;
}
.icon-btn:hover { background: var(--surface2); }

.lang-switch { border: 1.5px solid var(--accent); color: var(--accent); font-size: 13px; }

.balance-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface2);
    border-radius: 12px; padding: 10px 14px;
    margin-bottom: 8px;
}
.logo { font-size: 28px; }
.app-name { font-size: 18px; font-weight: 700; color: var(--accent); flex: 1; }
.balance-wrap { display: flex; align-items: center; gap: 6px; }
#balanceVal { font-size: 16px; font-weight: 700; }

.spin-btn { font-size: 16px; transition: transform .5s; }
.spin-btn.spinning { transform: rotate(360deg); }

.support-btn {
    width: 100%; padding: 8px;
    background: none; border: 1px solid var(--border);
    border-radius: 10px; color: var(--muted);
    font-size: 13px; cursor: pointer; transition: .2s;
}
.support-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Pages ─── */
.pages { flex: 1; overflow-y: auto; padding: 18px 14px calc(var(--nav-h) + 8px); }

.page { display: none; }
.page.active { display: block; }

.section-title {
    font-size: 19px; font-weight: 700; color: var(--accent);
    margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.sub-title { font-size: 16px; font-weight: 700; margin: 20px 0 10px; }

/* ─── Form elements ─── */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }

.input-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: var(--radius); padding: 6px 10px;
}
.text-input {
    flex: 1; background: none; border: none; color: var(--text);
    font-size: 15px; outline: none;
}
.text-input::placeholder { color: var(--muted); }

.pill-btn {
    padding: 8px 14px; background: var(--accent);
    border: none; border-radius: 10px;
    color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: .2s;
}
.pill-btn:hover { filter: brightness(1.1); }

.amount-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.price-tag { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ─── Chips ─── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.chip {
    flex: 1; min-width: 56px;
    padding: 12px 6px; text-align: center;
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: 12px; color: var(--text);
    font-size: 15px; font-weight: 600; cursor: pointer; transition: .2s;
}
.chip.active { background: var(--accent); border-color: var(--accent); }
.chip:hover:not(.active) { border-color: var(--accent); }

/* ─── Gift grid ─── */
.grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.gift-card {
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    text-align: center; cursor: pointer; transition: .2s;
}
.gift-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.gift-emoji { font-size: 44px; margin-bottom: 6px; }
.gift-name  { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.gift-stars { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.gift-price { font-size: 12px; color: var(--muted); }

/* ─── Premium ─── */
.premium-list { display: flex; flex-direction: column; gap: 14px; }

.premium-card {
    background: linear-gradient(135deg, rgba(91,155,213,.15), var(--surface2));
    border: 2px solid var(--accent);
    border-radius: var(--radius); padding: 18px;
    position: relative; transition: .2s;
}
.premium-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(91,155,213,.25); }
.premium-card.hot { border-color: var(--gold); background: linear-gradient(135deg, rgba(255,215,0,.12), var(--surface2)); }

.badge {
    position: absolute; top: -11px; right: 16px;
    background: var(--gold); color: #000;
    padding: 3px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
}
.p-months  { font-size: 20px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.hot .p-months { color: var(--gold); }
.p-price   { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.p-discount { font-size: 13px; color: #4caf50; font-weight: 600; margin-bottom: 8px; }
.p-features { font-size: 13px; color: var(--muted); line-height: 1.8; margin-bottom: 14px; }

.buy-btn {
    width: 100%; padding: 12px;
    background: var(--accent); border: none; border-radius: 10px;
    color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: .2s;
}
.hot .buy-btn { background: var(--gold); color: #000; }
.buy-btn:hover { filter: brightness(1.1); }

/* ─── Rating ─── */
.rating-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.rank   { font-size: 20px; font-weight: 700; color: var(--accent); width: 36px; }
.avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--accent); display: flex; align-items: center;
    justify-content: center; font-size: 18px;
}
.r-name { flex: 1; font-size: 14px; font-weight: 600; }
.r-val  { font-size: 14px; font-weight: 700; color: var(--accent); }

/* ─── Profile ─── */
.stat-row {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: 12px; padding: 14px 16px; margin-bottom: 8px;
}
.stat-row span { color: var(--muted); font-size: 14px; }
.stat-row strong { font-size: 17px; font-weight: 700; color: var(--accent); }

/* ─── History ─── */
.history-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface2); border: 2px solid var(--border);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.h-icon   { font-size: 22px; }
.h-info   { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.h-detail { font-size: 13px; font-weight: 600; }
.h-date   { font-size: 11px; color: var(--muted); }
.h-price  { font-size: 14px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.empty    { text-align: center; color: var(--muted); padding: 40px 0; }

/* ─── Bottom nav ─── */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%; max-width: 480px;
    height: var(--nav-h);
    background: rgba(15,20,25,.97);
    border-top: 1px solid var(--border);
    display: flex; align-items: center;
    z-index: 100;
}
.nav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: var(--muted);
    font-size: 11px; font-weight: 600; cursor: pointer;
    padding: 8px 0; transition: color .2s;
}
.nav-btn span:first-child { font-size: 22px; }
.nav-btn.active { color: var(--accent); }
