:root {
  color-scheme: light;
  --ink: #3d3650;
  --muted: #6b607c;
  --soft-ink: #4f4763;
  --base: #fff9ef;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --lavender: #d8cffb;
  --pink: #ffd6e7;
  --mint: #ccefe3;
  --cream: #fff4cb;
  --gold: #e5ad32;
  --coral: #ff8c92;
  --green: #54ad8c;
  --shadow: 0 14px 34px rgba(104, 83, 132, 0.18);
  --radius: 8px;
  --tap: 52px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 214, 231, 0.72), transparent 32rem),
    radial-gradient(circle at 90% 10%, rgba(204, 239, 227, 0.7), transparent 30rem),
    linear-gradient(155deg, #fff9ef 0%, #f6efff 46%, #eefbf4 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(229, 173, 50, 0.65);
  outline-offset: 3px;
}

a {
  color: #755dbd;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 30;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  transform: translateY(-160%);
}

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

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 14px 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 18px rgba(104, 83, 132, 0.12);
}

.top-title,
.eyebrow {
  margin: 0;
}

.top-title {
  font-weight: 800;
  line-height: 1.25;
}

.eyebrow {
  color: #7f6fb6;
  font-size: 0.82rem;
  font-weight: 700;
}

.icon-button {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(104, 83, 132, 0.12);
}

.app-main {
  min-height: 64vh;
}

.app-main:focus {
  outline: none;
}

.screen {
  display: none;
  animation: fadeIn 180ms ease both;
}

.screen.is-active {
  display: block;
}

.hero-panel,
.section-head,
.quiz-card,
.notice-card,
.info-card,
.result-details,
.extra-advice,
.mini-summary,
.settings-card {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  padding: 22px 18px 18px;
  text-align: center;
}

.date-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-mark {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin: 18px auto 10px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cream), var(--pink), var(--mint));
  font-size: 2.5rem;
  box-shadow: 0 16px 26px rgba(229, 173, 50, 0.22);
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.32;
}

h1 {
  font-size: 1.72rem;
}

h2 {
  font-size: 1.55rem;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.45;
}

.subtitle {
  margin: 8px 0 0;
  color: #725eb4;
  font-size: 1.08rem;
  font-weight: 800;
}

.lead {
  margin: 14px 0;
  color: var(--soft-ink);
}

.theme-card {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 244, 203, 0.86), rgba(204, 239, 227, 0.72));
  text-align: left;
}

.theme-card span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.saving-pill {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff;
  color: #836224;
  font-weight: 800;
}

.button-stack {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.primary-button,
.secondary-button,
.ghost-button,
.choice-button {
  min-height: var(--tap);
  border-radius: 999px;
  border: 0;
  padding: 12px 18px;
  font-weight: 800;
  line-height: 1.35;
}

.primary-button {
  background: linear-gradient(135deg, #8c72de, #ff8c92);
  color: #fff;
  box-shadow: 0 14px 24px rgba(140, 114, 222, 0.25);
}

.secondary-button {
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 10px 18px rgba(104, 83, 132, 0.12);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.34);
  color: var(--soft-ink);
  border: 1px solid rgba(117, 93, 189, 0.2);
}

.section-head {
  margin-bottom: 14px;
  padding: 16px;
}

.section-head p:last-child {
  margin-bottom: 0;
}

.section-head.compact {
  margin-bottom: 10px;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step-list li {
  position: relative;
  min-height: 48px;
  padding: 12px 12px 12px 52px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 16px rgba(104, 83, 132, 0.08);
}

.step-list li::before {
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--lavender);
  color: #534188;
  content: counter(step);
  counter-increment: step;
  font-weight: 800;
}

.notice-card {
  padding: 14px;
}

.notice-card p {
  margin: 0 0 10px;
}

.notice-card p:last-child {
  margin-bottom: 0;
}

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

.choice-button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(117, 93, 189, 0.16);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(104, 83, 132, 0.1);
}

.choice-button .choice-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--cream), var(--mint));
  font-size: 1.25rem;
}

.quiz-card {
  padding: 16px;
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.game-stats div {
  min-height: 62px;
  padding: 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  box-shadow: 0 8px 18px rgba(104, 83, 132, 0.09);
}

.game-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.game-stats strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
}

.game-area {
  position: relative;
  height: min(62vh, 500px);
  min-height: 390px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 239, 255, 0.78)),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(204, 239, 227, 0.22) 32px 33px);
  box-shadow: var(--shadow);
  touch-action: manipulation;
}

