
@font-face {
  font-family: 'GMarketSans';
  src: url('../fonts/GmarketSansLight.woff') format('woff');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'GMarketSans';
  src: url('../fonts/GmarketSansMedium.woff') format('woff');
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'GMarketSans';
  src: url('../fonts/GmarketSansBold.woff') format('woff');
  font-weight: 700;
  font-display: swap;
}

:root {
  --container-width: 800px;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #1a1d24;
  --text-secondary: #6b707a;
  --text-muted: #9aa0aa;
  --accent: #3182f6;
  --accent-bg: #eaf2ff;
  --thumb-bg: #eef0f3;
  --danger: #e5391f;
  --radius: 0;
  --radius-pill: 999px;
  --radius-image: 6px;
}

:root[data-theme="dark"] {
  --bg: #121317;
  --surface: #1c1e24;
  --border: #2b2e36;
  --border-strong: #3c404a;
  --text: #eef0f4;
  --text-secondary: #a7acb6;
  --text-muted: #767b87;
  --accent: #5b9bff;
  --accent-bg: #1c2b47;
  --thumb-bg: #24262c;
  --danger: #ff6b52;
}

* {
  box-sizing: border-box;
}

* {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input,
textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

a,
button,
img {
  -webkit-tap-highlight-color: transparent;
}

a:focus,
button:focus,
img:focus {
  outline: none;
}

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

html {
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'GMarketSans', -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

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

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

.site-header-top,
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
}

.site-logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}

.back-link.site-name-mode {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.icon-button {
  flex: none;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button .icon-moon {
  display: inline-flex;
}

.icon-button .icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-button .icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-button .icon-sun {
  display: inline-flex;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.search-form {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  padding: 0 34px 0 16px;
  font-size: 13px;
  color: var(--text);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}

.category-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px;
}

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

.category-tab {
  flex: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.category-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

.view-toggle {
  flex: none;
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-toggle-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--border-strong);
}

.view-toggle-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.deal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 24px;
}

.deal-row {
  display: block;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.deal-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.deal-badge {
  flex: none;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius);
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-badge-site {
  background: var(--text-secondary);
  color: #fff;
}

.deal-badge-category {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

:root[data-theme="dark"] .deal-badge-category {
  color: #fff;
}

.deal-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.deal-thumb {
  position: relative;
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-image);
  overflow: hidden;
  background: var(--thumb-bg);
  border: 1px solid var(--border);
}

.deal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.deal-hot-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius);
}

.deal-info {
  flex: 1;
  min-width: 0;
}

.deal-name {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

.deal-price {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--danger);
  white-space: nowrap;
}

.deal-price .price-unit {
  font-size: 13px;
  font-weight: 400;
}

.deal-time {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.deal-chevron {
  flex: none;
  align-self: center;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 14px;
}

.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.loading-indicator[hidden] {
  display: none;
}

.scroll-sentinel {
  height: 1px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.deal-list.grid-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.deal-list.grid-view .deal-row {
  padding: 10px;
  min-width: 0;
}

.deal-list.grid-view .deal-body {
  gap: 8px;
}

.deal-list.grid-view .deal-thumb {
  width: 72px;
  height: 72px;
}

.deal-list.grid-view .deal-badge {
  font-size: 11px;
  padding: 2px 7px;
  max-width: 80px;
}

.deal-list.grid-view .deal-name {
  font-size: 14px;
  margin-bottom: 4px;
}

.deal-list.grid-view .deal-price {
  font-size: 15px;
}

.deal-list.grid-view .deal-time {
  font-size: 12px;
}

.detail {
  background: var(--surface);
  padding-top: 12px;
  padding-bottom: 32px;
}

.detail-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--thumb-bg);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.detail-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.detail-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius);
}

.detail-badge-site {
  background: var(--text-secondary);
  color: #fff;
}

