:root {
    --bg-color: #000000;
    --surface-color: #111111;
    --text-primary: #FFFFFF;
    --text-secondary: #888888;
    --accent-color: #FFFFFF;
    /* Back to White */
    --accent-hover: #CCCCCC;
    --border-color: #333333;
    --success-color: #34C759;
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Revert font */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-soft: 0 4px 20px rgba(255, 255, 255, 0.1);
    --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.5);
}

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

html,
body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* Header */
header {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.header-content {
    padding: 16px 20px 8px 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: nowrap;
    /* Prevent wrapping */
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Ensure title doesn't push cart out */
.header-top h1 {
    flex-shrink: 0;
}

.logo-group {
    display: flex;
    flex-direction: column;
}

.logo {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    margin: 0;
    line-height: 1;
    text-transform: uppercase;
}

.subtitle {
    font-family: var(--font-body);
    font-size: 0.55rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 4px;
    font-weight: 400;
}

/* Cart Icon */
.cart-icon-wrapper {
    position: relative;
    color: var(--text-primary);
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.05);
}

.support-icon-wrapper {
    position: relative;
    color: var(--text-primary);
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.05);
}

.support-icon-wrapper svg {
    width: 18px;
    height: 18px;
}

.support-icon-wrapper:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.cart-icon-wrapper svg {
    width: 20px;
    height: 20px;
}

.cart-icon-wrapper:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--text-primary);
    color: var(--bg-color);
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-color);
}

/* Category Scroll */
.category-scroll {
    display: flex;
    overflow-x: auto;
    padding: 12px 20px 16px 20px;
    gap: 10px;
    scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.cat-btn.active {
    background: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Product Grid */
.container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.product-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #000;
    border-bottom: 1px solid var(--border-color);
}

.product-info {
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-grow: 1;
}

.product-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.product-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: auto;
    /* Push price down */
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
}

.btn-mini-add {
    background: transparent;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    padding: 8px 16px;
    border-radius: 12px;
    width: 100%;
    margin-top: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 600;
}

.btn-mini-add:active {
    background: var(--text-primary);
    color: var(--bg-color);
}

/* Modal Shared */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.center-modal {
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay:not(.center-modal) {
    align-items: flex-end;
}

.modal-content {
    background: var(--surface-color);
    width: 100%;
    max-width: 100vw;
    /* Fix: prevent overflow */
    max-height: 92vh;
    /* Slightly more space */
    border-radius: 24px 24px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Fix: prevent side drift */
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    border-top: 1px solid var(--border-color);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* Carousel */
.modal-carousel {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    /* Force square ratio */
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.carousel-track {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

.carousel-track img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    background: #1a1a1a;
    /* Dark gray placeholder while loading */
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #FFF;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav:active {
    transform: translateY(-50%) scale(1.2);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.carousel-nav.prev {
    left: 10px;
}

.carousel-nav.next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.dot.active {
    background: #FFF;
    width: 20px;
    border-radius: 4px;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #FFF;
    font-size: 1.5rem;
    /* Reduced size for better centering control */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    backdrop-filter: blur(8px);
    padding: 0 0 2px 0;
    /* Slight bottom padding to lift the character up */
    line-height: 1;
}

.modal-divider {
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    margin: 25px auto;
    /* Perfect 25px above and below */
}

.weight-options {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 25px 0;
    /* No top margin, rely on divider's bottom 25px */
    max-width: 100%;
}

.brewing-guide {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin: 0 0 24px 0;
    /* No top margin if it follows description */
    justify-content: center;
}

.weight-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.weight-btn.active {
    background: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
    font-weight: 700;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.modal-header {
    margin-bottom: 0px;
    /* Reduced to avoid margin collision with divider/weights */
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.modal-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    margin-bottom: 15px;
    display: inline-block;
}

.modal-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}

.tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    max-width: 100%;
}

/* Quantity */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
}

.form-textarea {
    resize: none;
    min-height: 100px;
    margin-bottom: 10px;
}

.btn-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-bottom: 2px;
    /* Lift up the + and - signs to compensate for font baseline */
}

.quantity-display {
    font-size: 1.2rem;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Buttons */
.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-top: auto;
}

.btn-primary,
.btn-secondary {
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: var(--font-body);
}

.btn-primary {
    background: var(--text-primary);
    /* White */
    color: var(--bg-color);
    /* Black */
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
    opacity: 0.9;
    transform: scale(0.98);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    width: 100%;
}

/* Checkout Modal */
.checkout-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden !important;
}

.checkout-body h2 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 24px;
    padding-top: 10px;
}

.cart-items-list {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.cart-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.checkout-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.hidden {
    display: none !important;
}

#checkout-success:not(.hidden)~#checkout-footer,
#checkout-success:not(.hidden)~#checkout-title {
    display: none !important;
}

#checkout-success,
#support-success {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    animation: fadeIn 0.3s ease;
    min-height: 200px;
    /* Ensure enough height to center content */
}

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    width: 100%;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 24px;
    filter: drop-shadow(0 0 15px rgba(52, 199, 89, 0.4));
}

.success-content h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.success-content p {
    color: var(--text-secondary);
    line-height: 1.6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.checkout-footer>* {
    width: 100% !important;
    margin-bottom: 20px;
}

.checkout-footer>*:last-child {
    margin-bottom: 0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.checkout-instruction {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: center;
}

.checkout-instruction p {
    margin-bottom: 8px;
}

.checkout-instruction p:last-child {
    margin-bottom: 0;
}

/* ... existing code ... */
/* Header Fix Reinforcement */
.header-top {
    display: flex;
    /* Ensure flex is active */
    flex-wrap: nowrap !important;
    align-items: center;
}

.cart-icon-wrapper {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    /* Force no shrink */
    min-height: 44px !important;
    padding: 0 !important;
    /* Remove internal padding */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Ensure icon inside is centered */
}

/* Badges */
/* Badges */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    width: 50px;
    /* Larger size */
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    /* Dark semi-transparent background like close btn */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.product-badge svg {
    width: 30px;
    height: 30px;
    fill: #FFFFFF;
    /* White */
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
    /* Glow effect */
}

/* Brewing Guide Tags */
.brewing-guide {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 15px;
    justify-content: center;
}

.brew-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    /* Pill shape */
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.brew-tag svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 2;
}

/* Checkout Contact Form */
.checkout-contact-form {
    margin: 24px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 100%;
    /* Fix: ensure it doesn't push width */
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.messenger-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    /* Fix: allow buttons to wrap on very narrow screens */
}

.messenger-option {
    flex: 1;
    min-width: 80px;
    /* Fix: ensure buttons don't shrink too much */
    cursor: pointer;
}

.messenger-option input {
    display: none;
}

.messenger-box {
    display: block;
    padding: 10px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.messenger-option input:checked+.messenger-box {
    background: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.checkout-instruction {
    margin-bottom: 20px;
}