:root {
  --color-bg: #F7F3ED;
  --color-surface: #ffffff;
  --color-border: rgba(0,0,0,0.10);
  --color-text: #1A1A1A;
  --color-text-muted: #7A7A72;
  --color-primary: #e86c45;
  --color-primary-dark: #C9522D;
  --color-primary-pale: #FDEAE3;
  --color-accent: #2A5A5A;
  --color-accent-pale: #E4EFEF;
  --color-danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.08);
  --max-width: 1120px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans KR', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-main {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.logo-sub {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--color-primary);
}

.back-home-link {
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  padding-right: 20px;
  margin-right: 4px;
  border-right: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.back-home-link:hover {
  color: var(--color-primary-dark);
}

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text) !important;
}

.cart-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: 56px 0 64px;
}

.hero h1 {
  font-size: 1.9rem;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.02rem;
  max-width: 640px;
}

/* Section */
.section {
  padding: 48px 0;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.section-desc {
  color: var(--color-text-muted);
  margin: 0 0 28px;
  font-size: 0.95rem;
}

.category-group {
  margin-bottom: 40px;
}

.category-label {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: var(--color-primary-pale);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.product-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-primary-pale);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.product-image-wrap {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-sm);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
}

.product-image-rounded {
  border-radius: 10px;
}

.product-image.product-image-rounded {
  padding: 0;
  object-fit: cover;
}

.product-visual-wrap {
  width: 100%;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.product-summary {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: 0 0 16px;
  flex-grow: 1;
}

.product-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  font-size: 0.83rem;
  color: var(--color-text);
}

.product-features li {
  padding-left: 18px;
  position: relative;
  margin-bottom: 6px;
}

.product-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 800;
}

.product-price-note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

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

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #111827;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Cart page */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}

.cart-item-info .name {
  font-weight: 700;
  margin-bottom: 4px;
}

.cart-item-info .meta {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.qty-control button {
  border: none;
  background: var(--color-bg);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
}

.qty-control input {
  width: 40px;
  border: none;
  text-align: center;
  font-size: 0.9rem;
  -moz-appearance: textfield;
}

.cart-item-subtotal {
  font-weight: 700;
  min-width: 100px;
  text-align: right;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  text-decoration: underline;
}

.remove-btn:hover {
  color: var(--color-danger);
}

.summary-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 24px;
  position: sticky;
  top: 88px;
}

.summary-box h3 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 800;
  border-top: 1px solid var(--color-border);
  margin-top: 14px;
  padding-top: 14px;
}

.summary-note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 14px;
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--color-text-muted);
}

.empty-state a {
  color: var(--color-primary);
  font-weight: 700;
}

/* Checkout form */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}

.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 26px;
}

.form-card h3 {
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.form-row {
  margin-bottom: 16px;
}

.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-row .required {
  color: var(--color-danger);
}

.form-row input,
.form-row textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 0.92rem;
  font-family: inherit;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 0;
}

.form-row textarea {
  resize: vertical;
  min-height: 80px;
}

.form-error {
  color: var(--color-danger);
  font-size: 0.78rem;
  margin-top: 4px;
  display: none;
}

.form-row.error input,
.form-row.error textarea {
  border-color: var(--color-danger);
}

.form-row.error .form-error {
  display: block;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 20px;
}

.checkbox-row input {
  margin-top: 3px;
}

.order-summary-list {
  font-size: 0.86rem;
  margin-bottom: 14px;
}

.order-summary-list .line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--color-border);
}

/* Result panel */
.result-panel {
  max-width: 560px;
  margin: 60px auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 40px;
  text-align: center;
}

.result-panel .badge-ok {
  display: inline-flex;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent-pale);
  color: var(--color-accent);
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.result-panel .badge-fail {
  display: inline-flex;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fee2e2;
  color: var(--color-danger);
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.result-panel h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.result-panel .order-no {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.result-summary {
  text-align: left;
  background: var(--color-bg);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 0.86rem;
  margin-bottom: 20px;
}

.result-summary .line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.pg-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.84rem;
  text-align: left;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.site-footer .footer-line {
  margin: 0 0 4px;
}

.site-footer .footer-line strong {
  color: var(--color-text);
}

.site-footer .footer-line a {
  color: var(--color-text-muted);
  text-decoration: underline;
}

.site-footer .footer-note {
  margin: 12px 0 0;
}

/* Policy page */
.policy-updated {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0 0 32px;
}

.policy-content {
  max-width: 760px;
}

.policy-content section {
  margin-bottom: 32px;
}

.policy-content h2 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 10px;
}

.policy-content p {
  margin: 0 0 10px;
  color: var(--color-text);
  line-height: 1.7;
}

.policy-content ul,
.policy-content ol {
  margin: 0 0 10px;
  padding-left: 20px;
  line-height: 1.7;
}

.policy-content li {
  margin-bottom: 4px;
}

.policy-content .policy-note {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.product-policy-link {
  display: inline-block;
  margin: -8px 0 12px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-decoration: underline;
}

.product-policy-link:hover {
  color: var(--color-primary-dark);
}

/* Responsive */
@media (max-width: 860px) {
  .cart-layout,
  .checkout-layout {
    grid-template-columns: 1fr;
  }
  .summary-box {
    position: static;
  }
  .main-nav {
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .cart-item {
    grid-template-columns: 1fr;
    row-gap: 10px;
  }
  .cart-item-subtotal {
    text-align: left;
  }
  .hero h1 {
    font-size: 1.5rem;
  }
}
