:root {
  color-scheme: light;
  --ink: #44362d;
  --muted: #74675d;
  --cream: #fff8ea;
  --green: #2f7d4a;
  --green-dark: #245f39;
  --green-soft: #eaf6ec;
  --orange: #dc7a3d;
  --orange-soft: #fff0e3;
  --border: #eadfcd;
  --shadow: 0 14px 34px rgba(96, 70, 48, 0.12);
  --font-rounded: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(246, 201, 85, 0.25), transparent 20rem),
    radial-gradient(circle at 95% 30%, rgba(92, 174, 113, 0.14), transparent 24rem),
    var(--cream);
  font-family: var(--font-rounded);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  touch-action: manipulation;
}

button:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(47, 125, 74, 0.38);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  color: #fff;
  background: var(--green-dark);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
}

.app-header {
  text-align: center;
}

.adult-settings-button {
  position: relative;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 7px;
  margin: 14px auto 0;
  padding: 8px 14px 10px;
  overflow: hidden;
  border: 2px solid #d8cdbd;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.adult-settings-button small {
  color: #88786b;
  font-size: 0.72rem;
}

.adult-settings-button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 5px;
  background: var(--green);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
}

.adult-settings-button.is-holding::after {
  animation: settings-hold 900ms linear forwards;
}

@keyframes settings-hold {
  to {
    transform: scaleX(1);
  }
}

.app-kicker,
.eyebrow {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.app-lead {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 600px;
  margin: 22px auto 26px;
  padding: 0;
  list-style: none;
}

.progress li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 7px 8px;
  border: 2px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  font-weight: 800;
  white-space: nowrap;
}

.progress li span {
  display: inline-grid;
  width: 25px;
  height: 25px;
  margin-right: 5px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #b9afa5;
}

.progress li.is-active {
  border-color: var(--orange);
  color: #8a4423;
  background: var(--orange-soft);
}

.progress li.is-active span {
  background: var(--orange);
}

.progress li.is-done {
  border-color: #b7d7be;
  color: var(--green-dark);
  background: var(--green-soft);
}

.progress li.is-done span {
  background: var(--green);
}

.screen {
  min-height: 420px;
  padding: clamp(20px, 5vw, 34px);
  border: 2px solid rgba(234, 223, 205, 0.92);
  border-radius: 28px;
  background: rgba(255, 254, 249, 0.96);
  box-shadow: var(--shadow);
}

[hidden] {
  display: none !important;
}

.settings-screen {
  padding-bottom: 0;
}

.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.settings-count {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 9px 12px;
  border: 2px solid #b7d7be;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  text-align: center;
  font-size: 1rem;
  font-weight: 900;
}

.settings-intro {
  max-width: 760px;
  margin: 12px 0 18px;
  color: var(--muted);
  font-weight: 700;
}

.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 24px;
}

.settings-tool-button,
.settings-cancel-button {
  min-height: 46px;
  padding: 8px 14px;
  border: 2px solid #b7d7be;
  border-radius: 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 900;
  cursor: pointer;
}

.settings-tool-button--quiet,
.settings-cancel-button {
  border-color: var(--border);
  color: var(--muted);
  background: #fff;
}

.settings-groups {
  display: grid;
  gap: 24px;
}

.settings-group h3 {
  margin: 0 0 10px;
  color: #6d4526;
  font-size: 1.05rem;
}

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

