:root {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", sans-serif;
  color: #16382f;
  background: #f5f9f8;
  line-height: 1.8;
  font-size: 16px;
  --green: #087563
}

* {
  box-sizing: border-box
}

body {
  margin: 0
}

header,
main,
footer {
  max-width: 1000px;
  margin: auto;
  padding: 24px
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d5e4df
}

.brand {
  font-size: 1.8rem;
  font-weight: 850;
  text-decoration: none;
  color: var(--green)
}

.brand span {
  display: block;
  font-size: .8rem;
  font-weight: 500
}

.tag,
.small {
  font-size: .875rem
}

.tag {
  border: 1px solid #c2d9d2;
  border-radius: 30px;
  padding: 5px 12px
}

.preview {
  padding: 8px 24px;
  background: #fff3ca;
  color: #635011;
  text-align: center;
  font-size: .875rem
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  line-height: 1.32;
  letter-spacing: -.04em;
  margin: 12px 0 24px
}

h1 em {
  font-style: normal;
  color: var(--green)
}

h2 {
  font-size: 1.35rem;
  line-height: 1.5
}

p {
  max-width: 64ch
}

.hero {
  padding: 32px 0 40px
}

.eyebrow {
  color: var(--green);
  font-weight: 700;
  letter-spacing: .08em
}

.lead {
  font-size: 1.125rem
}

.button,
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid #9cbdb1;
  border-radius: 12px;
  padding: 14px 22px;
  color: #16382f;
  background: white;
  text-decoration: none;
  display: inline-block;
  min-height: 48px
}

.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
  font-weight: 750;
  margin-top: 16px
}

.button span {
  margin-left: 24px
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #c2d9d2;
  gap: 28px;
  padding-top: 28px
}

.steps b {
  color: var(--green);
  font-size: 1.5rem
}

.steps h2 {
  margin: 4px 0
}

.continue {
  border-radius: 20px;
  background: #e1f1eb;
  padding: 24px;
  margin: 36px 0
}

section {
  margin-bottom: 28px
}

footer {
  border-top: 1px solid #c2d9d2;
  font-size: .875rem
}

nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap
}

a {
  color: #076454
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid #c06812;
  outline-offset: 4px
}

button:disabled {
  cursor: default;
  background: #e8eeeb;
  color: #52675f
}

.consent {
  border-top: 1px solid #c2d9d2;
  padding: 16px 0
}

.consent button {
  margin: 4px;
  font-size: .875rem
}

.check-title {
  font-size: clamp(1.9rem, 5vw, 2.7rem)
}

.quiz {
  background: white;
  border: 1px solid #c9ddd5;
  border-radius: 20px;
  padding: 28px;
  max-width: 720px
}

.answers {
  display: grid;
  gap: 12px
}

.answers button {
  text-align: left;
  width: 100%
}

.feedback {
  border-left: 4px solid var(--green);
  padding: 8px 18px;
  margin: 20px 0;
  background: #f0f8f4
}

.source {
  font-size: .875rem;
  overflow-wrap: anywhere
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: .9rem;
  margin: 20px 0
}

td,
th {
  padding: 8px;
  border-bottom: 1px solid #dbe7e2;
  text-align: left
}

progress {
  width: 100%;
  accent-color: var(--green)
}

@media(max-width:600px) {

  header,
  main,
  footer {
    padding: 20px
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 16px
  }

  .steps p {
    margin-top: 4px
  }

  .hero {
    padding-top: 16px
  }

  .quiz {
    padding: 20px
  }

  .button {
    width: 100%;
    text-align: center
  }

  .tag {
    font-size: .75rem
  }
}

@media(prefers-reduced-motion:no-preference) {

  button:hover,
  .button:hover {
    filter: brightness(.96)
  }
}

/* Keep amounts readable on narrow phones while labels may wrap. */
td:last-child {
  white-space: nowrap;
}

/* Match QuizView / AnswerOptionView / QuizFeedbackView (FP3 light theme). */
body:has(#quiz) {
  background: #fff;
  color: #1c1c1e;
  --green: #0f766e
}

