/* トーン＆マナーは learn.jpschool.jp（Real Japanese Drills）に合わせる */
:root {
  color-scheme: light;
  --ink: #0f1733;
  --ink-2: #4c5677;
  --paper: #f6f4ef;
  --paper-2: #ecebf6;
  --line: #e3e1ec;
  --violet: #6d3ee6;
  --blue: #3f63f0;
  --cyan: #17a6e0;
  --pink: #ff5fb4;
  --orange: #ff8a3d;
  --sun: #ffc23d;
  --green: #2fc28b;
  --grad: linear-gradient(100deg, var(--violet), var(--blue) 50%, var(--cyan));
  --grad-warm: linear-gradient(90deg, var(--pink), var(--orange));
  --display: 'Nunito', system-ui, sans-serif;
  --ja: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  --kana: 'Klee One', 'Hiragino Mincho ProN', serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --r: 20px;
  --shadow: 0 20px 40px -26px rgba(15, 23, 51, 0.5);
  --shadow-sm: 0 10px 24px -18px rgba(15, 23, 51, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
#app { flex: 1; display: flex; flex-direction: column; }
/* ヒーローの淡いグラデーション（ピンク左上・ラベンダー右上） */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vw 34vw at 4% -6%, rgba(255, 95, 180, 0.2), transparent 70%),
    radial-gradient(42vw 38vw at 100% 4%, rgba(63, 99, 240, 0.16), transparent 70%),
    radial-gradient(40vw 30vw at 60% 110%, rgba(23, 166, 224, 0.08), transparent 70%);
}
[lang='ja'], .jp { font-family: var(--ja); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 64px; flex: 1; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; margin: 0 calc(-1 * clamp(16px, 4vw, 40px));
  background: rgba(246, 244, 239, 0.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 23, 51, 0.06);
}
.topbar-in { display: flex; align-items: center; gap: 12px; padding: 12px clamp(16px, 4vw, 40px); }
.mark { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.mark i {
  font-style: normal; font-family: var(--ja); font-weight: 900; flex: 0 0 auto;
  width: 34px; height: 34px; border: 1.5px solid; border-radius: 10px; display: grid; place-items: center;
}
.mark span { display: flex; flex-direction: column; }
.mark small { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.topbar-title { flex: 1; text-align: center; font-weight: 800; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.streak { background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14px; box-shadow: var(--shadow-sm); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: #fff; box-shadow: var(--shadow-sm); font-size: 17px; font-weight: 800;
  transition: transform 0.4s var(--ease);
}
.icon-btn:hover { transform: translateY(-2px); }

/* ---------- buttons（ブランドのピル型＋丸矢印） ---------- */
.btn {
  --h: 54px; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: var(--h); padding: 0 26px; border-radius: 999px; background: var(--ink); color: #fff;
  font-weight: 800; font-size: 16px; overflow: hidden; isolation: isolate; white-space: nowrap;
  transition: transform 0.5s var(--ease);
}
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--grad);
  transform: translateY(101%); transition: transform 0.6s var(--ease);
}
.btn:hover::before { transform: none; }
.btn:active { transform: scale(0.97); }
.btn:has(.ar) { padding-right: 8px; }
.btn .ar {
  width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--ink);
  display: grid; place-items: center; font-size: 18px; transition: transform 0.6s var(--ease);
}
.btn:hover .ar { transform: rotate(-45deg); }
.btn small { font-weight: 600; font-size: 12px; opacity: 0.75; }
.btn.sm { --h: 42px; font-size: 14px; padding: 0 18px; }
.btn.light { background: #fff; color: var(--ink); }
.btn.light .ar { background: var(--ink); color: #fff; }
.btn.light:hover { color: #fff; }
.btn.ghost, .btn.ghost-pill { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.btn.ghost-pill { box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover, .btn.ghost-pill:hover { color: #fff; }
.btn.ghost { --h: 46px; font-size: 15px; padding: 0 18px; }

/* ---------- home ---------- */
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; font-size: 12px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 6px rgba(255, 95, 180, 0.18); }
.hero { display: grid; grid-template-columns: 1fr minmax(260px, 320px); gap: clamp(20px, 4vw, 56px); align-items: end; margin: clamp(28px, 6vw, 64px) 0 clamp(28px, 4vw, 44px); }
.hero h1 { font-size: clamp(38px, 6.4vw, 72px); font-weight: 900; line-height: 1.02; letter-spacing: -0.025em; margin: 0 0 18px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 900; }
.lead { margin: 0; color: var(--ink-2); font-size: 17px; line-height: 1.65; max-width: 44ch; }
.lead [lang='ja'] { display: block; color: var(--ink); font-weight: 700; margin-bottom: 4px; }
.card { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); }
.k { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.progress-card { padding: 22px 24px; }
.progress-num { display: flex; align-items: baseline; gap: 8px; color: var(--ink-2); font-size: 14px; }
.progress-num b { font-size: 48px; font-weight: 900; color: var(--ink); letter-spacing: -0.03em; line-height: 1; }
.bar { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin: 14px 0 8px; }
.bar i { display: block; height: 100%; min-width: 8px; background: var(--grad); border-radius: 99px; transition: width 0.8s var(--ease); }
.progress-sub { font-size: 13px; color: var(--ink-2); }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  display: flex; align-items: baseline; gap: 8px; padding: 11px 20px; border-radius: 999px; flex: 0 0 auto;
  background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 800; transition: background 0.3s;
}
.tabs button small { font-family: var(--ja); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tabs button[aria-selected='true'] { background: var(--ink); color: #fff; box-shadow: none; }
.tabs button[aria-selected='true'] small { color: rgba(255, 255, 255, 0.7); }

.chart { background: #fff; border-radius: 24px; padding: clamp(10px, 2vw, 20px); box-shadow: var(--shadow); display: grid; gap: 10px; }
.chart-row { display: grid; grid-template-columns: 44px repeat(5, 1fr); gap: 10px; align-items: stretch; }
.row-label { display: grid; place-items: center; }
.row-label span {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 2.5px solid var(--c); background: #fff; font-size: 11px; font-weight: 900; text-transform: uppercase;
}
.cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 2px; border-radius: 16px; background: var(--paper); min-height: 92px;
  transition: transform 0.4s var(--ease), background 0.3s, box-shadow 0.3s;
}
a.cell:hover { transform: translateY(-3px); background: #fff; box-shadow: var(--shadow), inset 0 0 0 2px var(--c, var(--blue)); }
a.cell:active { transform: scale(0.96); }
.cell.empty { background: transparent; }
.cell .kana { font-family: var(--kana); font-size: clamp(28px, 4.6vw, 42px); line-height: 1.1; }
.cell .romaji { font-size: 12px; color: var(--ink-2); font-weight: 800; }
.cell.mastered { background: var(--paper-2); }
.cell.mastered::after {
  content: '✓'; position: absolute; top: 6px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--grad); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 900;
}
.stars { display: inline-flex; gap: 3px; margin-top: 5px; }
.stars i, .star {
  width: 11px; height: 11px; display: inline-block; background: var(--line);
  clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%);
}
.stars i.on, .star.on { background: var(--sun); }

.challenge-cta {
  display: flex; align-items: center; gap: 20px; margin-top: 24px; padding: clamp(22px, 3vw, 34px);
  border-radius: 24px; background: var(--ink); color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.challenge-cta::after {
  content: ''; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 62, 230, 0.55), transparent 65%); pointer-events: none;
}
.cta-text { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; position: relative; z-index: 1; }
.cta-text b { font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: -0.02em; }
.cta-text small { color: rgba(255, 255, 255, 0.7); font-size: 15px; }
.step-tag { display: inline-block; background: var(--grad); color: #fff; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 800; }
.challenge-cta .btn { position: relative; z-index: 1; }
.cta-emoji.big { font-size: 56px; }

/* ---------- footer（ブランドと同じ紺） ---------- */
.foot { background: var(--ink); color: rgba(255, 255, 255, 0.7); font-size: 13px; line-height: 1.6; }
.foot-in { max-width: 1120px; margin: 0 auto; padding: 40px clamp(16px, 4vw, 40px) 48px; }
.foot .mark { color: #fff; margin-bottom: 14px; }
.foot p { margin: 4px 0; }
.foot a { text-decoration: underline; text-underline-offset: 3px; }
.foot .mark { text-decoration: none; }
.foot-cta { color: #fff; font-weight: 800; font-size: 15px; margin-bottom: 12px !important; }
.foot-cta a { text-decoration: none; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: brightness(1.4); }
.link { text-decoration: underline; text-underline-offset: 3px; color: rgba(255, 255, 255, 0.55); font-size: 12px; }

/* ---------- practice ---------- */
.practice-body { display: grid; grid-template-columns: 280px 1fr; gap: clamp(20px, 3vw, 40px); align-items: start; margin-top: 28px; }
.practice-body > *, .info > * { min-width: 0; }
.info { display: grid; gap: 14px; position: sticky; top: 88px; }
.big-card { background: #fff; border-radius: var(--r); padding: 22px; text-align: center; box-shadow: var(--shadow); }
.big-kana { font-family: var(--kana); font-size: 116px; line-height: 1.15; }
.pill { display: inline-block; background: var(--grad-warm); color: #fff; font-weight: 900; padding: 5px 22px; border-radius: 999px; font-size: 18px; }
.say {
  display: block; margin: 14px auto 0; padding: 9px 18px; border-radius: 999px;
  background: var(--paper); font-weight: 800; transition: background 0.3s;
}
.say:hover { background: var(--paper-2); }
.stroke-count { margin-top: 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.word-card {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  background: #fff; border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  transition: transform 0.4s var(--ease);
}
.word-card:hover { transform: translateY(-2px); }
.word-emoji { width: 62px; height: 62px; flex: 0 0 auto; display: grid; place-items: center; font-size: 34px; background: var(--paper-2); border-radius: 16px; }
.word-text { display: flex; flex-direction: column; }
.word-text b { font-family: var(--ja); font-size: 22px; font-weight: 700; }
.word-text mark { background: none; color: var(--pink); }
.word-text em { font-style: normal; color: var(--blue); font-weight: 800; }
.word-text small { color: var(--ink-2); }

.work { display: flex; flex-direction: column; align-items: center; }
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; justify-content: center; }
.steps li {
  display: flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px;
  background: #fff; color: var(--ink-2); font-size: 14px; font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--line);
}
.steps li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font-size: 11px; color: var(--ink); }
.steps li.now { background: var(--grad); color: #fff; box-shadow: none; }
.steps li.now span { background: #fff; }
.steps li.done span { background: var(--ink); color: #fff; }
.steps li.now .star:not(.on) { background: rgba(255, 255, 255, 0.55); }
.steps li .star { width: 18px; height: 18px; }

.pad-wrap { position: relative; width: min(100%, 470px); }
.pad {
  width: 100%; aspect-ratio: 1; background: #fff; border-radius: 28px; box-shadow: var(--shadow);
  border: 1.5px solid var(--line); overflow: hidden;
}
.pad-canvas { display: block; touch-action: none; cursor: crosshair; }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.msg { min-height: 1.6em; margin: 14px 0 6px; font-weight: 800; font-size: 17px; text-align: center; }
.msg.ok { color: var(--blue); }
.msg.win { font-size: 24px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.msg.miss { color: var(--pink); }

.controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.kana-nav { display: flex; justify-content: space-between; align-items: center; width: min(100%, 470px); margin-top: 22px; }
.kana-nav .btn { font-size: 18px; }
.bounce { animation: bounce 1s var(--ease) infinite; }
@keyframes bounce { 50% { transform: translateY(-6px); } }

/* ---------- confetti ---------- */
.confetti { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; z-index: 3; }
.confetti span { grid-area: 1 / 1; font-size: 22px; opacity: 0; animation: pop 1.2s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes pop {
  0% { opacity: 1; transform: translate(0, 0) scale(0.3); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); }
}

/* ---------- challenge ---------- */
.challenge-body { display: flex; justify-content: center; margin-top: 32px; }
.setup, .result, .quiz { width: min(100%, 540px); text-align: center; display: flex; flex-direction: column; align-items: center; }
.setup, .result { background: #fff; border-radius: 24px; padding: clamp(26px, 5vw, 44px) 22px; box-shadow: var(--shadow); position: relative; }
.setup .eyebrow { justify-content: center; }
.setup h2, .result h2 { margin: 6px 0 10px; font-size: clamp(30px, 5vw, 44px); font-weight: 900; letter-spacing: -0.025em; line-height: 1.05; }
.setup p, .result p { color: var(--ink-2); margin: 0 0 22px; line-height: 1.6; }
.pool { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.setup .pool .btn { --h: 60px; flex-direction: column; gap: 0; line-height: 1.15; }
.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dots i.now { background: var(--ink); }
.dots i.good { background: var(--sun); }
.dots i.meh { background: rgba(255, 95, 180, 0.35); }
.prompt { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.prompt-romaji { font-size: 44px; font-weight: 900; background: var(--grad); color: #fff; padding: 2px 30px; border-radius: 999px; letter-spacing: -0.01em; }
.result-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; margin-bottom: 22px; }
.result-grid .cell { min-height: 74px; }

@media (max-width: 860px) {
  .nav-cta { display: none; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .practice-body { grid-template-columns: 1fr; gap: 14px; margin-top: 16px; }
  .info { position: static; grid-template-columns: auto 1fr; align-items: stretch; }
  .big-card { padding: 12px 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; justify-items: start; text-align: left; width: 100%; }
  .big-kana { font-size: 62px; grid-row: span 3; }
  .say { margin: 0; padding: 5px 12px; font-size: 14px; }
  .stroke-count { margin: 0; }
  .word-card { padding: 10px; }
  .word-emoji { width: 46px; height: 46px; font-size: 26px; }
  .word-text b { font-size: 18px; }
  .steps { gap: 4px; }
  .steps li { padding: 5px 10px; font-size: 13px; }
  .topbar-title { display: none; }
  .mark small { display: none; }
}
@media (max-width: 480px) {
  .info { grid-template-columns: 1fr; }
  .chart { gap: 6px; }
  .chart-row { grid-template-columns: 26px repeat(5, 1fr); gap: 5px; }
  .row-label span { width: 26px; height: 26px; font-size: 9px; border-width: 2px; }
  .cell { min-height: 74px; border-radius: 12px; }
  .stars i { width: 8px; height: 8px; }
  .challenge-cta { flex-direction: column; align-items: stretch; }
  .challenge-cta .btn { justify-content: space-between; }
  .practice .mark span { display: none; }
  .lead { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition: none !important; }
}