.countdown-card {
  position: absolute;
  inset: 16px;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  text-align: center;
}

.game-item {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 20px rgba(104, 83, 132, 0.16);
  font-size: 1.78rem;
  transform: translate(-50%, -50%);
  animation: popIn 160ms ease both, breathe 1050ms ease-in-out infinite;
}

.game-item.bad {
  background: rgba(255, 237, 238, 0.96);
}

.float-text {
  position: absolute;
  z-index: 3;
  color: #7a5cd6;
  font-weight: 900;
  pointer-events: none;
  text-shadow: 0 2px 0 #fff;
  transform: translate(-50%, -50%);
  animation: floatUp 780ms ease-out forwards;
}

.last-five {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 3;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff4cb;
  color: #8c5d00;
  font-weight: 900;
  transform: translateX(-50%);
  box-shadow: 0 10px 20px rgba(229, 173, 50, 0.22);
}

.result-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 244, 203, 0.96), rgba(255, 214, 231, 0.9) 45%, rgba(204, 239, 227, 0.86));
  box-shadow: var(--shadow);
}

.result-hero h2 {
  margin-top: 4px;
  font-size: 2rem;
}

.score-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 42px;
  padding: 4px 14px;
  border-radius: 999px;
  background: #fff;
  color: #7b5a0f;
  font-weight: 900;
}

.score-badge span {
  font-size: 1.55rem;
}

.focus-step {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 16px;
  border: 2px solid rgba(229, 173, 50, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 24px rgba(229, 173, 50, 0.14);
}

.focus-step span {
  color: #8b661a;
  font-weight: 800;
}

.focus-step strong {
  font-size: 1.25rem;
  line-height: 1.4;
}

.result-grid {
  display: grid;
  gap: 10px;
}

.info-card {
  padding: 14px;
}

.info-card p {
  margin: 0;
}

.mate-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
}

.mate-emoji {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--lavender), var(--cream));
  font-size: 2rem;
}

.highlight-soft {
  background: rgba(238, 251, 244, 0.9);
}

.result-details {
  margin-top: 12px;
  padding: 12px 14px;
}

.result-details summary {
  min-height: 42px;
  font-weight: 900;
  cursor: pointer;
}

.result-details dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.result-details div {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid rgba(117, 93, 189, 0.12);
}

.result-details dt {
  color: var(--muted);
  font-weight: 800;
}

.result-details dd {
  margin: 0;
}

.extra-advice {
  margin-top: 12px;
  padding: 14px;
  background: rgba(255, 244, 203, 0.82);
}

.done-message {
  min-height: 28px;
  margin: 12px 0 0;
  color: #477c67;
  font-weight: 800;
  text-align: center;
}

.share-fallback {
  width: 100%;
  min-height: 120px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid rgba(117, 93, 189, 0.24);
  border-radius: var(--radius);
  color: var(--ink);
}

.history-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.history-item {
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(104, 83, 132, 0.09);
}

.history-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.toggle-row {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(104, 83, 132, 0.09);
  font-weight: 800;
}

.toggle-row input {
  width: 24px;
  height: 24px;
  accent-color: #8c72de;
}

.ad-slot {
  display: grid;
  min-height: 72px;
  place-items: center;
  margin: 16px 0;
  border: 1px dashed rgba(79, 71, 99, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.36);
  color: rgba(79, 71, 99, 0.58);
  font-size: 0.88rem;
  font-weight: 800;
}

.top-ad {
  min-height: 56px;
  margin-top: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(61, 54, 80, 0.38);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(100%, 420px);
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 22px 48px rgba(61, 54, 80, 0.24);
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 18px 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.static-page {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.static-card {
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.static-card h1 {
  font-size: 1.9rem;
}

.static-card h2 {
  margin-top: 24px;
  font-size: 1.25rem;
}

.static-card li {
  margin-bottom: 8px;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 1ms !important;
  transition-duration: 1ms !important;
  scroll-behavior: auto !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes breathe {
  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes floatUp {
  to {
    opacity: 0;
    transform: translate(-50%, -118%);
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 22px;
  }
}

@media (max-width: 340px) {
  :root {
    --tap: 50px;
  }

  .app-shell {
    padding-inline: 10px;
  }

  .topbar {
    grid-template-columns: 48px 1fr 48px;
  }

  .hero-panel,
  .section-head,
  .quiz-card,
  .info-card {
    padding-inline: 12px;
  }

  .game-item {
    width: 54px;
    height: 54px;
  }
}

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