:root {
  color-scheme: light;
  --bg: #f7f6f0;
  --surface: #ffffff;
  --surface-soft: #f2efe6;
  --ink: #21241f;
  --muted: #646b60;
  --line: #ddd8cc;
  --line-strong: #cfc6b3;
  --accent: #146c63;
  --accent-deep: #0f4d47;
  --accent-soft: #e7f4ef;
  --gold: #b9822e;
  --error: #a8332b;
  --shadow: 0 18px 50px rgba(35, 39, 32, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
  min-width: 320px;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -8%, rgba(20, 108, 99, 0.16), transparent 30rem),
    linear-gradient(180deg, #fffdf8 0%, var(--bg) 30rem, #f9f8f2 100%);
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: rgba(20, 108, 99, 0.14);
}

.app-shell {
  margin: 0 auto;
  max-width: 1080px;
  min-height: 100vh;
  padding: 24px 22px 64px;
}

.site-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.site-header p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
  display: block;
  height: 42px;
  width: 42px;
}

.intro-band {
  align-items: stretch;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  margin-bottom: 30px;
}

.intro-copy {
  padding: 18px 0 4px;
}

.eyebrow,
.section-index {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2rem, 3vw, 3.45rem);
  line-height: 1.2;
  margin: 0 0 16px;
}

.lead {
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0;
  max-width: 46rem;
}

.notice-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 247, 239, 0.94));
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.notice-panel p {
  margin: 0;
}

.notice-panel p + p {
  margin-top: 14px;
}

.check-form,
.result-view {
  display: grid;
  gap: 26px;
}

.form-section {
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 30px clamp(18px, 3vw, 30px) 22px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h2,
.result-heading h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.35;
  margin: 0 0 8px;
}

#resultTitle:focus {
  border-radius: 8px;
  outline: 3px solid rgba(20, 108, 99, 0.24);
  outline-offset: 4px;
}

.section-heading p:last-child,
.result-heading p {
  color: var(--muted);
  margin: 0;
}

.field-group {
  margin-top: 24px;
}

.field-group h3,
.question-card h3 {
  font-size: 1.08rem;
  line-height: 1.5;
  margin: 0 0 12px;
}

.option-grid,
.score-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.score-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.option-card,
.score-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.option-card:hover,
.score-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(20, 108, 99, 0.12);
  transform: translateY(-1px);
}

.option-card input,
.score-card input {
  appearance: none;
  border: 2px solid #a8b0a4;
  border-radius: 999px;
  flex: 0 0 auto;
  height: 18px;
  margin: 0;
  width: 18px;
}

.option-card:has(input:checked),
.score-card:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(20, 108, 99, 0.1);
}

.option-card input:checked,
.score-card input:checked {
  background: radial-gradient(circle, var(--accent) 0 42%, transparent 46%);
  border-color: var(--accent);
}

.option-card span,
.score-card span {
  display: block;
  font-size: 0.96rem;
  line-height: 1.45;
}

.question-list {
  display: grid;
  gap: 22px;
}

.question-card {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.question-card p {
  color: var(--muted);
  margin: 0 0 14px;
}

textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  min-height: 148px;
  outline: none;
  padding: 14px 16px;
  resize: vertical;
  width: 100%;
}

textarea:focus,
button:focus-visible,
a:focus-visible,
.option-card:has(input:focus-visible),
.score-card:has(input:focus-visible) {
  outline: 3px solid rgba(20, 108, 99, 0.28);
  outline-offset: 3px;
}

.form-actions,
.result-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.primary-link {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 52px;
  min-width: 168px;
  padding: 12px 18px;
  text-decoration: none;
}

.primary-button,
.primary-link {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}

.primary-button:hover,
.primary-link:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.secondary-button {
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent-deep);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.primary-button[disabled] {
  cursor: wait;
  opacity: 0.7;
}

.error-message {
  color: var(--error);
  flex: 1 1 280px;
  font-weight: 700;
  margin: 0;
  min-height: 1.7em;
}

