:root {
  --bg: #eef3f7;
  --bg-soft: #ffffff;
  --ink: #152028;
  --muted: #5f7385;
  --line: rgba(21, 32, 40, 0.1);
  --panel: #ffffff;
  --accent: #0f8a7d;
  --accent-ink: #ffffff;
  --shadow: 0 10px 28px rgba(21, 32, 40, 0.08);
  --font-display: "Outfit", sans-serif;
  --font-body: "Figtree", sans-serif;
  --phone-width: 430px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(120% 55% at 50% 0%, #d9e8f2 0%, transparent 60%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  inset: 0;
}

.app {
  width: min(100%, var(--phone-width));
  height: 100%;
  max-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding:
    calc(env(safe-area-inset-top, 0px) + 10px)
    calc(env(safe-area-inset-right, 0px) + 12px)
    calc(env(safe-area-inset-bottom, 0px) + 10px)
    calc(env(safe-area-inset-left, 0px) + 12px);
}

.app.is-scrollable {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.brand-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f7fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 3.1vw, 0.86rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.picks-bar {
  flex: 0 0 auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.picks-label {
  margin: 0 0 6px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.picks-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.picks-row::-webkit-scrollbar {
  display: none;
}

.pick-thumb {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f3f7fa;
  padding: 4px;
  cursor: pointer;
}

.pick-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pick-size {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pick-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.intro {
  flex: 0 0 auto;
  min-width: 0;
}

.intro-done {
  text-align: center;
}

.done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
}

.done-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.intro-done h1 {
  font-size: clamp(1.25rem, 5.5vw, 1.6rem);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 7vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.86rem, 3.6vw, 0.98rem);
  line-height: 1.4;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 18px)
    18px
    calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: rgba(21, 32, 40, 0.42);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

.popup {
  width: min(100%, 360px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 18px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 48px rgba(21, 32, 40, 0.22);
  text-align: center;
  animation: popup-in 0.28s ease;
}

.popup h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 5.2vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.popup-ordinal {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  vertical-align: baseline;
}

.flow-chart {
  list-style: none;
  margin: 6px 0 2px;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  border-radius: 14px;
  background: #f3f7fa;
  border: 1px solid var(--line);
}

.intro .flow-chart {
  margin-top: 8px;
}

.flow-step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  min-width: 0;
}

.flow-step:last-child {
  flex: 0 0 auto;
}

.flow-dot {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  background: #ffffff;
  border: 2px solid rgba(21, 32, 40, 0.16);
  flex: 0 0 auto;
}

.flow-line {
  flex: 1 1 auto;
  height: 3px;
  margin: 0 4px;
  border-radius: 999px;
  background: rgba(21, 32, 40, 0.12);
}

.flow-step.is-done .flow-dot,
.flow-step.is-current .flow-dot {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.flow-step.is-done .flow-line {
  background: var(--accent);
}

.flow-step.is-current .flow-dot {
  box-shadow: 0 0 0 4px rgba(15, 138, 125, 0.18);
  transform: scale(1.08);
}

.popup-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 14px 12px 12px;
  border-radius: 16px;
  background: #f3f7fa;
  border: 1px solid var(--line);
}

.popup-size-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.popup-size {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1;
}

.popup-question {
  margin: 4px 0 2px;
  color: var(--ink);
  font-size: clamp(0.95rem, 3.8vw, 1.05rem);
  font-weight: 600;
  line-height: 1.35;
}

.popup-hint {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.popup-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 4px;
}

.popup-confirm {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  font-size: clamp(0.86rem, 3.4vw, 0.95rem);
  border-radius: 14px;
  min-height: 52px;
  padding: 0 12px;
  cursor: pointer;
}

.popup-reselect {
  appearance: none;
  border: 1px solid var(--line);
  background: #f3f7fa;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: clamp(0.86rem, 3.4vw, 0.95rem);
  border-radius: 14px;
  min-height: 48px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.popup-reselect svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

.popup-confirm.is-danger {
  background: #c0392b;
}

.product {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.price-banner {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f8a7d, #0b6f65);
  color: #ffffff;
  text-align: center;
  box-shadow: var(--shadow);
}

.price-banner strong {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 3.6vw, 1.02rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.price-banner span {
  font-size: 0.72rem;
  opacity: 0.92;
}

.photo-wrap {
  appearance: none;
  border: 1px solid var(--line);
  flex: 1 1 auto;
  min-height: 0;
  max-height: 30vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, #f8fbfd 0%, #e7eef4 100%);
  border-radius: 16px;
  padding: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  color: inherit;
  font: inherit;
  width: 100%;
  position: relative;
  z-index: 1;
}

.zoom-hint {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(21, 32, 40, 0.08);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.zoom-hint svg {
  width: 12px;
  height: 12px;
  display: block;
  flex: 0 0 auto;
}

.zoom-hint.is-compact {
  font-size: 0.72rem;
  padding: 4px 8px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(21, 32, 40, 0.72);
  backdrop-filter: blur(5px);
  animation: fade-in 0.2s ease;
}

.lightbox img {
  max-width: min(100%, 520px);
  max-height: min(78dvh, 640px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
}

.lightbox-close {
  appearance: none;
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
  display: block;
}

.lightbox-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.photo {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.features-btn {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #f3f7fa;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  border-radius: 12px;
  min-height: 40px;
  width: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

.features-btn svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  display: block;
  flex: 0 0 auto;
}

.features-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.features-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
  max-height: 45vh;
  overflow-y: auto;
}

.features-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border-radius: 12px;
  background: #f3f7fa;
  border: 1px solid var(--line);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.features-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px #d8f3ef;
}

.sizes {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.size-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 3.8vw, 1.08rem);
  font-weight: 700;
  border-radius: 12px;
  min-height: 46px;
  width: 100%;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.size-btn:active {
  transform: scale(0.97);
}

.size-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.size-btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.dots {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(21, 32, 40, 0.16);
}

.dots span.is-done,
.dots span.is-current {
  background: var(--accent);
}

.dots span.is-current {
  width: 22px;
}

.summary {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.summary-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: inherit;
  text-align: center;
}

.summary-zoom,
.popup-zoom,
.order-zoom {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.summary-zoom img {
  width: min(88%, 280px);
  height: auto;
  max-height: 28vh;
  object-fit: contain;
  display: block;
}

.summary-meta {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.summary-meta strong,
.summary-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
}

.summary-meta span,
.summary-item span:not(.zoom-hint) {
  color: var(--muted);
  font-size: 0.92rem;
}

.popup-card img {
  width: min(72%, 200px);
  height: auto;
  max-height: 22vh;
  object-fit: contain;
  display: block;
  margin-bottom: 4px;
  pointer-events: none;
}

.popup-zoom-btn {
  appearance: none;
  border: 0;
  cursor: zoom-in;
  margin-bottom: 4px;
}

.order-zoom {
  width: 88px;
}

.order-zoom img {
  width: 88px;
  height: 72px;
  object-fit: contain;
  display: block;
}

.done-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-btn,
.restart {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.order-btn {
  background: var(--accent);
  color: var(--accent-ink);
}

.restart {
  background: #eef3f7;
  color: var(--ink);
  border: 1px solid var(--line);
}

.order-btn svg,
.restart svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.order-btn:focus-visible,
.restart:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.order-models {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-model {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.order-model strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
}

.order-model span {
  color: var(--muted);
  font-size: 0.92rem;
}

.order-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.order-submit {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 54px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.order-submit svg {
  width: 20px;
  height: 20px;
  display: block;
}

.order-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.section-label {
  margin: 0 0 2px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.success-meta,
.order-summary-box,
.delivery-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.meta-row,
.summary-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.meta-row span,
.summary-line span {
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-row strong,
.summary-line strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-align: right;
}

.summary-line.is-free strong {
  color: var(--accent);
}

.summary-line.is-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.summary-line.is-total span,
.summary-line.is-total strong {
  font-size: 1.1rem;
  color: var(--ink);
  font-weight: 800;
}

.summary-note,
.success-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.delivery-box p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.delivery-box strong {
  font-family: var(--font-display);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popup-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 360px) {
  .app {
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .sizes {
    gap: 6px;
  }

  .size-btn {
    min-height: 46px;
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .size-btn,
  .popup-overlay,
  .popup,
  .lightbox {
    transition: none;
    animation: none;
  }
}
