/* ラクガキパーティ：基本の見た目（色・ボタン・画面の枠・お絵描き・診断・プレイ・結果・モーダル）
   アートディレクション「らくがき帳 × ポップなおもちゃ箱」：方眼ノート・太いインク線・白フチのステッカー・ぷっくりしたクレヨン色
   タイトル・ホーム・詳細シート・設定・画面の切りかえは css/ui.css。共有シートは css/share.css */
:root {
  --ink: #1f2a44;
  --ink2: #5b6780;
  --ink3: #8b94a8;
  --paper: #fbfaf5;
  --bg: #f6f3ea;
  --grid: rgba(96, 128, 180, .15);
  --line: #d8d2c2;
  --primary: #e53935;
  --primary-d: #b71c1c;
  --accent: #1e88e5;
  --yellow: #fdd835;
  --cream: #fff3c4;
  --card: #ffffff;
  --radius: 16px;
  --soft: 0 10px 22px rgba(31, 42, 68, .12);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* フォントは css/fonts.css（同梱の "RG Rounded"）が html:root で上書きする。これは読み込めなかったときの予備 */
  --font: "RG Rounded", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #e4dfd2; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font); color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  /* 日本語の改行：禁則をきびしく、はみ出すときだけどこでも折る */
  line-break: strict; overflow-wrap: anywhere; -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; color: inherit; }
[hidden] { display: none !important; }
/* 数字＋単位・短い言葉は途中で折らない */
.nw { white-space: nowrap; }
/* 文のかたまり：文はわかち書き（空白区切り）で書いているので、空白のところで折る。
   auto-phrase はひらがなの単語を途中で切る（「ど/ひょうから」）ので使わない */
.howto, .hint, .comments li, .res-notes li, .sheet-aff, .set-p, .tp-hint, .intro-steps li, #sheet-howto li { word-break: keep-all; overflow-wrap: anywhere; }
/* わかち書き（ひらがなを空白で区切った文）：空白と記号のところでだけ折る。入りきらないときだけどこでも折る */
.lead, .lock-card h2, .lock-lead, .recv-card h2, .rc-ask, .res-chal, .res-best, .sheet-chal, .sheet-best, .chars-sub,
.set-lab small, .tp-tag, .chal-banner b, .rd-title, .rd-text { word-break: keep-all; overflow-wrap: anywhere; }

/* 横向きのスマホ（見える高さが低い）：縦のレイアウトなので、全面に「スマホを たてに してね」を出す（index.html の #rotate）。
   マウスの PC（pointer: fine）の横長の窓では出さない。プレイ中は main.js がポーズにする */
.rotate-ov { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-ov {
    position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px;
    background-color: var(--bg);
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
  }
  .rotate-card {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 26px; text-align: center;
    background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); transform: rotate(-1.5deg);
  }
  .rotate-ic { font-size: 54px; line-height: 1; animation: rotate-hint 2.4s ease-in-out infinite; }
  .rotate-card p { margin: 0; font-size: 20px; font-weight: 900; white-space: nowrap; }
}
@keyframes rotate-hint { 0%, 25% { transform: rotate(-90deg); } 55%, 100% { transform: rotate(0deg); } }

#app {
  position: relative; margin: 0 auto; width: 100%; max-width: 480px; height: 100%;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  box-shadow: 0 0 40px rgba(0, 0, 0, .14);
  overflow: hidden;
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
/* スクロールする中身（下にボタンの帯がある画面は .action-bar と組む） */
.scr-body {
  flex: 1 1 auto; min-height: 0; width: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: max(10px, var(--safe-t)) 16px 18px;
  scrollbar-width: none;
}
.scr-body::-webkit-scrollbar { display: none; }
.scr-body > * { flex-shrink: 0; }
/* 画面の下に固定するボタンの帯 */
.action-bar {
  flex: none; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 16px max(12px, var(--safe-b));
  background: linear-gradient(rgba(246, 243, 234, 0), var(--bg) 14px);
  position: relative; z-index: 2;
}
.action-bar > * { width: 100%; max-width: 400px; }

/* ---------- ボタン：ぷっくり厚みのあるクレヨン色（押すと沈む） ---------- */
.btn {
  --b: #fff; --t: var(--ink);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 20px;
  border: 3px solid var(--ink); border-radius: 999px; background-color: var(--b); color: var(--t);
  font: 800 16px/1.2 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 0 var(--ink), inset 0 -4px 0 rgba(0, 0, 0, .1), inset 0 3px 0 rgba(255, 255, 255, .5);
  transition: transform .07s, box-shadow .07s, filter .1s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink), inset 0 -2px 0 rgba(0, 0, 0, .1), inset 0 2px 0 rgba(255, 255, 255, .4); }