.review-banner {
  background: #fff8e9;
  border: 1px solid #e0c590;
  border-radius: 8px;
  color: #63470e;
  font-weight: 700;
  padding: 12px 16px;
  position: sticky;
  top: 12px;
  z-index: 4;
}

.check-form.is-reviewing .option-card,
.check-form.is-reviewing .score-card,
.check-form.is-reviewing textarea {
  cursor: default;
  pointer-events: none;
}

.check-form.is-reviewing .option-card:not(:has(input:checked)),
.check-form.is-reviewing .score-card:not(:has(input:checked)) {
  background: #f5f2ea;
  border-color: #e3ded2;
  box-shadow: none;
  color: var(--muted);
  opacity: 0.48;
}

.check-form.is-reviewing .option-card:has(input:checked),
.check-form.is-reviewing .score-card:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(20, 108, 99, 0.12);
  opacity: 1;
}

.check-form.is-reviewing textarea {
  background: #f8f6ef;
  color: var(--muted);
}

.hp-field {
  height: 0;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  top: auto;
  width: 1px;
}

.result-view {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 34px clamp(18px, 3vw, 30px) 30px;
}

.result-view.is-visible {
  animation: resultIn 520ms ease both;
}

.result-note {
  background: var(--surface-soft);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  color: var(--ink);
  margin: 0;
  padding: 16px 18px;
}

.result-status {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #cfe7de;
  border-radius: 8px;
  color: var(--accent-deep);
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 800;
  margin: 0 0 10px;
  padding: 4px 10px;
}

.result-status[hidden] {
  display: none;
}

.result-list {
  display: grid;
  gap: 16px;
}

.theme-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.theme-card h3 {
  font-size: 1.24rem;
  line-height: 1.38;
  margin: 0 0 10px;
}

.theme-card p {
  color: var(--muted);
  margin: 0;
}

.theme-card .first-step {
  background: #f7fbf8;
  border: 1px solid #d9eadf;
  border-radius: 8px;
  color: var(--ink);
  margin-top: 14px;
  padding: 12px 14px;
}

.noscript-note {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.transition-layer {
  align-items: center;
  background: rgba(247, 246, 240, 0.86);
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 180ms ease;
  z-index: 20;
}

.transition-layer.is-active {
  opacity: 1;
  pointer-events: auto;
}

.transition-panel {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  min-width: min(88vw, 320px);
  padding: 18px 20px;
}

.transition-panel p {
  font-weight: 800;
  margin: 0;
}

.transition-mark {
  background: conic-gradient(from 0deg, var(--accent), var(--gold), var(--accent));
  border-radius: 999px;
  height: 28px;
  width: 28px;
  animation: spin 850ms linear infinite;
}

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

@keyframes resultIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 820px) {
  html {
    font-size: 18px;
  }

  body {
    background: linear-gradient(180deg, #fffdf8 0%, var(--bg) 24rem, #f9f8f2 100%);
  }

  .app-shell {
    padding: 18px 16px 54px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
  }

  .site-header p {
    font-size: 0.9rem;
  }

  .intro-band {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 22px;
  }

  .intro-copy {
    padding-top: 6px;
  }

  h1 {
    font-size: 2rem;
  }

  .lead {
    font-size: 1rem;
  }

  .notice-panel,
  .theme-card {
    padding: 18px;
  }

  .form-section {
    padding: 24px 16px 20px;
  }

  .result-view {
    padding: 28px 16px 26px;
  }

  .option-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .option-card,
  .score-card {
    min-height: 62px;
    padding: 13px 14px;
  }

  .option-card span,
  .score-card span {
    font-size: 0.98rem;
  }

  .form-actions,
  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .primary-link {
    min-width: 100%;
    width: 100%;
  }

  .error-message {
    flex-basis: auto;
    width: 100%;
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 1.82rem;
  }

  .section-heading h2,
  .result-heading h2 {
    font-size: 1.26rem;
  }
}
