:root {
  --void: #0a0a0b;
  --panel: #141416;
  --panel-2: #1a1a1d;
  --line: #2a2a2e;
  --ink: #f4f4f5;
  --mute: #8b8b93;
  --signal: #d4d4d8;
  --signal-2: #a1a1aa;
  --heat: #f07167;
  --ok: #7dcea0;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--void);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  place-items: center;
}

.icon-btn:active {
  opacity: 0.85;
}

.icon-btn[hidden] {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.brand-mark,
.brand-thumb {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 0.85rem;
  background: var(--panel-2);
  color: var(--text);
  overflow: hidden;
}

.brand-mark-logo {
  width: 72%;
  height: auto;
  display: block;
}

.brand-mark.is-initials .brand-mark-logo {
  display: none;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-tag {
  margin: 2px 0 0;
  color: var(--mute);
  font-size: 0.75rem;
}

.view {
  display: grid;
  gap: 14px;
}

.home-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 148px;
}

.home-banner img,
.home-banner .fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-banner .fallback {
  background: var(--panel-2);
}

.home-banner .veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 11, 0.25) 0%,
    rgba(10, 10, 11, 0.78) 100%
  );
}

.home-banner .copy {
  position: relative;
  z-index: 1;
  padding: 56px 16px 16px;
}

.home-banner .eyebrow {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-banner h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.home-banner .copy > p:last-child {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  margin-top: 6px;
}

.section-label h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-label span {
  color: var(--mute);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 560px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cat-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  aspect-ratio: 1 / 1.05;
  min-height: 0;
  text-align: left;
  padding: 0;
}

.cat-card:active {
  opacity: 0.92;
}

.cat-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.cat-card .media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.cat-card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cat-card .media-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.18);
  background: var(--panel-2);
}

.cat-card .shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.72) 100%);
}

.cat-card .footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
}

.cat-card .footer strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.cat-card .footer small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
}

.home-list {
  display: grid;
  gap: 8px;
}

.home-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: left;
}

.home-row:active {
  opacity: 0.9;
}

.home-row-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.home-row-main strong {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.home-row-main small {
  color: var(--mute);
  font-size: 0.72rem;
}

.home-row-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: 0 0 auto;
}

.home-row-side .price {
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* —— Category —— */
.cat-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 148px;
}

.cat-hero img,
.cat-hero .fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cat-hero .fallback {
  background: var(--panel-2);
}

.cat-hero .veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, 0.78) 100%);
}

.cat-hero .copy {
  position: relative;
  z-index: 1;
  padding: 72px 16px 16px;
}

.cat-hero .copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.cat-hero .copy p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--mute);
  font-size: 0.8rem;
  font-weight: 500;
}

.chip[aria-current="true"] {
  color: var(--void);
  background: var(--ink);
  border-color: var(--ink);
}

.product-list {
  display: grid;
  gap: 8px;
}

.ticket {
  display: grid;
  grid-template-columns: 1fr auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  text-align: left;
  min-height: 88px;
}

.ticket:active {
  opacity: 0.92;
}

.ticket:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.ticket-spine {
  display: none;
}

.ticket-body {
  padding: 14px;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
}

.ticket-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ticket-body p {
  margin: 0;
  color: var(--mute);
  font-size: 0.76rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-side {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 6px;
  padding: 14px;
  border-left: 1px solid var(--line);
  min-width: 92px;
}

.price {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.stock {
  font-size: 0.7rem;
  color: var(--mute);
}

.stock.in {
  color: var(--ok);
}

.stock.out {
  color: var(--heat);
}

.view-hint {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--mute);
}

.state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px 18px;
  text-align: center;
}

.state h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
}

.state p {
  margin: 8px 0 0;
  color: var(--mute);
  font-size: 0.9rem;
}

.spinner {
  width: 24px;
  height: 24px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  animation: spin 0.7s linear infinite;
}

/* —— Sheet / product detail —— */
.sheet[hidden] {
  display: none;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.62);
}

.sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(720px, 100%);
  max-height: min(90dvh, 820px);
  background: #0e0e10;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  padding: 8px 0 0;
  overflow: auto;
  animation: sheet-up 0.24s ease;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #2e2e33;
  margin: 6px auto 10px;
}

.sheet-body {
  padding: 0 16px calc(18px + var(--safe-bottom));
}

.detail-category {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: left;
}

.detail-category:not(:disabled):active {
  opacity: 0.9;
}

.detail-category .hint {
  margin: 4px 0 0;
  color: var(--mute);
  font-size: 0.72rem;
}

.detail-category img,
.detail-category .fallback {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.detail-category .fallback {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  background: var(--panel-2);
}

.detail-category .label {
  margin: 0;
  color: var(--mute);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-category h3 {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.detail-head h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.74rem;
  color: var(--mute);
}

.pill strong {
  color: var(--ink);
  font-weight: 650;
}

.detail-desc {
  margin: 0 0 18px;
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.buy-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--void);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.buy-btn:active {
  opacity: 0.92;
}

.buy-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-btn {
  width: 100%;
  margin-top: 8px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--mute);
  font-weight: 500;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 50;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.82rem;
  box-shadow: var(--shadow);
}

.promo-popup[hidden] {
  display: none;
}

.promo-popup {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.promo-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.66);
}

.promo-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px));
  max-height: min(80dvh, 640px);
  overflow: auto;
  background: #0e0e10;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px 16px 16px;
}

.promo-body {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 8px 0 16px;
}

.promo-body :is(h1, h2, h3, h4) {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.promo-body p {
  margin: 0 0 10px;
  color: var(--mute);
}

.promo-body a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.promo-body img {
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
}

.promo-body ul,
.promo-body ol {
  margin: 0 0 10px;
  padding-left: 1.2rem;
  color: var(--mute);
}

@keyframes sheet-up {
  from {
    transform: translate(-50%, 20px);
    opacity: 0.4;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