body:has(#quiz) header {
  max-width: 620px;
  padding: 10px 20px;
  border: 0
}

body:has(#quiz) .brand {
  font-size: 1.3rem
}

.brand span {
  line-height: 1.3
}

body:has(#quiz) main {
  max-width: 620px;
  padding: 0 0 24px
}

body:has(#quiz) main>.eyebrow,
body:has(#quiz) main>.check-title,
body:has(#quiz) main>.check-title+p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%)
}

body:has(#quiz) .quiz {
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  height: calc(100svh - 128px);
  min-height: 510px
}

.quiz-toolbar {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 14px 20px;
  color: #8e8e93;
  font-size: .875rem;
  font-weight: 700
}

.quiz-toolbar span {
  white-space: nowrap
}

.quiz-toolbar progress {
  height: 16px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  appearance: none;
  background: #ededee
}

progress::-webkit-progress-bar {
  background: #ededee;
  border-radius: 12px
}

progress::-webkit-progress-value {
  background: #0f766e;
  border-radius: 12px
}

progress::-moz-progress-bar {
  background: #0f766e;
  border-radius: 12px
}

.quiz-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overscroll-behavior: contain
}

.quiz-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.6;
  margin: 0
}

.quiz-content .source {
  font-size: .75rem;
  color: #8e8e93;
  line-height: 1.6;
  margin: 0
}

.source a {
  color: inherit
}

.quiz-content .answers {
  margin-top: auto;
  padding-top: 32px;
  gap: 12px
}

.answers button,
.answers button:disabled {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  min-height: 68px;
  border: 2px solid #e5e5e7;
  border-radius: 18px;
  background: #fafafa;
  color: #1c1c1e;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.5
}

.answers .option-badge {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaeaec;
  font-weight: 700
}

.answers button.selected {
  border-color: #0f766e;
  background: #e2efee
}

.answers button.selected .option-badge {
  background: #cde2e0
}

.answers button.correct {
  border-color: #34c759;
  background: #e7f8eb
}

.answers button.correct .option-badge {
  background: #d0efda
}

.answers button.incorrect {
  border-color: #ff3b30;
  background: #ffe7e6
}

.answers button.incorrect .option-badge {
  background: #ffd1ce
}

.answer-mark {
  margin-left: auto;
  font-size: 1.3rem;
  font-weight: 900;
  color: #248b3e
}

.incorrect .answer-mark {
  color: #dc3028
}

.quiz-controls {
  padding: 16px 20px 22px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0
}

.quiz-controls .button {
  width: 100%;
  margin: 0;
  min-height: 54px;
  border-radius: 17px;
  font-weight: 800;
  text-align: center
}

.quiz-controls .submit-answer:disabled {
  background: #e5e5ea;
  color: #8e8e93;
  border-color: transparent
}

.quiz-controls.feedback {
  border-left: 0;
  margin: 0;
  background: #e9f8df;
  border-top: 1px solid #c4e9a9;
  --feedback: #59cc0a;
  --base: #0a7533;
  --face: #dbffc2;
  color: #28610e
}

.quiz-controls.feedback.is-incorrect {
  background: #ffe8e8;
  border-top-color: #ffcbcb;
  --feedback: #ff4f4f;
  --base: #ad141f;
  --face: #ffe0e0;
  color: #bb2424
}

.feedback h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.375rem;
  font-weight: 900;
  margin: 0 0 14px;
  color: var(--feedback)
}

.feedback h3>span:first-child {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--feedback);
  color: white;
  font-size: 1.2rem
}

.feedback p {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 14px
}

.quiz-controls.feedback .button {
  box-shadow: 0 6px 0 var(--base);
  background: var(--feedback);
  border: 0;
  color: white;
  margin-bottom: 6px
}

.quiz-controls.feedback .explanation-button {
  background: var(--face);
  color: var(--base);
  border: 2px solid var(--feedback);
  margin-bottom: 20px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--feedback) 70%, white)
}

