/* モシバト：スマホゲーム風の画面（2026-11-30 作り直し）。スマホは全画面、パソコンはまん中にスマホの幅で出す */
:root {
  --bg: #1d1838; --panel: #fffaf0; --panel2: #f4ecdf; --ink: #2b2033; --ink2: #5b4f66; --line: #4a3a2a;
  --gold: #f2c640; --gold2: #c0902a; --red: #e0603e; --green: #4f8f3c; --blue: #3a4a8a; --pink: #f08aa0; --purple: #7a5cc8;
  --r1: #9a948a; --r2: #5a7ee0;
  --fire: #e0603e; --water: #3a8ad0; --wood: #4f8f3c; --earth: #a8774a; --thunder: #b8860b; --none: #8a8478;
  --tab-h: 64px; --hud-h: 56px;
  --pix: 'DotGothic16', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(circle at 20% 10%, #3a2f6b 0, transparent 40%), radial-gradient(circle at 80% 90%, #2f4a6b 0, transparent 45%), var(--bg);
  color: var(--ink); font: 15px/1.6 system-ui, -apple-system, 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  -webkit-tap-highlight-color: transparent; min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
img.spr { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
[hidden] { display: none !important; }
.app { position: relative; max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: #f1e6d2;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 20px 60px rgba(0,0,0,.5); padding-top: var(--hud-h); padding-bottom: calc(var(--tab-h) + var(--safe-b) + 8px); }
.foot { max-width: 520px; margin: 0 auto; padding: 8px 16px calc(var(--tab-h) + 24px); color: #b9b0d6; font-size: 11px; text-align: center; }

/* ---------- 上の帯 ---------- */
.hud { position: fixed; z-index: 30; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: rgba(29,24,56,.95); color: #fff; border-bottom: 2px solid #4b3f86; }
.hud-me { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hud-ava { width: 40px; height: 40px; border-radius: 12px; background: #4b3f86; display: grid; place-items: center; overflow: hidden; flex: none; border: 2px solid #8a7ad8; }
.hud-ava img { width: 52px; height: 52px; margin-top: 10px; }
.hud-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.hud-name b { font-family: var(--pix); font-weight: normal; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-name small { color: #c9c0ee; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-res { display: flex; align-items: center; gap: 6px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; border-radius: 999px; background: #3c3270; border: 2px solid #5d50a8; font-family: var(--pix); font-size: 15px; }
.ico-coin { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, var(--gold) 45%, var(--gold2)); border: 2px solid #7a5a10; display: inline-block; flex: none; }
.ico-ticket { width: 22px; height: 16px; border-radius: 4px; background: linear-gradient(90deg, var(--pink), #f6b6c8); border: 2px solid #8a3050; display: inline-block; flex: none; }
.hud-help { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #8a7ad8; background: #3c3270; font-family: var(--pix); font-size: 18px; color: #fff; display: grid; place-items: center; padding: 0; }

/* ---------- 下のタブ ---------- */
.tabbar { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(5, 1fr); background: #241d48; border-top: 2px solid #4b3f86; }
.tabbar button { position: relative; isolation: isolate; border: 0; background: none; color: #b9b0d6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 12px; font-weight: 700; }
.tabbar button[aria-current="page"] { color: #fff; }
.tabbar button[aria-current="page"]::before { content: ''; position: absolute; inset: 5px 8px; border-radius: 14px; background: linear-gradient(#5b4bb8, #3f338a); box-shadow: inset 0 2px 0 rgba(255,255,255,.2); z-index: -1; }
.tabbar .ti { width: 34px; height: 34px; display: grid; place-items: center; }
.tabbar .ti img { width: 34px; height: 34px; }
.tabbar .dot { position: absolute; top: 7px; right: calc(50% - 24px); width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid #241d48; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* ---------- 画面 ---------- */
.screen { animation: fadeUp .22s ease-out; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin: 10px 12px; padding: 4px; border-radius: 14px; background: #2b2350; }
.seg button { border: 0; border-radius: 10px; padding: 9px 4px; background: none; color: #e6dfff; font-weight: 800; font-size: 14px; min-height: 42px; }
.seg button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.sub { padding: 0 12px; }
.card { background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 12px; margin: 0 0 12px; box-shadow: 0 4px 0 rgba(43,32,51,.35); }
.card h2, .card h3 { font-family: var(--pix); font-weight: normal; margin: 0 0 6px; line-height: 1.3; }
.card h2 { font-size: 19px; } .card h3 { font-size: 16px; }
.hint { color: var(--ink2); font-size: 13px; margin: 4px 0; }
.small { font-size: 12px; color: var(--ink2); }
.tag { display: inline-block; padding: 1px 8px; margin: 0 4px 0 0; border-radius: 999px; background: var(--panel2); border: 1px solid #cbc3ae; font-size: 11px; font-weight: 700; color: var(--ink2); vertical-align: middle; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* ボタン（つやのあるゲーム風） */
.btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 46px; padding: 6px 16px; border-radius: 14px; border: 3px solid var(--line);
  background: linear-gradient(#fff, #e9dfcb); font-weight: 800; font-size: 15px; line-height: 1.25; box-shadow: 0 4px 0 var(--line); transition: transform .06s, box-shadow .06s; color: var(--ink); text-decoration: none; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 0 4px 0 var(--line); }
.btn.main { background: linear-gradient(#ffe48a, #f2a83a); }
.btn.go { background: linear-gradient(#8fe07a, #4f8f3c); color: #fff; text-shadow: 0 2px 0 #2f5a2a; }
.btn.red { background: linear-gradient(#ff9a7a, #d0502e); color: #fff; text-shadow: 0 2px 0 #8a2a10; }
.btn.blue { background: linear-gradient(#9ad0ff, #4a6ed0); color: #fff; text-shadow: 0 2px 0 #2a3a7a; }
.btn.small { min-height: 38px; padding: 4px 12px; font-size: 13px; border-radius: 12px; }
.btn.wide { width: 100%; }
.btn .price { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.btn .price .ico-coin { width: 14px; height: 14px; border-width: 1px; }

/* 属性・珍しさ */
.attr { display: inline-flex; align-items: center; gap: 2px; padding: 0 7px 0 3px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 800; vertical-align: middle; line-height: 20px; white-space: nowrap; }
.attr > img { width: 16px !important; height: 16px !important; margin: 0 !important; } /* ほかの「img」の大きさの指定に負けないように */
.attr.fire { background: var(--fire); } .attr.water { background: var(--water); } .attr.wood { background: var(--wood); } .attr.earth { background: var(--earth); } .attr.thunder { background: var(--thunder); } .attr.none { background: var(--none); }
.rar { font-size: 12px; letter-spacing: -1px; white-space: nowrap; }
.rar1 { color: #7a7468; } .rar2 { color: var(--r2); } .rar3 { color: var(--gold2); text-shadow: 0 0 6px rgba(242,198,64,.8); }

/* ---------- ホーム ---------- */
.stage { position: relative; height: 320px; overflow: hidden; background: linear-gradient(#2b2350, #5a4aa8 70%, #8a6ad0); }
.stage-sky { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 20%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 70% 12%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 40% 35%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 88% 40%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 10% 55%, #fff 50%, transparent 51%); opacity: .8; animation: twinkle 3s infinite alternate; }
@keyframes twinkle { to { opacity: .4; } }
.stage-title { position: absolute; top: 12px; left: 0; right: 0; text-align: center; color: #fff; }
.logo-text { margin: 0; font-family: var(--pix); font-weight: normal; font-size: 40px; letter-spacing: 4px; text-shadow: 0 3px 0 #3a2a70, 0 0 18px rgba(255,214,90,.6); color: #ffe48a; line-height: 1.2; }
.stage-title p { margin: 0; font-size: 13px; color: #e6dfff; }
.stage-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 84px; background: linear-gradient(#7a5cc8, #4a347a); border-top: 4px solid #9a8ae0; }
.stage-team { position: absolute; z-index: 2; left: 0; right: 0; bottom: 40px; display: flex; justify-content: center; align-items: flex-end; gap: 0; }
.stage-team .mate { position: relative; display: flex; flex-direction: column; align-items: center; animation: bob 1.4s ease-in-out infinite; border: 0; background: none; padding: 0; }
.stage-team .mate:nth-child(2) { animation-delay: .25s; z-index: 2; } .stage-team .mate:nth-child(3) { animation-delay: .5s; }
.stage-team .mate > img { width: 124px; height: 124px; }
.stage-team .mate:nth-child(2) > img { width: 148px; height: 148px; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.stage-team .nm { margin-top: -12px; padding: 0 8px; border-radius: 8px; background: rgba(29,24,56,.8); color: #fff; font-size: 11px; font-weight: 700; display: flex; gap: 3px; align-items: center; }
.stage-power { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: 8px; padding: 2px 14px; border-radius: 999px; background: rgba(29,24,56,.85); color: #ffe48a; font-family: var(--pix); font-size: 15px; white-space: nowrap; }
.home-cards { padding: 12px; }
.quest { display: flex; gap: 12px; align-items: center; }
.quest .qi { width: 56px; height: 56px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--panel2); border: 2px solid #cbc3ae; overflow: hidden; }
.quest .qi img { width: 56px; height: 56px; }
.quest .qt { flex: 1; min-width: 0; }
.quest .qt b { display: block; font-size: 15px; }
.quest .qt small { display: block; color: #5a4a3a; font-size: 13px; line-height: 1.4; }
.tut { background: linear-gradient(#fff8e0, #ffeec0); border-color: #a07010; }
.tut .steps { display: flex; gap: 6px; margin: 6px 0; }
.tut .steps i { flex: 1; height: 8px; border-radius: 4px; background: #e6d6a8; }
.tut .steps i.on { background: var(--green); }
.cardintro { margin: 8px 0; padding: 10px; border-radius: 12px; background: #fff; border: 2px dashed var(--gold2); font-size: 13px; }
.cardintro .ex { font-family: var(--pix); font-size: 15px; margin: 4px 0; }
.tutteam { display: flex; gap: 6px; justify-content: center; margin: 6px 0; }
.tutteam div { text-align: center; font-size: 11px; font-weight: 700; }
.tutteam img { width: 64px; height: 64px; }

/* ---------- なかま ---------- */
.mate-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 10px; }
.mate-pick button { position: relative; border: 3px solid var(--line); border-radius: 14px; background: var(--panel2); padding: 2px 2px 4px; box-shadow: 0 3px 0 var(--line); }
.mate-pick button[aria-pressed="true"] { background: linear-gradient(#fff3c0, #ffd96a); }
.mate-pick button > img { width: 72px; height: 72px; margin: 0 auto; }
.mate-pick .pw { display: block; font-family: var(--pix); font-size: 13px; }
.mate-pick .ord { position: absolute; top: 2px; left: 6px; font-family: var(--pix); font-size: 13px; color: var(--ink2); }
.mate-pick .rowb { position: absolute; top: 2px; right: 6px; font-size: 11px; font-weight: 800; color: var(--purple); }
.mate-main { display: grid; grid-template-columns: 148px 1fr; gap: 10px; align-items: center; }
.mate-main .big { background: radial-gradient(circle at 50% 70%, #fff 0, #efe4ff 60%, #d6c8f6); border-radius: 16px; border: 2px solid #cbc3ae; display: grid; place-items: center; height: 164px; overflow: hidden; }
.mate-main .big > img { width: 150px; height: 150px; margin-top: 10px; }
.stats { display: grid; gap: 4px; }
.stat { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.stat .bar { position: relative; height: 10px; border-radius: 5px; background: #e6dccb; overflow: hidden; border: 1px solid #cbc3ae; }
.stat .bar i { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, #8fe07a, #4f8f3c); }
.stat .bar i.plus { background: linear-gradient(90deg, #ffd96a, #f2a83a); }
.stat b { text-align: right; font-family: var(--pix); font-weight: normal; font-size: 14px; }
.power-big { font-family: var(--pix); font-size: 20px; }
.slots4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.gslot { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; border: 3px solid var(--line); background: #fff; text-align: left; min-height: 64px; box-shadow: 0 3px 0 var(--line); }
.gslot:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.gslot .gi { width: 48px; height: 48px; flex: none; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; overflow: hidden; }
.gslot .gi img { width: 42px; height: 42px; }
.gslot .gn { min-width: 0; line-height: 1.25; }
.gslot .gn small { display: block; color: var(--ink2); font-size: 11px; font-weight: 700; }
.gslot .gn b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.25; word-break: break-all; }
.gslot.empty .gn b { color: #8a806e; }
.gslot.r2 { border-color: var(--r2); } .gslot.r3 { border-color: var(--gold2); background: linear-gradient(#fffbe8, #fff1c0); }
.types { display: flex; gap: 6px; flex-wrap: wrap; }
.types button { display: flex; align-items: center; gap: 2px; border: 2px solid #cbc3ae; border-radius: 12px; background: #fff; padding: 0 8px 0 0; font-size: 12px; font-weight: 700; min-height: 44px; overflow: hidden; }
.types button[aria-pressed="true"] { border-color: var(--line); background: #fff3c0; }
.types img { width: 44px; height: 44px; margin-top: 8px; }
.cardrow { display: grid; gap: 8px; }
.cardsel { display: grid; grid-template-columns: 28px 1fr; gap: 6px; align-items: center; }
.cardsel .no { width: 28px; height: 28px; border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; font-family: var(--pix); }
.cardsel select { width: 100%; min-height: 46px; padding: 6px 36px 6px 10px; border-radius: 12px; border: 3px solid var(--line); font: inherit; font-size: 15px; font-weight: 800; color: var(--ink); -webkit-appearance: none; appearance: none; cursor: pointer; box-shadow: 0 3px 0 var(--line);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10'%3E%3Cpath d='M0 0h14L7 10z' fill='%237a5cc8'/%3E%3C/svg%3E") no-repeat right 12px center, linear-gradient(#fff, #f4ecdf); }
.cardsel .desc { grid-column: 2; font-size: 12px; color: var(--ink2); margin-top: -2px; line-height: 1.4; }
.rowtoggle { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.rowtoggle button { border: 0; padding: 6px 14px; background: #fff; font-weight: 800; min-height: 40px; }
.rowtoggle button[aria-pressed="true"] { background: var(--purple); color: #fff; }
.orderbtns { display: flex; gap: 6px; }

/* 装備の一覧 */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; border: 2px solid #cbc3ae; border-radius: 999px; padding: 4px 12px; background: #fff; font-weight: 700; font-size: 13px; min-height: 38px; }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (min-width: 420px) { .items { grid-template-columns: repeat(5, 1fr); } }
.item { position: relative; border: 3px solid var(--r1); border-radius: 12px; background: #fff; padding: 2px 2px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.item img { width: 100%; max-width: 72px; aspect-ratio: 1; }
.item.r2 { border-color: var(--r2); background: linear-gradient(#fff, #e8f0ff); }
.item.r3 { border-color: var(--gold2); background: linear-gradient(#fffbe8, #ffe9a0); box-shadow: 0 0 10px rgba(242,198,64,.55); }
.item .plus { position: absolute; top: 1px; right: 4px; font-family: var(--pix); font-size: 13px; color: var(--red); }
.item .on { position: absolute; top: 2px; left: 2px; padding: 0 4px; border-radius: 6px; background: var(--purple); color: #fff; font-size: 10px; font-weight: 800; }
.item .rar { position: absolute; bottom: 0; left: 0; right: 0; }
.item[aria-pressed="true"] { outline: 4px solid var(--red); outline-offset: -3px; }
.item:disabled { opacity: .45; }
.empty-msg { text-align: center; padding: 24px 8px; color: var(--ink2); }
.itemdetail { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: center; }
.itemdetail img { width: 72px; height: 72px; }
.itemrow { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 6px; border-radius: 12px; border: 2px solid #e6dccb; background: #fff; margin-bottom: 6px; width: 100%; text-align: left; }
.itemrow img { width: 56px; height: 56px; }
.itemrow.r2 { border-color: var(--r2); } .itemrow.r3 { border-color: var(--gold2); background: #fffbe8; }
.itemrow:disabled { opacity: .55; }
.itemrow .nm { font-weight: 800; font-size: 13px; line-height: 1.3; }
.diff { font-size: 12px; font-weight: 700; line-height: 1.4; }
.diff .up { color: var(--green); } .diff .down { color: var(--red); }
.ng { color: var(--red); font-size: 12px; font-weight: 700; }

/* ---------- ガチャ ---------- */
.machine { position: relative; text-align: center; padding: 14px 10px 12px; border-radius: 20px; border: 4px solid var(--line); background: linear-gradient(#ffeaa0, #f2a83a); box-shadow: 0 5px 0 var(--line); margin-bottom: 12px; overflow: hidden; }
.machine h2 { position: relative; font-family: var(--pix); font-weight: normal; margin: 0; font-size: 24px; color: #5a2a00; }
.machine .sub2 { position: relative; font-size: 12px; font-weight: 700; color: #5a2a00; }
.globe { position: relative; width: 160px; height: 160px; margin: 8px auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d8f0ff 35%, #9ad0ff); border: 4px solid var(--line); overflow: hidden; }
.globe .cap { position: absolute; width: 24px; height: 38px; border-radius: 12px; border: 3px solid var(--line); background: linear-gradient(var(--c1, #9a8ae0) 52%, #ffe48a 52%); transform: rotate(var(--r, 0deg)); } /* たて長のカプセル（丸い赤白のボールに見えないように。reviewer 2026-11-30 夜） */
.globe.spin .cap { animation: rattle .3s infinite alternate; }
@keyframes rattle { to { transform: translate(4px, -6px) rotate(25deg); } }
.machine .btns { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pity { position: relative; margin: 8px auto 0; max-width: 300px; font-size: 12px; font-weight: 700; color: #5a2a00; }
.pity .bar { height: 10px; border-radius: 5px; background: rgba(255,255,255,.6); border: 2px solid #5a2a00; overflow: hidden; margin-top: 2px; }
.pity .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--purple)); }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; font-size: 12px; font-weight: 700; }
.rates div { padding: 6px; border-radius: 10px; background: var(--panel2); }
.gacha-show { position: fixed; inset: 0; z-index: 70; background: radial-gradient(circle at 50% 40%, #5a4aa8, #1d1838 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.gacha-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 560px; }
@media (max-width: 520px) { .gacha-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 330px; gap: 7px; } .gacha-cards .gcard:nth-child(10) { grid-column: 2; } }
.gacha-cards.one { grid-template-columns: 1fr; max-width: 200px; }
.gcard { perspective: 600px; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; }
.gcard .in { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s; }
.gcard.open .in { transform: rotateY(180deg); }
.gcard .f, .gcard .b { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 12px; border: 3px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gcard .b { background: repeating-linear-gradient(45deg, #5b4bb8 0 10px, #4b3fa0 10px 20px); }
.gcard .b::after { content: '?'; font-family: var(--pix); font-size: 28px; color: #ffe48a; }
.gcard.r3 .b { box-shadow: 0 0 18px rgba(255,214,90,.9); }
.gcard .f { transform: rotateY(180deg); background: #fff; padding: 4px; text-align: center; color: var(--ink); }
.gcard .f img { width: 70%; max-width: 96px; aspect-ratio: 1; height: auto; }
.gcard .f small { font-size: 11px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.gcard .f .rar { font-size: 13px; }
.gcard.r2 .f { background: linear-gradient(#fff, #d8e6ff); border-color: var(--r2); }
.gcard.r3 .f { background: linear-gradient(#fffbe8, #ffd96a); border-color: var(--gold2); box-shadow: 0 0 24px rgba(255,214,90,.9); }
.gcard.r3.open { animation: glow 1s ease-out; }
@keyframes glow { 0% { filter: brightness(2.2); } 100% { filter: none; } }
.gacha-show-ctrl { display: flex; gap: 10px; margin-top: 16px; }
.synthbox { display: grid; grid-template-columns: 1fr auto 1fr auto 0.8fr; gap: 4px; align-items: center; text-align: center; }
.synthbox .sl { border: 3px dashed #cbc3ae; border-radius: 14px; min-height: 110px; display: grid; place-items: center; background: #fff; padding: 4px; font-size: 12px; font-weight: 700; color: var(--ink2); }
.synthbox .sl img { width: 72px; height: 72px; margin: 0 auto; }
.synthbox .op { font-family: var(--pix); font-size: 30px; color: var(--purple); }
.synthbox .res { border: 3px solid var(--gold2); border-radius: 14px; min-height: 110px; display: grid; place-items: center; background: linear-gradient(#fffbe8, #ffe9a0); font-family: var(--pix); font-size: 30px; color: var(--gold2); }
.synthbox .sl img { width: 60px !important; height: 60px !important; }
.synth-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.synth-btns .why { display: block; min-height: 16px; margin-top: 4px; font-size: 12px; text-align: center; color: #9a3a20; font-weight: 700; }
.synth-btns .sub { display: block; margin-top: 4px; font-size: 12px; text-align: center; color: #5a4a3a; }
details.rules summary { cursor: pointer; font-weight: 800; list-style: none; } details.rules summary::-webkit-details-marker { display: none; }
details.rules summary::before { content: '？ '; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: var(--purple); color: #fff; font-size: 13px; }

/* ---------- バトル ---------- */
.rival { display: grid; grid-template-columns: 76px 1fr; gap: 8px; align-items: center; }
.rival .face { width: 76px; height: 76px; border-radius: 14px; background: radial-gradient(circle at 50% 70%, #fff, #efe4ff 70%); border: 2px solid #cbc3ae; overflow: hidden; display: grid; place-items: center; }
.rival .face img { width: 96px; height: 96px; margin-top: 14px; }
.rival .line { font-size: 13px; }
.mini-team { display: flex; gap: 4px; margin: 6px 0; }
.mini-team .mm { display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 4px; border-radius: 8px; background: var(--panel2); flex: 1; min-width: 0; }
.mini-team .mm img { width: 48px; height: 48px; }
.mini-team .mm .cs { color: var(--ink2); max-width: 100%; text-align: center; line-height: 1.3; margin-top: 2px; }
.mini-team .mm .cs i { display: block; font-style: normal; color: var(--ink); }
.weekbox { padding: 10px; border-radius: 12px; background: var(--panel2); margin: 6px 0; font-size: 13px; }
.games { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.games li { padding: 8px; border-radius: 12px; background: #fff; border: 2px solid #e6dccb; font-size: 13px; }
.games li.win { border-color: var(--green); } .games li.lose { border-color: #e6b0a0; }
.games .res { font-family: var(--pix); font-size: 15px; }
.scout { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; font-size: 13px; }
.scout li { padding: 8px; border-radius: 12px; background: #fff; border: 2px solid #e6dccb; }
.predict { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.stamprow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 12px; }
.stamprow select { min-height: 38px; border-radius: 10px; border: 2px solid #cbc3ae; font: inherit; font-size: 13px; }
.msg { min-height: 1.2em; font-size: 13px; font-weight: 700; color: var(--green); }
.msg.err { color: var(--red); }

/* 試合の再生（全画面） */
.arena-wrap { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: linear-gradient(#1d1838, #2b2350 40%, #4a347a 60%, #6a4ab0); color: #fff; }
.arena-wrap > *:not(.result-back) { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
.arena-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.arena-top h2 { flex: 1; margin: 0; font-family: var(--pix); font-weight: normal; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arena-turn { font-size: 12px; color: #c9c0ee; white-space: nowrap; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 2px solid currentColor; background: rgba(255,255,255,.12); font-size: 20px; line-height: 1; padding: 0; flex: none; }
.sheet .x { color: var(--ink); background: var(--panel2); }
.arena { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 8px; position: relative; min-height: 0; }
.side { display: flex; justify-content: center; gap: 4px; align-items: flex-end; }
.side-b { flex-direction: row-reverse; align-items: flex-start; }
.unit { position: relative; flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; transition: transform .25s, opacity .3s; }
.unit .sprbox { position: relative; }
.unit img.ch { width: 124px; height: 124px; }
.side-b .unit img.ch { transform: scaleX(-1); }
.side-a .unit.back { transform: translateY(14px) scale(.86); } .side-b .unit.back { transform: translateY(-14px) scale(.86); }
.unit.acting .sprbox::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: 4px; height: 14px; border-radius: 50%; background: rgba(255,228,138,.9); filter: blur(4px); z-index: -1; }
.unit.down { opacity: .4; filter: grayscale(.8); }
.unit.hit .sprbox { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.side-a .unit.lunge .sprbox { animation: lungeA .4s; }
.side-b .unit.lunge .sprbox { animation: lungeB .4s; }
@keyframes lungeA { 40% { transform: translateY(-18px); } }
@keyframes lungeB { 40% { transform: translateY(18px); } }
.uname { font-size: 13px; color: #fff; font-weight: 800; display: flex; gap: 3px; align-items: center; justify-content: center; flex-wrap: wrap; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000; }
.hpbar { width: 92%; height: 12px; border-radius: 6px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.5); overflow: hidden; }
.hpbar i { display: block; height: 100%; background: linear-gradient(90deg, #8fe07a, #4fc04f); transition: width .35s; }
.hpbar i.low { background: linear-gradient(90deg, #ff9a7a, #e0603e); }
.unit .row { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000; }
.unit .badges { font-size: 11px; font-weight: 700; min-height: 14px; color: #ffe48a; }
.pop { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-family: var(--pix); font-size: 22px; color: #fff; text-shadow: 0 2px 0 #b03a20, 0 0 6px #000; animation: popup .9s ease-out forwards; pointer-events: none; z-index: 5; }
.pop.heal { color: #b8ffb0; text-shadow: 0 2px 0 #2f5a2a, 0 0 6px #000; }
@keyframes popup { from { transform: translate(-50%, 0) scale(1.2); opacity: 1; } to { transform: translate(-50%, -34px); opacity: 0; } }
.banner { position: relative; z-index: 2; min-height: 48px; margin: 2px 0; padding: 5px 10px; border-radius: 14px; background: rgba(29,24,56,.85); border: 2px solid #8a7ad8; text-align: center; font-size: 16px; font-weight: 800; line-height: 1.45; }
.banner .cardname { display: inline-block; padding: 2px 12px; border-radius: 10px; background: linear-gradient(#ffd96a, #f2a83a); color: var(--ink); font-family: var(--pix); font-weight: normal; font-size: 16px; box-shadow: 0 3px 0 #6a3a10; animation: cardIn .3s ease-out; }
@keyframes cardIn { from { transform: scale(.6) rotate(-6deg); opacity: 0; } }
.banner .adv { display: inline-flex; gap: 2px; align-items: center; font-size: 12px; padding: 0 6px; border-radius: 8px; margin: 2px; }
.banner .adv.good { background: rgba(79,192,79,.35); } .banner .adv.bad { background: rgba(224,96,62,.35); }
.banner .yomi { display: inline-block; margin: 2px; padding: 0 8px; border-radius: 8px; background: #d0502e; color: #fff; }
.banner .yomi.hit { background: #3f7f2c; }
.arena-ctrl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 10px calc(10px + var(--safe-b)); }
.arena-ctrl button { min-height: 48px; border-radius: 14px; border: 3px solid #1a1430; background: linear-gradient(#5a4aa8, #3b2f78); color: #fff; font-weight: 800; box-shadow: 0 4px 0 #1a1430; transition: transform .06s, box-shadow .06s; }
.arena-ctrl button:active { transform: translateY(3px); box-shadow: 0 1px 0 #1a1430; }
.arena-ctrl #btnSkip { background: linear-gradient(#ffe48a, #f2a83a); color: var(--ink); }
.arena-wrap .log { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(72px + var(--safe-b)); max-height: 42vh; overflow: auto; margin: 0; padding: 8px 8px 8px 28px; background: rgba(255,250,240,.97); color: var(--ink); border-radius: 14px; font-size: 12px; width: calc(100% - 20px); max-width: 620px; z-index: 4; }
.log li.me { color: var(--blue); font-weight: 700; }
.result-back { position: absolute; inset: 0; z-index: 8; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.result { width: 100%; max-width: 420px; background: var(--panel); color: var(--ink); border: 4px solid var(--line); border-radius: 20px; padding: 16px; text-align: center; animation: cardIn .3s ease-out; max-height: 88vh; overflow: auto; }
.result .big { font-family: var(--pix); font-weight: normal; font-size: 36px; margin: 0; color: var(--red); line-height: 1.3; }
.result.win .big { color: var(--green); }
.result ul { text-align: left; font-size: 13px; padding-left: 20px; margin: 6px 0; }
.result .meta { font-size: 10px; color: var(--ink2); }
.result .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

/* ---------- 下から出る画面 ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; z-index: 51; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 520px; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--panel); border-radius: 22px 22px 0 0; border: 3px solid var(--line); border-bottom: 0; padding: 4px 12px calc(12px + var(--safe-b)); animation: sheetUp .25s ease-out; }
.sheet.tall { max-height: 90vh; }
@keyframes sheetUp { from { transform: translate(-50%, 100%); } }
.sheet-grip { width: 48px; height: 5px; border-radius: 3px; background: #cbc3ae; margin: 4px auto; }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sheet-head h2 { flex: 1; margin: 0; font-family: var(--pix); font-weight: normal; font-size: 18px; }
.sheet-body { overflow: auto; padding-bottom: 6px; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; padding: 10px 16px; border-radius: 14px; background: rgba(29,24,56,.96); color: #fff; font-weight: 700; font-size: 14px; border: 2px solid #8a7ad8; animation: fadeUp .2s; }
.toast.err { border-color: var(--red); background: #5a1a10; }

/* あそびかた */
.wheel { position: relative; width: 240px; height: 240px; margin: 0 auto; }
.wheel svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wheel .arrows line { stroke: var(--ink2); stroke-width: 1.4; }
.wheel .arrows path { fill: var(--ink2); }
.wheel .node { position: absolute; transform: translate(-50%, -50%); text-align: center; font-size: 12px; line-height: 1.2; }
.wheel .node img { width: 32px; height: 32px; margin: 0 auto; }
.wheel .node small { display: block; color: var(--ink2); font-size: 10px; }
.howto { padding-left: 20px; font-size: 14px; }
.howto li { margin: 4px 0; }
.cardtable { display: grid; gap: 6px; font-size: 12px; }
.cardtable div { padding: 6px 8px; border-radius: 10px; background: var(--panel2); }

/* ホームのいちばん大事な1手（大きいボタン） */
.hero { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px; margin: 0 0 14px; padding: 6px 12px; border-radius: 18px; border: 3px solid var(--line); background: linear-gradient(#ffe48a, #f2a83a); color: var(--ink); font-size: 19px; font-weight: 900; line-height: 1.2; box-shadow: 0 5px 0 var(--line); animation: heroPulse 1.6s ease-in-out infinite; }
.hero.go { background: linear-gradient(#8fe07a, #4f8f3c); color: #fff; text-shadow: 0 2px 0 #2f5a2a; }
.hero img { width: 40px; height: 40px; flex: none; }
.hero small { display: block; font-size: 12px; font-weight: 700; opacity: .9; }
.hero:active { transform: translateY(4px) scale(.98); box-shadow: 0 1px 0 var(--line); animation: none; }
@keyframes heroPulse { 50% { transform: scale(1.04); } }
.quest-mini .card { padding: 8px 10px; margin-bottom: 8px; }
.quest-mini .quest .qi img { width: 40px; height: 40px; }
/* スマホより広い画面：外側にも夜空の星（designer の指摘） */
@media (min-width: 521px) { body { background-image: radial-gradient(2px 2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 85% 22%, #ffe48a 50%, transparent 51%), radial-gradient(1.5px 1.5px at 30% 70%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 72% 64%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 82%, #ffe48a 50%, transparent 51%), radial-gradient(2px 2px at 6% 88%, #fff 50%, transparent 51%), radial-gradient(circle at 20% 10%, #3a2f6b 0, transparent 40%), radial-gradient(circle at 80% 90%, #2f4a6b 0, transparent 45%); background-size: 420px 420px, 380px 380px, 300px 300px, 460px 460px, 340px 340px, 400px 400px, 100% 100%, 100% 100%; } }
@media (min-width: 900px) {
  body { padding: 16px 0; }
  .app { max-width: 480px; }
  .app { border-radius: 22px; overflow: hidden; min-height: calc(100vh - 32px); }
  .hud { top: 16px; border-radius: 22px 22px 0 0; }
  .tabbar { bottom: 16px; border-radius: 0 0 22px 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 440px) {
  .stage-team .mate > img { width: 106px; height: 106px; } .stage-team .mate:nth-child(2) > img { width: 132px; height: 132px; }
}
@media (max-width: 360px) {
  .stage-team .mate > img { width: 92px; height: 92px; } .stage-team .mate:nth-child(2) > img { width: 112px; height: 112px; }
  .unit img.ch { width: 84px; height: 84px; } .mate-main { grid-template-columns: 116px 1fr; } .mate-main .big > img { width: 120px; height: 120px; }
  .hud-name small { display: none; }
}
/* 図鑑 */
.dexbar { display: block; width: 100%; text-align: left; cursor: pointer; background: linear-gradient(#fff3c0, #ffe48a); }
.dexbar:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43,32,51,.35); }
.dexbar .bar { display: block; height: 10px; margin-top: 6px; border-radius: 6px; background: rgba(0,0,0,.15); overflow: hidden; }
.dexbar .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--purple)); }
.dex { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-bottom: 10px; }
.dx { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; border: 2px solid #cbc3ae; background: #fff; }
.dx img { width: 80%; height: auto; }
.dx i { position: absolute; bottom: 0; right: 3px; font-style: normal; font-size: 9px; color: var(--gold2); }
.dx { box-shadow: 0 0 8px rgba(242,198,64,.45); } .dx.r2 { border-color: var(--r2); } .dx.r3 { border-color: var(--gold2); background: #fffbe8; box-shadow: 0 0 10px rgba(242,198,64,.8); }
.dx.no { background: var(--panel2); border-color: #ddd3c0; box-shadow: none; } .dx.no img { filter: brightness(0); opacity: .18; } .dx.no i { color: #b8ad98; }
/* ガチャの NEW! */
.newb { position: absolute; top: 4px; left: 4px; padding: 0 6px; border-radius: 8px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; transform: rotate(-8deg); box-shadow: 0 2px 0 #7a2a10; }
/* 図鑑の見出しの進み具合 */
.dexh { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; } .dexh b { white-space: nowrap; } .dexh .bar { flex: 1; height: 8px; border-radius: 5px; background: rgba(0,0,0,.12); overflow: hidden; } .dexh .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--purple)); }
/* 今週の課題・図鑑の目標 */
.weekq h3 .small { font-weight: 700; margin-left: 4px; }
.goalrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed #d8ccb4; }
.goalrow:first-of-type { border-top: 0; }
.goalrow .gname { font-size: 14px; font-weight: 700; min-width: 0; }
.goalrow .bar { display: block; height: 8px; margin-top: 4px; border-radius: 5px; background: rgba(0,0,0,.12); overflow: hidden; }
.goalrow .bar i { display: block; height: 100%; background: linear-gradient(90deg, #8fe07a, #4f8f3c); }
.goalrow.taken { opacity: .6; }
.donemark { display: inline-grid; place-items: center; width: 40px; height: 32px; border-radius: 10px; background: var(--green); color: #fff; font-weight: 900; }