:root{
    --brand-start: #667eea; /* Indigo */
    --brand-end:   #764ba2; /* Violet */
    --brand-mid:   #706ae9;
    --bg:          #0b0b0f;
    --text:        #f5f7ff;
    --muted:       #c8cbe0;
    --glass:       rgba(255,255,255,0.06);
    --glass-strong:rgba(255,255,255,0.10);
    --border:      rgba(255,255,255,0.14);
    --shadow-brand: 0 0 24px rgba(118,75,162,0.35), 0 0 12px rgba(102,126,234,0.25);
    --shadow-soft:  0 6px 22px rgba(0,0,0,0.45);
}
body {
    margin: 0;
    font-family: 'Segoe UI', 'Microsoft JhengHei', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
.main-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(90deg, var(--brand-start), var(--brand-end));
    box-shadow: var(--shadow-brand);
    /* Slightly lower content while staying slim */
    padding: 16px 0 8px 0;
    min-height: 58px;
    position: sticky;
    top: 0;
    z-index: 998;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.logo-container {
    position: absolute;
    left: 32px;
    top: 12px;
    display: flex;
    align-items: center;
}
/* Header social links */
.social-btns { position:absolute; right:20px; top:12px; display:flex; gap:8px; }
.social-btns a { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; text-decoration:none; }
.social-btns a i { font-size:18px; line-height:1; display:block; }
.social-btns .ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.social-btns .fb { background:#1877F2; }
.social-btns .wa { background:#25D366; color:#0b3b2e; font-weight:800; }
.logo {
    height: 32px;
    width: 32px;
    margin-right: 8px;
}
.shop-name {
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.shop-name .zh{ font-size: 1.05rem; color:#fff; }
.shop-name .en{ font-size: 0.85rem; opacity:0.95; color:#fff; }
/* Landing hero */
.landing{ padding-bottom: 88px; }
.landing-hero{ position:relative; margin: 0 -16px 12px; padding: 28px 16px 40px; color:#fff; background: #000; box-shadow: var(--shadow-brand); border-bottom: 1px solid var(--border); }
.landing-hero .hero-art{ position:absolute; right:-20px; top:-30px; width:260px; height:260px; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.25), rgba(255,255,255,0)); filter: blur(8px); transform: rotate(25deg); pointer-events:none; }
.landing-hero .hero-inner{ max-width: 780px; margin: 0 auto; padding: 0 8px; position: relative; z-index: 1; }
.hero-title{ margin:0 0 6px; font-size: clamp(1.4rem, 5vw, 2rem); font-weight:800; }
.hero-sub{ margin:0 0 16px; font-size:1rem; opacity:0.96; }
.cta-row{ display:flex; gap:10px; flex-wrap:wrap; position: relative; z-index: 2; }
.btn{ display:inline-flex; align-items:center; gap:8px; border:none; border-radius:10px; padding:12px 16px; cursor:pointer; font-size:1rem; touch-action: manipulation; -webkit-tap-highlight-color: rgba(255,255,255,0.15); user-select: none; -webkit-user-select: none; position: relative; }
.btn i{ font-size:1rem; pointer-events: none; }
.btn-primary{ background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); color:#fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover, .btn-primary:active{ filter: brightness(1.05); }
.btn-outline{ background:transparent; color:#fff; border:1px solid #ffffff55; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn-outline:hover{ background:#ffffff14; }

/* Destructive/Logout CTA */
.btn-danger{ background: linear-gradient(135deg, #ff6b6b, #ff3b3b); color:#fff; box-shadow: 0 8px 24px rgba(255,59,59,0.35); }
.btn-danger:hover{ filter: brightness(1.05); }

/* Landing features */
.landing-features{ display:grid; grid-template-columns: 1fr; gap:10px; margin: 10px auto 0; max-width: 780px; }
.feature{ display:flex; gap:12px; align-items:center; background: var(--glass); border-radius:12px; padding:12px; box-shadow: var(--shadow-soft); border:1px solid var(--border); }
.feature i{ width:32px; height:32px; display:grid; place-items:center; color:#fff; background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); border-radius:8px; box-shadow: var(--shadow-brand); }
.ft-title{ font-weight:700; color: var(--text); }
.ft-desc{ color: var(--muted); font-size:0.95rem; }

@media (min-width: 720px){
    .landing-hero{ margin: 0 -24px 16px; border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; }
  .landing-features{ grid-template-columns: repeat(3, 1fr); gap:14px; }
}
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.hidden {
    display: none !important;
}
/* Page loader overlay */
.page-loader{ position:fixed; inset:0; background:rgba(0,0,0,0.7); display:flex; flex-direction:column; align-items:center; justify-content:center; z-index: 2000; }
.page-loader .spinner{ width:48px; height:48px; border:4px solid rgba(255,255,255,0.12); border-top-color:var(--brand-start); border-radius:50%; animation: spin 1s linear infinite; }
.page-loader .loading-text{ margin-top:12px; color:var(--text); font-weight:600; letter-spacing:0.5px; }
@keyframes spin{ to { transform: rotate(360deg); } }
/* Add more styles for modal and form */
.modal-content {
    background: var(--glass-strong);
    padding: 26px 22px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    width: min(92vw, 420px);
    text-align: left;
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
}
.modal-header{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.modal-header .brand-mark{ width:36px; height:36px; border-radius:10px; background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); display:flex; align-items:center; justify-content:center; box-shadow: var(--shadow-brand); color:#fff; }
.modal-header h2{ margin:0; color:var(--text); font-size:1.2rem; }

.auth-tabs{ display:flex; gap:8px; margin-bottom:8px; }
.auth-tabs .tab{ flex:1; border:1px solid var(--border); background: var(--glass); color:var(--text); border-radius:999px; padding:8px 10px; cursor:pointer; }
.auth-tabs .tab.active{ background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); border-color: transparent; color:#fff; box-shadow: var(--shadow-brand); }

.input-group{ display:flex; align-items:center; gap:8px; border:1px solid var(--border); border-radius:10px; padding:10px 12px; margin:10px 0; background: rgba(255,255,255,0.04); color:var(--text); }
.input-group i{ color:#aab2cc; }
.input-group input{ flex:1; border:none; outline:none; font-size:1rem; background:transparent; color: var(--text); }

.form-actions{ margin-top:8px; display:flex; flex-direction:column; gap:10px; }
.btn-submit{ width:100%; padding:12px; border:none; border-radius:10px; background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); color:#fff; font-size:1.05rem; cursor:pointer; box-shadow: var(--shadow-brand); }
.btn-submit:hover{ filter: brightness(1.05); }
.btn-submit[disabled]{ opacity:0.6; cursor:not-allowed; }

.divider{ display:flex; align-items:center; gap:10px; color:#aab2cc; margin:12px 0; font-size:0.9rem; }
.divider::before, .divider::after{ content:""; height:1px; background:#e1e9f2; flex:1; }

.field-msg{ font-size:0.85rem; margin:4px 2px 0; }
.field-msg.error{ color:#d32f2f; }

.oauth-buttons {
    margin: 6px 0 10px 0;
}
.oauth-buttons button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: #fff;
    transition: background 0.2s;
}
.oauth-buttons .google { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid var(--border); display:flex; align-items:center; justify-content:center; gap:8px; }
.oauth-buttons button:hover { background: rgba(255,255,255,0.16); }
.modal-links {
    margin: 8px 0 0 0;
    display: flex;
    justify-content: space-between;
}
.modal-links a {
    background: linear-gradient(90deg, var(--brand-start), var(--brand-end));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    text-decoration: none;
    font-size: 0.98rem;
}
#closeModal{ position:absolute; right:10px; top:10px; border:none; background:transparent; color: var(--text); border-radius:50%; width:32px; height:32px; display:grid; place-items:center; cursor:pointer; }
#closeModal:hover{ background: rgba(255,255,255,0.12); }

/* Top camera button */
.camera-btn { display:none; }

/* Bottom navbar */
.bottom-navbar{ position:fixed; bottom:0; left:0; right:0; display:flex; justify-content:space-around; background: linear-gradient(90deg, var(--brand-start), var(--brand-end)); border-top:1px solid rgba(255,255,255,0.12); padding:6px 0 8px; z-index:999; }
.bottom-navbar .nav-item{ display:flex; flex-direction:column; align-items:center; text-decoration:none; color:#fff; font-size:12px; }
.bottom-navbar .nav-item.active{ color:#fff; text-shadow: 0 0 10px rgba(255,255,255,0.4); }
.bottom-navbar .nav-item span{ margin-top:4px; }

/* Redeem page sections */
.main-content h1{ text-align:center; font-weight:800; margin: 16px 0 8px; }
.user-status{ text-align:center; font-weight:800; margin: 4px 0 12px; }
.member-points-badge{ display:flex; align-items:center; justify-content:center; gap:8px; margin: 8px auto 16px; padding:10px 14px; width: fit-content; max-width: 92vw; background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); color:#fff; border-radius:999px; box-shadow: var(--shadow-brand); border:1px solid rgba(255,255,255,0.18); }
.member-points-badge strong{ font-size:1.05rem; }
.search-bar{ padding:12px 16px; }
.search-bar input{ width:100%; padding:12px; border:1px solid var(--border); border-radius:8px; background: rgba(255,255,255,0.06); color: var(--text); }
.section{ padding:8px 0 16px; }
.section .section-inner{ max-width: clamp(320px, 96vw, 720px); margin: 0 auto; padding: 0 36px; }
.section-header{ display:flex; justify-content:space-between; align-items:center; margin:8px 0; gap:8px; }
.section-header h2{ margin:0; font-size:clamp(1rem, 3.5vw, 1.15rem); }
.view-all{ background: linear-gradient(90deg, var(--brand-start), var(--brand-end)); -webkit-background-clip: text; background-clip: text; color: transparent; text-decoration:underline; cursor:pointer; font-size:0.95rem; white-space:nowrap; flex-shrink:0; margin-left:12px; }
.carousel{ display:flex; overflow-x:auto; gap:12px; padding-bottom:8px; scroll-snap-type:x mandatory; scroll-behavior:smooth; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.carousel::-webkit-scrollbar{ display:none; }
.card{ min-width:140px; background: var(--glass); border-radius:10px; box-shadow: var(--shadow-soft); padding:8px; border:1px solid var(--border); }
.card{ scroll-snap-align:start; }
.carousel-wrap{ position:relative; max-width: clamp(320px, 96vw, 720px); margin: 0 auto; padding: 0 32px; }
/* Invisible functional buttons; visuals provided by pseudo elements below */
.carousel-prev,.carousel-next{ position:absolute; top:50%; transform:translateY(-50%); border:none; width:40px; height:40px; border-radius:50%; background:transparent; color:transparent; box-shadow:none; cursor:pointer; z-index:4; }
.carousel-prev{ left:4px; }
.carousel-next{ right:4px; }
/* Visual arrow overlays */
.carousel-wrap::before,
.carousel-wrap::after{ content:""; position:absolute; top:50%; transform:translateY(-50%); width:40px; height:40px; border-radius:50%; background:rgba(255,255,255,0.12); box-shadow: var(--shadow-soft); display:flex; align-items:center; justify-content:center; font-size:20px; color:#fff; pointer-events:none; z-index:3; }
.carousel-wrap::before{ left:4px; content:"\2039"; }
.carousel-wrap::after{ right:4px; content:"\203A"; }

@media (max-width: 420px){
    .carousel-prev,.carousel-next{ width:32px; height:32px; }
    .carousel-wrap::before, .carousel-wrap::after{ width:32px; height:32px; font-size:18px; }
}

/* Show exactly three cards per view on small screens */
@media (max-width: 600px){
    .carousel{ gap: 12px; }
    .carousel .card{
        /* Show two cards per view on phones for better readability */
        flex: 0 0 calc((100% - 12px) / 2);
        min-width: initial; /* override fixed min */
    }
    .section .section-inner{ padding: 0 28px; }
    .carousel-wrap{ padding: 0 24px; }
}

@media (max-width: 360px){
    .section .section-inner{ padding: 0 24px; }
    .carousel-wrap{ padding: 0 20px; }
    .view-all{ font-size:0.9rem; }
    /* On very small screens, show one card per view */
    .carousel .card{ flex: 0 0 100%; }
}

/* Add-to-cart floating button */
.card{ position: relative; padding-bottom: 44px; }
.add-fab{ position:absolute; right:6px; bottom:6px; width:26px; height:26px; border:1px solid var(--border); border-radius:50%; background:#fff; color:#000; display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow: var(--shadow-soft); font-size:14px; }
.add-fab:hover{ filter:none; box-shadow: 0 6px 16px rgba(0,0,0,0.35); }
.card img{ width:100%; height:100px; object-fit:cover; border-radius:8px; }
.card .name{ font-size:0.9rem; margin:6px 0 4px; color:var(--text); }
.card .points{ font-size:0.85rem; color: var(--brand-mid); }
.card .stock{ font-size:0.75rem; color:#9aa3b8; }
.card .add-btn{ width:100%; margin-top:6px; padding:8px; border:1px solid var(--border); border-radius:6px; background:#fff; color:#000; cursor:pointer; box-shadow: var(--shadow-soft); }
.card .add-btn:hover{ box-shadow: 0 8px 20px rgba(0,0,1,0.35); }

/* Grid list */
.grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:12px; padding:12px 16px 80px; }
.grid .card{ min-width:initial; }
@media (max-width: 600px){
    .grid{ grid-template-columns:repeat(2,1fr); gap:10px; }
}

/* Cart */
.cart-container{ padding:12px 16px 90px; }
.cart-item{ display:flex; gap:12px; background: var(--glass); border-radius:10px; padding:10px; box-shadow: var(--shadow-soft); margin-bottom:10px; border:1px solid var(--border); }
.cart-item img{ width:80px; height:80px; object-fit:cover; border-radius:8px; }
.cart-item .title{ font-weight:600; color: var(--text); }
.qty-row{ display:flex; align-items:center; gap:6px; margin-top:4px; }
.qty-row input{ width:56px; padding:6px; }
.remove-btn{ background: linear-gradient(135deg, #ff6b6b, #ff3b3b); color:#fff; border:none; border-radius:6px; padding:6px 10px; cursor:pointer; box-shadow: 0 6px 20px rgba(255,59,59,0.35); }
.summary{ position:fixed; left:0; right:0; bottom:56px; background: var(--glass-strong); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; padding:12px 16px; color: var(--text); }
.checkout-btn{ background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); color:#fff; border:none; border-radius:8px; padding:10px 16px; cursor:pointer; box-shadow: var(--shadow-brand); }

/* Semantic toasts */
.toast-container{ position: fixed; right: 16px; bottom: 72px; display:flex; flex-direction:column; gap:10px; z-index: 3000; }
.toast{ display:flex; align-items:flex-start; gap:10px; padding:12px 14px; border-radius:12px; color:#fff; min-width: 240px; box-shadow: 0 12px 28px rgba(0,0,0,0.45); border:1px solid rgba(255,255,255,0.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.toast .title{ font-weight:700; margin-bottom:2px; }
.toast .msg{ opacity:0.95; }
.toast.success{ background: linear-gradient(135deg, #34d399, #059669); }
.toast.error{ background: linear-gradient(135deg, #f87171, #ef4444); }
.toast.warning{ background: linear-gradient(135deg, #fbbf24, #f59e0b); color:#1b1400; }
.toast.info{ background: linear-gradient(135deg, #60a5fa, #3b82f6); }

/* Accessibility: focus styles */
.btn:focus, .input-group input:focus, .auth-tabs .tab:focus, .view-all:focus, .modal-links a:focus { outline: 2px solid var(--brand-mid); outline-offset: 2px; }
