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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #111;
    background: #fff;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Header */
.site-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 200;
}
.header-top {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.header-top::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: url('/images/brand/seolyuhwa-pattern.png') center center / cover no-repeat;
}
.header-top::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.75);
}
.header-top > .header-inner {
    position: relative;
    z-index: 1;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.brand-logo:hover { opacity: 0.88; }
.brand-logo {
    line-height: 0;
}
.brand-mark {
    display: block;
    height: auto;
    object-fit: contain;
    background: transparent;
}
.brand-mark-header {
    width: auto;
    height: 94px;
    max-width: 312px;
}

/* 카테고리 토글 버튼 */
.category-nav { position: relative; }
.category-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
.category-toggle:hover,
.category-toggle.active {
    background: rgba(255, 255, 255, 0.45);
}
.category-toggle.active .category-arrow {
    transform: rotate(180deg);
}
.category-arrow {
    transition: transform 0.2s;
}

/* 카테고리 드롭다운 패널 */
.category-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: transparent;
    border-bottom: 1px solid transparent;
}
.category-panel.open {
    max-height: 70vh;
    border-bottom-color: #eee;
    overflow-y: auto;
    background: #fff;
}
.category-panel-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.category-panel.open .category-panel-inner {
    padding: 20px 20px 28px;
}
.category-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px 32px;
}
.category-group {}
.category-parent {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}
.category-parent:hover { color: #555; }
.category-children {
    list-style: none;
}
.category-children li { margin-bottom: 6px; }
.category-children a {
    font-size: 14px;
    color: #666;
    display: block;
    padding: 4px 0;
}
.category-children a:hover { color: #111; }
.category-empty {
    text-align: center;
    color: #999;
    padding: 24px 0;
    font-size: 14px;
}
.category-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 150;
}
.category-backdrop.open { display: block; }
body.category-open { overflow: hidden; }

@media (max-width: 1023px) {
    .category-panel {
        position: relative;
        z-index: 160;
    }
    .category-panel.open {
        max-height: 60vh;
        overflow-y: auto;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }
    .category-backdrop {
        z-index: 155;
    }
}

.search-form {
    display: flex;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.search-form input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 10px 16px;
    outline: none;
    font-size: 14px;
}
.search-form button {
    border: none;
    background: none;
    padding: 0 14px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
}
.header-right {
    display: flex;
    gap: 12px;
    font-size: 14px;
    align-items: center;
    justify-content: flex-end;
}
.header-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.cart-link { position: relative; }
.cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #111;
    color: #fff;
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 10px;
    min-width: 16px;
    text-align: center;
}
.tab-nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 28px;
    padding: 0 20px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    background: #fff;
    position: relative;
    z-index: 1;
}
    -webkit-overflow-scrolling: touch;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-nav a {
    font-size: 15px;
    color: #666;
    padding-bottom: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.tab-nav a.active {
    color: #111;
    font-weight: 600;
    border-bottom: 2px solid #111;
}

main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; min-height: 60vh; }

/* Hero banner */
.hero-banner { margin: 0 -20px 32px; }
.banner-slider {
    position: relative;
    width: 100%;
    height: 480px;
    overflow: hidden;
    background: #222;
}
.banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.banner-slide.active { opacity: 1; z-index: 1; }
.banner-link { display: block; width: 100%; height: 100%; position: relative; }
.banner-bg { width: 100%; height: 100%; object-fit: cover; }
.banner-text {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.banner-text h2 { font-size: 42px; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
.banner-text p { font-size: 18px; opacity: 0.95; }
.banner-prev, .banner-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.3);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}
.banner-prev { left: 20px; }
.banner-next { right: 20px; }
.banner-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 3;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
}

