:root {
  color-scheme: dark;
  --bg: #101011;
  --bg-deep: #0b0b0c;
  --panel: #121213;
  --panel-soft: #151516;
  --line: #4b4b50;
  --line-soft: #2b2b2f;
  --text: #f5f5f6;
  --muted: #8a8a91;
  --muted-strong: #b7b7bd;
  --blue: #2f58ff;
  --blue-strong: #1f45df;
  --blue-glow: rgba(48, 76, 255, 0.52);
  --silver: #d7d7dc;
  --radius: 8px;
  --font: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f8;
  --bg-deep: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f7f8fb;
  --line: #d8dbe3;
  --line-soft: #eceef3;
  --text: #111318;
  --muted: #69707c;
  --muted-strong: #3d4450;
  --blue: #2f58ff;
  --blue-strong: #2347d7;
  --blue-glow: rgba(47, 88, 255, 0.16);
  --silver: #3d4450;
}

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

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 220px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.market-app {
  min-height: 100vh;
}

.market-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  min-height: 72px;
  padding: 0 60px;
  background: rgba(16, 16, 17, 0.96);
  border-bottom: 1px solid #161619;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 44px;
}

.brand-name {
  color: #ffffff;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.market-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  min-width: 0;
}

.market-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: #dadade;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.market-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.market-nav a:hover,
.market-nav a.active {
  color: #ffffff;
}

.market-nav a:hover::after,
.market-nav a.active::after {
  opacity: 1;
  transform: translateY(0);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-pill,
.language-pill,
.user-pill,
.discord-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: #ececf0;
}

.icon-pill {
  display: inline-grid;
  place-items: center;
  width: 66px;
  padding: 0;
}

.language-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 17px;
}

.language-pill select {
  width: auto;
  min-width: 74px;
  min-height: 30px;
  padding: 0 18px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
  cursor: pointer;
}

.language-pill span {
  color: #9c9ca4;
}

.language-pill strong {
  font-weight: 700;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 8px;
}

.user-pill img,
.user-pill > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  object-fit: cover;
}

.discord-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 22px;
  border-color: transparent;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease;
}

.discord-button:hover {
  background: var(--blue-strong);
  transform: translateY(-1px);
}

.market-shell {
  width: min(100% - 120px, 1320px);
  margin: 0 auto;
  padding: 34px 0 80px;
}

.flash-mount {
  margin-bottom: 18px;
}

.flash-stack {
  display: grid;
  gap: 10px;
}

.flash {
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #151516;
  color: #ffffff;
}

.notice-carousel {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: end;
  gap: 20px;
  min-height: 350px;
}

.notice-rail {
  display: grid;
  gap: 8px;
  align-content: end;
  padding-bottom: 4px;
}

.notice-count {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.notice-thumb-stack {
  display: grid;
  gap: 10px;
}

.notice-thumb {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 2px;
  background: #151516;
  color: #fff;
}

.notice-thumb.active {
  border-color: #d9d9dd;
}

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

.notice-thumb span {
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.notice-controls {
  display: flex;
  gap: 4px;
}

.notice-controls button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: #5b5b62;
  color: #fff;
}

.notice-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 350px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c0c0d;
}

.notice-visual {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  background: #070708;
}

.notice-visual img {
  width: 100%;
  height: 100%;
  min-height: 350px;
  object-fit: cover;
}

.notice-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 350px;
  background:
    linear-gradient(135deg, rgba(47, 88, 255, 0.22), transparent 48%),
    linear-gradient(315deg, rgba(255, 83, 38, 0.2), transparent 42%),
    #111112;
}

.notice-fallback span {
  color: #fff;
  font-size: 48px;
  font-weight: 900;
}

.notice-copy {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 10px;
  min-width: 0;
  padding: 28px;
  background: linear-gradient(180deg, #151516 0%, #101011 100%);
}

.notice-chip {
  align-self: flex-start;
  display: inline-flex;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.notice-copy h1 {
  margin: 0;
  color: #fff;
  font-size: 25px;
  font-weight: 850;
  line-height: 1.25;
}

.notice-copy p {
  margin: 0;
  color: #b9b9c0;
  font-size: 14px;
}

.notice-copy small {
  color: #777780;
  font-weight: 700;
}

.notice-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.24);
  color: rgba(255, 255, 255, 0.74);
  transform: translateY(-50%);
}

.notice-arrow:hover {
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}

.notice-arrow.left {
  left: 18px;
}

