@font-face {
  font-family: 'Wanted Sans';
  src: url('fonts/wanted-sans-regular-subset.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Wanted Sans';
  src: url('fonts/wanted-sans-bold-subset.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --background: #f7f8fa;
  --card: #ffffff;
  --foreground: #191f28;
  --body: #4e5968;
  --muted: #6b7684;
  --secondary: #f2f4f6;
  --primary: #3182f6;
  --primary-hover: #2272eb;
  --primary-weak: #e8f3ff;
  --primary-weak-foreground: #1b64da;
  --destructive: #e42939;
  --border: #e5e8eb;
  --on-primary: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--body);
  font-family: 'Wanted Sans', -apple-system, 'Segoe UI', 'Malgun Gothic', sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

h1, h2, h3 {
  margin: 0;
  color: var(--foreground);
  font-weight: 700;
  outline: none;
}

a {
  color: var(--primary-weak-foreground);
}

.page {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

#order,
#done {
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  gap: 12px;
}

/* 소개 */
.photo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--border);
  color: var(--muted);
}

.intro-body {
  flex: 1;
  padding: 24px 20px;
}

h1 {
  font-size: 28px;
  line-height: 1.3;
}

.lead {
  margin: 8px 0 16px;
}

.price {
  margin: 0;
  color: var(--foreground);
  font-size: 22px;
  font-weight: 700;
}

.shipping-note {
  margin: 2px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.facts {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: var(--card);
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

.facts dt {
  flex: none;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  color: var(--foreground);
  text-align: right;
}

.facts .fact-highlight {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.fact-highlight dt,
.fact-highlight dd {
  color: var(--primary-weak-foreground);
  font-weight: 700;
}

.action-bar {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom));
  background: var(--background);
}

.notice {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: var(--primary-weak);
  color: var(--primary-weak-foreground);
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

/* 버튼 */
.button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

.button:hover {
  background: var(--primary-hover);
}

.button:disabled {
  cursor: default;
}

.button.is-loading span {
  visibility: hidden;
}

.button.is-loading::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid rgb(255 255 255 / 0.4);
  border-top-color: var(--on-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.button-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  margin-top: 8px;
  border-radius: 14px;
  background: var(--secondary);
  color: var(--body);
  font-weight: 700;
  text-decoration: none;
}

.button-weak {
  flex: none;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-weak);
  color: var(--primary-weak-foreground);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button-weak.wide {
  width: 100%;
  margin-top: 12px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

#lookup {
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  gap: 12px;
}

#lookup-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lookup-empty {
  margin: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

.status {
  padding: 2px 10px;
  border-radius: 8px;
  background: var(--secondary);
  color: var(--body);
  font-size: 14px;
  font-weight: 700;
}

.status.is-done {
  background: var(--primary-weak);
  color: var(--primary-weak-foreground);
}

/* 주문 */
.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.screen-header h2 {
  font-size: 22px;
}

.back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  color: var(--foreground);
  font-size: 22px;
  text-decoration: none;
}

#order-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  padding: 16px;
  border-radius: 14px;
  background: var(--card);
}

.card h3 {
  margin-bottom: 12px;
  font-size: 17px;
}

.field {
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

input:not([type='checkbox']) {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--foreground);
  font: inherit;
  font-size: 16px; /* iOS 자동 확대 방지 */
}

input[readonly] {
  background: var(--secondary);
}

input[aria-invalid='true'] {
  border-color: var(--destructive);
}

.address-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.error {
  margin: 4px 0 0;
  color: var(--destructive);
  font-size: 14px;
}

.form-error {
  margin: 0;
  text-align: center;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
}

.summary-row > :last-child {
  color: var(--foreground);
  text-align: right;
  overflow-wrap: anywhere;
}

.summary-row.total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.summary-row.total strong {
  color: var(--primary-weak-foreground);
  font-size: 20px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stepper button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--secondary);
  color: var(--foreground);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}

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

.stepper output {
  min-width: 32px;
  color: var(--foreground);
  font-weight: 700;
  text-align: center;
}

.agreement label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--foreground);
  cursor: pointer;
}

.agreement input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

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

.honeypot {
  position: absolute;
  left: -9999px;
}

/* 완료 */
.done-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 32px auto 4px;
  border-radius: 50%;
  background: var(--primary-weak);
  color: var(--primary-weak-foreground);
  font-size: 26px;
}

#done h2 {
  font-size: 24px;
  text-align: center;
}

.done-sub {
  margin: 0 0 8px;
  text-align: center;
}

.guide {
  margin: 4px 0 0;
  padding-left: 20px;
  font-size: 14px;
}

.guide li {
  margin-bottom: 4px;
}

.guide a {
  overflow-wrap: anywhere;
}

/* 주소 검색 레이어 */
.postcode-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
}

.postcode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 4px 16px;
  color: var(--foreground);
}

.postcode-header button {
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--foreground);
  font-size: 18px;
  cursor: pointer;
}

.postcode-frame {
  flex: 1;
  min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  .button.is-loading::after {
    animation-duration: 3s;
  }
}
