:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --text: #1d2433;
  --muted: #667085;
  --border: #dfe3eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --success: #166534;
  --success-bg: #ecfdf3;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(31, 41, 55, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
button, input { font: inherit; }

.site-header {
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  max-width: 1080px;
  margin: auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: .02em;
}
.nav { display: flex; flex-wrap: wrap; gap: 16px; }
.nav a { color: var(--text); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 42px 20px 72px; }
.hero { margin-bottom: 26px; }
.eyebrow { color: var(--accent); font-weight: 700; margin: 0 0 6px; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: clamp(1.45rem, 3.5vw, 2rem); line-height: 1.35; margin: 0 0 14px; }
h3 { font-size: 1.12rem; line-height: 1.5; margin: 28px 0 8px; }
p { margin: 0 0 16px; }
.lead { max-width: 820px; color: var(--muted); font-size: 1.04rem; }

.game-card,
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.game-card { padding: 22px; margin-bottom: 28px; }
.content-card { padding: 28px; margin: 22px 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 13px 10px;
  text-align: center;
}
.stat-label { display: block; color: var(--muted); font-size: .82rem; }
.stat-value { display: block; font-weight: 800; font-size: 1.3rem; line-height: 1.45; }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  font-weight: 700;
}
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.secondary-button { background: var(--surface-2); color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.notice {
  border-left: 4px solid var(--accent);
  background: #eff6ff;
  border-radius: 8px;
  padding: 13px 16px;
  margin: 18px 0;
}
.status-message {
  min-height: 1.7em;
  margin: 12px 0 0;
  font-weight: 700;
}
.status-message.success { color: var(--success); }
.status-message.error { color: var(--danger); }

/* Mole game */
.mole-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 12px;
  max-width: 600px;
  margin: 16px auto;
}
.hole {
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 65%, #7c4a2d 0 35%, #5a3420 36% 55%, #392116 56% 100%);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 -8px 16px rgba(0,0,0,.22);
}
.hole:focus-visible { outline: 4px solid #93c5fd; outline-offset: 3px; }
.mole {
  position: absolute;
  left: 50%;
  bottom: -72%;
  transform: translateX(-50%);
  width: 72%;
  height: 78%;
  border-radius: 48% 48% 38% 38%;
  background: #b7794b;
  transition: bottom .12s ease;
  pointer-events: none;
}
.mole::before { content: "🦫"; position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(2rem, 7vw, 4.2rem); }
.hole.active .mole { bottom: 2%; }
.hole.hit .mole { filter: brightness(1.25); transform: translateX(-50%) scale(.94); }

/* Typing game */
.race-track {
  position: relative;
  height: 112px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(#dbeafe 0 48%, #4b5563 48% 100%);
  margin-bottom: 18px;
  border: 1px solid var(--border);
}
.race-track::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 26px;
  height: 3px;
  background: repeating-linear-gradient(90deg, #fff 0 20px, transparent 20px 42px);
  opacity: .9;
}
.car {
  position: absolute;
  left: 96%;
  bottom: 34px;
  font-size: 2.4rem;
  transform: translateX(-50%);
  transition: left .18s ease;
  z-index: 2;
}
.word-panel {
  text-align: center;
  margin: 18px 0 12px;
}
.target-word {
  display: inline-block;
  min-width: min(420px, 90%);
  padding: 14px 18px;
  background: var(--surface-2);
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.35rem, 5vw, 2.3rem);
  font-weight: 800;
  letter-spacing: .04em;
}
.typing-input {
  width: min(560px, 100%);
  display: block;
  margin: 12px auto 0;
  padding: 13px 15px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1.05rem;
}
.typing-input:focus { outline: 3px solid #bfdbfe; border-color: var(--accent); }
.typing-input.correct { border-color: #22c55e; background: var(--success-bg); }
.typing-input.wrong { border-color: #ef4444; background: var(--danger-bg); }

.rules-grid, .faq-list, .related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.info-box, .faq-item, .related-link {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}
.info-box h3, .faq-item h3 { margin-top: 0; }
.related-link { text-decoration: none; color: var(--text); }
.related-link strong { display: block; margin-bottom: 3px; }
.related-link span { color: var(--muted); font-size: .92rem; }
.related-link:hover { border-color: #93c5fd; color: var(--text); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { padding: 11px 12px; border: 1px solid var(--border); text-align: left; }
th { background: var(--surface-2); }
code { background: var(--surface-2); padding: 2px 5px; border-radius: 5px; }

.site-footer { border-top: 1px solid var(--border); background: #fff; }
.footer-inner { max-width: 1080px; margin: auto; padding: 28px 20px; color: var(--muted); font-size: .9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.footer-links a { color: var(--muted); }

@media (max-width: 720px) {
  .header-inner { align-items: flex-start; flex-direction: column; }
  .nav { gap: 10px 14px; }
  main { padding-top: 28px; }
  .game-card, .content-card { padding: 18px; }
  .stats { grid-template-columns: 1fr; }
  .mole-board { gap: 8px; }
  .rules-grid, .faq-list, .related-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
.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;
}
