:root {
    --bg: #07101d;
    --bg2: #0c1727;
    --card: #101f33;
    --card2: #14253b;
    --line: #20344e;
    --text: #f7faff;
    --muted: #8fa3bd;
    --accent: #43e77f;
    --accent2: #25c968;
    --danger: #ff5574;
    --gold: #ffc857;
    --shadow: 0 12px 30px rgba(0,0,0,.28);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 50% -10%, #16365c 0, transparent 40%),
        var(--bg);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

button,
input {
    font: inherit;
}

.app {
    max-width: 760px;
    margin: auto;
    padding: 14px 14px 100px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 3px 16px;
}

.brand {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -.5px;
}

.subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.balance {
    padding: 10px 13px;
    border-radius: 15px;
    background: #152941;
    border: 1px solid var(--line);
    font-weight: 900;
    box-shadow: var(--shadow);
}

.hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 22px;
    margin-bottom: 14px;
    background:
        linear-gradient(135deg, #12385b, #142b45 60%, #123421);
    border: 1px solid #244462;
    box-shadow: var(--shadow);
}

.hero:after {
    content: "🔥";
    position: absolute;
    right: 18px;
    bottom: -12px;
    font-size: 70px;
    opacity: .18;
}

.hero-title {
    font-size: 24px;
    font-weight: 950;
}

.hero-subtitle {
    color: #c4d3e7;
    font-size: 13px;
    margin-top: 5px;
}

.search {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 15px;
    margin-bottom: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.search input {
    width: 100%;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 15px;
}

.search input::placeholder {
    color: #71859e;
}

.section {
    margin-bottom: 22px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}

.section-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.section-head span {
    color: var(--muted);
    font-size: 12px;
}

.grid,
.discount-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.card,
.discount-card {
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 7px 20px rgba(0,0,0,.16);
}

.discount-card {
    background:
        linear-gradient(145deg, #172d3c, #102336);
    border-color: #285b46;
}

.pic {
    height: 115px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle, #1c3855, #0f2035);
    overflow: hidden;
}

.pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.emoji-pic {
    font-size: 46px;
}

.sale-badge {
    position: absolute;
    z-index: 2;
    top: 9px;
    left: 9px;
    padding: 5px 8px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 950;
}

.card-body {
    padding: 11px;
}

.name {
    min-height: 38px;
    line-height: 1.25;
    font-size: 14px;
    font-weight: 800;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 7px;
}

.price,
.sale-price {
    font-size: 18px;
    font-weight: 950;
}

.sale-price {
    color: var(--accent);
}

.old-price {
    color: #74859b;
    text-decoration: line-through;
    font-size: 12px;
}

.stock {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
}

.timer {
    display: inline-block;
    margin-top: 7px;
    padding: 5px 7px;
    border-radius: 8px;
    background: #291f25;
    color: #ffd16a;
    font-size: 10px;
    font-weight: 850;
}

.buy {
    width: 100%;
    border: 0;
    border-radius: 11px;
    padding: 10px;
    margin-top: 10px;
    background: var(--accent);
    color: #05220f;
    font-weight: 950;
}

.buy:active,
.checkout:active {
    transform: scale(.98);
}

.disabled {
    opacity: .4;
    pointer-events: none;
}

.no-discount,
.empty {
    color: var(--muted);
    padding: 25px;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    background: rgba(0,0,0,.68);
    display: flex;
    align-items: flex-end;
}

.sheet-card {
    position: relative;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 16px 28px;
    background: #0f2035;
    border-top: 1px solid #29405e;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 50px rgba(0,0,0,.35);
}

.close {
    position: absolute;
    top: 12px;
    right: 13px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #21364f;
    color: white;
    font-size: 23px;
}

.selected-image {
    width: 100%;
    height: 150px;
    margin-bottom: 13px;
    overflow: hidden;
    border-radius: 16px;
    background: #162b44;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selected-image .emoji-pic {
    font-size: 60px;
}

.selected-name {
    padding-right: 45px;
    font-size: 20px;
    font-weight: 950;
}

.selected-price {
    margin-top: 7px;
    font-size: 18px;
}

.sale-mini {
    margin-left: 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
}

.selected-timer {
    margin-top: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #2c2522;
    color: #ffd36b;
    font-size: 12px;
}

.selected-timer strong {
    margin-left: 5px;
}

.qty {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin: 20px 0;
}

.qty button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 13px;
    background: #21364f;
    color: white;
    font-size: 25px;
}

.qty strong {
    font-size: 23px;
}

.total-label {
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.total {
    text-align: center;
    font-size: 28px;
    font-weight: 950;
    margin-bottom: 18px;
}

.pay-title {
    font-weight: 900;
    margin-bottom: 9px;
}

.pay-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.pay-grid button {
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 13px 8px;
    color: white;
    background: #172c44;
    font-weight: 800;
}

.pay-grid button.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(67,231,127,.18);
}

.checkout {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    border: 0;
    border-radius: 13px;
    background: var(--accent);
    color: #05220f;
    font-weight: 950;
    font-size: 15px;
}

.bottom-nav {
    position: fixed;
    z-index: 80;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(8,18,31,.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.nav {
    position: relative;
    border: 0;
    background: transparent;
    color: #7890aa;
    padding: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 17px;
}

.nav span {
    font-size: 10px;
}

.nav.active {
    color: var(--accent);
}

.nav b {
    position: absolute;
    top: 0;
    right: 23%;
    min-width: 17px;
    height: 17px;
    padding: 1px 4px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-size: 10px;
}

[hidden] {
    display: none !important;
}

@media (min-width: 600px) {
    .grid,
    .discount-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
