:root {
  color-scheme: light;
  --ink: #20211f;
  --muted: #777a73;
  --soft-muted: #a1a49d;
  --line: #e6e7e2;
  --surface: #ffffff;
  --canvas: #f7f7f4;
  --accent: #214c3d;
  --accent-strong: #16372c;
  --accent-soft: #e7efea;
  --danger: #b64e47;
  --shadow: 0 18px 50px rgba(29, 39, 32, 0.07);
  font-family: Inter, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(33, 76, 61, 0.25);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.app-shell { width: min(100% - 40px, 1080px); margin: 0 auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 28px 0; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-size: 18px; font-weight: 700; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 13px; letter-spacing: 0.12em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: 0.2em; }
.local-badge { color: var(--muted); font-size: 12px; }
.local-badge span { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #6e9e7e; vertical-align: 1px; }

main { padding: 46px 0 70px; }
.intro { max-width: 680px; margin-bottom: 42px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 20px; font-size: clamp(40px, 6vw, 70px); font-weight: 500; letter-spacing: -0.07em; line-height: 1.08; }
h1 em { color: var(--accent); font-style: normal; }
.intro-copy { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.unlock-panel { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(320px, 0.9fr); gap: 24px; align-items: start; padding: 32px; }
.panel-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; color: var(--accent); background: var(--accent-soft); font-size: 28px; line-height: 1; }
h2 { margin-bottom: 8px; font-size: 28px; letter-spacing: -0.04em; line-height: 1.2; }
h3 { margin-bottom: 0; font-size: 21px; letter-spacing: -0.04em; }
.panel-description { max-width: 450px; margin-bottom: 0; color: var(--muted); font-size: 13px; }
.unlock-form { min-width: 0; }
.unlock-form > label, .field { display: block; color: var(--ink); font-size: 12px; font-weight: 650; }
.input-with-action { display: flex; gap: 8px; margin-top: 8px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfbfa; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(33, 76, 61, .1); }
select { appearance: none; padding: 11px 34px 11px 12px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.input-with-action input { min-width: 0; padding: 12px 13px; }
.field-help, .optional, .required { color: var(--soft-muted); font-size: 11px; font-weight: 400; }
.field-help { margin: 9px 0 0; }
.share-pending-notice { color: var(--accent); }
.required { margin-left: 3px; color: var(--accent); }

.button { border: 0; border-radius: 8px; padding: 11px 16px; font-size: 13px; font-weight: 700; white-space: nowrap; transition: background .15s, color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-strong); }
.button-subtle { color: var(--muted); background: transparent; }
.button-subtle:hover { color: var(--ink); background: #eef0ec; }
.button-danger { color: var(--danger); background: #fff2f0; }
.button-danger:hover { background: #fbe4e1; }
.form-message { margin: 10px 0 0; font-size: 12px; }
.error { color: var(--danger); }

.cart-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.cart-heading h2 { margin-bottom: 0; }
.heading-actions { display: flex; align-items: center; gap: 4px; }
.cart-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--muted); font-size: 12px; }
.cart-summary strong { color: var(--ink); font-size: 16px; }
.summary-divider { width: 3px; height: 3px; border-radius: 50%; background: var(--soft-muted); }
.settings-panel { margin-bottom: 24px; box-shadow: none; }
.settings-panel summary { padding: 14px 18px; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 700; }
.settings-content { padding: 0 18px 16px; border-top: 1px solid var(--line); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 14px; color: var(--ink); cursor: pointer; }
.setting-row span { display: grid; gap: 3px; }
.setting-row strong em { color: var(--accent); font-size: 10px; font-style: normal; letter-spacing: 0.08em; }
.setting-row small { color: var(--muted); font-size: 12px; font-weight: 400; }
.setting-row input { width: 38px; height: 22px; margin: 0; accent-color: var(--accent); }

.cart-controls { margin-bottom: 24px; }
.search-row { display: flex; align-items: center; gap: 8px; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field > span { position: absolute; top: 50%; left: 13px; color: var(--muted); font-size: 21px; line-height: 1; transform: translateY(-54%); }
.search-field input { padding: 13px 14px 13px 39px; }
.sort-field { display: flex; align-items: center; gap: 7px; min-width: 158px; color: var(--muted); font-size: 12px; }
.sort-field select { padding-top: 10px; padding-bottom: 10px; }
.filter-toggle { position: relative; }
.filter-count { display: inline-grid; min-width: 18px; height: 18px; margin-left: 3px; padding: 0 4px; place-items: center; border-radius: 9px; color: #fff; background: var(--accent); font-size: 10px; }
.filter-panel { margin-top: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfa; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.filter-field { display: block; color: var(--muted); font-size: 11px; }
.filter-field select { margin-top: 6px; padding-top: 9px; padding-bottom: 9px; font-size: 13px; }
.price-range-inputs { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.price-range-inputs input { min-width: 0; padding: 9px 10px; font-size: 13px; }
.price-range-inputs span { color: var(--soft-muted); }
.filter-footer { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.active-filter-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 5px; }
.filter-chip { padding: 4px 8px; border-radius: 5px; color: var(--accent); background: var(--accent-soft); font-size: 11px; }

.url-capture-panel { margin-bottom: 24px; padding: 28px; }
.url-capture-panel .panel-description { max-width: 620px; margin-bottom: 20px; }
.url-capture-form textarea { display: block; min-height: 88px; margin-top: 8px; padding: 12px; resize: vertical; line-height: 1.6; }
.url-capture-actions { display: flex; align-items: center; gap: 5px; margin-top: 12px; }
.duplicate-notice { margin-top: 13px; padding: 12px; border-radius: 9px; background: #fff4e5; }
.duplicate-notice .form-message { margin: 0 0 7px; }
.warning { color: #925d16; }
.inline-action { display: block; margin-top: 8px; padding: 5px 0; color: var(--accent); }
.source-hint { margin: -10px 0 18px; color: var(--accent); }

.item-form-panel { margin-bottom: 24px; padding: 28px; }
.form-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 22px; }
.icon-button { border: 0; padding: 0 4px; color: var(--soft-muted); background: transparent; font-size: 28px; line-height: 1; }
.icon-button:hover { color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.field input, .field select { display: block; margin-top: 8px; padding: 11px 12px; }
.field select { padding-right: 34px; }
.field-wide { grid-column: span 2; }
.input-suffix { display: flex; align-items: center; margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfa; }
.input-suffix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(33, 76, 61, .1); }
.input-suffix input { margin: 0; border: 0; background: transparent; box-shadow: none; }
.input-suffix span { padding-right: 12px; color: var(--muted); font-size: 12px; }
.form-actions { display: flex; align-items: center; gap: 5px; margin-top: 28px; }
.form-actions-spacer { flex: 1; }

.empty-state { padding: 64px 20px 70px; text-align: center; }
.empty-illustration { display: grid; width: 64px; height: 64px; margin: 0 auto 20px; place-items: center; border: 1px dashed #b9c9bf; border-radius: 50%; color: var(--accent); font-size: 27px; font-weight: 300; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.no-results-state { padding-top: 42px; padding-bottom: 48px; }
.cart-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cart-card { display: flex; min-width: 0; flex-direction: column; min-height: 240px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.seller { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.product-name { overflow-wrap: anywhere; margin: 0; font-size: 18px; letter-spacing: -0.04em; line-height: 1.35; }
.card-meta { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.status-badge { margin-left: auto; padding: 4px 7px; border-radius: 5px; color: var(--accent); background: var(--accent-soft); font-size: 10px; white-space: nowrap; }
.edit-link { flex: 0 0 auto; border: 0; padding: 4px 0; color: var(--muted); background: transparent; font-size: 12px; }
.edit-link:hover { color: var(--accent); }
.price-block { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px 9px; margin: 24px 0 20px; }
.current-price { font-size: 24px; font-weight: 700; letter-spacing: -0.05em; }
.shipping-price { color: var(--muted); font-size: 11px; }
.total-price { color: var(--ink); font-size: 13px; font-weight: 700; }
.target-price { color: var(--accent); font-size: 12px; }
.target-price::before { content: '목표 '; color: var(--muted); }
.target-price.reached { font-weight: 700; }
.target-price.reached::after { content: ' 도달'; margin-left: 2px; font-size: 10px; }
.card-bottom { display: flex; align-items: end; justify-content: space-between; gap: 12px; min-width: 0; margin-top: auto; padding-top: 16px; border-top: 1px solid #f0f0ed; }
.memo { overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.source-link { overflow: hidden; max-width: 47%; color: var(--accent); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.site-footer { padding: 0 0 34px; color: var(--soft-muted); font-size: 11px; line-height: 1.7; }
.site-footer p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 28px, 620px); }
  .site-header { padding: 20px 0; }
  main { padding: 38px 0 54px; }
  .intro { margin-bottom: 32px; }
  h1 { font-size: clamp(38px, 12vw, 58px); }
  .unlock-panel { grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 23px; }
  .unlock-form { grid-column: 1 / -1; }
  .cart-heading { align-items: start; }
  .heading-actions { flex-direction: column-reverse; align-items: stretch; }
  .heading-actions .button { width: 100%; }
  .search-row { flex-wrap: wrap; }
  .search-field { flex-basis: calc(100% - 100px); }
  .sort-field { flex: 1; min-width: 0; }
  .filter-toggle { flex: 0 0 auto; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cart-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .app-shell { width: min(100% - 24px, 420px); }
  .local-badge { font-size: 11px; }
  .header-actions { gap: 6px; }
  .install-button { padding: 8px 10px; font-size: 11px; }
  .input-with-action { display: block; }
  .input-with-action .button { width: 100%; margin-top: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .item-form-panel { padding: 21px; }
  .url-capture-panel { padding: 21px; }
  .filter-panel { padding: 14px; }
  .filter-grid { grid-template-columns: 1fr; gap: 11px; }
  .filter-footer { align-items: stretch; flex-direction: column; }
  .filter-footer .button { align-self: flex-start; }
  .form-actions { flex-wrap: wrap; }
  .form-actions-spacer { display: none; }
  .form-actions .button:not(.button-danger) { flex: 1; }
  .form-actions .button-danger { order: 3; width: 100%; margin-top: 5px; }
  .card-bottom { align-items: start; flex-direction: column; }
  .source-link { max-width: 100%; }
}
