/* ============================================================
   トラックパッド道場・タッチ道場 共通CSS（dojo-core.js と組で使う）
   ============================================================ */
:root {
  --dj-green: #1abc9c;
  --dj-green-d: #12876f;
  --dj-red: #e90114;
  --dj-ink: #222;
  --dj-paper: #f5f0e8;
  --dj-card: #fff;
  --dj-yellow: #ffd84a;
  --dj-blue: #3b82c4;
  --dj-purple: #8e44ad;
}
* { box-sizing: border-box; }
html { overscroll-behavior-x: none; }
body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans", "Yu Gothic", sans-serif;
  background-color: var(--dj-paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px),
    repeating-linear-gradient(90deg, transparent 0, transparent 31px, rgba(0,0,0,0.03) 31px, rgba(0,0,0,0.03) 32px);
  color: var(--dj-ink);
  line-height: 1.7;
  font-size: 17px;
  overscroll-behavior-x: none;
}
ruby rt { font-size: 0.55em; }
.px { font-family: "DotGothic16", "Helvetica Neue", sans-serif; letter-spacing: 0.04em; }

header { background: #fff; border-bottom: 3px solid var(--dj-green); padding: 10px 16px; }
.header-container { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #222; }
.logo-img { height: 38px; }
.logo-text { font-weight: bold; font-size: 1.02rem; display: flex; flex-direction: column; line-height: 1.2; }
.logo-text-sub { font-size: 0.7rem; color: #666; }
.back-to-overview { background: var(--dj-green); color: #fff; padding: 6px 14px; border-radius: 4px; text-decoration: none; font-size: 0.9rem; font-weight: bold; white-space: nowrap; }

main { max-width: 960px; margin: 20px auto; padding: 0 16px; }
footer { background: #222; color: #ddd; text-align: center; padding: 20px; font-size: 0.9rem; margin-top: 32px; }
.footer-content { max-width: 900px; margin: 0 auto; }

.dj-card { background: #fff; border: 3px solid #222; border-radius: 12px; padding: 18px 22px; box-shadow: 4px 4px 0 #222; margin-bottom: 18px; }
.dj-btn {
  font-family: "DotGothic16", sans-serif; font-size: 1.08rem; line-height: 1.3;
  padding: 11px 22px; border: 3px solid #222; border-radius: 8px;
  background: var(--dj-green); color: #fff; cursor: pointer; text-decoration: none; display: inline-block;
  box-shadow: 4px 4px 0 #222; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.dj-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #222; }
.dj-btn.sub { background: #fff; color: #222; }
.dj-btn.warm { background: var(--dj-yellow); color: #222; }
.dj-btn.small { font-size: 0.92rem; padding: 6px 12px; box-shadow: 3px 3px 0 #222; }

/* 端末の案内帯 */
.dj-banner { display: none; max-width: 960px; margin: 12px auto 0; padding: 0 16px; }
.dj-banner.is-shown { display: block; }
.dj-banner-inner { background: #fff8d6; border: 2px solid #d8b200; border-radius: 8px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; font-size: 0.95rem; }
.dj-banner-inner p { margin: 0; flex: 1; }
.dj-banner-close { border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; padding: 2px 8px; }

/* ゲームのはじめの画面 */
.dj-hero { text-align: center; }
.dj-hero h1 { font-family: "DotGothic16", sans-serif; margin: 4px 0 6px; font-size: 1.8rem; }
.dj-hero .lead { margin: 0 auto 10px; max-width: 640px; }
.dj-howto { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; text-align: left; max-width: 640px; margin: 10px auto; }
.dj-howto svg { width: 150px; height: 110px; display: block; }
.dj-howto ol { margin: 0; padding-left: 1.3em; }
.dj-stage-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; }
.dj-stage-pick button { min-width: 64px; }
.dj-stage-pick button[aria-pressed="true"] { background: var(--dj-yellow); color: #222; }
.dj-stage-pick button:disabled { opacity: 0.45; cursor: not-allowed; }
.dj-best { font-size: 0.92rem; color: #555; margin-top: 8px; }
@media (max-width: 560px) { .dj-howto { grid-template-columns: 1fr; justify-items: center; } }

/* 遊んでいる間：画面いっぱいに固定してページを流さない */
.dj-play {
  position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column;
  background: #203040; color: #fff; overscroll-behavior: none;
}
.dj-play.is-on { display: flex; }
html.dj-locked, html.dj-locked body { overflow: hidden; }
.dj-hud { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #15212c; flex-wrap: nowrap; }
.dj-hud .t { font-family: "DotGothic16", sans-serif; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dj-hud .lv { background: var(--dj-yellow); color: #222; border-radius: 6px; padding: 1px 10px; font-family: "DotGothic16", sans-serif; white-space: nowrap; }
.dj-dots { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 0; }
.dj-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #8fb; display: block; }
.dj-dots i.on { background: #8fb; }
.dj-hud .hud-btn { background: #fff; color: #222; border: 2px solid #222; border-radius: 6px; padding: 3px 10px; font-size: 0.9rem; cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.dj-msg { padding: 6px 14px; font-weight: bold; font-size: 1.05rem; background: #2a3d50; min-height: 2.2em; display: flex; align-items: center; justify-content: center; text-align: center; }
.dj-msg.good { background: #1e6b4f; }
.dj-msg.bad { background: #7a3030; }
.dj-board {
  position: relative; flex: 1; margin: 10px; border: 3px solid var(--dj-yellow); border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, #1a252f 0%, #2a3a4a 100%);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none;
}
.dj-board.light { background: linear-gradient(180deg, #e8f6f1 0%, #d4ece3 100%); color: #222; }

/* 段クリア・結果 */
.dj-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,20,30,0.72); z-index: 20; }
.dj-overlay .box { background: #fff; color: #222; border: 4px solid #222; border-radius: 14px; padding: 22px 28px; text-align: center; box-shadow: 6px 6px 0 #000; max-width: 92%; }
.dj-overlay h2 { font-family: "DotGothic16", sans-serif; font-size: 2rem; margin: 0 0 6px; }
.dj-overlay .big { font-size: 1.25rem; margin: 4px 0 14px; }
.dj-overlay .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dj-medal { width: 84px; height: 84px; margin: 0 auto 6px; display: block; }

/* よく使う的 */
.dj-target { position: absolute; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #222; }
.dj-lamp { background: radial-gradient(circle at 35% 35%, #fff9c2, #ffd84a 55%, #c99a00); border: 3px solid #fff3a0; box-shadow: 0 0 18px rgba(255,216,74,0.8); }
.dj-lamp.off { background: #3b4b5b; border-color: #56697c; box-shadow: none; }
.dj-ring { position: absolute; border-radius: 50%; border: 4px dashed #8fb; }
.dj-btnt { background: radial-gradient(circle at 35% 35%, #bfe3ff, #3b82c4 60%, #1d4f80); border: 3px solid #fff; box-shadow: 0 4px 0 #0d2b47; }
.dj-btnt.red { background: radial-gradient(circle at 35% 35%, #ffd0d0, #d64545 60%, #7a1f1f); box-shadow: 0 4px 0 #4a1010; }
.dj-pop { position: absolute; pointer-events: none; font-weight: bold; font-family: "DotGothic16", sans-serif; color: #fff36a; text-shadow: 2px 2px 0 #000; animation: dj-pop 0.7s ease-out forwards; z-index: 15; }
@keyframes dj-pop { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -110%) scale(1.25); } }

/* デバッグ表示 */
.dj-debug { position: fixed; right: 6px; bottom: 6px; width: min(360px, 60vw); max-height: 40vh; overflow: auto; background: rgba(0,0,0,0.82); color: #9f9; font: 11px/1.35 monospace; padding: 6px; z-index: 300; border-radius: 6px; pointer-events: none; white-space: pre-wrap; }

/* 目次 */
.dj-index-hero { text-align: center; }
.dj-index-hero h1 { font-family: "DotGothic16", sans-serif; font-size: 2rem; margin: 4px 0; }
.dj-choose { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0 4px; }
.dj-choose a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; border: 3px solid #222; border-radius: 10px; background: #fff; text-decoration: none; color: #222; min-width: 150px; box-shadow: 3px 3px 0 #222; }
.dj-choose a[aria-current="page"] { background: #e3f7f1; border-color: var(--dj-green-d); }
.dj-choose svg { width: 64px; height: 44px; }
.dj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.dj-game-card { display: block; background: #fff; border: 3px solid #222; border-radius: 10px; padding: 12px 14px; text-decoration: none; color: #222; box-shadow: 3px 3px 0 #222; }
.dj-game-card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #222; }
.dj-game-card .no { font-family: "DotGothic16", sans-serif; color: var(--dj-green-d); font-size: 0.9rem; }
.dj-game-card h3 { margin: 2px 0 4px; font-size: 1.12rem; }
.dj-game-card p { margin: 0; font-size: 0.9rem; color: #444; }
.dj-game-card .stars { margin-top: 6px; letter-spacing: 2px; color: #c99a00; font-size: 1rem; }
.dj-section-title { font-family: "DotGothic16", sans-serif; font-size: 1.3rem; margin: 26px 0 10px; }
.dj-course-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.dj-note { font-size: 0.92rem; color: #444; }
.dj-teacher { background: #f3f8ff; border: 2px solid #9ab8d8; border-radius: 10px; padding: 12px 16px; font-size: 0.95rem; }
.dj-teacher code { background: #fff; padding: 1px 6px; border-radius: 4px; border: 1px solid #ccd; word-break: break-all; }

/* 修了証 */
.dj-cert { background: #fffdf3; border: 6px double #c99a00; border-radius: 12px; padding: 24px; text-align: center; }
.dj-cert h2 { font-family: "DotGothic16", sans-serif; font-size: 1.8rem; margin: 6px 0; }
.dj-cert ul { list-style: none; padding: 0; margin: 14px auto; max-width: 520px; text-align: left; }
.dj-cert li { display: flex; justify-content: space-between; border-bottom: 1px dashed #ccc; padding: 4px 2px; }
@media print {
  header, footer, .dj-noprint, .dj-banner { display: none !important; }
  body { background: #fff; }
}

/* 下の説明 */
.dj-info { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.dj-info .dj-card h2 { font-size: 1.1rem; margin: 0 0 6px; }
.dj-breadcrumb { font-size: 0.85rem; margin: 6px 0 12px; }