.quiz-controls.feedback .button:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--base)
}

.explanation-sheet {
  width: min(100%, 620px);
  max-height: 90svh;
  border: 0;
  border-radius: 22px;
  padding: 24px;
  color: #1c1c1e;
  line-height: 1.8
}

.explanation-sheet::backdrop {
  background: #0006
}

.explanation-sheet h2 {
  text-align: center;
  margin-top: 0
}

.explanation-sheet .primary {
  display: block;
  width: 100%
}

body:has(#quiz) .about-check,
body:has(#quiz) .consent {
  margin: 20px;
  padding: 16px 0
}

body:has(#quiz) .quiz.quiz-complete {
  height: auto;
  min-height: 510px;
  padding: 40px 20px;
  display: block
}

@media(max-width:600px) {
  .explanation-sheet {
    width: 100%;
    max-width: 100%;
    height: 100svh;
    max-height: 100svh;
    margin: 0;
    border-radius: 0
  }

  .quiz-controls {
    padding-bottom: max(22px, env(safe-area-inset-bottom))
  }
}

.quiz {
  margin-inline: auto;
  max-width: 760px
}

.quiz-complete {
  text-align: center;
  padding-block: 40px
}

.quiz-complete h2 {
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  color: var(--green);
  margin: 0 0 12px
}

.quiz-complete p {
  margin-inline: auto
}

.app-store-badge {
  display: inline-block;
  padding: 15px;
  /* Apple指定：高さの1/4のクリアスペース */
  line-height: 0;
}

.app-store-badge img {
  display: block;
  width: auto;
  height: 60px;
}

.quiz-restart {
  display: block;
  margin: 16px auto 0;
  padding: 10px 12px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #53635e;
  font: inherit;
  font-size: .875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.quiz-restart:focus-visible,
.app-store-badge:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.store-qr {
  margin: 24px auto 0
}

.store-qr img {
  display: block;
  margin: auto;
  background: white;
  max-width: 100%;
  height: auto
}

.store-qr figcaption {
  font-size: .875rem;
  margin-top: 8px
}

.about-check {
  margin: 24px 0;
  font-size: .875rem
}

summary {
  cursor: pointer
}

.check-title {
  margin-bottom: 12px
}

main>.eyebrow {
  margin-top: 0
}

/* Noua landing: AppTheme colors and playfulCard geometry.
   Keep the embedded FP3 lesson's course color and answer states intact. */
body.landing-page {
  --noua-brand: #59cc0a;
  --noua-brand-base: #42a305;
  --noua-ink: #1c1c1e;
  --noua-muted: #63666a;
  --noua-border: #e0e6de;
  --noua-raised: #f0f2ed;
}

body.landing-page:has(#quiz) {
  background: #fff;
  color: var(--noua-ink);
  --green: var(--noua-brand);
}

body.landing-page:has(#quiz) header,
body.landing-page:has(#quiz) main,
body.landing-page footer {
  max-width: 1080px;
  padding: 24px 40px;
}

body.landing-page:has(#quiz) header {
  border-bottom: 2px solid var(--noua-border);
}

body.landing-page:has(#quiz) .brand {
  color: var(--noua-brand-base);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

body.landing-page:has(#quiz) .brand span {
  color: var(--noua-muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.6;
}

.landing-page .tag {
  border: 0;
  background: #eef9e6;
  color: #397b13;
  font-weight: 700;
  padding: 7px 14px;
}

.landing-page .hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: center;
  gap: 64px;
  padding: 40px 0 64px;
  margin-bottom: 32px;
}

.landing-page .hero-copy {
  min-width: 0;
}

.landing-page .eyebrow {
  color: #397b13;
  font-weight: 800;
  letter-spacing: .04em;
  margin: 0 0 16px;
}

.landing-page h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -.035em;
  margin: 0 0 24px;
}

.landing-page h1 em {
  color: var(--noua-brand-base);
}

.landing-page .lead {
  font-weight: 500;
  line-height: 1.9;
}

.landing-page .small {
  color: var(--noua-muted);
  font-size: .8125rem;
}

.landing-page .hero .primary,
.landing-page .continue .store {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  border: 1px solid #ffffff29;
  border-radius: 17px;
  background: var(--noua-brand);
  /* color: #214809; */
  color: #ffffff;
  letter-spacing: 1px;
  font-weight: 800;
  padding: 16px 24px;
  line-height: 1.5;
}

.landing-page .hero-app {
  width: 100%;
  max-width: 280px;
  margin: 0;
  justify-self: center;
}

.landing-page .iphone-frame {
  border: 7px solid #202426;
  border-radius: 44px;
  background: #202426;
  box-shadow: 0 0 0 1px #697071, 0 20px 40px -20px #1c1c1e40;
  overflow: hidden;
}

.landing-page .iphone-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 36px;
}

.landing-page .quiz-embed {
  scroll-margin-top: 24px;
  padding: 36px 24px;
  margin-bottom: 56px;
  background: var(--noua-raised);
  border-radius: 28px;
}

.landing-page .quiz-embed>h2 {
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 800;
  margin: 0 0 24px;
}

body.landing-page:has(#quiz) #quiz {
  --green: #0f766e;
  color: var(--noua-ink);
  max-width: 620px;
  margin: 0 auto;
  border: 2px solid var(--noua-border);
  border-radius: 22px;
  overflow: hidden;
  /* 埋め込みは内容に合わせて伸ばし、枠内のスクロールをなくす。 */
  height: auto;
  min-height: 0;
  max-height: none;
}

.landing-page #quiz .quiz-content {
  flex: none;
  overflow: visible;
  min-height: auto;
  overscroll-behavior: auto;
}

/* LPのクイズは回答前から結果欄を確保し、回答で枠が伸びるのを防ぐ。
   小画面・文字拡大時は切り捨てず、必要な分だけページを伸ばす。 */
body.landing-page:has(#quiz) #quiz:not(.quiz-complete) {
  min-height: min(700px, calc(100svh - 24px));
  overflow-anchor: none;
}

.landing-page #quiz .quiz-toolbar { padding: 8px 12px; }
.landing-page #quiz .quiz-content { padding: 10px 12px; gap: 8px; flex: 1 0 auto; }
.landing-page #quiz .quiz-content h2 { font-size: 1rem; line-height: 1.45; }
.landing-page #quiz .quiz-content .source { font-size: .75rem; line-height: 1.35; }
.landing-page #quiz .answers { padding-top: 4px; margin-top: auto; gap: 6px; }
.landing-page #quiz .answers button {
  min-height: 44px; padding: 7px 10px; gap: 8px;
  font-size: .875rem; line-height: 1.35; border-radius: 12px;
}
.landing-page #quiz .option-badge { width: 26px; height: 26px; flex-basis: 26px; }
.landing-page #quiz .question-table {
  font-size: .875rem;
  line-height: 1.4;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #d7e5e1;
  border-radius: 12px;
  background: #fff;
  color: #253c35;
}
.landing-page #quiz .question-table caption {
  padding: 0 0 6px;
  text-align: left;
  font-size: .8125rem;
  font-weight: 700;
  color: #526d64;
}
.landing-page #quiz .question-table th,
.landing-page #quiz .question-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #e6eeeb;
  vertical-align: middle;
}
.landing-page #quiz .question-table th {
  background: #eaf3ef;
  color: #36594b;
  font-size: .8125rem;
  font-weight: 700;
}
.landing-page #quiz .question-table th:first-child { border-top-left-radius: 11px; }
.landing-page #quiz .question-table th:last-child { border-top-right-radius: 11px; }
.landing-page #quiz .question-table tbody tr:nth-child(even) { background: #f7faf9; }
.landing-page #quiz .question-table tbody tr:last-child td { border-bottom: 0; }
.landing-page #quiz .question-table tbody tr:last-child td:first-child { border-bottom-left-radius: 11px; }
.landing-page #quiz .question-table tbody tr:last-child td:last-child { border-bottom-right-radius: 11px; }
.landing-page #quiz .question-table th:last-child,
.landing-page #quiz .question-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.landing-page #quiz .quiz-controls {
  min-height: 184px; padding: 10px 12px 14px;
  display: flex; flex-direction: column; gap: 12px;
  justify-content: flex-end;
}
.landing-page #quiz .quiz-controls h3,
.landing-page #quiz .quiz-controls p { margin: 0; }
.landing-page #quiz .quiz-controls h3 {
  display: flex; align-items: center; font-size: 1rem; line-height: 1.4; gap: 8px;
}
.landing-page #quiz .quiz-controls h3 > span:first-child {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: 0 0 26px;
  font-size: 1rem; line-height: 1;
}
.landing-page #quiz .quiz-controls p { font-size: .875rem; line-height: 1.3; }
.landing-page #quiz .quiz-controls .button {
  min-height: 44px; margin: 0; padding: 8px; border-radius: 12px;
  font-size: .875rem; line-height: 1.3;
}

