:root {
  --primary: #08788a;
  --primary-dark: #0b6775;
  --text: #25313a;
  --muted: #66737d;
  --border: #dfe9ec;
  --warning: #9a5b00;
  --warning-soft: #fff4df;
  --danger: #bd3e45;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: #f4f8fa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.card {
  width: min(100%, 420px);
  padding: 40px 28px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(27, 76, 88, .10);
  text-align: center;
}
.survey-card { width: min(100%, 680px); text-align: left; }
.logo { display: block; width: 180px; max-width: 75%; height: auto; margin: 0 auto 30px; }
.survey-logo { width: 142px; margin-bottom: 24px; }
h1 { margin: 0 0 12px; font-size: 21px; line-height: 1.45; text-align: center; }
#survey-title {
  position: relative;
  margin-bottom: 22px;
  color: #1a2c32;
  font-size: clamp(32px, 8vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .02em;
  text-wrap: balance;
}
#survey-title::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin: 12px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}
h2 { margin: 12px 0; font-size: 20px; text-align: center; }
p { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.7; }
#link-view > p, #survey-description { min-height: 3.4em; text-align: center; }
#survey-description:empty { display: none; min-height: 0; margin: 0; }
#survey-description.auth-warning {
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid rgba(154, 91, 0, .28);
  border-radius: 12px;
  color: var(--warning);
  background: var(--warning-soft);
  font-weight: 700;
  text-align: left;
}
.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 20px;
  border: 4px solid #dce9ec;
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: grid; gap: 12px; }
.button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button:focus-visible, .ranking-option:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
.button:disabled { cursor: wait; opacity: .65; }
.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 12px rgba(8, 120, 138, .25);
}
.primary.ready { box-shadow: 0 0 0 4px rgba(8, 120, 138, .18), 0 4px 12px rgba(8, 120, 138, .25); }
.secondary { color: var(--primary-dark); background: #eaf7f9; }
.oauth-actions {
  position: relative;
  left: 50%;
  width: min(92vw, 420px);
  gap: 14px;
  transform: translateX(-50%);
}
.oauth {
  display: grid;
  width: 100%;
  height: 52px;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  column-gap: 8px;
  padding: 10px 16px;
  border: 2px solid #d6e0e5;
  border-radius: 14px;
  color: #000;
  background: #f2f4f6;
  font-size: 20px;
  line-height: 28px;
}
.oauth:active { opacity: .9; }
.oauth-icon { grid-column: 1; width: 30px; height: 25px; object-fit: contain; }
.oauth span { grid-column: 2; }
.guest {
  min-height: 52px;
  border: 2px solid var(--primary);
  border-radius: 14px;
  color: var(--primary-dark);
  background: #fff;
  font-size: 16px;
}
.stores { display: grid; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #e7ecef; }
.store { color: #fff; background: #101214; border-radius: 12px; }
.login-notice {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 18px 18px 18px 38px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--muted);
  background: #f4fcfd;
  font-size: 14px;
  line-height: 1.7;
}
.survey-form { display: grid; gap: 20px; scroll-padding-block: 72px 140px; }
.survey-progress { position: sticky; top: 0; z-index: 2; margin: 0 -4px; padding: 10px 4px 12px; background: rgba(255, 255, 255, .96); }
.survey-progress-copy { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.survey-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e4eef1; }
.survey-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); transition: width .2s ease; }
.survey-step-page { display: grid; gap: 14px; }
.voice-step-page { animation: step-in .18s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateY(5px); } }
.voice-page-title { margin: 2px 0 0; text-align: left; font-size: 20px; }
.voice-page-title:focus, .voice-intro h2:focus { outline: none; }
.voice-page-description { margin: -4px 0 2px; }
.voice-intro { padding: 22px; background: linear-gradient(145deg, #f4fcfd, #fff); }
.voice-intro h2 { margin-top: 0; color: var(--primary-dark); }
.voice-intro p { text-align: center; }
.voice-intro ul { display: grid; gap: 10px; margin: 16px 0 0; padding-left: 22px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.question { margin: 0; border: 0; }
.question-card { padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 4px 16px rgba(27, 76, 88, .06); scroll-margin-block: 72px 140px; }
.question-card[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(189, 62, 69, .10); }
.question legend { width: 100%; margin-bottom: 14px; font-size: 16px; font-weight: 700; line-height: 1.6; }
.required { margin-left: 8px; color: var(--danger); font-size: 12px; }
.choice { display: flex; min-height: 48px; gap: 12px; align-items: center; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; line-height: 1.45; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary-dark); background: #eaf7f9; }
.choice input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; accent-color: var(--primary-dark); }
.choice-grid { display: grid; gap: 8px; }
.choice-grid .choice { margin: 0; }
.compact-options { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.compact-options .choice { position: relative; justify-content: center; min-height: 58px; padding: 6px 2px; font-size: 14px; font-weight: 800; text-align: center; }
.compact-options .choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.compact-options .choice:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.rating-copy { display: grid; gap: 1px; justify-items: center; pointer-events: none; }
.rating-number { font-size: 16px; line-height: 1; }
.rating-label { font-size: 10px; font-weight: 700; line-height: 1.15; }
.scale-key { display: grid; gap: 4px; margin: 0; padding: 12px 12px 12px 34px; border-radius: 12px; color: var(--muted); background: #f4f8fa; font-size: 12px; line-height: 1.45; }
.feature-card > legend { font-size: 17px; }
.comment-details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.comment-details summary { min-height: 48px; display: flex; align-items: center; color: var(--primary-dark); font-size: 14px; font-weight: 700; cursor: pointer; }
.comment-details textarea { margin-top: 6px; min-height: 88px; }
.comment-count { display: block; }
.ranking-hint { margin: -4px 0 12px; font-size: 12px; }
.ranking-options { display: grid; gap: 8px; }
.ranking-option {
  display: grid;
  width: 100%;
  min-height: 52px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.ranking-option[aria-pressed="true"] { border-color: var(--primary); background: #eaf7f9; }
.ranking-option:disabled { cursor: not-allowed; opacity: .48; }
.ranking-option-copy { display: grid; gap: 3px; }
.ranking-option-copy small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
.rank-badge { display: grid; min-width: 32px; height: 32px; place-items: center; padding: 0 7px; border-radius: 999px; color: var(--primary-dark); background: #eaf7f9; font-size: 12px; }
.ranking-option[aria-pressed="true"] .rank-badge { color: #fff; background: var(--primary-dark); }
.detail-feature > h3 { margin: 0 0 14px; font-size: 18px; }
.nested-question { padding: 12px 0; box-shadow: none; border-width: 1px 0 0; border-radius: 0; }
.nested-question legend { font-size: 14px; }
.detail-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-options .choice { min-height: 52px; margin: 0; padding: 8px 10px; font-size: 13px; }
.future-rankings { display: grid; gap: 12px; }
.review-card { display: grid; gap: 12px; background: #f4fcfd; }
.review-card strong { color: var(--primary-dark); }
.review-card p { margin: 0; }
textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #bdcbd0;
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}
.hint { margin: 6px 0 0; font-size: 12px; text-align: right; }
.error { margin: 0; color: var(--danger); font-weight: 700; text-align: center; }
#survey-questions { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
.survey-navigation { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: minmax(92px, .4fr) 1fr; gap: 10px; margin: 0 -8px -12px; padding: 14px 8px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgba(255, 255, 255, .98); box-shadow: 0 -8px 20px rgba(27, 76, 88, .08); }
.survey-navigation .secondary.hidden + .primary:not(.hidden) { grid-column: 1 / -1; }
.result { text-align: center; }
.result-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin: 4px auto 12px;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-size: 30px;
  font-weight: 700;
}
.reward { margin-top: 24px; padding: 20px; border-radius: 16px; background: #eaf7f9; text-align: center; }
.reward-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.reward strong { color: var(--primary-dark); font-size: 20px; }
.hidden { display: none !important; }

@media (max-width: 520px) {
  main { padding: 0; align-items: stretch; }
  .card { width: 100%; min-height: 100vh; min-height: 100dvh; border-radius: 0; padding: max(24px, env(safe-area-inset-top)) 16px 24px; }
  .survey-logo { width: 124px; margin-bottom: 16px; }
  .survey-card.survey-in-progress { padding-top: max(8px, env(safe-area-inset-top)); }
  .survey-in-progress > .survey-logo,
  .survey-in-progress > #survey-title,
  .survey-in-progress > #survey-description { display: none; }
  .survey-in-progress .survey-progress { padding-top: 8px; }
  .question-card { padding: 16px 14px; }
  .compact-options { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 2px; }
  .compact-options .choice { min-height: 60px; }
  .nested-question { padding: 12px 0; }
}

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