/* Main groups */
.main-groups { margin-bottom: 40px; overflow: hidden; }
.main-groups--top {
    margin-top: 4px;
    padding-top: 4px;
}
.home-top-compact .product-section {
    margin-top: 0;
}
.product-section--after-groups-only {
    margin-top: 0;
}
.group-scroll {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding: 8px 4px 16px;
    scrollbar-width: none;
}
.group-scroll::-webkit-scrollbar { display: none; }
.group-item { flex: 0 0 auto; text-align: center; width: 80px; }
.group-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
}
.group-circle img { width: 100%; height: 100%; object-fit: cover; }
.group-circle.large { width: 80px; height: 80px; }
.group-placeholder { font-size: 24px; color: #999; }
.group-name { font-size: 12px; color: #333; display: block; }
.group-item.active .group-circle {
    border-color: #111;
    box-shadow: 0 0 0 2px #111;
}
.group-item.active .group-name { font-weight: 700; color: #111; }

/* Product grid */
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; text-align: center; }
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}
.product-card { display: block; }
.product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f8f8f8;
    overflow: hidden;
    margin-bottom: 12px;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.sold-out-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    pointer-events: none;
}
.pre-line { white-space: pre-line; }
.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
}
.no-image.large { min-height: 400px; }
.product-info .brand { font-size: 13px; font-weight: 600; }
.product-info .name { font-size: 13px; color: #444; margin: 4px 0 8px; line-height: 1.4; }
.price-row { display: flex; align-items: center; gap: 6px; }
.discount { color: #7c3aed; font-weight: 700; font-size: 14px; }
.price { font-weight: 700; font-size: 15px; }

/* Product detail */
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-bottom: 48px; }
.main-image { background: #f8f8f8; aspect-ratio: 1; }
.thumb-list { display: flex; gap: 8px; margin-top: 12px; }
.thumb-list img { width: 64px; height: 64px; object-fit: cover; cursor: pointer; border: 1px solid #eee; }
.detail-info h1 { font-size: 24px; margin: 8px 0 16px; }
.summary { color: #666; margin-bottom: 20px; }
.price-block { margin-bottom: 24px; }
.price-block .original { text-decoration: line-through; color: #999; margin-right: 8px; }
.price-block .sale-price { font-size: 28px; font-weight: 700; }
.option-row { margin-bottom: 16px; }
.option-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.option-group { margin-bottom: 24px; padding: 16px; border-radius: 8px; border: 1px solid #eee; }
.option-group-required { background: #fff8f8; border-color: #fecaca; }
.option-group-optional { background: #f8fafc; border-color: #e2e8f0; }
.option-group-title { margin: 0 0 6px; font-size: 15px; }
.option-group-hint { margin: 0 0 14px; font-size: 12px; color: #6b7280; }
.option-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.option-badge.required { background: #fee2e2; color: #b91c1c; }
.option-badge.optional { background: #e2e8f0; color: #475569; }
.option-error { margin: 6px 0 0; font-size: 12px; color: #dc2626; }
.product-option-select.is-invalid { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626; }
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-secondary { background: #fff; color: #111; border: 1px solid #ddd; padding: 12px 20px; border-radius: 6px; cursor: pointer; }
.btn-secondary:hover { background: #f8f8f8; }
.option-row select, .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.quantity-row { margin-bottom: 24px; }
.quantity-row input { width: 80px; padding: 8px; border: 1px solid #ddd; }
.action-buttons { display: flex; gap: 12px; }
.btn-primary {
    background: #111;
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
}
.btn-primary.full { width: 100%; }
.btn-primary:hover { background: #333; }
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
}
.btn-sm.danger { color: #dc2626; border-color: #fca5a5; }
.detail-section { margin-bottom: 40px; padding-top: 32px; border-top: 1px solid #eee; }
.detail-section h3 { font-size: 18px; margin-bottom: 16px; }
.detail-content { line-height: 1.8; color: #333; }
.related-products-section {
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid #eee;
}
.related-products-section h3 {
    font-size: 20px;
    margin-bottom: 20px;
}
.related-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Auth */
.auth-page { display: flex; justify-content: center; padding: 40px 0; }
.auth-box { width: 100%; max-width: 400px; padding: 32px; border: 1px solid #eee; border-radius: 8px; }
.auth-box.wide { max-width: 560px; }
.auth-box h2 { margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group-span-2 { grid-column: 1 / -1; }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; }
.auth-links-row { text-align: center; margin-top: 14px; font-size: 13px; }
.auth-links-row a { text-decoration: underline; color: #333; }
.auth-sep { margin: 0 10px; color: #ccc; }
.auth-result { text-align: center; padding: 14px 16px; margin-bottom: 16px; border-radius: 6px; font-size: 14px; line-height: 1.6; }
.auth-result.ok { background: #f1f8f1; border: 1px solid #c8e6c9; color: #2e7d32; }
.auth-result strong { display: block; margin-top: 6px; font-size: 16px; color: #1b5e20; }
.auth-link a { text-decoration: underline; }
.auth-note { text-align: center; font-size: 12px; color: #999; margin-top: 12px; }
.auth-error { color: #c62828; font-size: 13px; text-align: center; margin-bottom: 12px; }
.auth-success { color: #2e7d32; font-size: 13px; text-align: center; margin-bottom: 12px; }
.social-oauth-section { margin-top: 20px; }
.social-oauth-title { font-size: 15px; font-weight: 600; text-align: center; margin: 0 0 12px; }
.social-oauth-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.social-oauth-buttons-single-col {
    grid-template-columns: 1fr;
}
.social-oauth-signup { font-size: 13px; }
.social-oauth-divider { display: flex; align-items: center; gap: 12px; color: #999; font-size: 13px; margin: 0 0 14px; }
.social-oauth-divider::before, .social-oauth-divider::after { content: ""; flex: 1; height: 1px; background: #e5e5e5; }
.social-oauth-buttons { display: flex; flex-direction: column; gap: 10px; }
.social-oauth-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 12px 16px; border-radius: 6px; font-size: 14px; font-weight: 600;
    text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.social-oauth-naver { background: #03c75a; color: #fff; }
.social-oauth-naver:hover { background: #02b351; color: #fff; }
.social-oauth-kakao { background: #fee500; color: #191919; border-color: #e5d400; }
.social-oauth-kakao:hover { background: #f5dc00; color: #191919; }
.social-oauth-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 4px; font-size: 13px; font-weight: 800;
    background: rgba(255,255,255,0.2);
}
.social-oauth-kakao .social-oauth-icon { background: rgba(0,0,0,0.08); }
.social-oauth-hint { margin-top: 10px; font-size: 12px; color: #888; text-align: center; line-height: 1.5; }
.social-oauth-consent { margin-bottom: 12px; text-align: left; }
.social-oauth-consent .privacy-label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; margin-bottom: 8px; }
.social-oauth-consent .privacy-detail { font-size: 11px; color: #777; line-height: 1.5; margin: 0 0 10px 24px; }
.marketing-agreement { margin-top: 8px; }
.marketing-label { margin-top: 4px; }
.marketing-detail { color: #666; }
.social-oauth-btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.social-oauth-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.social-oauth-modal[hidden] { display: none !important; }
body.social-oauth-modal-open { overflow: hidden; }
.social-oauth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.social-oauth-modal-panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    padding: 24px 22px 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.social-oauth-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}
.social-oauth-modal-title {
    margin: 0 0 8px;
    font-size: 18px;
    text-align: center;
}
.social-oauth-modal-desc {
    margin: 0 0 14px;
    font-size: 13px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}
#socialOAuthModalSignupBtn { margin-top: 8px; }
.encryption-notice { font-size: 12px; color: #666; margin-bottom: 16px; text-align: center; line-height: 1.5; }
.input-with-btn { display: flex; gap: 8px; align-items: stretch; }
.input-with-btn input { flex: 1; min-width: 0; }
.btn-check {
    flex-shrink: 0;
    padding: 0 14px;
    border: 1px solid #222;
    background: #fff;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-check:hover { background: #f5f5f5; }
.btn-check:disabled { opacity: 0.5; cursor: not-allowed; }
.email-check-msg { font-size: 12px; margin-top: 6px; min-height: 18px; }
.email-check-msg.ok { color: #2e7d32; }
.email-check-msg.err { color: #c62828; }
.form-hint { font-size: 12px; color: #888; margin-top: 4px; }
.privacy-agreement {
    margin: 20px 0;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
}
.privacy-label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.privacy-label input { margin-top: 3px; }
.privacy-detail { font-size: 12px; color: #666; margin: 10px 0 0 24px; line-height: 1.6; }

/* Cart & tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
.data-table th { background: #fafafa; font-weight: 600; }
.inline-form { display: inline; }
.cart-actions { margin-top: 24px; text-align: right; }
.checkout-section { margin-bottom: 32px; padding: 24px; border: 1px solid #eee; border-radius: 8px; }
.checkout-section h3 { margin-bottom: 16px; }
.checkout-items { list-style: none; }
.checkout-items li { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }

/* Mypage */
.mypage-info { background: #fafafa; padding: 20px; border-radius: 8px; margin-bottom: 32px; }
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Alerts & misc */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-error { background: #fef2f2; color: #991b1b; }
.empty-msg { text-align: center; color: #999; padding: 40px; }
.site-footer {
    background: #fafafa;
    text-align: center;
    padding: 18px 10px 16px;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #eee;
}
.footer-brand {
    display: inline-block;
    margin-bottom: 8px;
}
.footer-brand:hover { opacity: 0.85; }
.brand-mark-footer {
    width: auto;
    height: 52px;
    max-width: 169px;
    margin: 0 auto;
    opacity: 0.82;
}
.site-footer p { margin-bottom: 2px; }
.thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }

@media (min-width: 1024px) {
    .category-backdrop { display: none !important; }
    body.category-open { overflow: auto; }
    .category-panel.open {
        max-height: 420px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    }
}

@media (max-width: 1023px) {
    .category-panel-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 20px 24px;
    }
}

@media (max-width: 768px) {
    .header-top::after {
        background: rgba(255, 255, 255, 0.78);
    }
    .header-inner {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 12px;
        padding: 12px 16px;
    }
    .header-left {
        grid-column: 1;
        grid-row: 1;
    }
    .header-right {
        grid-column: 2;
        grid-row: 1;
    }
    .search-form {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: none;
    }
    .header-link span:not(.cart-badge) { display: none; }
    .admin-link { font-size: 12px; }
    .brand-mark-header {
        height: 55px;
        max-width: 182px;
    }
    .category-toggle { padding: 6px 8px; font-size: 13px; }
    .category-panel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .tab-nav {
        gap: 20px;
        padding: 0 16px 10px;
    }
    .detail-layout { grid-template-columns: 1fr; }
    .banner-text h2 { font-size: 28px; }
    .banner-slider { height: 320px; }
    .form-row { grid-template-columns: 1fr; }
    main { padding: 16px 16px 48px; }
    .hero-banner { margin: 0 -16px 24px; }
}

@media (max-width: 480px) {
    .category-panel-grid {
        grid-template-columns: 1fr;
    }
    .header-right { gap: 8px; }
    .category-toggle .category-arrow { width: 10px; height: 10px; }
}