body.landing-page:has(#quiz) #quiz.quiz-complete {
  height: auto;
  max-height: none;
}

.landing-page .steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border: 0;
  padding: 0;
  margin-bottom: 48px;
}

.landing-page .steps>div {
  padding: 24px 20px;
  border: 2px solid var(--noua-border);
  border-radius: 22px;
}

.landing-page .steps b {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: #eef9e6;
  color: #397b13;
  font-size: 1.125rem;
  font-weight: 900;
}

.landing-page .steps h2 {
  font-size: 1.125rem;
  font-weight: 800;
}

.landing-page .steps p {
  color: var(--noua-muted);
  font-size: .9375rem;
  margin-bottom: 0;
}

.landing-page .continue {
  text-align: center;
  background: #d7f4e0;
  border-radius: 28px;
  padding: 40px 28px;
  margin: 0 0 40px;
}

.landing-page .continue h2 {
  font-size: 1.875rem;
  font-weight: 900;
  margin: 0 0 12px;
}

.landing-page .continue p {
  margin: 0 auto 24px;
}

body.landing-page:has(#quiz) .about-check,
body.landing-page:has(#quiz) .consent {
  margin: 24px 0;
  color: var(--noua-muted);
}

.landing-page footer {
  border-top: 2px solid var(--noua-border);
  color: var(--noua-muted);
}

.landing-page footer a {
  color: #397b13;
}

.landing-page a:focus-visible,
.landing-page button:focus-visible,
.landing-page summary:focus-visible {
  outline: 3px solid #397b13;
  outline-offset: 4px;
}

@media (max-width: 780px) {
  .landing-page .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
    padding: 24px 0 40px;
  }

  .landing-page .hero-app {
    max-width: 250px;
  }

  .landing-page .iphone-frame {
    border-width: 6px;
    border-radius: 39px;
  }

  .landing-page .iphone-frame img {
    border-radius: 32px;
  }

  .landing-page .steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {

  body.landing-page:has(#quiz) header,
  body.landing-page:has(#quiz) main,
  body.landing-page footer {
    padding: 20px;
  }

  .landing-page .hero {
    gap: 32px;
  }

  .landing-page .hero .primary {
    padding-inline: 16px;
  }

  .landing-page .hero .button span {
    margin-left: 12px;
  }

  .landing-page .quiz-embed {
    padding: 24px 10px 10px;
    border-radius: 24px;
    margin-inline: -10px;
    margin-bottom: 32px;
  }

  .landing-page .quiz-embed>h2 {
    margin-bottom: 20px;
  }

  body.landing-page:has(#quiz) #quiz {
    border-radius: 18px;
  }

  .landing-page .steps {
    gap: 12px;
    margin-bottom: 32px;
  }

  .landing-page .continue {
    padding: 32px 20px;
    border-radius: 22px;
  }

  .landing-page .continue h2 {
    font-size: 1.625rem;
  }
}
