:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --surface: rgba(255, 255, 255, 0.52);
  --text: #17181a;
  --muted: #686a70;
  --line: #dcdad4;
  --accent: #6e55c6;
  --accent-soft: #e9e3ff;
  --good: #087f62;
  --bad: #b42332;
  --shadow: 0 24px 70px rgba(47, 38, 74, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  padding: max(24px, env(safe-area-inset-top)) 24px max(64px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 72% 10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 32%),
    var(--bg);
  color: var(--text);
  overscroll-behavior-y: contain;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue",
    "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
}

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

.price-app {
  width: min(620px, 100%);
  transition: transform 180ms ease;
}

.pull-refresh {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 5;
  width: 28px;
  height: 28px;
  border: 2px solid color-mix(in srgb, var(--muted) 24%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -48px);
  transition: opacity 140ms ease, transform 180ms ease;
}

.pull-refresh.is-spinning {
  animation: spin 720ms linear infinite;
  opacity: 1 !important;
}

@keyframes spin {
  to { transform: translate(-50%, 30px) rotate(360deg); }
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.content-section + .content-section {
  margin-top: 42px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.view-intro {
  padding: 0 0 16px;
}

.view-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.32rem, 4vw, 1.58rem);
  font-weight: 680;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 0;
  font-size: 0.98rem;
  font-weight: 670;
}

.stock-count {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  margin-left: 6px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  vertical-align: middle;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

button:hover {
  border-color: var(--muted);
}

button:disabled {
  color: var(--muted);
  cursor: default;
}

.hero {
  padding: 30px 0 27px;
  border-bottom: 1px solid var(--line);
}

.hero strong {
  display: block;
  color: var(--accent);
  font-size: clamp(3.1rem, 12vw, 5rem);
  font-weight: 730;
  line-height: 0.92;
  letter-spacing: -0.065em;
}

.hero > span {
  display: block;
  margin-top: 14px;
  color: var(--muted);
}

.hero p {
  margin: 8px 0 0;
  font-size: 0.96rem;
  font-weight: 640;
}

.facts {
  margin: 28px 0 0;
  border-top: 1px solid var(--line);
}

.facts > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 630;
}

.section {
  padding-top: 28px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.73rem;
}

.section-heading a {
  color: var(--muted);
  font-size: 0.86rem;
  text-underline-offset: 3px;
}

.variants {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.variant {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}

.variant:last-child {
  border-bottom: 0;
}

.variant.is-unavailable,
.compact-item.is-unavailable {
  opacity: 0.42;
  filter: grayscale(0.65);
}

.color-dot {
  width: 18px;
  height: 18px;
  border: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
  border-radius: 50%;
  background: #6f7175;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, white 18%, transparent);
}

.color-dot.violet { background: #7564a6; }
.color-dot.cream { background: #e9dfcc; }
.color-dot.graphite { background: #555b60; }
.color-dot.blue { background: #8fb5da; }
.color-dot.pink { background: #d8a5ac; }
.color-dot.white { background: #f6f3ed; }
.color-dot.silver { background: #aeb2b8; }
.color-dot.black { background: #25272a; }

.variant-name {
  font-weight: 650;
}

.availability {
  display: inline-flex !important;
  align-items: center;
  min-height: 18px;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.61rem !important;
  font-weight: 720;
  line-height: 1;
  vertical-align: 1px;
}

.availability.in {
  background: color-mix(in srgb, var(--good) 13%, transparent);
  color: var(--good);
}

.availability.out {
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  color: var(--muted);
}

.variant-model {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.variant-prices {
  min-width: 180px;
}

.price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 0.76rem;
}

.price-line + .price-line {
  margin-top: 4px;
}

.price-line strong {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
}

.price-line.retail strong {
  color: var(--accent);
  font-size: 1.06rem;
  font-weight: 740;
}

.delta {
  display: block;
  min-height: 17px;
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 620;
}

.delta.down { color: var(--good); }
.delta.up { color: var(--bad); }

.compact-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.compact-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.compact-item:last-child {
  border-bottom: 0;
}

.compact-identity {
  min-width: 0;
}

.compact-identity > strong,
.compact-identity > span {
  display: block;
}

.compact-identity strong {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-identity > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
}

.compact-prices {
  text-align: right;
}

.compact-prices > span,
.compact-prices > strong {
  display: block;
  white-space: nowrap;
}

.compact-prices > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.compact-prices > strong {
  margin-top: 3px;
  color: var(--accent);
  font-size: 0.9rem;
}

.compact-prices .delta {
  min-height: 0;
  margin-top: 3px;
}

.memory-group + .memory-group {
  border-top: 5px solid var(--bg);
}

.memory-group h3 {
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 680;
  letter-spacing: 0.04em;
}

.history {
  border-top: 1px solid var(--line);
}

.history-item,
.history-empty {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.history-time {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-text {
  line-height: 1.4;
}

.history-empty {
  display: block;
  color: var(--muted);
}

.push-status,
.app-status {
  min-height: 22px;
  margin: 20px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.app-status {
  margin-top: 4px;
}

.app-status.error {
  color: var(--bad);
}

.site-legal {
  width: min(620px, calc(100% - 36px));
  margin: 34px auto 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 560px) {
  body {
    place-items: start center;
    padding-right: 18px;
    padding-left: 18px;
  }

  .top {
    align-items: center;
  }

  .actions {
    max-width: 145px;
  }

  .facts > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  dd {
    text-align: left;
  }

  .variant {
    grid-template-columns: auto 1fr;
  }

  .variant-prices {
    grid-column: 2;
    min-width: 0;
    margin-top: 2px;
  }

  .compact-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .compact-prices {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    text-align: left;
  }

  .compact-prices > strong {
    margin-top: 0;
  }

  .history-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: rgba(255, 255, 255, 0.035);
    --text: #f2f2ef;
    --muted: #9b9da4;
    --line: #303136;
    --accent: #a98df2;
    --accent-soft: #352d4d;
    --good: #53d1ae;
    --bad: #ff7180;
    --shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