.setting-choice {
  position: relative;
  display: grid;
  min-height: 92px;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border: 3px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.setting-choice.is-selected {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 6px 14px rgba(47, 125, 74, 0.12);
}

.setting-choice__icon {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 2rem;
  line-height: 1;
  text-align: center;
}

.setting-choice__label {
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.35;
}

.setting-choice__check {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 2px solid #cfc4b6;
  border-radius: 50%;
  color: transparent;
  background: #fff;
  font-weight: 900;
}

.setting-choice.is-selected .setting-choice__check {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.settings-error {
  margin: 20px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  color: #8c341f;
  background: #fff0eb;
  font-weight: 900;
}

.settings-actions {
  position: sticky;
  z-index: 3;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 10px;
  margin: 26px clamp(-34px, -5vw, -20px) 0;
  padding: 16px clamp(20px, 5vw, 34px) max(18px, env(safe-area-inset-bottom));
  border-top: 2px solid var(--border);
  border-radius: 0 0 26px 26px;
  background: rgba(255, 254, 249, 0.96);
  box-shadow: 0 -10px 24px rgba(96, 70, 48, 0.08);
  backdrop-filter: blur(8px);
}

.primary-button:disabled {
  color: #766f69;
  background: #d7d1ca;
  box-shadow: none;
  cursor: not-allowed;
}

.question-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.question-heading--center {
  justify-content: center;
  text-align: left;
}

.question-number {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: var(--orange);
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(220, 122, 61, 0.24);
}

.question-number--done {
  background: var(--green);
  box-shadow: 0 8px 18px rgba(47, 125, 74, 0.22);
}

h2 {
  margin: 2px 0 0;
  font-size: clamp(1.45rem, 5vw, 2.2rem);
  line-height: 1.35;
}

.choice-grid {
  display: grid;
  gap: 14px;
}

.choice-grid--people {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid--actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card {
  display: flex;
  min-height: 138px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 12px;
  border: 3px solid var(--border);
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(96, 70, 48, 0.08);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.choice-card:hover {
  border-color: #efb58d;
  background: #fffaf4;
  box-shadow: 0 10px 24px rgba(96, 70, 48, 0.12);
  transform: translateY(-2px);
}

.choice-card__icon {
  display: grid;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 22px;
  background: var(--orange-soft);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 3.1rem;
  line-height: 1;
}

.choice-card:nth-child(even) .choice-card__icon {
  background: var(--green-soft);
}

.choice-card__label {
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  font-weight: 900;
  line-height: 1.35;
}

.choice-card__sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.back-button,
.restart-button {
  min-height: 46px;
  padding: 8px 14px;
  border: 0;
  border-radius: 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 800;
  cursor: pointer;
}

.selected-strip {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 9px;
  margin: 14px 0 22px;
  padding: 9px 15px;
  border: 2px solid #b7d7be;
  border-radius: 999px;
  background: var(--green-soft);
  font-size: 1rem;
}

.selected-strip__icon {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 1.65rem;
}

.sentence-card {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(22px, 6vw, 42px) clamp(16px, 5vw, 34px);
  border: 4px solid #f0bf73;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(145deg, #fffdf7, #fff4dc);
  box-shadow: 0 14px 30px rgba(173, 111, 53, 0.14);
}

.sentence-pictures {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.result-icon {
  display: grid;
  width: clamp(82px, 18vw, 118px);
  height: clamp(82px, 18vw, 118px);
  place-items: center;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 7px 16px rgba(96, 70, 48, 0.1);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: clamp(3.5rem, 10vw, 5.4rem);
  line-height: 1;
}

.plus-mark {
  color: var(--orange);
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 900;
}

.result-sentence {
  margin: 22px 0 4px;
  color: #613817;
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0.03em;
}

.sentence-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 2.6vw, 1.1rem);
  font-weight: 700;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 760px;
  margin: 18px auto 0;
}

.primary-button,
.secondary-button {
  min-height: 62px;
  padding: 12px 16px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  background: var(--green);
  box-shadow: 0 8px 18px rgba(47, 125, 74, 0.22);
}

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

.secondary-button {
  background: var(--orange);
  box-shadow: 0 8px 18px rgba(220, 122, 61, 0.2);
}

.secondary-button:hover {
  background: #bc5e2d;
}

.adult-help {
  max-width: 760px;
  margin: 16px auto 0;
  padding: 18px 20px;
  border: 2px solid #afd2b7;
  border-radius: 20px;
  background: #f3faf4;
}

.adult-help__label {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.adult-help__text {
  margin: 6px 0 0;
  font-size: clamp(1.05rem, 3vw, 1.3rem);
  font-weight: 800;
}

.adult-help__note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.restart-button {
  display: block;
  margin: 18px auto 0;
}

.app-footer {
  padding: 18px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.app-footer p {
  margin: 0;
}

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

@media (min-width: 760px) {
  .choice-grid--people {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .choice-grid--people .choice-card {
    flex-direction: column;
    min-height: 190px;
  }

  .choice-grid--actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 18px, 980px);
  }

  .screen {
    min-height: 0;
    padding: 18px 14px;
    border-radius: 22px;
  }

  .question-heading {
    gap: 10px;
  }

  .question-number {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.2rem;
  }

  .choice-card {
    min-height: 126px;
    flex-direction: column;
    gap: 6px;
    padding: 12px 8px;
  }

  .choice-card__icon {
    width: 64px;
    height: 64px;
    font-size: 2.65rem;
  }

  .choice-card__sub {
    display: none;
  }

  .settings-heading {
    align-items: flex-start;
  }

  .settings-count {
    min-width: 82px;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 0.9rem;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .setting-choice {
    min-height: 76px;
  }

  .settings-actions {
    grid-template-columns: 1fr;
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
    border-radius: 0 0 20px 20px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}

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