* {
  box-sizing: border-box;
}

:root {
  --ink: #283044;
  --muted: #6b7280;
  --paper: #fffaf0;
  --card: rgba(255, 255, 255, 0.92);
  --accent: #ff7ab6;
  --accent-dark: #e85595;
  --blue: #65d6ff;
  --yellow: #ffe66d;
  --green: #72e6ac;
  --shadow: 0 18px 45px rgba(40, 48, 68, 0.18);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 230, 109, 0.95) 0 90px, transparent 92px),
    radial-gradient(circle at 88% 12%, rgba(101, 214, 255, 0.85) 0 120px, transparent 122px),
    radial-gradient(circle at 80% 86%, rgba(114, 230, 172, 0.85) 0 110px, transparent 112px),
    linear-gradient(135deg, #fff4c7 0%, #ffd6ea 45%, #d7f4ff 100%);
}

body::before {
  content: "π  3.? ? ? ? ?";
  position: fixed;
  inset: 0;
  z-index: -1;
  color: rgba(40, 48, 68, 0.09);
  font-size: clamp(2.6rem, 9vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1.8;
  transform: rotate(-10deg) scale(1.1);
  pointer-events: none;
}

.app {
  width: min(960px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 16px;
  display: grid;
  place-items: center;
}

.hero-card {
  position: relative;
  width: min(720px, 100%);
  padding: clamp(24px, 5vw, 48px);
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.8);
  border-radius: 36px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -72px;
  bottom: -72px;
  width: 190px;
  height: 190px;
  border: 18px solid rgba(255, 122, 182, 0.23);
  border-radius: 50%;
}

.math-doodles span {
  position: absolute;
  color: rgba(40, 48, 68, 0.16);
  font-weight: 900;
  user-select: none;
}

.math-doodles span:nth-child(1) { top: 22px; left: 28px; font-size: 3rem; transform: rotate(-12deg); }
.math-doodles span:nth-child(2) { top: 34px; right: 34px; font-size: 1.1rem; transform: rotate(9deg); }
.math-doodles span:nth-child(3) { left: 48px; bottom: 62px; font-size: 1.6rem; }
.math-doodles span:nth-child(4) { right: 64px; bottom: 38px; font-size: 1.2rem; transform: rotate(-9deg); }
.math-doodles span:nth-child(5) { right: 130px; top: 96px; font-size: 2rem; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: 0.03em;
}

.lead {
  margin: 18px auto 26px;
  color: var(--muted);
  line-height: 1.8;
}

.game-panel {
  position: relative;
  z-index: 1;
  padding: 22px;
  border: 3px solid rgba(40, 48, 68, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
}

.current-pi-box {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(101, 214, 255, 0.28), rgba(255, 230, 109, 0.34));
}

.label,
.status-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.current-pi {
  margin: 8px 0 0;
  min-height: 56px;
  font-family: "Consolas", "Menlo", monospace;
  font-size: clamp(1.7rem, 7vw, 3rem);
  font-weight: 900;
  word-break: break-all;
  text-align: left;
  line-height: 1.25;
}
.question {
  margin: 22px 0 14px;
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  font-weight: 900;
}

.answer-form {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.answer-input {
  width: 92px;
  height: 64px;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  font-size: 2.1rem;
  font-weight: 900;
  text-align: center;
  outline: none;
}

.answer-input:focus {
  box-shadow: 0 0 0 6px rgba(101, 214, 255, 0.45);
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  color: white;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary-button {
  padding: 0 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 0 #b53a75;
  font-size: 1.1rem;
}

.secondary-button {
  margin-top: 18px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #55c7ee, #2a8fd6);
  box-shadow: 0 7px 0 #1d6ba2;
  font-size: 1rem;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(4px);
  box-shadow: none;
}

.message {
  min-height: 28px;
  margin: 18px 0;
  font-weight: 900;
}

.message.correct {
  color: #15915b;
}

.message.wrong {
  color: #e11d48;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.status-grid > div {
  padding: 14px 10px;
  border-radius: 18px;
  background: rgba(255, 230, 109, 0.35);
}

.status-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

.result {
  margin-top: 18px;
  padding: 18px;
  border: 3px dashed rgba(40, 48, 68, 0.26);
  border-radius: 22px;
  background: #fff;
  line-height: 1.8;
  text-align: left;
    overflow-wrap: break-word;
  }

  .result strong {
    color: var(--accent-dark);
  }

  .pi-result {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
    white-space: normal;
    border-radius: 26px;
  }

  .answer-form {
    flex-direction: column;
    align-items: center;
  }

  .answer-input,
  .primary-button {
    width: min(280px, 100%);
  }

  .primary-button {
    height: 56px;
  }

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