:root {
  --ink: #262220;
  --muted: #514d49;
  --paper: #fffaea;
  --wash: #f4efe0;
  --line: #e9e4d6;
  --brand: #c14323;
  --brand-dark: #96331f;
  --gold: #e36b3f;
  --error: #b42318;
  --shadow: 0 12px 36px rgba(38, 34, 32, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(193, 67, 35, .06), transparent 28rem),
    #f7f4ec;
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN",
    "Meiryo", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

html:lang(zh-TW) body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
    "Heiti TC", Arial, sans-serif;
}

html:lang(zh-CN) body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei",
    "Heiti SC", Arial, sans-serif;
}

html:lang(ko) body {
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
    Arial, sans-serif;
}

html:lang(en) body {
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--ink);
  background: rgba(255, 250, 234, .96);
  border-bottom: 2px solid var(--brand);
  box-shadow: 0 4px 18px rgba(38, 34, 32, .06);
}

.brand { display: flex; align-items: center; }
.brand strong {
  display: block;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.25;
  letter-spacing: .06em;
  white-space: nowrap;
}

.language-picker select {
  width: 142px;
  min-height: 42px;
  padding: 7px 28px 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.shell {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 40px;
}

.intro { max-width: 690px; margin-bottom: 24px; }
.intro p { margin: 0; color: var(--muted); font-size: 15px; }

.progress-panel {
  padding: 21px 24px 18px;
  margin-bottom: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 7px 24px rgba(38, 34, 32, .05);
}
.step-dots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0;
  margin: 0;
  list-style: none;
}
.step-dots li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: #8a827d;
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
}
.step-dots li:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 14px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: #ddd7cc;
}
.step-number {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #77706b;
  background: #f1ede4;
  border: 2px solid #d9d3c8;
  border-radius: 50%;
  font-weight: 800;
}
.step-name { max-width: 110px; }
.step-dots li.active { color: var(--brand); font-weight: 800; }
.step-dots li.active .step-number {
  color: #fff;
  background: var(--brand);
  border-color: #ef9b83;
  box-shadow: 0 0 0 4px rgba(193,67,35,.2);
}
.step-dots li.done { color: var(--ink); }
.step-dots li.done .step-number {
  color: #fff;
  background: var(--brand);
  border-color: #ef9b83;
}
.step-dots li.done:not(:last-child)::after { background: var(--gold); }

#survey-form {
  padding: clamp(22px, 5vw, 42px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.question {
  padding: 0 0 32px;
  margin: 0 0 32px;
  border-bottom: 1px solid var(--line);
}
.question.invalid .hint {
  display: inline-block;
  padding: 5px 9px;
  color: #9f2414;
  background: #ffe4de;
  border-radius: 5px;
  font-weight: 700;
}
.question:last-child { margin-bottom: 0; border-bottom: 0; }
.question-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 5px;
}
.question-number {
  flex: 0 0 auto;
  display: inline-block;
  margin: 0;
  color: var(--brand);
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
}
.question h2 {
  margin: 0;
  font-size: clamp(18px, 3.2vw, 21px);
  line-height: 1.5;
  font-weight: 700;
}
.hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.required {
  margin-left: 8px;
  padding: 2px 6px;
  color: #fff;
  background: var(--brand);
  border-radius: 4px;
  font-size: 10px;
  vertical-align: middle;
}

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.custom-select {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid #d8d1c4;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(38, 34, 32, .04);
}
.custom-select[open] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(193, 67, 35, .12);
}
.custom-select-summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 12px 52px 12px 16px;
  cursor: pointer;
  list-style: none;
}
.custom-select-summary::-webkit-details-marker { display: none; }
.custom-select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: -1px;
  width: calc(100% + 2px);
  max-height: min(46vh, 360px);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #d8d1c4;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(38, 34, 32, .16);
}
.custom-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.custom-select-option:hover,
.custom-select-option:has(input:checked) {
  background: #fff0e8;
  color: var(--brand);
}
.custom-select-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}
.select-arrow {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 28px;
  height: 28px;
  background: #f7eee8;
  border-radius: 50%;
  pointer-events: none;
  transform: translateY(-50%);
}
.custom-select[open] .select-arrow::after {
  top: 11px;
  transform: rotate(225deg);
}
.select-arrow::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 9px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
  transform: rotate(45deg);
}
.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 52px;
  padding: 13px 14px;
  background: #fffdf5;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.option:hover { border-color: var(--brand); transform: translateY(-1px); }
.option:has(input:checked) {
  background: #fff0e8;
  border-color: var(--brand);
  box-shadow: inset 3px 0 var(--brand);
}
.option input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}
.option span { line-height: 1.45; }

.other-input, textarea {
  width: 100%;
  margin-top: 12px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fffdf5;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.other-input[hidden] { display: none; }
textarea { min-height: 120px; resize: vertical; }
.other-input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 3px solid rgba(193,67,35,.28);
  outline-offset: 2px;
}

.form-error {
  padding: 12px 14px;
  color: var(--error);
  background: #fff1f0;
  border-left: 4px solid var(--error);
  border-radius: 5px;
}
.actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 30px;
}
.button {
  min-width: 132px;
  min-height: 50px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}
.button.primary {
  margin-left: auto;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 6px 16px rgba(193, 67, 35, .2);
}
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button[hidden] { display: none; }

.success-screen {
  padding: clamp(34px, 8vw, 74px) 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.success-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  color: #fff;
  background: var(--brand);
  border: 4px solid #f1ae98;
  border-radius: 50%;
  font-size: 32px;
}
.success-screen h2 { margin: 0 0 12px; font-family: inherit; font-size: 30px; font-weight: 800; }
.completion-time {
  display: inline-block;
  padding: 7px 12px;
  margin: 10px 0 0;
  color: var(--muted);
  background: #f7f4ec;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.gift-note {
  max-width: 570px;
  padding: 18px;
  margin: 26px auto 0;
  background: var(--wash);
  border: 1px solid var(--gold);
  border-radius: 8px;
  font-weight: 700;
  white-space: pre-line;
}

footer {
  padding: 16px 20px 34px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 640px) {
  .site-header { padding: 12px; gap: 10px; }
  .brand strong { font-size: 17px; letter-spacing: .02em; }
  .language-picker select { width: 160px; }
  .shell { width: min(100% - 20px, 860px); padding-top: 34px; }
  .options { grid-template-columns: 1fr; }
  .custom-select-menu {
    position: static;
    width: 100%;
    max-height: 46vh;
    margin: 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 10px 10px;
    box-shadow: none;
  }
  #survey-form { padding: 24px 18px; }
  .progress-panel { padding: 17px 18px; }
  .step-name { font-size: 10px; }
  .step-dots li:not(:last-child)::after {
    left: calc(50% + 16px);
    width: calc(100% - 32px);
  }
  .actions { position: sticky; bottom: 0; padding: 12px 0 4px; background: #fff; }
  .button { min-width: 0; flex: 1; }
}

@media (max-width: 370px) {
  .site-header { padding-inline: 9px; gap: 7px; }
  .brand strong { font-size: 15px; }
  .language-picker select { width: 128px; padding-left: 8px; }
}

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