:root {
  --bg-top: #f3f3ef;
  --bg-mid: #e7e5dd;
  --bg-bottom: #d7d4c8;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text-main: #1e2724;
  --text-muted: #53605c;
  --accent: #0e5f5d;
  --accent-soft: #c9eceb;
  --line: rgba(16, 40, 36, 0.14);
  --shadow: 0 16px 36px rgba(35, 39, 38, 0.18);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bottom) 100%);
  color: var(--text-main);
  overflow-x: hidden;
}

.app-shell {
  min-height: 100dvh;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}

.stage {
  position: relative;
  width: min(100%, 430px);
  justify-self: center;
  aspect-ratio: 9 / 16;
  min-height: 70dvh;
  max-height: 82dvh;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.72), transparent 52%),
    linear-gradient(180deg, #fdfdfc 0%, #f4f5f1 62%, #eaede8 100%);
  animation: stage-in 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(0deg, rgba(18, 56, 50, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 56, 50, 0.045) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

.clip-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition:
    opacity 100ms linear,
    filter 100ms linear,
    mix-blend-mode 100ms linear;
}

.clip-layer.is-active {
  opacity: 1;
}

.clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.top-hud {
  top: 0;
}

.bottom-hud {
  bottom: 0;
}

.focus-exit-btn {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 7;
  display: none;
  appearance: none;
  border: 0;
  background: rgba(12, 48, 45, 0.86);
  color: #eef9f8;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 13px;
  cursor: pointer;
}

.pill {
  background: rgba(12, 48, 45, 0.82);
  color: #eef9f8;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.3px;
}

.pill-muted {
  background: rgba(15, 40, 36, 0.66);
}

.controls {
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 10px 20px rgba(39, 45, 44, 0.1);
  display: grid;
  gap: 14px;
}

.shop-view {
  display: none;
  min-height: 100dvh;
  padding: 18px 16px 24px;
  background:
    radial-gradient(circle at top left, rgba(255, 245, 214, 0.86), transparent 38%),
    radial-gradient(circle at top right, rgba(189, 223, 214, 0.78), transparent 34%),
    linear-gradient(180deg, #efe7d5 0%, #ddd6c6 100%);
}

.shop-shell {
  width: min(100%, 430px);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shop-back-btn {
  appearance: none;
  border: 0;
  background: rgba(21, 52, 47, 0.9);
  color: #eff8f6;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  letter-spacing: 0.2px;
  cursor: pointer;
}

.shop-brand,
.shop-count,
.shop-kicker {
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.shop-brand {
  font-size: 12px;
  color: #30514d;
}

.shop-count {
  font-size: 12px;
  color: #4c635f;
}

.shop-hero {
  display: grid;
  gap: 6px;
}

.shop-kicker {
  margin: 0;
  font-size: 11px;
  color: #6d7a73;
}

.shop-title {
  margin: 0;
  font-size: clamp(28px, 8vw, 40px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: #172b28;
}

.shop-copy {
  margin: 0;
  max-width: 34ch;
  font-size: 14px;
  line-height: 1.45;
  color: #516461;
}

.shop-stage-slot {
  display: grid;
  justify-items: center;
}

.shop-card-panel {
  position: relative;
  overflow: hidden;
  min-height: 230px;
}

.shop-card-track {
  position: relative;
  min-height: 230px;
}

.shop-card {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 246, 240, 0.9) 100%);
  border: 1px solid rgba(34, 55, 50, 0.12);
  box-shadow:
    0 18px 44px rgba(41, 44, 38, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  will-change: transform, opacity;
}

.shop-card-secondary {
  pointer-events: none;
}

.shop-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.shop-card-index {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6e7b77;
}

.shop-card-price {
  font-size: 15px;
  font-weight: 600;
  color: #173633;
}

.shop-card-name {
  margin: 0;
  font-size: 26px;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: #132724;
}

.shop-card-meta {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #74847c;
}

.shop-card-blurb {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #425652;
}

.shop-card-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-card-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(19, 60, 54, 0.08);
  color: #274944;
  font-size: 12px;
}

.shop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-card-note {
  font-size: 12px;
  color: #72807b;
}

.shop-card-cta {
  padding: 10px 14px;
  border-radius: 999px;
  background: #143d39;
  color: #effbf8;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.focus-enter-btn {
  justify-self: start;
}

.control-block {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

h2 {
  margin: 0;
  font-size: 14px;
}

.selected-label {
  font-size: 12px;
  color: var(--text-muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button.mode-btn {
  appearance: none;
  border: 1px solid rgba(10, 65, 62, 0.2);
  background: #f4f7f6;
  border-radius: 999px;
  color: #224845;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
}

button.mode-btn:active {
  transform: scale(0.97);
}

button.mode-btn.is-active {
  background: var(--accent);
  color: #f0fffd;
  border-color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

body.focus-mode .app-shell {
  max-width: none;
  padding: 0;
  gap: 0;
  grid-template-rows: 1fr;
}

body.focus-mode .controls {
  display: none;
}

body.focus-mode .stage {
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

body.focus-mode .hud {
  display: none;
}

body.focus-mode .focus-exit-btn {
  display: inline-flex;
  align-items: center;
}

body.shop-view-mode {
  background:
    radial-gradient(circle at top left, rgba(255, 245, 214, 0.86), transparent 38%),
    radial-gradient(circle at top right, rgba(189, 223, 214, 0.78), transparent 34%),
    linear-gradient(180deg, #efe7d5 0%, #ddd6c6 100%);
}

body.shop-view-mode .app-shell {
  display: none;
}

body.shop-view-mode .shop-view {
  display: block;
}

body.shop-view-mode .stage {
  width: min(100%, 430px);
  min-height: 70dvh;
  max-height: 74dvh;
  border-radius: 34px;
  border: 1px solid rgba(27, 52, 47, 0.12);
  box-shadow: 0 20px 48px rgba(34, 37, 33, 0.18);
}

body.shop-view-mode .clip {
  object-fit: cover;
}

body.shop-view-mode .hud,
body.shop-view-mode .focus-exit-btn {
  display: none !important;
}

@keyframes stage-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 720px) {
  .app-shell {
    grid-template-rows: auto auto;
    padding: 18px;
  }
}
