/* 画面のしあげ：画面の切りかえ・タイトル・ホーム（ゲーム選択）・ゲーム詳細シート・設定・動きを減らす設定
   基本の部品（ボタン・チップ・ランクのバッジ）は css/style.css */

/* ===================== 画面の切りかえ（スライド＋フェード） ===================== */
/* 二重写しにしない：出ていく画面は最初の120msで消し、入ってくる画面は60ms待ってから 16px すべりこむ（合わせて K.SCREEN_MS 以内） */
.screen.scr-in { animation: scr-in .18s .06s cubic-bezier(.2, .8, .3, 1) both; z-index: 2; }
.screen.scr-out { animation: scr-out .12s ease-in both; z-index: 1; pointer-events: none; }
.screen.scr-in.scr-back { animation-name: scr-in-back; }
.screen.scr-out.scr-back { animation-name: scr-out-back; }
@keyframes scr-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes scr-out { to { opacity: 0; transform: translateX(-8px); } }
@keyframes scr-in-back { from { opacity: 0; transform: translateX(-16px); } }
@keyframes scr-out-back { to { opacity: 0; transform: translateX(8px); } }

/* ===================== タイトル ===================== */
.title-screen {
  cursor: pointer;
  background: radial-gradient(120% 70% at 50% 34%, rgba(255, 253, 246, .95) 0%, rgba(255, 253, 246, 0) 70%);
}
.title-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.title-main {
  position: absolute; left: 0; right: 0; top: max(17%, calc(var(--safe-t) + 60px));
  display: flex; flex-direction: column; align-items: center; padding: 0 20px; pointer-events: none;
}
.title-logo { width: 100%; max-width: 340px; min-height: 120px; }
.title-catch {
  margin: 12px 0 0; font-weight: 900; font-size: 18px; background: var(--ink); color: #fff; padding: 6px 18px; border-radius: 999px;
  transform: rotate(-2deg); box-shadow: 0 4px 0 rgba(31, 42, 68, .25); animation: catch-in .45s 1.35s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes catch-in { from { transform: rotate(-2deg) scale(.3); opacity: 0; } }
.title-foot {
  position: absolute; left: 0; right: 0; bottom: max(26px, calc(var(--safe-b) + 14px));
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 16px;
}
.title-load { width: min(250px, 72%); }
.tl-bar { height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; box-shadow: 0 3px 0 var(--ink); }
.tl-bar i {
  display: block; height: 100%; width: 100%; transform-origin: left center; transform: scaleX(.02); transition: transform .35s ease-out;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 8px, #ffe98a 8px 16px);
}
.tl-text { text-align: center; font-size: 12px; font-weight: 800; color: var(--ink2); margin-top: 8px; min-height: 1.3em; }
.title-load.done { display: none; }
.title-start {
  font: 900 22px/1.2 var(--font); color: #fff; background-color: var(--primary); border: 3px solid var(--ink); border-radius: 999px;
  min-height: 60px; padding: 12px 32px; cursor: pointer; text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  background-image: repeating-linear-gradient(-28deg, rgba(255, 255, 255, .08) 0 3px, transparent 3px 8px);
  box-shadow: 0 5px 0 var(--ink), inset 0 -5px 0 rgba(0, 0, 0, .12), inset 0 3px 0 rgba(255, 255, 255, .4);
  animation: start-in .4s cubic-bezier(.2, 1.5, .4, 1) both, start-pulse 1.5s .4s ease-in-out infinite;
}
.title-start:active { transform: translateY(5px); box-shadow: none; }
/* 挑戦リンクで開いたとき：「🎁 ともだちから とどいてるよ！」の札（ボタンは「うけとる！」） */
.title-gift {
  font-weight: 900; font-size: 16px; color: var(--ink); background: #fff; border: 3px dashed var(--primary); border-radius: 14px;
  padding: 6px 14px; transform: rotate(-2deg); box-shadow: 0 4px 0 rgba(31, 42, 68, .18); white-space: nowrap;
  animation: gift-in .45s cubic-bezier(.2, 1.5, .4, 1) both, gift-bob 1.4s .45s ease-in-out infinite alternate;
}
@keyframes gift-in { from { transform: rotate(-2deg) scale(.3); opacity: 0; } }
@keyframes gift-bob { to { transform: rotate(1deg) translateY(-3px); } }
@keyframes start-in { from { transform: scale(.4); opacity: 0; } }
@keyframes start-pulse { 50% { transform: scale(1.06); } }
.title-ver { font-size: 11px; color: var(--ink3); font-weight: 800; }
/* ことばの切りかえ（右上）。いま選んでいる方を塗る */
.title-lang {
  position: absolute; z-index: 3; top: max(12px, calc(var(--safe-t) + 6px)); right: 12px;
  display: flex; gap: 0; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; box-shadow: 0 3px 0 var(--ink);
}
.tl-lang { font: 900 13px/1 var(--font); color: var(--ink); background: #fff; border: 0; padding: 9px 12px; min-height: 36px; cursor: pointer; }
.tl-lang + .tl-lang { border-left: 2px solid var(--ink); }
.tl-lang.on { background: var(--ink); color: #fff; }
/* 英語のときだけ、ロゴの下に英語の名前 */
.title-en { margin: 2px 0 0; font: 900 15px/1 var(--font); letter-spacing: .14em; color: var(--ink); }

/* ===================== ホーム ===================== */
.home-body { padding: 0 0 max(18px, var(--safe-b)); gap: 0; align-items: stretch; }
.home-top {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px;
  padding: max(8px, var(--safe-t)) 16px 10px;
  background: linear-gradient(var(--bg) 72%, rgba(246, 243, 234, 0));
}
.home-logo { flex: 0 1 136px; min-width: 0; min-height: 28px; }
.medal-pill {
  position: relative; margin-left: auto; min-width: 0; flex: 0 1 auto; display: flex; align-items: center; gap: 6px; overflow: hidden;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 3px 12px 5px 4px; box-shadow: 0 3px 0 var(--ink);
}
.mp-ic { flex: none; width: 32px; height: 32px; display: grid; place-items: center; font-size: 19px; background: var(--cream); border: 2px solid var(--ink); border-radius: 50%; }
.mp-txt { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.mp-num { font-weight: 900; font-size: 15px; white-space: nowrap; }
.mp-title { font-size: 12px; font-weight: 900; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(31, 42, 68, .08); }
.mp-bar i { display: block; height: 100%; width: calc(var(--prog, 0) * 100%); background: var(--yellow); border-radius: 0 4px 4px 0; }

/* ヒーロー：自分のキャラが紙の台の上でくるくる */
.hero {
  --el: #e53935;
  position: relative; margin: 2px 16px 0; padding-bottom: 12px;
  border: 3px solid var(--ink); border-radius: 24px;
  background: radial-gradient(130% 95% at 50% 26%, #ffffff 0%, #fffaf0 40%, #fde8b8 100%);
  background: radial-gradient(130% 95% at 50% 26%, #ffffff 0%, color-mix(in srgb, var(--el) 9%, #fffaf0) 45%, color-mix(in srgb, var(--el) 26%, #fde8b8) 100%);
  box-shadow: 0 5px 0 var(--ink), var(--soft);
}
/* マスキングテープ */
.hero::before {
  content: ''; position: absolute; top: -11px; left: 50%; width: 84px; height: 20px; margin-left: -42px; z-index: 3;
  background: rgba(253, 216, 53, .72); border: 1.5px solid rgba(31, 42, 68, .16); transform: rotate(-3deg); pointer-events: none;
}
.hero-stage { position: relative; height: clamp(176px, 30vh, 250px); border-radius: 21px 21px 0 0; overflow: hidden; }
.hero-plate { position: relative; margin: -14px 14px 0; text-align: center; z-index: 2; pointer-events: none; }
.hp-name {
  display: inline-block; max-width: 100%; font-size: 22px; font-weight: 900; line-height: 1.25;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 3px 18px; transform: rotate(-2deg);
  box-shadow: 0 4px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hp-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 9px; }
/* 能力：絵文字＋数字の下に短い名前（タッチ端末では title が出ないので） */
.hp-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.hp-stats .ms { display: inline-flex; flex-direction: column; align-items: center; min-width: 42px; line-height: 1.1; white-space: nowrap; }
.hp-stats .ms-v { display: inline-flex; align-items: center; gap: 1px; font-size: 13px; }
.hp-stats .ms i { font-style: normal; font-size: 12px; }
.hp-stats .ms b { color: var(--c); font-weight: 900; }
.hp-stats .ms small { font-size: 12px; font-weight: 800; color: var(--ink2); letter-spacing: -.04em; }
.hero-btn {
  position: absolute; top: 12px; z-index: 3; width: 58px; height: 58px; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 18px; font: 900 12px/1.1 var(--font);
  box-shadow: 0 4px 0 var(--ink), inset 0 -4px 0 rgba(0, 0, 0, .07); transition: transform .07s, box-shadow .07s;
}
.hero-btn i { font-style: normal; font-size: 22px; line-height: 1.1; }
.hero-btn:active { transform: translateY(4px); box-shadow: none; }
.hero-btn.hb-left { left: 10px; transform: rotate(-4deg); }
.hero-btn.hb-right { right: 10px; transform: rotate(4deg); background: var(--yellow); }
.hero-btn.hb-left:active { transform: rotate(-4deg) translateY(4px); }
.hero-btn.hb-right:active { transform: rotate(4deg) translateY(4px); }

/* 背の低い画面：ヒーローを小さくして、おすすめのカードまで1画面に入れる */
@media (max-height: 700px) {
  .hero { padding-bottom: 8px; }
  /* 3Dの枠を広くして、名前プレートと属性チップは枠の下の1行に（台・足もとにかぶせない） */
  .hero-stage { height: 134px; }
  .hero-plate { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 2px; }
  .hp-name { flex: 0 1 auto; min-width: 0; font-size: 18px; padding: 1px 12px; box-shadow: 0 3px 0 var(--ink); }
  .hp-chips { flex: none; margin-top: 0; flex-wrap: nowrap; }
  .hp-chips .type-chip, .hp-chips .friend-chip { display: none; }
  .hp-stats { display: none; }
  .hero-btn { width: 50px; height: 50px; top: 8px; border-radius: 16px; }
  .hero-btn i { font-size: 19px; }
  .banners { margin-top: 12px; }
  .sec-title { margin-top: 12px; font-size: 17px; }
  .carousel { padding-top: 8px; }
}
@media (max-width: 380px) {
  .home-top { gap: 6px; }
  /* 称号（12px）が切れないよう、ロゴを少し小さく */
  .home-logo { flex-basis: 104px; }
  .mp-num { font-size: 14px; }
  .mp-title { letter-spacing: -.03em; }
  .medal-pill { padding-right: 10px; }
}

/* バナー（挑戦・届いたキャラ・今週のお題・お試し版） */
/* 上のバナーは1枚だけ（main.js updBanners）。お試し版の案内はおすすめの下（.after-reco） */
.banners { display: flex; flex-direction: column; gap: 8px; margin: 14px 16px 0; }
.banners:not(:has(> :not([hidden]))) { display: none; }
.banners.after-reco { margin-top: 4px; }
/* 挑戦のバナー：左にアイコン、まん中に「○○からの ちょうせん」と目標、右に「ちょうせん！」だけ。✕ は左上の角 */
.chal-banner {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 64px;
  background: #fff; border: 3px solid var(--primary); border-radius: 16px; padding: 6px 8px; box-shadow: 0 4px 0 var(--ink);
  background-image: linear-gradient(90deg, #ffebee 0 46px, transparent 46px);
}
.chal-banner.done { border-color: #43a047; background-image: linear-gradient(90deg, #e8f5e9 0 46px, transparent 46px); }
.chal-banner.gift { border-color: #f06292; background-image: linear-gradient(90deg, #fce4ec 0 46px, transparent 46px); }
.chal-banner .cb-ic { flex: none; width: 32px; text-align: center; font-size: 23px; }
.chal-banner.both .cb-ic { display: none; }
/* 挑戦と🎁の両方：左のアイコンのかわりに小さい🎁（文字の横） */
.chal-banner .cb-look {
  flex: none; position: relative; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; font-size: 17px; cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: 50%; background: var(--cream); box-shadow: 0 2px 0 var(--ink);
}
.chal-banner .cb-look::after { content: ''; position: absolute; inset: -5px; }
.chal-banner .cb-look:active { transform: translateY(2px); box-shadow: none; }
.chal-banner #btn-chal-go { padding-left: 11px; padding-right: 11px; font-size: 13px; }
.chal-banner .cb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.chal-banner .cb-from { font-size: 11px; letter-spacing: -.02em; font-weight: 900; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chal-banner.done .cb-from { color: #2e7d32; }
.chal-banner.gift .cb-from { color: #c2185b; }
.chal-banner .cb-text b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; font-weight: 900; word-break: keep-all; overflow-wrap: anywhere; }
.chal-banner .btn { flex-shrink: 0; }
/* ✕：左上の角（ちょうせん！から離す）。押しても3秒は「もどす」で取り消せる */
.chal-banner .cb-x {
  position: absolute; top: -11px; left: -9px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); background: #fff;
  padding: 0; font-size: 11px; font-weight: 900; cursor: pointer; box-shadow: 0 2px 0 var(--ink); display: grid; place-items: center;
}
.chal-banner .cb-x::after { content: ''; position: absolute; inset: -8px; }
.theme-banner, .demo-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; text-align: left; cursor: pointer;
  border: 2.5px solid var(--ink); border-radius: 6px 16px 16px 6px; padding: 6px 12px 6px 10px; box-shadow: 0 3px 0 var(--ink);
  font: 800 12px/1.3 var(--font); transition: transform .07s, box-shadow .07s;
}
.theme-banner { background: var(--cream); transform: rotate(-.6deg); }
.theme-banner.on { background: #ffd54f; }
.theme-banner:active, .demo-banner:active { transform: translateY(3px); box-shadow: none; }
.tb-ic, .db-ic { flex: none; font-size: 24px; line-height: 1; }
.tb-body, .db-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-lab { font-size: 12px; font-weight: 900; color: var(--primary); }
.tb-text { font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-days { flex: none; font-size: 11px; font-weight: 800; color: var(--ink2); white-space: nowrap; }
.tb-go, .db-go { flex: none; font-weight: 900; font-size: 13px; color: #fff; background: var(--ink); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.demo-banner { background: #fffbe6; border-style: dashed; }
.db-lab { font-size: 11px; color: var(--ink2); }
.demo-banner b { color: var(--primary); font-size: 13px; }

/* 見出し（マーカーを引いたような） */
.sec-title { margin: 18px 16px 4px; font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.sec-title span { display: inline-block; padding: 0 6px; transform: rotate(-1.5deg); background: linear-gradient(transparent 58%, #ffe082 58%, #ffe082 92%, transparent 92%); }

/* おすすめ：大きいカードの横スクロール（真ん中のカードの絵が動く） */
.carousel {
  display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  padding: 10px calc(50% - 124px) 16px; scrollbar-width: none; overscroll-behavior-x: contain;
}
.carousel::-webkit-scrollbar, .shelf-row::-webkit-scrollbar { display: none; }
/* 横スクロールの列の入れ物。マウス（PC）のときだけ左右の矢印を出し、ドラッグでも動かせる（js/ui/home.js の hscroll）。
   タッチの端末は指で横に動かせるので矢印は出さない */
.hscroll { position: relative; }
.hs-arrow { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hs-arrow {
    display: grid; place-items: center; position: absolute; top: 50%; z-index: 3; width: 40px; height: 40px; margin-top: -22px; padding: 0 0 3px;
    font: 900 28px/1 var(--font); color: var(--ink); background: #fff; border: 2.5px solid var(--ink); border-radius: 50%;
    box-shadow: 0 3px 0 var(--ink); cursor: pointer; transition: opacity .15s, transform .12s;
  }
  .hs-arrow:hover { background: var(--cream); }
  .hs-arrow:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
  .hs-prev { left: 6px; }
  .hs-next { right: 6px; }
  .hs-arrow.off { opacity: 0; pointer-events: none; }
  .carousel, .shelf-row { cursor: grab; }
  .carousel.dragging, .shelf-row.dragging { cursor: grabbing; scroll-snap-type: none; }
}

/* カテゴリの棚 */
.shelf { margin-top: 12px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 16px 2px; }
.shelf-title {
  margin: 0; font-size: 15px; font-weight: 900; color: #fff; background: var(--cat); border: 2.5px solid var(--ink);
  border-radius: 10px 10px 10px 3px; padding: 3px 14px; transform: rotate(-2deg); box-shadow: 0 3px 0 var(--ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .22); white-space: nowrap;
}
.shelf-medals { font-size: 12px; font-weight: 800; color: var(--ink2); white-space: nowrap; }
.shelf-row {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 10px 16px 14px;
  scroll-snap-type: x proximity; scroll-padding: 0 16px; scrollbar-width: none; overscroll-behavior-x: contain;
}
.home-foot { margin: 18px 0 0; text-align: center; font-size: 11px; font-weight: 800; color: var(--ink3); }

/* ゲームのカード：キーアート＋ゲーム名＋適性ランク＋メダル */
.gcard {
  --tilt: 0deg;
  position: relative; flex: none; display: flex; flex-direction: column; padding: 0; margin: 0; text-align: left; cursor: pointer;
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 0 var(--ink); font: inherit; color: inherit;
  transform: rotate(var(--tilt)); transition: transform .12s cubic-bezier(.2, 1.4, .4, 1), box-shadow .12s;
  animation: card-in .38s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--i, 0) * 45ms);
  touch-action: manipulation;
}
.gcard:nth-child(odd) { --tilt: -.8deg; }
.gcard:nth-child(even) { --tilt: .8deg; }
.gcard:active { transform: rotate(var(--tilt)) translateY(3px) scale(.97); box-shadow: 0 1px 0 var(--ink); }
@keyframes card-in { from { opacity: 0; transform: rotate(var(--tilt)) translateY(14px) scale(.94); } }
.gcard-reco { width: 248px; scroll-snap-align: center; }
.gcard-shelf { width: 152px; scroll-snap-align: start; }
.gc-art { position: relative; display: block; border-bottom: 3px solid var(--ink); background: var(--paper); }
/* 絵を描くまでの台紙（カテゴリの色の方眼） */
.gc-art::before {
  content: ''; position: absolute; inset: 0;
  background-color: color-mix(in srgb, var(--cat) 12%, #fffdf6);
  background-image: linear-gradient(rgba(31, 42, 68, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(31, 42, 68, .06) 1px, transparent 1px);
  background-size: 14px 14px;
}
.gc-cv { position: relative; display: block; width: 100%; height: auto; opacity: 0; transition: opacity .25s; }
.gcard.ready .gc-cv { opacity: 1; }
.gc-info { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; padding: 6px 10px 8px; background: linear-gradient(90deg, var(--cat) 0 5px, #fff 5px); padding-left: 13px; }
.gc-name {
  font-size: 14px; font-weight: 900; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: keep-all; overflow-wrap: anywhere;
}
.gc-name.long { font-size: 12.5px; letter-spacing: -.02em; }
.gcard-reco .gc-name { font-size: 17px; min-height: 0; -webkit-line-clamp: 1; }
.gcard-reco .gc-name.long { font-size: 16px; }
.gcard-reco .gc-medals { padding-right: 110px; min-height: 20px; align-items: center; }
/* メダル：下にそろえる。とったものは絵文字、とっていないものは輪郭だけ */
.gc-medals { display: flex; align-items: center; gap: 3px; margin-top: auto; font-size: 16px; line-height: 1; min-height: 18px; }
.gc-medals .gm { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.gc-medals .gm:not(.on) { font-size: 0; border: 2.5px dashed #c77b3a; border-radius: 50%; opacity: .55; width: 15px; height: 15px; margin: 0 1.5px; }
/* とっていないメダルの輪郭も どう・ぎん・きんの色 */
.gc-medals .gm:nth-child(2):not(.on) { border-color: #9aa7b8; }
.gc-medals .gm:nth-child(3):not(.on) { border-color: #f2b705; }
.gc-cat { position: absolute; right: 10px; bottom: 8px; font-size: 11px; font-weight: 900; color: #fff; background: var(--cat); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.gcard-reco .rank-badge { width: 40px; height: 40px; font-size: 22px; top: 8px; left: 8px; }
/* お試し版の鍵 */
.gcard.locked .gc-cv { filter: grayscale(.85) contrast(.85) brightness(1.06); }
.gc-lock {
  position: absolute; left: 50%; top: 46%; z-index: 2; transform: translate(-50%, -50%); width: 42px; height: 42px;
  display: grid; place-items: center; font-size: 22px; background: #fff; border: 2.5px solid var(--ink); border-radius: 50%; box-shadow: 0 3px 0 var(--ink);
}
.gc-lock-lab {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; text-align: center; font-size: 11px; font-weight: 900; color: #fff;
  background: rgba(31, 42, 68, .86); padding: 3px 4px; white-space: nowrap;
}
.gcard.locked .gc-name { color: var(--ink2); }
/* WebGL が使えない端末の3Dゲーム */
.gcard.nogl .gc-lock-lab { font-size: 10px; letter-spacing: -.03em; }
/* 挑戦中 */
.gc-chal {
  position: absolute; top: 8px; right: -4px; z-index: 2; font-size: 11px; font-weight: 900; color: #fff; background: var(--primary);
  border: 2px solid var(--ink); border-radius: 6px 0 0 6px; padding: 2px 8px 2px 6px; box-shadow: 0 2px 0 var(--ink); white-space: nowrap;
}
.gcard.chal { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px #ffcdd2; }

/* ===================== ゲーム詳細シート ===================== */
.sheet-root { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(31, 42, 68, .52); opacity: 0; transition: opacity .25s; }
.sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet {
  position: relative; display: flex; flex-direction: column; max-height: calc(100% - max(20px, var(--safe-t)));
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 22px, rgba(229, 57, 53, .22) 22px, rgba(229, 57, 53, .22) 24px, transparent 24px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 22px 22px, 22px 22px;
  border: 3px solid var(--ink); border-bottom: 0; border-radius: 26px 26px 0 0;
  box-shadow: 0 -6px 0 rgba(31, 42, 68, .14);
  transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .9, .3, 1.04);
}
.sheet-root.open .sheet { transform: none; }
.sheet-root { --cat: #90a4ae; }
.sheet-grab { flex: none; height: 26px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.sheet-grip { width: 48px; height: 5px; border-radius: 999px; background: var(--ink); opacity: .35; }
.sheet-x {
  position: absolute; top: 8px; right: 10px; z-index: 3; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; box-shadow: 0 3px 0 var(--ink); font: 900 17px/1 var(--font); cursor: pointer;
}
.sheet-x:active { transform: translateY(3px); box-shadow: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 14px 30px; scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-art {
  position: relative; margin: 8px 40px 0 0; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden;
  box-shadow: 0 5px 0 var(--ink); transform: rotate(-1deg); background: #fff; touch-action: none;
}
.sheet-art canvas { display: block; width: 100%; height: auto; }
.sheet-art .rank-badge.big { width: 52px; height: 52px; font-size: 29px; top: 8px; left: 8px; }
.sheet-cat { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.sc-cat { font-size: 12px; font-weight: 900; color: #fff; background: var(--cat); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; text-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.sc-no { font-size: 12px; font-weight: 900; color: var(--ink2); }
.sheet-name { margin: 4px 0 2px; font-size: 26px; line-height: 1.25; transform: rotate(-1deg); transform-origin: left; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
.sheet-aff { margin: 2px 0 0; font-size: 14px; font-weight: 800; }
.sheet-aff b { color: var(--primary); }
.sheet-chal { margin-top: 10px; font-size: 14px; font-weight: 900; color: var(--primary); background: var(--cream); border: 2.5px dashed var(--primary); border-radius: 12px; padding: 7px 10px; }
.sheet-chal small { display: block; font-size: 11px; color: var(--ink2); }
.sheet-box { margin-top: 10px; background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; padding: 10px 12px; box-shadow: 0 3px 0 var(--ink); }
.sheet-box h3 { margin: 0 0 6px; font-size: 12px; font-weight: 900; color: var(--ink2); letter-spacing: .04em; }
.sheet-box .howto { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-weight: 800; line-height: 1.5; font-size: 14px; counter-reset: how; }
.sheet-box .howto li { position: relative; padding-left: 24px; }
.sheet-box .howto li::before {
  counter-increment: how; content: counter(how); position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--cat); color: #fff; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center; border: 1.5px solid var(--ink);
}
.sheet-box .hint { margin: 6px 0 0; font-size: 13px; font-weight: 800; color: var(--ink2); }
.uses { list-style: none; margin: 0; padding: 0; }
.uses li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1.5px dashed var(--line); font-weight: 800; font-size: 14px; }
.uses li:last-child { border-bottom: 0; }
.uses .u-lab { min-width: 0; }
.uses .u-lab small { margin-left: 4px; font-size: 11px; color: var(--ink2); white-space: nowrap; }
.uses .stars, .stars { flex: none; color: #f9a825; letter-spacing: 1px; font-size: 15px; white-space: nowrap; }
.sheet-best { font-size: 14px; font-weight: 800; }
.sheet-best b { font-size: 18px; font-weight: 900; }
.sb-plays { font-size: 11px; color: var(--ink2); margin-left: 4px; }
.medal-goals { display: flex; gap: 6px; margin-top: 8px; }
/* メダルの目標：とっていないものも、どう・ぎん・きんの色のふち（うすめ）と名前で見分けられるように */
.goal {
  --mc: #c77b3a;
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0;
  border: 2.5px dashed color-mix(in srgb, var(--mc) 55%, transparent); border-radius: 12px; padding: 5px 2px; background: #fff;
  font-size: 12px; font-weight: 900;
}
.goal.m2 { --mc: #9aa7b8; }
.goal.m3 { --mc: #f2b705; }
.goal i { font-style: normal; font-size: 22px; line-height: 1.1; filter: grayscale(.5) opacity(.6); }
.goal .g-lab { font-size: 11px; font-weight: 900; line-height: 1.2; color: color-mix(in srgb, var(--mc) 80%, var(--ink)); }
.goal.got { background: var(--cream); border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink), inset 0 0 0 2px var(--mc); }
.goal.got i { filter: none; }
.sheet-foot { flex: none; padding: 10px 16px max(12px, var(--safe-b)); border-top: 2px dashed var(--line); background: rgba(251, 250, 245, .96); }
.sheet-foot .sheet-online { margin-top: 8px; --b: #e3f2fd; }
#sheet-play { min-height: 60px; font-size: 22px; }
#sheet-play.locked { --b: var(--ink); font-size: 17px; }
@media (max-height: 700px) {
  .sheet-art { margin-right: 46px; }
  .sheet-box { padding: 8px 10px; }
  .sheet-name { font-size: 22px; }
  #sheet-play { min-height: 54px; font-size: 20px; }
}

/* ===================== 設定 ===================== */
.set-top { padding: max(8px, var(--safe-t)) 16px 0; }
.set-body { gap: 12px; padding-top: 10px; padding-bottom: max(18px, calc(var(--safe-b) + 8px)); }
.set-body > * { width: 100%; max-width: 420px; }
.set-card { background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 12px 14px 14px; box-shadow: 0 4px 0 var(--ink); display: flex; flex-direction: column; gap: 8px; }
.set-title { margin: 0 0 2px; font-size: 16px; font-weight: 900; }
.set-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.set-row.off { opacity: .6; }
.set-lab { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-lab b { font-size: 15px; font-weight: 900; }
.set-lab small { font-size: 13px; font-weight: 700; line-height: 1.4; color: var(--ink2); }
.set-note { font-size: 13px; color: var(--ink2); background: #f6f8fb; border-radius: 10px; padding: 6px 10px; }
.set-parent { border-style: dashed; background: #fbfcff; }
.switch {
  position: relative; flex: none; width: 58px; height: 34px; padding: 0; border: 2.5px solid var(--ink); border-radius: 999px;
  background: #dfe3ea; cursor: pointer; transition: background .15s; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .08);
}
.switch::before { content: ''; position: absolute; inset: -6px -2px; }
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 25px; height: 25px; border-radius: 50%; background: #fff;
  border: 2.5px solid var(--ink); box-sizing: border-box; transition: transform .15s cubic-bezier(.2, 1.4, .4, 1); box-shadow: 0 2px 0 rgba(31, 42, 68, .3);
}
.switch.on { background: #43a047; }
.switch.on::after { transform: translateX(24px); }
.switch:disabled { opacity: .45; cursor: default; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; cursor: pointer; }
.slider::-webkit-slider-runnable-track {
  height: 12px; border-radius: 999px; border: 2px solid var(--ink);
  background: linear-gradient(90deg, var(--yellow) 0 var(--v, 50%), #fff var(--v, 50%));
}
.slider::-moz-range-track { height: 8px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; }
.slider::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--yellow); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); }
.slider:disabled { opacity: .4; }
.set-seg { max-width: none; }
.set-seg button { min-height: 40px; }
.set-details summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 44px;
  font-weight: 900; font-size: 14px; border-top: 1.5px dashed var(--line); padding: 4px 0;
}
.set-card > .set-details:first-of-type summary { border-top: 0; }
.set-details summary::-webkit-details-marker { display: none; }
.set-details summary::after { content: '＋'; font-weight: 900; }
.set-details[open] summary::after { content: '－'; }
.set-how { display: flex; flex-direction: column; gap: 6px; padding-bottom: 4px; }
.set-p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.6; }
.set-table { list-style: none; margin: 2px 0; padding: 0; display: grid; gap: 4px; }
.set-table li { display: flex; gap: 8px; font-size: 13px; font-weight: 800; background: #f6f8fb; border-radius: 8px; padding: 6px 8px; }
.set-table li b { flex: none; width: 7.5em; }
.set-lic { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.lic-name { font-weight: 900; }
.lic-copy { font-size: 13px; color: var(--ink2); }
.lic-text {
  margin: 0; max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 600 10.5px/1.5 ui-monospace, Menlo, Consolas, monospace;
  background: #f6f8fb; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px; color: var(--ink2);
  -webkit-user-select: text; user-select: text;
}
.set-ver { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 12px; font-weight: 800; color: var(--ink2); }
.set-ver b { font-size: 14px; color: var(--ink); }

/* ===================== 動きを減らす（設定 reduceMotion。端末の設定は audio.js が data 属性にする） ===================== */
[data-reduce-motion="1"] *, [data-reduce-motion="1"] *::before, [data-reduce-motion="1"] *::after {
  animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  .title-start, .btn.share-cta.hype, .title-gift, .char-list.editing .char-item { animation: none; }
}

/* ===================== 確認ダイアログ・保護者ゲート・取り消せるひとこと（js/ui/kit.js・gate.js） ===================== */
.rg-dlg {
  position: absolute; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px;
  padding-top: max(16px, var(--safe-t)); padding-bottom: max(16px, var(--safe-b));
  background: rgba(31, 42, 68, .55); animation: dlg-fade .16s ease-out;
}
.rg-dlg.out { opacity: 0; transition: opacity .14s; pointer-events: none; }
@keyframes dlg-fade { from { opacity: 0; } }
.rg-dlg-card {
  position: relative; width: 100%; max-width: 330px; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 18px 16px 16px; box-shadow: 0 6px 0 var(--ink);
  text-align: center; animation: pop2 .2s cubic-bezier(.2, 1.4, .4, 1);
}
.rd-ic { font-size: 40px; line-height: 1; }
.rd-art { width: 112px; height: 112px; display: grid; place-items: center; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink); transform: rotate(-3deg); overflow: hidden; }
.rd-art img, .rd-art canvas { width: 92%; height: 92%; object-fit: contain; }
.rd-title { margin: 0; font-size: 20px; line-height: 1.35; transform: rotate(-1deg); word-break: keep-all; overflow-wrap: anywhere; }
.rd-text { margin: 0; font-size: 14px; font-weight: 800; color: var(--ink2); line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.rd-btns { display: flex; gap: 10px; width: 100%; margin-top: 4px; }
.rd-btns .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; font-size: 15px; white-space: normal; line-height: 1.2; }
/* 保護者ゲート：おとな向けの文（漢字のまま）＋漢数字の計算＋数字ボタン */
.gate-card { max-width: 340px; gap: 8px; padding-top: 14px; }
.gate-card.shake { animation: shake .36s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
/* カードは中身が多いとスクロールするので、リボンははみ出させずに流れの中へ */
.gate-ribbon {
  transform: rotate(-2deg); white-space: nowrap;
  font-size: 14px; font-weight: 900; color: #fff; background: var(--ink); border: 2.5px solid #fff; border-radius: 999px; padding: 4px 14px; box-shadow: 0 3px 0 rgba(31, 42, 68, .3);
}
.gate-title { margin: 0; font-size: 18px; }
.gate-lead { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink2); line-height: 1.55; text-align: left; }
.gate-q { font-size: 22px; font-weight: 900; letter-spacing: .02em; background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 6px 14px; width: 100%; }
.gate-out { min-width: 110px; padding: 0 12px; min-height: 44px; font-size: 28px; font-weight: 900; line-height: 40px; border-bottom: 3px dashed var(--ink); letter-spacing: .12em; }
.gate-out.empty { color: var(--ink3); }
.gate-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: 100%; }
.gate-key {
  min-height: 46px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; font: 900 20px/1 var(--font); color: var(--ink); cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); touch-action: manipulation;
}
.gate-key:active { transform: translateY(3px); box-shadow: none; }
.gate-key.del { font-size: 14px; background: #f1f4f9; }
.gate-key.ok {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--primary); color: #fff; font-size: 18px; -webkit-touch-callout: none;
}
.gate-key.ok .gk-ok { position: relative; z-index: 1; line-height: 1; }
.gate-key.ok .gk-hold { position: relative; z-index: 1; font-size: 10px; font-weight: 900; line-height: 1; opacity: .9; }
/* 長押しのあいだ、下から黄色がたまる（HOLD_MS と同じ長さ） */
.gate-key.ok::before {
  content: ''; position: absolute; inset: 0; background: rgba(253, 216, 53, .9); transform-origin: left center; transform: scaleX(0);
}
.gate-key.ok.holding::before { transform: scaleX(1); transition: transform .9s linear; }
.gate-key.ok.holding .gk-ok, .gate-key.ok.holding .gk-hold { color: var(--ink); }
.gate-key.ok.hold-miss { animation: shake .3s ease-in-out; }
.gate-key.ok:disabled { opacity: .45; cursor: default; }
.gate-cancel { margin-top: 2px; }
@media (max-height: 640px) {
  .gate-card { gap: 6px; padding-top: 12px; }
  .gate-key { min-height: 42px; }
  .gate-lead { font-size: 12px; }
}
/* 取り消せるひとこと（「けしたよ［もどす］」） */
.ui-undo {
  position: absolute; left: 50%; bottom: max(24px, calc(var(--safe-b) + 14px)); z-index: 96; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); white-space: nowrap;
  background: var(--ink); color: #fff; font-weight: 900; font-size: 14px; border: 2.5px solid #fff; border-radius: 999px; padding: 6px 6px 6px 16px;
  box-shadow: 0 4px 0 rgba(31, 42, 68, .3); animation: undo-in .22s ease-out;
}
@keyframes undo-in { from { transform: translateX(-50%) translateY(20px); opacity: 0; } }
.ui-undo-btn { min-height: 36px; border: 2px solid #fff; border-radius: 999px; background: var(--yellow); color: var(--ink); font: 900 14px/1 var(--font); padding: 4px 14px; cursor: pointer; }

/* ===================== ネット対戦（js/ui/online.js） ===================== */
.online-card { align-items: center; text-align: center; gap: 10px; overflow-y: auto; }
/* 文は分かち書き（ことばの間の空白）でだけ改行する（「入るよ」の途中で折らない） */
.online-card p, .online-card .btn { word-break: keep-all; overflow-wrap: anywhere; }
.online-card .ol-game { font-weight: 900; font-size: 14px; color: var(--ink2); }
.online-card .ol-lead { margin: 0; font-weight: 800; font-size: 15px; line-height: 1.5; }
.online-card .ol-note { margin: 0; font-size: 12.5px; font-weight: 800; color: #b23a2e; line-height: 1.45; }
.online-card .ol-wait { margin: 0; font-weight: 800; color: var(--ink2); animation: olBlink 1.4s ease-in-out infinite; }
@keyframes olBlink { 50% { opacity: .45; } }
.ol-me { display: flex; align-items: center; gap: 10px; justify-content: center; }
.ol-me-name, .ol-name { font-weight: 900; font-size: 16px; max-width: 9em; overflow-wrap: anywhere; }
.ol-art { display: block; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; }
.ol-code { display: flex; gap: 8px; justify-content: center; margin: 4px 0; }
.ol-code span {
  display: grid; place-items: center; width: 58px; height: 72px; font: 900 44px/1 var(--font); background: #fff;
  border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
}
.ol-input span { font-size: 38px; }
.ol-input span.on { border-color: var(--primary); box-shadow: 0 4px 0 var(--primary); }
.ol-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 280px; }
.ol-key {
  min-height: 52px; font: 900 24px/1 var(--font); background: #fff; border: 2.5px solid var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink); cursor: pointer; color: var(--ink);
}
.ol-key:active { transform: translateY(3px); box-shadow: none; }
.ol-vs { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.ol-side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.ol-side.me .ol-name { color: #1e88e5; }
.ol-side.them .ol-name { color: #e53935; }
.ol-vs-mark { font: 900 28px/1 var(--font); color: var(--primary); transform: rotate(-8deg); }
.ol-vs.small .ol-name { font-size: 14px; }
.ol-score { display: flex; gap: 14px; align-items: center; justify-content: center; font: 900 52px/1 var(--font); }
.ol-score .me { color: #1e88e5; }
.ol-score .them { color: #e53935; }
.online-card.win h2 { color: var(--primary); }
.online-card .btn[disabled] { opacity: .55; }
