:root {
  --ink: #1d2745;
  --muted: #56607d;
  --paper: #fff9ea;
  --bg: #3552a3;
  --bg-line: #2e4994;
  --red: #f0503c;
  --yellow: #ffcf3f;
  --mint: #62d2a2;
  --sky: #8fd0ff;
  --line: 2.5px solid var(--ink);
  --font: ui-rounded, "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "Tsukushi A Round Gothic", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.7;
  background: var(--bg) repeating-linear-gradient(135deg, transparent 0 22px, var(--bg-line) 22px 24px);
  overflow-wrap: anywhere;
}
main { width: min(100%, 780px); min-height: 100vh; margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* 共通パーツ */
.card { background: var(--paper); border: var(--line); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); padding: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 22px; margin-bottom: 4px;
  border: var(--line); border-radius: 999px; background: #fff; box-shadow: 0 4px 0 var(--ink);
  font-weight: 800; text-decoration: none; color: var(--ink); user-select: none; -webkit-user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn.primary { background: var(--red); color: #fff; }
.btn.yellow { background: var(--yellow); }
.btn.small { min-height: 36px; padding: 2px 14px; font-size: .85rem; box-shadow: 0 3px 0 var(--ink); }
.link { border: 0; background: none; padding: 0; color: #fff; font-size: .85rem; font-weight: 700; text-decoration: underline; }
kbd {
  display: inline-block; padding: 0 .5em; margin: 0 .1em; border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 8px;
  background: #fff; font: inherit; font-size: .9em; font-weight: 800; line-height: 1.5; white-space: nowrap;
}

/* 上のバー */
.topbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.topbar { padding-top: 14px; }
.logo {
  position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 3px 20px 3px 52px; margin: 0 auto 4px 6px;
  border: var(--line); border-radius: 6px; box-shadow: 0 4px 0 var(--ink);
  background: #dba465 repeating-linear-gradient(92deg, transparent 0 13px, rgba(120, 70, 20, .18) 13px 15px);
  font-size: 1.35rem; font-weight: 900; letter-spacing: .18em; text-indent: .18em; transform-origin: 50% -30px;
}
.logo::before, .logo::after { content: ""; position: absolute; top: -34px; width: 3px; height: 32px; background: var(--paper); border-radius: 2px; }
.logo img { position: absolute; left: -10px; top: 50%; width: 52px; height: 52px; margin-top: -28px; border: var(--line); border-radius: 15px; box-shadow: 0 3px 0 var(--ink); transform: rotate(-8deg); }
.logo:hover img { animation: bob 1s ease-in-out; }
.logo::before { left: 60px; } .logo::after { right: 16px; }
.logo:hover { animation: swing .9s ease-in-out; }
@keyframes swing { 25% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } }
.seg { display: inline-flex; border: var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 4px 14px; font-size: .85rem; font-weight: 800; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* スタート */
.start { text-align: center; margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 34px 22px; }
.start img { width: 110px; height: 110px; border-radius: 28px; border: var(--line); animation: bob 2.4s ease-in-out infinite; }
.start h1 { font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 900; line-height: 1.1; letter-spacing: .04em; }
.start .sub { font-weight: 700; }
.start .row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
.start .label { font-size: .85rem; font-weight: 800; color: var(--muted); }
.note { font-size: .85rem; color: var(--muted); font-weight: 700; }

/* 道場一覧 */
.intro { color: #fff; }
.intro h1 { font-size: clamp(1.15rem, 3.6vw, 1.45rem); font-weight: 900; line-height: 1.4; margin-bottom: 4px; }
.intro p { font-size: .92rem; font-weight: 700; }
.dojos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dojo {
  position: relative; display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 18px;
  background: var(--paper); border: var(--line); border-radius: 22px; box-shadow: 0 6px 0 var(--ink);
}
.dojo:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink); }
.dojo:active { transform: translateY(6px); box-shadow: none; }
.mark { display: grid; place-items: center; width: 68px; height: 68px; border: var(--line); border-radius: 18px; background: var(--tint); flex: none; }
.mark svg { width: 50px; height: 50px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.mark .t { fill: var(--yellow); } .mark .r { fill: var(--red); }
.mark.big { width: 104px; height: 104px; border-radius: 26px; }
.mark.big svg { width: 78px; height: 78px; }
.dojo h2 { font-size: 1.25rem; font-weight: 900; }
.dojo p { font-size: .88rem; font-weight: 700; color: var(--muted); line-height: 1.5; flex: 1; }
.meter { display: flex; align-items: center; gap: 10px; font-weight: 900; font-variant-numeric: tabular-nums; }
.meter .bar { flex: 1; height: 14px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--tint); border-right: 2px solid var(--ink); transition: width .4s; }
.meter .bar i[style*="width:0%"] { border: 0; }
.dojo .seal { position: absolute; top: 12px; right: 12px; }
.seal {
  display: inline-grid; place-items: center; padding: 2px 10px; border: 3px solid var(--red); border-radius: 10px;
  color: var(--red); font-weight: 900; font-size: .9rem; letter-spacing: .1em; transform: rotate(8deg); background: rgba(255,255,255,.6);
}
.c0 { --tint: #ffb8a6; } .c1 { --tint: #9be3c3; } .c2 { --tint: #a9dcff; } .c3 { --tint: #ffe07a; }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-top: auto; color: #fff; font-size: .85rem; font-weight: 700; }
.foot a { color: #fff; }
.foot { align-items: center; }
.foot .heart { color: #ff8f8f; }

/* ミッション */
.m-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: #fff; font-weight: 900; }
.m-nav .name { margin-right: auto; font-size: 1.1rem; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dots button {
  width: 30px; height: 30px; padding: 0; border: 2px solid var(--ink); border-radius: 50%; background: #fff;
  font-size: .8rem; font-weight: 900; font-variant-numeric: tabular-nums;
}
.dots button.done { background: var(--tint); }
.dots button[aria-current="true"] { box-shadow: 0 0 0 3px var(--yellow); }
.mission { position: relative; display: flex; flex-direction: column; gap: 16px; }
.m-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.m-no { padding: 0 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .85rem; font-weight: 800; }
.m-head h2 { font-size: clamp(1.3rem, 4.6vw, 1.7rem); font-weight: 900; line-height: 1.3; }
.lead { font-weight: 700; }
.how { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 26px; padding: 14px; border: 2px dashed var(--ink); border-radius: 16px; background: #fff; }
.combo { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.2rem; }
.key {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; height: 58px; padding: 0 12px;
  border: var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 5px 0 var(--ink);
  font-size: 1.25rem; font-weight: 900; line-height: 1.1; transition: transform .06s, box-shadow .06s, background .06s;
}
.key small { font-size: .62rem; font-weight: 800; color: var(--muted); }
.key.down { transform: translateY(5px); box-shadow: none; background: var(--yellow); }
.or { font-size: .8rem; font-weight: 800; color: var(--muted); }
.area { display: flex; flex-direction: column; gap: 12px; }
.area:empty { display: none; }
.manual { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.result { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; border: var(--line); border-radius: 16px; background: var(--tint); animation: pop .35s cubic-bezier(.3, 1.6, .6, 1); }
.result .stamp { font-size: 1.6rem; padding: 2px 18px; background: #fff; animation: stamp .4s cubic-bezier(.3, 1.6, .6, 1); }
.result .tip { font-weight: 700; text-align: center; }
.result .tip b { display: block; font-size: .8rem; color: var(--muted); }

/* 練習エリアの部品 */
.sheet { padding: 14px 16px; border: var(--line); border-radius: 14px; background: #fff; font-weight: 700; }
.sheet.big { text-align: center; font-size: 1.5rem; font-weight: 900; letter-spacing: .1em; }
.sheet p + p { margin-top: 10px; }
.sheet .target { background: linear-gradient(transparent 60%, var(--yellow) 60%); }
.field { width: 100%; padding: 12px 14px; border: var(--line); border-radius: 14px; background: #fff; font-weight: 700; resize: none; }
.field:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
.field.shake { animation: shake .4s; }
.two { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; font-weight: 900; }
.cap { font-size: .8rem; font-weight: 800; color: var(--muted); }
.scroller { height: 230px; overflow: auto; border: var(--line); border-radius: 14px; background: linear-gradient(#e8f6ff, #fff3d1); scrollbar-width: none; overscroll-behavior: contain; }
.scroller::-webkit-scrollbar { display: none; }
.scroller .tall { display: flex; flex-direction: column; align-items: center; gap: 110px; padding: 30px 0 40px; font-weight: 900; }
.scroller .wide { display: flex; align-items: center; gap: 260px; width: max-content; height: 100%; padding: 0 40px; font-weight: 900; white-space: nowrap; }
.scroller.x { height: 130px; background: linear-gradient(90deg, #e8f6ff, #fff3d1); }
.goal { padding: 6px 18px; border: var(--line); border-radius: 12px; background: var(--yellow); font-size: 1.2rem; }
.hit { position: relative; display: grid; place-items: center; min-height: 150px; border: var(--line); border-radius: 14px; background: #fff; font-weight: 900; user-select: none; -webkit-user-select: none; }
.menu { position: absolute; padding: 6px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; box-shadow: 3px 3px 0 var(--ink); font-size: .85rem; white-space: nowrap; text-align: left; }
.menu div { padding: 2px 14px; border-radius: 6px; }
.menu div:first-child { background: var(--sky); }
.zoombox { display: grid; place-items: center; height: 190px; overflow: hidden; border: var(--line); border-radius: 14px; background: #fff; touch-action: none; }
.zoombox span { display: block; font-size: 1.6rem; font-weight: 900; white-space: nowrap; transform: scale(.14); }
.dragbox { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 150px; padding: 16px 26px; border: var(--line); border-radius: 14px; background: #fff; }
.drag-item { display: grid; place-items: center; width: 70px; height: 70px; border: var(--line); border-radius: 50%; background: var(--yellow); font-weight: 900; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; z-index: 2; }
.drag-item.grab { cursor: grabbing; box-shadow: 0 8px 0 rgba(29,39,69,.25); }
.drop { display: grid; place-items: center; width: 120px; height: 110px; border: 3px dashed var(--ink); border-radius: 16px; font-size: .85rem; font-weight: 800; color: var(--muted); }
.drop.got { background: var(--tint); border-style: solid; }

/* 指の動きの図 */
.pad { position: relative; display: grid; place-items: center; width: 150px; height: 104px; border: var(--line); border-radius: 16px; background: #e9ecf5; flex: none; }
.pad .f { display: flex; gap: 9px; }
.pad i { display: block; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 50%; background: var(--red); }
.pad.up .f { animation: g-up 1.5s ease-in-out infinite; }
.pad.updown .f { animation: g-updown 2.2s ease-in-out infinite; }
.pad.side .f { animation: g-side 2.2s ease-in-out infinite; }
.pad.tap .f { animation: g-tap 1.2s ease-in-out infinite; }
.pad.drag .f { animation: g-drag 2s ease-in-out infinite; }
.pad.pinch i:first-child { animation: g-pin-a 1.6s ease-in-out infinite; }
.pad.pinch i:last-child { animation: g-pin-b 1.6s ease-in-out infinite; }
@keyframes g-up { 0% { transform: translateY(26px); opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-26px); opacity: 0; } }
@keyframes g-updown { 0%, 100% { transform: translateY(24px); } 50% { transform: translateY(-24px); } }
@keyframes g-side { 0%, 100% { transform: translateX(-34px); } 50% { transform: translateX(34px); } }
@keyframes g-tap { 0%, 100% { transform: scale(1.25); opacity: .35; } 50% { transform: scale(.9); opacity: 1; } }
@keyframes g-drag { 0% { transform: translateX(-36px) scale(1.25); opacity: .4; } 20% { transform: translateX(-36px) scale(.9); opacity: 1; } 80% { transform: translateX(36px) scale(.9); opacity: 1; } 100% { transform: translateX(36px) scale(1.25); opacity: .4; } }
@keyframes g-pin-a { 0%, 100% { transform: translate(8px, 6px); } 50% { transform: translate(-22px, 20px); } }
@keyframes g-pin-b { 0%, 100% { transform: translate(-8px, -6px); } 50% { transform: translate(22px, -20px); } }

/* 仮想デスクトップの図 */
.desks { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 14px; border: var(--line); border-radius: 14px; background: #dfe6f7; }
.desks div { display: grid; place-items: center; width: 104px; height: 66px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; font-size: .72rem; font-weight: 800; text-align: center; line-height: 1.3; }
.desks .plus { width: 44px; border-style: dashed; font-size: 1.3rem; background: transparent; }
.desks .now { background: var(--tint); }
.desks.add .new { animation: d-add 2.4s ease-in-out infinite; }
.desks.switch div:nth-child(1) { animation: d-sw 2.4s steps(1) infinite; }
.desks.switch div:nth-child(2) { animation: d-sw 2.4s steps(1) infinite reverse; }
.desks.close .new { animation: d-add 2.4s ease-in-out infinite reverse; }
.desks.wins { flex-wrap: wrap; }
.desks.wins div { width: 86px; height: 56px; }
@keyframes d-add { 0%, 30% { transform: scale(0); opacity: 0; } 50%, 100% { transform: scale(1); opacity: 1; } }
@keyframes d-sw { 0% { background: #a9dcff; } 50% { background: #fff; } }

/* 演出 */
.confetti { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; left: 50%; top: 42%; width: 10px; height: 15px; border-radius: 3px; animation: conf 1.2s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
@keyframes pop { from { transform: scale(.85); } }
@keyframes stamp { from { transform: rotate(8deg) scale(2.4); } }
@keyframes bob { 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
.clear { text-align: center; margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 8px 0; }
.clear .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.clear-msg { color: #fff; font-weight: 800; }

/* 賞状 */
.cert {
  position: relative; width: min(100%, 520px); padding: 12px; border: var(--line); border-radius: 10px; box-shadow: 0 8px 0 var(--ink);
  background: #e0ac3f repeating-linear-gradient(45deg, transparent 0 7px, rgba(255, 255, 255, .35) 7px 10px);
  animation: cert-in .6s cubic-bezier(.3, 1.4, .6, 1);
}
.cert-in {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 22px 18px;
  border: 2px solid var(--ink); outline: 2px solid var(--ink); outline-offset: -8px; border-radius: 4px; background: var(--paper);
}
.cert-title { font-size: clamp(2rem, 9vw, 3rem); font-weight: 900; letter-spacing: .3em; text-indent: .3em; line-height: 1.2; }
.cert h2 { font-size: 1.5rem; font-weight: 900; }
.cert-body { font-weight: 700; }
.cert-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; width: 100%; margin-top: 8px; padding: 0 14px 0 64px; font-size: .85rem; font-weight: 800; }
.cert-sign { display: inline-flex; align-items: center; gap: 6px; }
.cert-sign img { width: 30px; height: 30px; border-radius: 8px; }
.hanko { display: grid; place-items: center; width: 46px; height: 46px; border: 3px solid var(--red); border-radius: 8px; color: var(--red); font-size: .72rem; font-weight: 900; line-height: 1.15; transform: rotate(-6deg); animation: stamp .5s .5s cubic-bezier(.3, 1.6, .6, 1) backwards; }
.rosette { position: absolute; left: 14px; bottom: -22px; width: 72px; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; animation: stamp .5s .25s cubic-bezier(.3, 1.6, .6, 1) backwards; }
@keyframes cert-in { from { transform: translateY(-40px) rotate(-4deg) scale(.9); } }

/* 入門の演出 */
.enter { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; overflow: hidden; cursor: pointer; animation: enter-out .3s 1.4s forwards; }
.enter .noren { position: absolute; top: 0; bottom: 0; width: 50.5%; background: var(--ink) repeating-linear-gradient(90deg, transparent 0 78px, rgba(255, 255, 255, .08) 78px 80px); border-bottom: 14px solid var(--tint); }
.enter .noren.l { left: 0; border-right: 3px solid var(--tint); animation: noren-l .5s 1s cubic-bezier(.6, 0, .9, .4) forwards; }
.enter .noren.r { right: 0; border-left: 3px solid var(--tint); animation: noren-r .5s 1s cubic-bezier(.6, 0, .9, .4) forwards; }
.enter-in { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; font-weight: 800; text-align: center; animation: enter-pop .45s cubic-bezier(.3, 1.6, .6, 1), enter-fade .25s 1s forwards; }
.enter-in h2 { font-size: clamp(2rem, 8vw, 3.2rem); font-weight: 900; line-height: 1.2; }
.enter-in .shout { padding: 0 16px; border-radius: 999px; background: var(--tint); color: var(--ink); font-weight: 900; transform: rotate(-4deg); }
@keyframes noren-l { to { transform: translateX(-101%); } }
@keyframes noren-r { to { transform: translateX(101%); } }
@keyframes enter-pop { from { transform: scale(.6); } }
@keyframes enter-fade { to { opacity: 0; transform: scale(1.15); } }
@keyframes enter-out { to { visibility: hidden; } }

@media (max-width: 560px) {
  .dojos { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

.exit { display: flex; justify-content: center; margin-top: 6px; }
.start .sub b { font-weight: 900; }
.intro .small { margin-top: 4px; font-size: .8rem; opacity: .85; }
.start .note { margin-top: -10px; }