.detail-badge-category {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

:root[data-theme="dark"] .detail-badge-category {
  color: #fff;
}

.detail-body {
  padding: 18px 4px 0;
}

.detail-time {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.detail-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.detail-price {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  color: var(--danger);
}

.detail-price .price-unit {
  font-size: 16px;
  font-weight: 400;
}

.detail-disclosure {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: left;
  word-break: keep-all;
}

.detail-cta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.buy-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  transition: filter 0.15s ease;
}

.share-button {
  flex: none;
  width: 46px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(26, 29, 36, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius);
  z-index: 20;
}

.deal-badge-site[data-site="11번가"],
.detail-badge-site[data-site="11번가"],
.buy-button[data-site="11번가"] {
  background: #FF0038;
  color: #fff;
}

.deal-badge-site[data-site="지마켓"],
.detail-badge-site[data-site="지마켓"],
.buy-button[data-site="지마켓"] {
  background: #0ABB26;
  color: #fff;
}

.deal-badge-site[data-site="쿠팡"],
.detail-badge-site[data-site="쿠팡"],
.buy-button[data-site="쿠팡"] {
  background: #D73227;
  color: #fff;
}

.deal-badge-site[data-site="이마트몰"],
.detail-badge-site[data-site="이마트몰"],
.buy-button[data-site="이마트몰"] {
  background: #FFD040;
  color: #fff;
}

.deal-badge-site[data-site="GS SHOP"],
.detail-badge-site[data-site="GS SHOP"],
.buy-button[data-site="GS SHOP"] {
  background: #0088FF;
  color: #fff;
}

.deal-badge-site[data-site="마켓컬리"],
.detail-badge-site[data-site="마켓컬리"],
.buy-button[data-site="마켓컬리"] {
  background: #5F0080;
  color: #fff;
}

.deal-badge-site[data-site="롯데홈쇼핑"],
.detail-badge-site[data-site="롯데홈쇼핑"],
.buy-button[data-site="롯데홈쇼핑"] {
  background: #CD3129;
  color: #fff;
}

.deal-badge-site[data-site="하이마트"],
.detail-badge-site[data-site="하이마트"],
.buy-button[data-site="하이마트"] {
  background: #000000;
  color: #fff;
}

.deal-badge-site[data-site="롯데온"],
.detail-badge-site[data-site="롯데온"],
.buy-button[data-site="롯데온"] {
  background: #000000;
  color: #fff;
}

.deal-badge-site[data-site="토스쇼핑"],
.detail-badge-site[data-site="토스쇼핑"],
.buy-button[data-site="토스쇼핑"] {
  background: #0064FF;
  color: #fff;
}

.deal-badge-site[data-site="토스 하루특가"],
.detail-badge-site[data-site="토스 하루특가"],
.buy-button[data-site="토스 하루특가"] {
  background: #0064FF;
  color: #fff;
}

:root[data-theme="dark"] .buy-button[data-site="롯데온"],
:root[data-theme="dark"] .buy-button[data-site="하이마트"] {
  border: 1px solid var(--border-strong);
}

.related-card {
  margin: 0 -16px;
  border-top: 8px solid var(--bg);
  padding: 18px 20px 4px;
}

.related-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.related-notice {
  margin: 0 0 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.related-card .related-title + .related-loading {
  margin-top: 12px;
}

.related-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 0;
}

.related-loading[hidden] {
  display: none;
}

.related-list {
  display: flex;
  flex-direction: column;
}

.related-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.related-item:last-child {
  border-bottom: none;
}

.related-item-extra {
  display: none;
}

.related-list.expanded .related-item-extra {
  display: flex;
}

.related-thumb {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-image);
  overflow: hidden;
  background: var(--thumb-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-thumb.price-compare-thumb {
  background: none;
  border: none;
}

.related-thumb.price-compare-thumb img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
}

.related-thumb-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  padding: 2px;
  word-break: keep-all;
}

.related-info {
  flex: 1;
  min-width: 0;
}

.related-name {
  margin: 0 0 3px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-price {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
}

.related-price .price-unit {
  font-size: 11px;
  font-weight: 400;
}

.related-more-btn {
  width: 100%;
  margin-top: 4px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
}

.not-found {
  padding: 80px 16px;
  text-align: center;
}

.not-found-title {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.not-found-home-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.not-found-desc {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.not-found-countdown {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .detail-title {
    font-size: 16px;
  }

  .detail-price {
    font-size: 22px;
  }

  .detail-disclosure {
    font-size: 13px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .buy-button:hover {
    filter: brightness(0.92);
  }

  .related-item:hover {
    background: var(--bg);
  }

  .category-tab:not(.is-active):hover {
    background: var(--accent-bg);
    border-color: var(--accent-bg);
    color: var(--accent);
  }

  .view-toggle-btn:not(.is-active):hover {
    background: var(--bg);
    color: var(--text-secondary);
  }

  .icon-button:hover {
    background: var(--bg);
    color: var(--text);
    border-radius: 50%;
  }

  .share-button:hover {
    background: var(--bg);
  }
}

.scroll-top-btn {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
  .scroll-top-btn:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  }
}

@media (max-width: 900px) {
  .scroll-top-btn {
    display: none;
  }

  body.product-page .scroll-top-btn {
    display: flex;
    top: 64px;
    left: 0;
    right: 0;
    bottom: auto;
    margin: 0 auto;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-color: transparent;
    color: #fff;
  }
}

@media (max-width: 800px) {
  .view-toggle {
    display: none;
  }

  .deal-list.grid-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .deal-list.grid-view .deal-row {
    padding: 12px;
  }

  .deal-list.grid-view .deal-body {
    gap: 12px;
  }

  .deal-list.grid-view .deal-thumb {
    width: 96px;
    height: 96px;
  }

  .deal-list.grid-view .deal-badge {
    font-size: 11px;
    padding: 3px 8px;
    max-width: 55%;
  }

  .deal-list.grid-view .deal-name {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .deal-list.grid-view .deal-price {
    font-size: 16px;
  }

  .deal-list.grid-view .deal-time {
    font-size: 12px;
  }
}

.a2hs-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: a2hs-slide-up 0.3s ease;
}

@keyframes a2hs-slide-up {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.a2hs-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--accent);
}

.a2hs-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  word-break: keep-all;
}

.a2hs-text strong {
  color: var(--accent);
}

.a2hs-install-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .a2hs-install-btn:hover {
    filter: brightness(0.92);
  }
}

.a2hs-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

@media (min-width: 700px) {
  .a2hs-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 320px;
  }
}