.notice-arrow.right {
  right: 18px;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.chip-group,
.type-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sort-chip,
.type-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #7f7f87;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.sort-chip:hover,
.type-switch a:hover {
  color: #fff;
  border-color: #686870;
}

.sort-chip.active,
.type-switch a.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.market-search {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 20px;
  padding: 0 13px 0 17px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111112;
  color: var(--muted);
}

.market-search input[type="search"] {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f4f4f5;
  font-size: 15px;
}

.market-search input[type="search"]::placeholder {
  color: #77777f;
}

.market-search button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9b9ba3;
}

.market-search:focus-within {
  border-color: #71717a;
}

.setup-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(47, 88, 255, 0.42);
  border-radius: var(--radius);
  background: rgba(47, 88, 255, 0.08);
}

.setup-notice strong {
  display: block;
  color: #fff;
  font-size: 14px;
}

.setup-notice p {
  margin: 3px 0 0;
  color: #b6b6bd;
}

.setup-notice a {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 50px;
}

.product-card,
.store-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111112;
}

.product-card {
  min-height: 338px;
}

.empty-card {
  background: transparent;
}

.product-media {
  position: relative;
  display: block;
  height: 184px;
  overflow: hidden;
  background: #0a0a0b;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.product-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(47, 88, 255, 0.28), transparent 45%),
    linear-gradient(315deg, rgba(255, 83, 38, 0.18), transparent 45%),
    #111112;
}

.product-fallback span {
  color: #fff;
  font-size: 54px;
  font-weight: 900;
  letter-spacing: 0;
}

.product-info {
  padding: 12px 10px 13px;
}

.seller {
  display: inline-flex;
  margin-bottom: 4px;
  color: #777780;
  font-size: 11px;
  font-weight: 600;
}

.product-info h2,
.store-card h2 {
  margin: 0;
  color: #f4f4f6;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: 0;
}

.price {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 26px;
  font-weight: 850;
  line-height: 1.1;
}

.stars {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 7px;
  line-height: 1;
}

.stars span {
  color: #5e5e65;
  font-size: 18px;
}

.stars span.active {
  color: var(--blue);
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.mini-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #3c3c42;
  border-radius: 999px;
  color: #8d8d95;
  font-size: 10px;
  font-weight: 600;
}

.card-action {
  margin-top: 12px;
}

.card-action button,
.store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #3e3e45;
  border-radius: 999px;
  background: transparent;
  color: #f3f3f5;
  font-size: 12px;
  font-weight: 700;
}

.card-action button:hover,
.store-link:hover {
  border-color: var(--blue);
  color: #fff;
}

.store-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.store-card {
  display: grid;
  gap: 14px;
  min-height: 260px;
  padding: 20px;
}

.store-card.has-banner {
  padding: 0;
}

.store-card-banner {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 6;
  overflow: hidden;
  background: #0a0a0b;
}

.store-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-card.has-banner .store-card-main,
.store-card.has-banner p,
.store-card.has-banner .mini-tags,
.store-card.has-banner .store-link {
  margin-right: 20px;
  margin-left: 20px;
}

.store-card.has-banner .store-link {
  margin-bottom: 20px;
}

.store-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(47, 88, 255, 0.45);
  border-radius: 50%;
  background: rgba(47, 88, 255, 0.12);
  color: #fff;
  overflow: hidden;
  flex: 0 0 auto;
}

.store-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-card p {
  margin: 0;
  color: #aaaab1;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  margin-top: 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111112;
  color: #fff;
  text-align: center;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 36px;
}

.pagination a {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #bfc0c7;
  font-weight: 700;
}

.pagination a.active,
.pagination a:hover {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.market-footer {
  display: flex;
  justify-content: space-between;
  width: min(100% - 120px, 1320px);
  margin: 0 auto;
  padding: 0 0 36px;
  color: #74747c;
}

.market-footer span {
  color: #fff;
  font-weight: 800;
}

:root[data-theme="light"] body {
  background:
    linear-gradient(180deg, rgba(47, 88, 255, 0.035), transparent 260px),
    var(--bg);
  color: var(--text);
}

:root[data-theme="light"] .market-topbar,
:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: #e8ebf1;
  box-shadow: 0 8px 22px rgba(20, 25, 35, 0.06);
}

:root[data-theme="light"] .brand-name,
:root[data-theme="light"] .brand,
:root[data-theme="light"] .market-footer span,
:root[data-theme="light"] .footer span:first-child {
  color: #111318;
}

:root[data-theme="light"] .market-nav a,
:root[data-theme="light"] .topnav a {
  color: #3d4450;
}

:root[data-theme="light"] .market-nav a:hover,
:root[data-theme="light"] .market-nav a.active,
:root[data-theme="light"] .topnav a:hover,
:root[data-theme="light"] .topnav a.active {
  color: #111318;
}