.btn.primary {
  --b: var(--primary); --t: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
  background-image: repeating-linear-gradient(-28deg, rgba(255, 255, 255, .07) 0 3px, transparent 3px 8px);
}
.btn.big { font-size: 20px; min-height: 56px; padding: 12px 24px; }
.btn.wide { width: 100%; }
.btn.small { font-size: 14px; min-height: 40px; padding: 6px 14px; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink), inset 0 -3px 0 rgba(0, 0, 0, .08); }
.btn.small:active { box-shadow: none; transform: translateY(3px); }
.btn.ghost { --b: rgba(255, 255, 255, .78); }
.btn.danger { --b: var(--primary); --t: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .gcard:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn-row { display: flex; gap: 10px; width: 100%; }
.btn-row .btn { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }
/* まるいアイコンボタン（44px） */
.icon-btn {
  flex: none; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; font: 900 20px/1 var(--font); cursor: pointer;
  box-shadow: 0 3px 0 var(--ink), inset 0 -3px 0 rgba(0, 0, 0, .08); transition: transform .07s, box-shadow .07s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }

/* チップ */
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 800; background: #f1f4f9; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.chip.el-chip { color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.chip.type-chip { background: #fff; }
.chip.friend-chip { background: #f06292; color: #fff; }

/* 適性ランクのバッジ（S/A/B/C） */
.rank-badge {
  position: absolute; z-index: 2; top: 6px; left: 6px; width: 34px; height: 34px; display: grid; place-items: center;
  border: 2.5px solid var(--ink); border-radius: 50%; color: #fff; font: 900 19px/1 var(--font);
  box-shadow: 0 2px 0 var(--ink); transform: rotate(-8deg); text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.rk-S { background: #e53935; box-shadow: 0 2px 0 var(--ink), 0 0 0 3px #fff3c4; }
.rk-A { background: #fb8c00; }
.rk-B { background: #1e88e5; }
.rk-C { background: #78909c; }

/* 上の帯（戻る・タイトル・ボタン） */
.topbar { width: 100%; flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 46px; position: relative; gap: 8px; }
.topbar-sp { width: 44px; flex: none; }
.topbar-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 150px; pointer-events: none; }
.screen-title { margin: 0; font-size: 21px; font-weight: 900; transform: rotate(-1.5deg); white-space: nowrap; }
.lead { margin: 0; text-align: center; font-weight: 900; font-size: 17px; line-height: 1.35; flex: none; }
.lead small { display: block; color: var(--ink2); font-weight: 700; font-size: 12px; }
/* お絵描き：受けとりを「あとで」にしたキャラ・挑戦をもう一度ひらくチップ */
.gift-chip {
  display: inline-flex; align-items: center; vertical-align: middle; margin: 0 0 2px 6px; min-height: 32px; padding: 2px 12px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: #fce4ec; font: 900 13px/1.1 var(--font); white-space: nowrap; cursor: pointer;
  box-shadow: 0 2px 0 var(--ink); transform: rotate(-2deg); position: relative;
}
.gift-chip::after { content: ''; position: absolute; inset: -6px -2px; }
.gift-chip:active { transform: rotate(-2deg) translateY(2px); box-shadow: none; }

/* ひとこと表示 */
.toast {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%); z-index: 95;
  background: var(--ink); color: #fff; font-weight: 900; padding: 9px 20px; border-radius: 999px; border: 2.5px solid #fff;
  box-shadow: 0 4px 0 rgba(31, 42, 68, .3); pointer-events: none !important; animation: pop .25s ease-out;
  white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }

/* ===================== お絵描き ===================== */
.draw-screen { padding: max(8px, var(--safe-t)) 16px max(12px, var(--safe-b)); gap: 8px; align-items: center; }
.draw-tools.top { width: 100%; max-width: 400px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; position: relative; }
.draw-tools.top .btn { flex-shrink: 0; }
.tool-btn { padding: 4px 11px !important; }
.canvas-box { flex: 1 1 auto; min-height: 140px; width: 100%; display: flex; align-items: center; justify-content: center; container-type: size; }
.canvas-wrap {
  position: relative; width: min(100%, 400px, 46vh); aspect-ratio: 1; flex: none;
  border: 3px solid var(--ink); border-radius: 14px; background: #fff;
  box-shadow: 0 5px 0 var(--ink), var(--soft);
}
@supports (width: 1cqmin) { .canvas-wrap { width: min(100cqmin - 10px, 400px); } }
/* マスキングテープ */
.canvas-wrap::before, .canvas-wrap::after {
  content: ''; position: absolute; top: -10px; width: 64px; height: 20px; z-index: 1; pointer-events: none;
  background: rgba(253, 216, 53, .7); border: 1.5px solid rgba(31, 42, 68, .16);
}
.canvas-wrap::before { left: -14px; transform: rotate(-32deg); }
.canvas-wrap::after { right: -14px; transform: rotate(32deg); background: rgba(240, 98, 146, .55); }
/* はじめて（キャラ0体）は ← を見えなくするだけ（🔊 の位置を動かさない） */
#btn-draw-back.is-off { visibility: hidden; pointer-events: none; }
#draw-canvas {
  width: 100%; height: 100%; display: block; touch-action: none; border-radius: 11px;
  background-color: #fff;
  background-image: linear-gradient(#e6ecf4 1px, transparent 1px), linear-gradient(90deg, #e6ecf4 1px, transparent 1px);
  background-size: 6.25% 6.25%;
}
.seg {
  display: flex; gap: 3px; padding: 3px; border: 3px solid var(--ink); border-radius: 999px; background: #fff;
  box-shadow: 0 3px 0 var(--ink); width: 100%; max-width: 400px;
}
.seg button {
  flex: 1; min-width: 0; min-height: 38px; border: 0; background: none; border-radius: 999px; padding: 4px 6px;
  font: 800 14px/1 var(--font); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 3px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.seg button i { font-style: normal; font-size: 16px; }
.seg button.on { background: var(--ink); color: #fff; }
.tool-row { width: 100%; max-width: 400px; display: flex; gap: 8px; align-items: center; flex: none; }
.seg.tools { flex: 1; min-width: 0; }
.seg.mini { width: auto; flex: none; }
.seg.mini button { width: 40px; flex: none; padding: 0; }
@media (max-width: 380px) {
  .seg.tools button { font-size: 13px; padding: 4px 2px; gap: 2px; }
  .seg.tools button i { font-size: 14px; }
  .seg.mini button { width: 36px; }
}
.seg.mini i { display: block; border-radius: 50%; background: currentColor; }
/* クレヨンのパレット */
.palette { display: flex; gap: 3px; justify-content: center; flex: none; width: 100%; max-width: 400px; }
.crayon {
  position: relative; flex: 1 1 0; max-width: 46px; height: 48px; border: 0; padding: 0; background: none; cursor: pointer;
  transition: transform .12s cubic-bezier(.2, 1.4, .4, 1);
}
.crayon::before {
  content: ''; position: absolute; left: 18%; right: 18%; top: 14px; bottom: 2px;
  background:
    linear-gradient(transparent 30%, rgba(255, 255, 255, .55) 30% 37%, transparent 37% 66%, rgba(255, 255, 255, .55) 66% 73%, transparent 73%),
    var(--c);
  border: 2.5px solid var(--ink); border-radius: 5px 5px 7px 7px;
  box-shadow: inset -5px 0 0 rgba(0, 0, 0, .12), 0 2px 0 var(--ink);
}
.crayon::after {
  content: ''; position: absolute; left: 31%; right: 31%; top: 3px; height: 14px;
  background: var(--c); border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 50% 50% 2px 2px / 80% 80% 2px 2px;
}
.crayon.on { transform: translateY(-7px); }
.crayon.on::before { box-shadow: inset -5px 0 0 rgba(0, 0, 0, .12), 0 9px 0 -2px rgba(31, 42, 68, .25); }
#btn-done { max-width: 400px; flex: none; }

/* 今週のお題（お絵描き画面） */
.theme-ribbon {
  margin-right: auto; flex: 0 1 auto; min-width: 0; min-height: 40px; display: flex; align-items: center; gap: 5px;
  border: 2.5px solid var(--ink); background: var(--cream); border-radius: 6px 999px 999px 6px; padding: 2px 12px 2px 7px;
  font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 var(--ink); transform: rotate(-2deg); text-align: left;
}
.theme-ribbon:active { transform: rotate(-2deg) translateY(3px); box-shadow: none; }
.theme-ribbon .tr-ic { flex-shrink: 0; font-size: 18px; line-height: 1; }
.theme-ribbon .tr-body { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.theme-ribbon .tr-lab { font-size: 11px; font-weight: 900; color: var(--primary); white-space: nowrap; }
.theme-ribbon .tr-text { min-width: 0; font-size: 13px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-ribbon .tr-check { display: none; flex-shrink: 0; color: var(--primary); font-weight: 900; }
.theme-ribbon.on { background: #ffd54f; }
.theme-ribbon.on .tr-check { display: inline; }
.theme-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; width: min(300px, 100%);
  background: #fffbe6; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 12px; box-shadow: 0 4px 0 var(--ink);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; animation: pop2 .18s ease-out;
}
@keyframes pop2 { from { transform: scale(.85); opacity: 0; } }
.theme-pop .tp-head { width: 100%; display: flex; justify-content: space-between; gap: 8px; font-weight: 900; font-size: 16px; }
.theme-pop .tp-days { flex-shrink: 0; font-size: 11px; color: var(--ink2); align-self: center; }
.theme-pop .tp-hint { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.45; }
.theme-pop .tp-tag { margin: 0; font-size: 11px; font-weight: 800; color: var(--accent); }
@media (max-height: 700px) {
  .lead { font-size: 15px; }
  .lead small { display: none; }
  .draw-screen { gap: 7px; }
  /* 背の低い画面：マスキングテープを小さく・ねかせて、上の「お題」「ぜんぶけす」にかぶせない（キャンバスも少し小さくして間をあける） */
  .canvas-wrap::before, .canvas-wrap::after { width: 42px; height: 14px; top: -4px; }
  .canvas-wrap::before { left: -8px; transform: rotate(-22deg); }
  .canvas-wrap::after { right: -8px; transform: rotate(22deg); }
}
@media (max-height: 700px) { @supports (width: 1cqmin) { .canvas-wrap { width: min(100cqmin - 26px, 400px); } } }

/* ===================== 診断 ===================== */
.diag-body { gap: 10px; }
.diag-stage {
  position: relative; width: 100%; max-width: 400px; height: clamp(170px, 32vh, 300px);
  border: 3px solid var(--ink); border-radius: 22px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 25%, #ffffff 0%, #fff8dc 55%, #fde9b5 100%);
  box-shadow: 0 5px 0 var(--ink), var(--soft);
}
.showcase-box { width: 100%; height: 100%; }
.type-stamp {
  position: absolute; top: 12px; right: 12px; z-index: 2; pointer-events: none;
  font: 900 19px/1.1 var(--font); color: var(--primary); background: rgba(255, 255, 255, .9);
  border: 3px solid var(--primary); border-radius: 10px; padding: 5px 12px; white-space: nowrap;
  box-shadow: 0 0 0 2px #fff, 0 3px 0 rgba(229, 57, 53, .35);
  transform: rotate(8deg) scale(0); opacity: 0;
}
.type-stamp.show { animation: stamp .45s cubic-bezier(.2, 1.5, .4, 1) forwards; }
/* 3Dのキャラを置かない上のすき間（背の低い画面だけ出す。下の @media） */
.stamp-reserve { display: none; position: absolute; top: 0; left: 0; width: 1px; height: 40px; pointer-events: none; visibility: hidden; }
@keyframes stamp { 0% { transform: rotate(14deg) scale(2.6); opacity: 0; } 55% { opacity: 1; } 100% { transform: rotate(8deg) scale(1); opacity: 1; } }
.name-input {
  font: 900 22px/1.2 var(--font); text-align: center; border: 0; border-bottom: 3px dashed var(--ink); background: transparent;
  width: min(80%, 320px); padding: 4px; color: var(--ink); -webkit-user-select: text; user-select: text; border-radius: 0;
}
.name-input:focus { outline: none; border-bottom-style: solid; background: rgba(255, 255, 255, .6); }
.name-tip { margin: -2px 0 0; font: 800 12.5px/1.4 var(--font); color: #b23a2e; text-align: center; max-width: 320px; }
.diag-chips { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.diag-chips .el-chip { font-size: 14px; padding: 4px 14px; }
.stats {
  width: 100%; max-width: 400px; display: grid; gap: 7px; background: #fff; border: 3px solid var(--ink);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 4px 0 var(--ink);
}
.stat { display: grid; grid-template-columns: 100px 1fr 34px; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.stat .st-lab { white-space: nowrap; }
.stat .track { height: 14px; border-radius: 999px; background: #eceff4; overflow: hidden; border: 2px solid var(--ink); }
.stat .fill { height: 100%; width: 0; border-radius: 999px; transition: width .7s cubic-bezier(.2, .9, .3, 1.15); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); }
.stat .num { text-align: right; font-weight: 900; }
.comments { list-style: none; padding: 0; margin: 0; width: 100%; max-width: 400px; display: grid; gap: 6px; }
.comments li { background: #fffbe6; border: 2.5px solid var(--ink); border-radius: 12px; padding: 7px 12px; font-weight: 800; font-size: 14px; line-height: 1.45; opacity: 0; }
.comments.show li { animation: li-in .32s ease-out both; }
.comments.show li:nth-child(2) { animation-delay: .12s; }
.comments.show li:nth-child(3) { animation-delay: .24s; }
@keyframes li-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.diag-share { display: none; }
.theme-chip {
  min-width: 0; min-height: 34px; flex: 0 1 auto; border: 2px dashed var(--ink); background: #fff; border-radius: 999px; padding: 5px 12px;
  font-weight: 800; font-size: 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.theme-chip.on { border-style: solid; background: var(--cream); }
.btn.share-btn { --b: var(--accent); --t: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
/* 診断のボタン帯：いちばん下に全幅の「このキャラであそぶ！」。上の行は［かきなおす］（文字の幅）＋［しんだんをシェア］ */
.diag-actions .btn-row #btn-redraw { flex: 0 0 auto; padding-left: 14px; padding-right: 14px; }
.diag-actions .btn-row .share-btn { flex: 1 1 auto; font-size: 15px; }
.diag-actions #btn-go-select { font-size: clamp(17px, 5.2vw, 20px); padding-left: 12px; padding-right: 12px; }
.no-share .diag-actions .btn-row #btn-redraw { flex: 1 1 auto; }
@media (max-height: 720px) {
  .diag-body { gap: 7px; }
  .diag-stage { height: clamp(150px, 27vh, 300px); }
  /* 箱が低いとキャラが箱いっぱいに出て、右上のスタンプが頭・耳にかぶる。スタンプを少し小さくして、
     その高さぶんを .stamp-reserve（data-showcase-reserve）で空け、キャラをスタンプの下に収める（js/core/showcase.js の fit） */
  .type-stamp { top: 8px; right: 8px; font-size: 16px; padding: 3px 10px; border-width: 2.5px; }
  .stamp-reserve { display: block; }
  .name-input { font-size: 19px; padding: 2px; }
  .stats { gap: 4px; padding: 8px 12px; }
  .stat { font-size: 13px; }
  .stat .track { height: 12px; }
  .comments li { padding: 5px 10px; font-size: 13px; }
  .comments li:nth-child(n+3) { display: none; }
}

/* ===================== プレイ ===================== */
#scr-play { background: #000; }
#stage { position: absolute; inset: 0; }
/* 横向きのスマホでのプレイ：画面いっぱいに使う（縦の画面を真ん中に出すゲームは、左右を方眼の紙にする） */
@media (orientation: landscape) and (max-height: 600px) {
  html.playing #app { max-width: none; }
  html.playing .rotate-ov { display: none !important; }
  html.playing #scr-play {
    background-color: var(--bg);
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
  }
}
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#stage canvas.gl { pointer-events: none; }
#hud {
  position: absolute; top: max(8px, var(--safe-t)); left: 10px; right: 60px; pointer-events: none; z-index: 3;
  font-weight: 900; font-size: 16px; display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start;
}
#hud .pill {
  background: rgba(255, 255, 255, .94); border: 2.5px solid var(--ink); border-radius: 999px; padding: 3px 12px;
  box-shadow: 0 3px 0 rgba(31, 42, 68, .9); white-space: nowrap;
}
#hud .hp { flex: 1; min-width: 120px; background: rgba(255, 255, 255, .85); border: 2.5px solid var(--ink); border-radius: 12px; padding: 2px 8px 5px; box-shadow: 0 3px 0 rgba(31, 42, 68, .9); }
#hud .hp .lab { font-size: 11px; }
#hud .hp .tr { height: 12px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
#hud .hp .tr i { display: block; height: 100%; transition: width .15s; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); }
/* ✕：遊び方カード・カウントダウンの上でも押せる */
.quit {
  position: absolute; top: max(8px, var(--safe-t)); right: 10px; z-index: 30; width: 44px; height: 44px; padding: 0;
  border: 2.5px solid var(--ink); border-radius: 50%; background: rgba(255, 255, 255, .94); font: 900 18px/1 var(--font); cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center;
}
.quit:active { transform: translateY(3px); box-shadow: none; }
#controls { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
#controls > * { pointer-events: auto; }
.vstick {
  position: absolute; left: 22px; bottom: max(26px, var(--safe-b)); width: 124px; height: 124px; border-radius: 50%;
  border: 3px dashed rgba(31, 42, 68, .55); background: rgba(255, 255, 255, .4); touch-action: none;
}
.vstick .knob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; pointer-events: none;
  background: var(--ink); border: 3px solid #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .25), inset 0 -5px 0 rgba(0, 0, 0, .25), inset 0 4px 0 rgba(255, 255, 255, .25);
}
.vbtn {
  position: absolute; padding: 0; line-height: 1.1; border-radius: 50%; border: 3px solid var(--ink); background: #fff;
  font: 900 15px/1.1 var(--font); touch-action: none; cursor: pointer;
  box-shadow: 0 5px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, .12), inset 0 4px 0 rgba(255, 255, 255, .55);
  -webkit-user-select: none; user-select: none;
}
.vbtn.on { transform: translateY(5px); box-shadow: 0 0 0 var(--ink), inset 0 -3px 0 rgba(0, 0, 0, .12); filter: brightness(.94); }
.vbtn.off { opacity: .4; }
.vbtn.r1 { right: 22px; bottom: max(30px, var(--safe-b)); width: 88px; height: 88px; background-color: var(--primary); color: #fff; font-size: 17px; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.vbtn.r2 { right: 122px; bottom: max(22px, var(--safe-b)); width: 66px; height: 66px; font-size: 13px; }
.vbtn.r3 { right: 34px; bottom: max(134px, calc(var(--safe-b) + 110px)); width: 64px; height: 64px; font-size: 13px; }
.vbtn.l2 { left: 122px; bottom: max(30px, var(--safe-b)); width: 88px; height: 88px; }
.vbtn.l1 { left: 22px; bottom: max(30px, var(--safe-b)); width: 88px; height: 88px; }
#controls .toast { top: 30%; z-index: 6; }
#play-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(246, 243, 234, .6); z-index: 10; padding: 16px; overflow-y: auto; }
/* カウントダウン中は下のゲームを触れるように（GO! のあいだも操作できる） */
#play-overlay:has(.count-wrap) { pointer-events: none; background: rgba(246, 243, 234, .35); }
.count-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.count-name {
  font-size: 16px; font-weight: 900; background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 14px;
  box-shadow: 0 3px 0 var(--ink); transform: rotate(-2deg); white-space: nowrap;
}
.count { font-size: 120px; line-height: 1; font-weight: 900; color: var(--ink); -webkit-text-stroke: 8px #fff; paint-order: stroke fill; animation: cnt .6s ease-out; text-shadow: 0 6px 0 rgba(31, 42, 68, .18); }
.count.go { color: var(--primary); font-size: 104px; }
.count-goal {
  margin: 4px 0 0; max-width: 320px; text-align: center; font-size: 14px; font-weight: 900; color: var(--primary);
  background: var(--cream); border: 2.5px dashed var(--primary); border-radius: 12px; padding: 6px 10px;
}
@keyframes cnt { from { transform: scale(1.9); opacity: 0; } 30% { opacity: 1; } }
/* ゲームが動かなかったとき（エンジンの _fail）：子ども向けの一言と「ホームへ」 */
.fail-card { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 320px; }
.fail-ic { font-size: 46px; line-height: 1; }
.fail-card h2 { margin: 0; font-size: 20px; line-height: 1.35; transform: rotate(-1deg); word-break: keep-all; overflow-wrap: anywhere; }
.fail-text { margin: 0 0 4px; font-size: 14px; font-weight: 800; line-height: 1.55; color: var(--ink2); word-break: keep-all; overflow-wrap: anywhere; }
.fail-detail { margin: 0; max-width: 100%; font: 600 10.5px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--ink3); overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }

/* 遊び方カード（エンジン） */
.card { background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 18px; box-shadow: 0 6px 0 var(--ink); width: 100%; max-width: 360px; text-align: center; }
/* 遊び方カード（エンジン）：詳細シートと同じ部品（キーアート・カテゴリのチップ・番号つきの手順・あそぶ！） */
.intro {
  position: relative; text-align: left; padding: 12px 14px 14px; background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
.intro-art { position: relative; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 4px 0 var(--ink); transform: rotate(-1deg); background: #fff; }
.intro-art canvas { display: block; width: 100%; height: auto; aspect-ratio: 312 / 168; }
.intro-art .rank-badge.big { width: 46px; height: 46px; font-size: 26px; top: 8px; left: 8px; }
.intro-cat { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.intro-aff { font-size: 13px; font-weight: 900; color: var(--primary); }
.intro h2.intro-name { margin: 2px 0 6px; font-size: 23px; line-height: 1.25; transform: rotate(-1deg); transform-origin: left; }
.intro-steps { margin: 0 0 8px; padding: 10px 12px; list-style: none; counter-reset: how; display: grid; gap: 4px; background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; font-weight: 800; font-size: 14px; line-height: 1.5; }
.intro-steps li { position: relative; padding-left: 24px; }
.intro-steps 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);
}
.intro .chips { justify-content: flex-start; margin: 6px 0; }
.intro #btn-start { margin-top: 2px; }
.rank { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 900; font-size: 20px; border: 2.5px solid var(--ink); transform: rotate(-8deg); box-shadow: 0 2px 0 var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.chips .chip .stars { color: #f9a825; }
.intro .hint { font-size: 13px; font-weight: 700; color: var(--ink2); margin: 4px 0 8px; }
.intro .best { font-size: 13px; font-weight: 800; min-height: 1em; margin: 0 0 10px; }
.intro .chal-goal { margin: 0 0 8px; font-size: 14px; font-weight: 900; color: var(--primary); background: var(--cream); border: 2px dashed var(--primary); border-radius: 10px; padding: 6px 8px; }

/* ポーズ */
.pause { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(31, 42, 68, .55); }
.pause-card {
  width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; align-items: center;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 18px 18px 20px; box-shadow: 0 6px 0 var(--ink);
  animation: pop2 .18s ease-out;
}
.pause-card h2 { margin: 0 0 4px; font-size: 24px; transform: rotate(-2deg); }

/* ===================== 結果 ===================== */
.res-body { gap: 8px; }
.res-head { display: flex; justify-content: center; width: 100%; }
.res-game {
  display: inline-block; max-width: 100%; background: var(--cat, var(--ink)); color: #fff; font-weight: 900; font-size: 15px;
  border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 16px; box-shadow: 0 3px 0 var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.res-stage { position: relative; width: 100%; max-width: 400px; height: clamp(150px, 28vh, 270px); }
/* 見出し：ステージの上のふつうの流れに置く（ジャンプしたキャラの頭にかぶせない） */
.res-title {
  position: relative; z-index: 2; pointer-events: none; max-width: 100%; margin: -2px 0 -4px; text-align: center;
  font-size: 34px; line-height: 1.12; font-weight: 900; color: var(--primary); -webkit-text-stroke: 7px #fff; paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(31, 42, 68, .15); white-space: nowrap;
  transform: rotate(-4deg) scale(0); opacity: 0;
}
/* 長い称号：main.js（K.fitLine）が幅に合うまで文字を小さくする。いちばん小さくしても入らないときだけ折り返す */
.res-title.fit-wrap { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
.lose .res-title { color: var(--ink2); }
.res-title.show { animation: rtitle .5s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes rtitle { from { transform: rotate(-12deg) scale(2.2); opacity: 0; } 50% { opacity: 1; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }
.res-scorebox {
  position: relative; width: 100%; max-width: 400px; background: #fff; border: 3px solid var(--ink); border-radius: 22px;
  padding: 8px 14px 12px; box-shadow: 0 5px 0 var(--ink); text-align: center;
}
.res-scorebox::before {
  content: ''; position: absolute; top: -11px; left: 50%; width: 80px; height: 20px; margin-left: -40px;
  background: rgba(253, 216, 53, .75); border: 1.5px solid rgba(31, 42, 68, .16); transform: rotate(-3deg);
}
.res-score { font-size: 50px; font-weight: 900; line-height: 1.05; white-space: nowrap; letter-spacing: .01em; }
.res-score .rs-unit { font-size: 22px; margin-left: 3px; }
.res-detail { font-weight: 700; font-size: 13px; color: var(--ink2); }
.res-detail:empty { display: none; }
.res-medals { display: flex; justify-content: center; gap: 12px; margin: 6px 0 2px; }
.rm-slot { font-size: 36px; line-height: 1; filter: grayscale(1) opacity(.2); }
.rm-slot.on { filter: none; }
.rm-slot.drop { animation: medal-drop .62s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes medal-drop { 0% { transform: translateY(-90px) rotate(-40deg) scale(1.5); opacity: 0; } 55% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.res-best { font-weight: 800; font-size: 14px; min-height: 1.2em; }
.res-best.new { color: var(--primary); }
.res-best.pop { animation: best-pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes best-pop { 40% { transform: scale(1.14) rotate(-2deg); } }
/* NEW RECORD! は1行目に独立させる（本文の左にかぶせない） */
.rb-stamp { display: table; margin: 2px auto 4px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 900; border-radius: 6px; padding: 2px 8px; transform: rotate(-4deg); box-shadow: 0 2px 0 var(--ink); }
.res-chal { width: 100%; max-width: 400px; border: 2.5px solid var(--ink); border-radius: 12px; padding: 6px 10px; font-weight: 900; font-size: 14px; background: #e3f2fd; text-align: center; }
.res-chal.win { background: #ffebee; color: var(--primary); }
.res-chal small { display: block; font-size: 11px; color: var(--ink2); font-weight: 800; }
/* 「絵がどう効いたか」：1枚のカードに箇条書き（白い箱を並べない） */
.res-notes {
  list-style: none; margin: 2px 0 0; width: 100%; max-width: 400px; padding: 4px 12px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.res-notes:empty { display: none; }
.res-notes li { position: relative; padding: 6px 0 6px 16px; font-weight: 800; font-size: 13px; line-height: 1.45; border-top: 1.5px dashed var(--line); }
.res-notes li:first-child { border-top: 0; }
.res-notes li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--cat, var(--ink)); }
.res-notes li.tip { color: #6d5200; }
.res-notes li.tip::before { display: none; }
.res-notes li.tip { padding-left: 0; }
.res-actions { gap: 8px; }
.btn.share-cta { min-height: 60px; font-size: 21px; }
.btn.share-cta.hype { animation: purupuru 1.6s ease-in-out infinite; --b: #ff6d3a; }
@keyframes purupuru {
  0%, 55%, 100% { transform: none; }
  60% { transform: rotate(-3deg) scale(1.05); } 66% { transform: rotate(3deg) scale(1.05); }
  72% { transform: rotate(-2deg) scale(1.03); } 78% { transform: rotate(2deg) scale(1.03); } 84% { transform: none; }
}
.btn.retry { --b: var(--yellow); }
/* シェアを止めているとき（おうちの人むけの設定）は「もう一回！」をいちばん大きく */
.no-share .res-actions .btn.retry { min-height: 56px; font-size: 19px; }
@media (max-height: 720px) {
  .res-body { gap: 6px; }
  .res-stage { height: clamp(130px, 24vh, 270px); }
  .res-score { font-size: 42px; }
  .rm-slot { font-size: 30px; }
  .res-notes li { padding-top: 4px; padding-bottom: 4px; font-size: 12px; }
  .res-title { font-size: 29px; }
  .btn.share-cta { min-height: 54px; font-size: 19px; }
  .res-actions .btn-row .btn { min-height: 44px; }
  /* 挑戦の行が出ているときは能力の自動コメントを省く（ゲームのコメントと💡ヒントは残す） */
  #res-chal:not([hidden]) ~ .res-notes li.auto { display: none; }
}

/* ===================== モーダル ===================== */
.modal { position: absolute; inset: 0; background: rgba(31, 42, 68, .5); display: grid; place-items: center; z-index: 60; padding: 16px; padding-top: max(16px, var(--safe-t)); padding-bottom: max(16px, var(--safe-b)); }
.modal-card {
  position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 16px;
  width: 100%; max-width: 400px; max-height: 100%; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 6px 0 var(--ink); animation: pop2 .2s ease-out;
  /* .modal は grid なので、子の min-height:auto（中身の高さ）が max-height より優先されて縮まない。0 にして中身をスクロールさせる */
  min-height: 0;
}
/* モーダルの右上の ✕（詳細シートの ✕ と同じ44px） */
.modal-x {
  position: absolute; top: 10px; 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;
}
.modal-x:active { transform: translateY(3px); box-shadow: none; }
.modal-card h2 { margin: 0; text-align: center; font-size: 21px; transform: rotate(-1.5deg); }

/* キャラ一覧：キーアート風の台紙 */
.chars-card { gap: 8px; }
.chars-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding-left: 4px; padding-right: 52px; flex: none; }
.chars-head h2 { text-align: left; white-space: nowrap; }
.chars-head .chars-edit { flex: none; min-height: 38px; padding: 4px 12px; font-size: 13px; }
.chars-head .chars-edit.on { --b: var(--yellow); }
.chars-sub { margin: -4px 0 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--ink2); flex: none; }
/* 一覧の中だけがスクロールする（見出しと「とじる」は動かない） */
.char-list {
  display: grid; grid-template-columns: repeat(3, 1fr); align-content: start; gap: 18px 12px; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 8px 18px; flex: 1 1 auto; min-height: 0; scrollbar-width: thin;
}
.chars-card > #btn-modal-close { flex: none; }
/* せまい画面は2列（名前を読めるように） */
@media (max-width: 380px) {
  .char-list { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; }
}
@media (max-width: 380px) and (max-height: 700px) {
  .chars-head h2 { font-size: 19px; }
}
.char-item {
  position: relative; border: 2.5px solid var(--ink); border-radius: 14px; padding: 6px 6px 8px; text-align: center; cursor: pointer;
  background: #fff; box-shadow: 0 3px 0 var(--ink); transform: rotate(var(--tilt, 0deg)); transition: transform .1s;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.char-item:active { transform: rotate(var(--tilt, 0deg)) translateY(3px); box-shadow: none; }
.char-item.on { background: var(--cream); box-shadow: 0 3px 0 var(--ink), 0 0 0 3px var(--yellow); }
.ci-pic {
  position: relative; border-radius: 9px; aspect-ratio: 1; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fff 30%, color-mix(in srgb, var(--el) 22%, #fff) 100%);
  background-color: #f6f7fb; border: 2px solid rgba(31, 42, 68, .15);
}
.ci-pic img { position: absolute; left: 7%; top: 7%; width: 86%; height: 86%; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(31, 42, 68, .18)); }
/* 絵の <img> は長押し（Android Chrome の画像メニュー：保存・共有・新しいタブ）とマウスのドラッグを受けない。押す判定は親のカードが受ける。
   -webkit-touch-callout（body）は iOS だけなので、ここで止める。共有シートの絵（share.css）は長押しで保存できるように対象にしない */
.ci-pic img, .rd-art img, #recv-img { pointer-events: none; -webkit-user-drag: none; }
/* 名前は自分で付けた大事なもの：2行まで出す */
.char-item .nm {
  font-size: 12px; font-weight: 900; line-height: 1.3; margin-top: 2px; min-height: 2.6em;
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: keep-all; overflow-wrap: anywhere;
}
/* 文節で折る（対応ブラウザ）：「ほのおのまんまるドラ／ゴン」のように単語の途中で折らない */
.char-item .ci-sub { font-size: 12px; font-weight: 800; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 14px; }
.char-item .ci-now { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 900; color: #fff; background: var(--ink); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
/* 消す✕：「へんしゅう」のときだけ出す（ふだんは誤タップしない） */
.char-item .del {
  display: none; position: absolute; top: -10px; right: -10px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid var(--ink);
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 900; padding: 0; cursor: pointer; box-shadow: 0 2px 0 var(--ink);
}
.char-list.editing .del { display: block; animation: pop2 .16s ease-out; }
.char-list.editing .char-item { animation: wiggle .5s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(calc(var(--tilt, 0deg) - 1.2deg)); } to { transform: rotate(calc(var(--tilt, 0deg) + 1.2deg)); } }
/* 押しやすさ：見た目は32pxでも、まわりまで押せるように */
.char-item .del::after { content: ''; position: absolute; inset: -6px; }
/* 送る：カードの右下の小さい📤（当たり判定は44px）。カードを押すのは「えらぶ」 */
.char-item .send {
  position: absolute; right: -8px; bottom: -8px; z-index: 2; width: 34px; height: 34px; padding: 0; display: grid; place-items: center;
  border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; font-size: 15px; line-height: 1; cursor: pointer; box-shadow: 0 2px 0 var(--ink);
}
.char-item .send::after { content: ''; position: absolute; inset: -5px; }
.char-item .send:active { transform: translateY(2px); box-shadow: none; }
.char-list.editing .send { display: none; }
.char-item .friend { position: absolute; top: -9px; left: -6px; z-index: 2; font-size: 10px; font-weight: 900; color: #fff; background: #f06292; border: 2px solid var(--ink); border-radius: 999px; padding: 1px 7px; transform: rotate(-6deg); }
.char-empty { grid-column: 1 / -1; text-align: center; font-weight: 800; }

/* 受けとりモーダル */
.recv-card { align-items: center; text-align: center; gap: 8px; overflow-y: auto; }
.recv-ribbon { align-self: center; background: var(--primary); color: #fff; font-weight: 900; font-size: 14px; padding: 5px 16px; border-radius: 999px; transform: rotate(-2deg); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.recv-card h2 { font-size: 19px; line-height: 1.35; }
/* 届いたキャラ：3Dのショーケース（紙の台の上で ぽんっ）。WebGL が使えないときだけ img */
.recv-hero {
  position: relative; width: 100%; height: clamp(150px, 27vh, 230px); display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
  border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink);
  background: radial-gradient(120% 90% at 50% 25%, #ffffff 0%, #fff8dc 55%, #fde9b5 100%);
}
.recv-hero .showcase-box { position: absolute; inset: 0; }
.recv-hero img { width: min(160px, 22vh); height: min(160px, 22vh); object-fit: contain; animation: bob 1s ease-in-out infinite alternate; filter: drop-shadow(0 6px 4px rgba(31, 42, 68, .2)); }
@keyframes bob { to { transform: translateY(-8px) rotate(4deg); } }
.recv-sub { font-weight: 800; font-size: 13px; color: var(--ink2); }
.recv-chal { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--cream); border: 2.5px solid var(--primary); border-radius: 12px; padding: 8px; flex-shrink: 0; text-align: left; }
.recv-chal .rc-art { flex: none; width: 96px; height: auto; aspect-ratio: 3 / 2; border: 2.5px solid var(--ink); border-radius: 10px; box-shadow: 0 2px 0 var(--ink); transform: rotate(-3deg); background: #fff; }
.recv-chal .rc-body { flex: 1; min-width: 0; text-align: center; }
.recv-chal .rc-game { font-weight: 800; font-size: 13px; }
.recv-chal .rc-score { font-weight: 900; font-size: 28px; color: var(--primary); line-height: 1.2; white-space: nowrap; }
.recv-chal .rc-ask { font-weight: 900; font-size: 14px; }
.recv-card .btn, .lock-card .btn { flex-shrink: 0; }
@media (max-height: 720px) {
  .recv-card, .lock-card { gap: 6px; }
  .recv-hero { height: clamp(130px, 24vh, 200px); }
  .recv-hero img { width: min(160px, 17vh); height: min(160px, 17vh); }
  .recv-chal .rc-art { width: 84px; }
  .recv-chal .rc-score { font-size: 22px; }
  .lock-ic { font-size: 36px; }
  .lock-art { width: min(220px, 70%); }
}

/* お試し版：アプリ版のご案内 */
.lock-card { align-items: center; text-align: center; gap: 8px; overflow-y: auto; }
.lock-ic { font-size: 46px; line-height: 1; }
/* 自分のキャラがそのゲームにいるキーアート（白フチ・少し傾ける） */
.lock-art {
  position: relative; width: min(260px, 82%); margin: 6px auto 2px; flex-shrink: 0; background: #fff; border: 3px solid var(--ink);
  border-radius: 14px; box-shadow: 0 0 0 5px #fff, 0 5px 0 5px var(--ink); transform: rotate(-2.5deg);
}
.lock-art canvas { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; border-radius: 11px; }
.lock-badge {
  position: absolute; right: -10px; bottom: -10px; font-size: 12px; font-weight: 900; color: #fff; background: var(--primary);
  border: 2.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; transform: rotate(6deg); box-shadow: 0 2px 0 var(--ink); white-space: nowrap;
}
.lock-card h2 { font-size: 19px; line-height: 1.35; }
.lock-lead { margin: 0; font-weight: 900; font-size: 15px; color: var(--primary); }
.lock-points { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 5px; text-align: left; }
.lock-points li { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 7px 10px; font-weight: 800; font-size: 13px; }

/* 遊び方カード・挑戦の目標などで使う */
@media (prefers-reduced-motion: reduce) {
  .btn.share-cta.hype, .recv-hero img, .theme-pop { animation: none; }
}
