:root {
  color-scheme: light;
  --ink: #1d2430;
  --muted: #5d6878;
  --line: #d8deea;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --accent: #186b73;
  --accent-strong: #0d4f55;
  --sun: #e7aa31;
  --leaf: #668c56;
  --rose: #bf6860;
  --shadow: 0 22px 70px rgba(29, 36, 48, 0.14);
  --app-logo-height: 34px;
  --app-header-gap: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  background:
    linear-gradient(135deg, rgba(24, 107, 115, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(231, 170, 49, 0.18), transparent 30%),
    var(--paper);
}

button,
a {
  font: inherit;
}

.app {
  width: min(920px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--app-header-gap);
  padding: 32px 0;
}

/* ロゴと画面カードを一体で上下中央に配置する。auto マージンなので、
   画面に収まらない時は自動的に 0 へ潰れて上端揃えになり、ロゴが画面外へ
   押し出されない（justify-content: safe center は Safari 17.6 以降のため使わない） */
.app-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: auto;
}

.site-logo {
  display: inline-flex;
  border-radius: 4px;
  transition: opacity 160ms ease;
}

.site-logo:hover {
  opacity: 0.72;
}

.site-logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site-logo img {
  display: block;
  width: auto;
  height: var(--app-logo-height);
}

.screen {
  flex: none;
  margin-bottom: auto;
  width: 100%;
  min-width: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(216, 222, 234, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 56px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin: 28px 0 22px;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: 0;
}

.lead,
.result-copy {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.9;
}

.screen-start {
  display: flex;
  min-height: min(
    680px,
    calc(100vh - 64px - var(--app-logo-height) - var(--app-header-gap))
  );
  min-height: min(
    680px,
    calc(100dvh - 64px - var(--app-logo-height) - var(--app-header-gap))
  );
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding-block: clamp(24px, 5vw, 44px);
  text-align: center;
}

.screen.hidden {
  display: none;
}

.screen-start .eyebrow,
.screen-start .lead {
  display: none;
}

.screen-start h1 {
  order: 1;
  max-width: 720px;
  margin: clamp(26px, 6vw, 54px) auto 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.18;
}

.screen-start .primary-button {
  order: 2;
  align-self: center;
  min-width: 240px;
  min-height: 54px;
  margin: clamp(46px, 10vw, 76px) auto;
  font-size: 0.98rem;
}

.start-parade {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  border-block: 1px solid rgba(24, 107, 115, 0.14);
  background: rgba(255, 253, 248, 0.52);
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 8%,
    #000 92%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 8%,
    #000 92%,
    transparent
  );
}

.start-parade-top {
  order: 0;
}

.start-parade-bottom {
  order: 3;
}

.start-parade-bottom .start-parade-track {
  animation-direction: reverse;
}

.start-parade-track {
  display: flex;
  align-items: center;
  width: max-content;
  gap: 28px;
  padding: 12px 18px;
  animation: start-parade-scroll 34s linear infinite;
}

.start-parade img {
  flex: 0 0 156px;
  width: 156px;
  height: 128px;
  object-fit: contain;
}

@keyframes start-parade-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .start-parade-track {
    animation: none;
  }
}

.primary-button,
.ghost-button,
.choice-button {
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  padding: 0 24px;
  border: 1px solid var(--accent-strong);
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.primary-button:hover,
.choice-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.choice-button:active,
.ghost-button:active {
  transform: translateY(0);
}

.progress-row,
.nav-row,
.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-row {
  color: var(--muted);
  font-size: 0.95rem;
}

.progress-track {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebf2;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--sun), var(--rose));
  transition: width 240ms ease;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}

.choice-button {
  width: 100%;
  min-height: 86px;
  padding: 18px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  line-height: 1.55;
}

.choice-button:hover {
  border-color: var(--accent);
  background: #f4fbfb;
}

.ghost-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.62);
  font-weight: 700;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.result-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.result-column .result-panel:last-child {
  flex: 1;
}

.result-share-card {
  position: relative;
  display: block;
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid rgba(24, 107, 115, 0.24);
  border-radius: 8px;
  background: #fffdf8;
}

.share-card-image {
  display: block;
  width: 100%;
  height: auto;
}

.result-panel {
  min-height: 0;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.result-column .result-panel + .result-panel {
  border-top: 1px solid var(--line);
}

.result-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.result-panel a {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration-color: rgba(13, 79, 85, 0.35);
  text-underline-offset: 3px;
}

.result-panel p + p {
  margin-top: 16px;
}

.library-links {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.result-panel .library-links a {
  margin-top: 0;
}

.match-reasons {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 1.2em;
  color: var(--muted);
  line-height: 1.7;
}

.match-reasons + p {
  margin-top: 18px;
}

.share-row {
  justify-content: flex-start;
  margin-top: 24px;
}

.share-button {
  margin-top: 0;
}

@media (max-width: 720px) {
  :root {
    --app-logo-height: 28px;
  }

  .app {
    width: min(100% - 20px, 920px);
    padding: 10px 0;
  }

  .screen {
    padding: 24px 18px;
  }

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

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

  .result-column .result-panel:last-child {
    flex: initial;
  }

  .choice-button {
    min-height: 72px;
  }

  .start-parade-track {
    gap: 20px;
    padding: 10px 14px;
    animation-duration: 30s;
  }

  .start-parade img {
    flex-basis: 124px;
    width: 124px;
    height: 104px;
  }

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

  .screen-start {
    min-height: calc(
      100vh - 20px - var(--app-logo-height) - var(--app-header-gap)
    );
    min-height: calc(
      100dvh - 20px - var(--app-logo-height) - var(--app-header-gap)
    );
    padding-block: 18px;
  }

  .screen-start h1 {
    margin-top: 34px;
  }

  .screen-start .primary-button {
    width: auto;
    min-width: 190px;
    margin-block: 58px;
  }
}