:root[data-theme="light"] .icon-pill,
:root[data-theme="light"] .language-pill,
:root[data-theme="light"] .user-pill,
:root[data-theme="light"] .icon-button,
:root[data-theme="light"] .language-switcher,
:root[data-theme="light"] .balance-pill,
:root[data-theme="light"] .avatar-link {
  background: #ffffff;
  border-color: #d8dbe3;
  color: #111318;
}

:root[data-theme="light"] .language-pill span,
:root[data-theme="light"] .language-switcher span,
:root[data-theme="light"] .seller,
:root[data-theme="light"] .muted,
:root[data-theme="light"] .row-meta,
:root[data-theme="light"] .text-tight {
  color: #69707c;
}

:root[data-theme="light"] .notice-stage,
:root[data-theme="light"] .product-card,
:root[data-theme="light"] .store-card,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .list-row,
:root[data-theme="light"] .empty-state,
:root[data-theme="light"] .setup-notice {
  background: #ffffff;
  border-color: #d8dbe3;
}

:root[data-theme="light"] .notice-copy {
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fb 100%);
}

:root[data-theme="light"] .notice-copy h1,
:root[data-theme="light"] .product-info h2,
:root[data-theme="light"] .store-card h2,
:root[data-theme="light"] .price,
:root[data-theme="light"] .section-header h1,
:root[data-theme="light"] .section-header h2,
:root[data-theme="light"] .panel h1,
:root[data-theme="light"] .panel h2,
:root[data-theme="light"] .setup-notice strong,
:root[data-theme="light"] .empty-state,
:root[data-theme="light"] .button,
:root[data-theme="light"] .card-action button,
:root[data-theme="light"] .store-link {
  color: #111318;
}

:root[data-theme="light"] .notice-copy p,
:root[data-theme="light"] .store-card p,
:root[data-theme="light"] .setup-notice p,
:root[data-theme="light"] .announcement-content {
  color: #4c5562;
}

:root[data-theme="light"] .market-search,
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background: #ffffff;
  border-color: #d8dbe3;
  color: #111318;
}

:root[data-theme="light"] .market-search input[type="search"] {
  color: #111318;
}

:root[data-theme="light"] .sort-chip,
:root[data-theme="light"] .type-switch a,
:root[data-theme="light"] .chip,
:root[data-theme="light"] .tabs a,
:root[data-theme="light"] .filter-pills a,
:root[data-theme="light"] .mini-tags span,
:root[data-theme="light"] .pagination a {
  background: #ffffff;
  border-color: #d8dbe3;
  color: #4c5562;
}

:root[data-theme="light"] .sort-chip.active,
:root[data-theme="light"] .type-switch a.active,
:root[data-theme="light"] .tabs a.active,
:root[data-theme="light"] .filter-pills a.active,
:root[data-theme="light"] .chip.success,
:root[data-theme="light"] .pagination a.active,
:root[data-theme="light"] .pagination a:hover,
:root[data-theme="light"] .discord-button,
:root[data-theme="light"] .button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

:root[data-theme="light"] .product-media,
:root[data-theme="light"] .notice-visual,
:root[data-theme="light"] .notice-fallback,
:root[data-theme="light"] .product-fallback,
:root[data-theme="light"] .announcement-hero-image {
  background: #f0f2f6;
}

:root[data-theme="light"] .stars span {
  color: #b6bcc7;
}

:root[data-theme="light"] .stars span.active {
  color: var(--blue);
}

.noscript-shell {
  width: min(100% - 40px, 720px);
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111112;
}

@media (max-width: 1120px) {
  .market-topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 18px 28px;
  }

  .brand-lockup,
  .top-actions {
    justify-self: center;
  }

  .market-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  .market-shell,
  .market-footer {
    width: min(100% - 48px, 1320px);
  }

  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .notice-carousel {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .notice-rail {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding-bottom: 0;
  }

  .notice-thumb-stack {
    display: flex;
    overflow-x: auto;
  }

  .notice-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
  }

  .notice-stage {
    grid-template-columns: 1fr;
  }

  .notice-visual,
  .notice-visual img,
  .notice-fallback {
    min-height: 220px;
  }

  .notice-copy {
    padding: 20px;
  }

  .notice-copy h1 {
    font-size: 21px;
  }

  .filter-row,
  .setup-notice,
  .market-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .content-grid,
  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .market-topbar {
    padding: 16px 18px;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .icon-pill {
    width: 46px;
  }

  .discord-button {
    width: 100%;
    justify-content: center;
  }

  .market-shell,
  .market-footer {
    width: min(100% - 28px, 1320px);
  }

  .content-grid,
  .store-grid {
    grid-template-columns: 1fr;
  }

  .product-media {
    height: 210px;
  }

}
