:root {
  --bg: #eef4e8;
  --bg-deep: #dce8d2;
  --paper: #fffdf7;
  --ink: #2a332c;
  --ink-soft: #5d6b60;
  --moss: #3f6b4f;
  --leaf: #5a8f68;
  --leaf-hi: #7eb37a;
  --shell: #c9844a;
  --sand: #efe4cf;
  --line: #d7ccb6;
  --ok: #3d7a5a;
  --ok-bg: #e4f3e8;
  --ng: #b56858;
  --ng-bg: #f8ebe6;
  --shadow: 0 10px 30px rgba(62, 84, 55, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -80px, #f7fbf2, transparent),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.shell {
  min-height: 100dvh;
  display: grid;
  place-items: stretch;
}

.app {
  width: min(430px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand small {
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.brand strong {
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--moss);
}

.hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.kamemon {
  width: 168px;
  height: 118px;
}

.kamemon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.walk .legs {
  transform-origin: 60px 78px;
  animation: paddle 1.1s ease-in-out infinite;
}

.walk .body {
  animation: bob 1.1s ease-in-out infinite;
}

.celebrate .body {
  animation: hop 0.7s ease-in-out 3;
}

.catchphrase {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

.level-num {
  font-size: 4.2rem;
  line-height: 0.9;
  color: var(--moss);
  font-weight: 900;
}

.level-num span {
  font-size: 1.1rem;
  margin-right: 4px;
  font-weight: 700;
}

.tier {
  background: var(--sand);
  color: var(--shell);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.meter {
  width: 100%;
  height: 10px;
  background: var(--sand);
  border-radius: 999px;
  overflow: hidden;
}

.meter > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--leaf), var(--leaf-hi));
  border-radius: inherit;
  transition: width 0.4s ease;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.stat {
  background: #f6f3ea;
  border-radius: 16px;
  padding: 10px 6px;
}

.stat b {
  display: block;
  font-size: 1.15rem;
}

.stat span {
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.actions {
  display: grid;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--moss);
  color: #fff;
  box-shadow: 0 8px 0 #2f513c;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 6px 0 #2f513c;
}

.btn.secondary {
  background: var(--paper);
  color: var(--moss);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.progress-row b {
  color: var(--ink);
  font-size: 1.05rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
}

.statement {
  font-size: 1.18rem;
  line-height: 1.75;
  font-weight: 500;
}

.ox {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
}

.ox button {
  border: 0;
  border-radius: 22px;
  min-height: 92px;
  font-size: 2.4rem;
  font-weight: 900;
  color: #fff;
}

.ox .maru {
  background: var(--ok);
  box-shadow: 0 8px 0 #2d5c43;
}

.ox .batsu {
  background: var(--ng);
  box-shadow: 0 8px 0 #8a4a3e;
}

.ox button:active {
  transform: translateY(2px);
}

.result-mark {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 900;
  margin: 8px auto 4px;
}

.result-mark.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.result-mark.ng {
  background: var(--ng-bg);
  color: var(--ng);
}

.explain {
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  line-height: 1.7;
}

.explain .source {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.explain .source a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hint,
.note {
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
}

.hint {
  font-size: 0.92rem;
}

.note {
  font-size: 0.8rem;
}

.error {
  background: var(--ng-bg);
  color: var(--ng);
  border-radius: 16px;
  padding: 16px;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes paddle {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

@keyframes hop {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .walk .legs,
  .walk .body,
  .celebrate .body,
  .meter > i {
    animation: none;
    transition: none;
  }
}

.result-title {
  text-align: center;
}

.site-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--ink-soft);
}

.page {
  line-height: 1.8;
}

.page h1 {
  font-size: 1.5rem;
}

.page h2 {
  font-size: 1.1rem;
  margin-top: 1.6em;
}

.page a:not(.btn) {
  color: var(--moss);
}

.page a.btn {
  display: inline-block;
  text-decoration: none;
}
