/* モンスターすごろく：夜のテーブルに広げたボードゲーム。色は土地と属性から */
:root {
  --table: #1B1F3B;
  --table2: #262B52;
  --table3: #323870;
  --ink: #F5F3FF;
  --soft: #AEB1DA;
  --gold: #F6C34A;
  --gold-deep: #B9821C;
  --line: rgba(255, 255, 255, 0.12);
  --good: #6FE39A;
  --bad: #FF7B6B;
  --display: 'Dela Gothic One', 'Hiragino Sans', sans-serif;
  --body: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% 0%, #2C3270 0%, var(--table) 60%) fixed, var(--table);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  line-height: 1.6;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
a { color: var(--gold); }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* 動き出す前の説明（JavaScript を動かさない読み取りにも、中身が見えるように） */
.prerender { padding: 24px 16px; font-size: 15px; line-height: 1.8; }
.prerender h1 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 0 8px; }
.prerender h2 { font-size: 17px; margin: 20px 0 6px; }
.prerender ol, .prerender ul { padding-left: 1.2em; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 0;
  font-weight: 800; font-size: 16px; letter-spacing: 0.02em;
  transition: transform 0.12s, filter 0.12s;
}
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn.primary { background: linear-gradient(180deg, #FFD866, var(--gold)); color: #3A2600; box-shadow: 0 4px 0 var(--gold-deep), 0 8px 18px rgba(0, 0, 0, 0.35); }
.btn.primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--gold-deep); }
.btn.primary:disabled { filter: grayscale(0.8) brightness(0.7); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); border: 1.5px solid var(--line); }
.btn.sub { background: var(--table3); box-shadow: 0 3px 0 #171A36; }
.btn.big { min-height: 60px; font-size: 19px; font-family: var(--display); font-weight: 400; letter-spacing: 0.06em; }
.iconBtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); }
.iconBtn svg { width: 22px; height: 22px; }
.linkBtn { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 4px; }

.topBar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 12px 16px 4px; }
.topTitle { margin: 0; text-align: center; font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: 0.06em; }
.page { padding-bottom: 40px; }
.hintText { margin: 8px 16px; font-size: 13px; color: var(--soft); text-align: center; }
.secTitle { margin: 22px 16px 10px; font-size: 16px; }
.empty { color: var(--soft); text-align: center; grid-column: 1 / -1; }
.warn { margin: 8px 16px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 123, 107, 0.14); color: #FFC3BA; font-size: 14px; }

/* ---- カード ---- */
.card {
  --ca: #888; --cb: #444;
  position: relative; display: flex; flex-direction: column;
  border-radius: 10px; padding: 4px;
  background: linear-gradient(160deg, var(--ca), var(--cb));
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45), 0 6px 14px rgba(0, 0, 0, 0.35);
  color: #fff; text-align: left; user-select: none; -webkit-user-select: none;
}
.card.mini { width: 100%; aspect-ratio: 5 / 7.4; }
.card.big { width: 168px; }
.card .cardTop { display: flex; align-items: center; gap: 3px; min-height: 18px; padding: 0 2px 3px; }
.card .attrIcon { width: 14px; height: 14px; flex: none; color: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.card .attrIcon svg { width: 100%; height: 100%; display: block; }
.card .cardName { font-size: 9.5px; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.card .cardArt { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #111; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.5); }
.card .artImg, .card .artSvg { width: 100%; height: 100%; display: block; object-fit: cover; }
.card .cardFoot { display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; margin-top: auto; padding: 3px 2px 0; }
.card .stars { font-size: 7px; letter-spacing: -0.5px; color: #FFE27A; text-shadow: 0 0 2px rgba(0, 0, 0, 0.8); white-space: nowrap; overflow: hidden; }
.card .kindTag { font-size: 9px; font-weight: 800; padding: 0 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); }
.card .atk { font-family: var(--display); font-size: 14px; line-height: 1; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 0 6px rgba(0, 0, 0, 0.4); }
.card .atk small { font-family: var(--body); font-size: 8px; font-weight: 800; margin-right: 1px; opacity: 0.85; }
.card.big { padding: 6px; border-radius: 14px; }
.card.big .cardName { font-size: 14px; }
.card.big .attrIcon { width: 18px; height: 18px; }
.card.big .stars { font-size: 11px; }
.card.big .atk { font-size: 24px; }
.card.big .atk small { font-size: 11px; }
.card .cardText { margin-top: 6px; padding: 6px 7px; border-radius: 8px; background: rgba(12, 10, 30, 0.55); font-size: 11.5px; line-height: 1.5; }
.card .cardText p { margin: 0; }
.card .cardText .abil { font-weight: 800; color: #FFE7A0; margin-bottom: 3px; }
.card .cardText .flavor { color: #DCDDF5; }
/* めずらしさ：レアは銀、スーパーレア・ウルトラレアは金の縁と光 */
.card.r-R { box-shadow: 0 0 0 2px #D8E0F0, 0 6px 14px rgba(0, 0, 0, 0.35); }
.card.r-SR { box-shadow: 0 0 0 2.5px #F6C34A, 0 0 14px rgba(246, 195, 74, 0.45), 0 6px 14px rgba(0, 0, 0, 0.35); }
.card.r-UR { box-shadow: 0 0 0 3px #FFE9A8, 0 0 22px rgba(255, 214, 102, 0.7), 0 6px 14px rgba(0, 0, 0, 0.35); }
.card.r-SR .cardArt::after, .card.r-UR .cardArt::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.75) 45%, transparent 60%) 0 0 / 250% 100%;
  animation: foil 3.2s ease-in-out infinite;
}
@keyframes foil { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.card.back { background: repeating-linear-gradient(45deg, #3B2F7A 0 8px, #33296B 8px 16px); box-shadow: 0 0 0 2px #F6C34A, 0 6px 14px rgba(0, 0, 0, 0.4); }
.card.big.back { aspect-ratio: 5 / 7.4; }
.card .backFace { position: absolute; inset: 8px; border-radius: 8px; border: 2px solid rgba(246, 195, 74, 0.6); background: radial-gradient(circle, rgba(246, 195, 74, 0.35) 0 18%, transparent 19%); }
.card.locked { background: #2A2F58; box-shadow: inset 0 0 0 1.5px var(--line); }
.card .lockFace { flex: 1; display: grid; place-items: center; font-family: var(--display); font-size: 26px; color: rgba(255, 255, 255, 0.18); }
.newBadge { position: absolute; top: -11px; right: -6px; padding: 0 6px; border-radius: 8px; background: #FF4F7B; color: #fff; font-size: 10px; font-weight: 800; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); }
.countBadge { position: absolute; top: 20px; right: 5px; padding: 0 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); font-size: 10px; font-weight: 800; }

.cardGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; padding: 0 16px; }
.cardBtn { position: relative; padding: 0; border: 0; background: none; text-align: center; }
.cardBtn.inDeck .card { outline: 3px solid var(--gold); outline-offset: 2px; }
.cardBtn .inCount { display: block; min-height: 16px; margin-top: 3px; font-size: 10px; font-weight: 800; color: var(--gold); }

/* ---- ホーム ---- */
.home { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 24px; }
.logo { text-align: center; margin-top: 4px; }
.logoSmall { display: block; font-size: 13px; color: var(--soft); letter-spacing: 0.14em; }
.logoMain {
  display: block; font-family: var(--display); font-size: 44px; line-height: 1.08; letter-spacing: 0.02em;
  background: linear-gradient(180deg, #FFF3C4 10%, #FFC93E 55%, #F08A24 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #6B3A0A) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}
.fan { position: relative; height: 196px; margin: 18px auto 6px; width: 260px; }
.fanCard { position: absolute; left: 50%; bottom: 0; width: 104px; transform-origin: 50% 120%; }
.fanCard.f0 { transform: translateX(-50%) translateY(-10px); z-index: 2; }
.fanCard.f1 { transform: translateX(-50%) rotate(-14deg) translateX(-30px); }
.fanCard.f2 { transform: translateX(-50%) rotate(14deg) translateX(30px); }
.homeBtns { display: grid; gap: 10px; padding: 0 24px; margin-top: 14px; }
.homeRow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.homeRow small { font-size: 12px; color: var(--soft); margin-left: 4px; }
.homeStats { text-align: center; color: var(--soft); font-size: 13px; margin: 16px 0 0; }
.homeFoot { text-align: center; font-size: 13px; margin: auto 0 0; padding-top: 16px; }

/* 難しさ */
.levelList { display: grid; gap: 12px; padding: 8px 16px; }
.levelCard { display: grid; gap: 4px; text-align: left; padding: 16px 18px; border-radius: 18px; border: 0; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.levelCard.lv1 { background: linear-gradient(135deg, #5DBE5A, #2E8C55); }
.levelCard.lv2 { background: linear-gradient(135deg, #3BA0E6, #2A5FB8); }
.levelCard.lv3 { background: linear-gradient(135deg, #9A6BE0, #4E2C93); }
.levelCard:disabled { filter: grayscale(0.85) brightness(0.6); }
.lvName { font-family: var(--display); font-size: 24px; letter-spacing: 0.06em; }
.lvDesc { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.lvDesc svg { width: 16px; height: 16px; flex: none; }

/* ---- すごろく ---- */
.bv { height: 100dvh; display: flex; flex-direction: column; }
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 10px 4px; }
.pChip { position: relative; padding: 6px 8px 5px 22px; border-radius: 12px; background: var(--table2); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 12px; line-height: 1.3; }
.pChip.me { box-shadow: inset 0 0 0 2px var(--tc); }
.pChip.done { opacity: 0.6; }
.pDot { position: absolute; left: 8px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 0 2px var(--table); }
.pName { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pStats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: center; gap: 2px; }
.stat svg { width: 13px; height: 13px; }
.stat b { font-weight: 800; }
.levelTag { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 0 12px; font-size: 11px; color: var(--soft); }
.levelTag .linkBtn { font-size: 12px; }
.boardWrap { flex: 1; overflow-y: auto; overscroll-behavior: contain; position: relative; scrollbar-width: none; }
.boardWrap::-webkit-scrollbar { display: none; }
.boardSvg { width: 100%; display: block; }
.roads line { stroke: #F3E3B8; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 1 13; opacity: 0.7; }
.sq .sqRing { fill: rgba(0, 0, 0, 0.35); }
.sq .sqFace { stroke: rgba(255, 255, 255, 0.85); stroke-width: 2.5; }
.sq.t-start .sqFace { fill: #4C5BD4; }
.sq.t-wild .sqFace { fill: #E2513D; }
.sq.t-event .sqFace { fill: #8E62D8; }
.sq.t-chest .sqFace { fill: #E59B1E; }
.sq.t-town .sqFace { fill: #1FA58A; }
.sq.t-duel .sqFace { fill: #D93A7A; }
.sq.t-goal .sqFace { fill: #E5B52C; }
.sq.choice .sqRing { fill: var(--gold); animation: pulse 0.9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.sq.landed .sqRing { fill: #fff; animation: pulse 0.3s ease-in-out 3 alternate; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { to { transform: scale(1.25); } }
.token { transition: transform 0.22s cubic-bezier(.3, 1.5, .5, 1); }
.token.hop .tokenBody { animation: hop 0.24s ease-out; }
@keyframes hop { 40% { transform: translateY(-10px); } }

.panel {
  min-height: 112px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #2C3268, #222750); border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); max-height: 62dvh; overflow-y: auto;
}
.panel.in { animation: rise 0.28s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.pTitle { margin: 0; font-family: var(--display); font-size: 20px; letter-spacing: 0.04em; }
.pSub { margin: 2px 0 0; color: var(--soft); font-size: 14px; }
.pKicker { margin: 0; font-size: 12px; font-weight: 800; color: var(--gold); letter-spacing: 0.12em; }
.pText { margin: 4px 0 8px; font-size: 16px; font-weight: 800; }
.rollBox { display: flex; align-items: center; gap: 16px; }
.dieBtn { width: 84px; height: 84px; flex: none; padding: 0; border: 0; background: none; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); animation: wobble 1.6s ease-in-out infinite; }
.dieBtn:disabled { animation: none; }
.dieBtn.spin { transform: rotate(18deg) scale(0.94); }
.dieBtn svg { width: 100%; height: 100%; }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-3px); } }
.branchBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.route { flex-direction: column; gap: 0; min-height: 68px; color: #fff; }
.route small { font-weight: 500; font-size: 12px; opacity: 0.9; }
.route.reg-forest { background: linear-gradient(135deg, #3FA65E, #1F6B40); box-shadow: 0 4px 0 #134A2B; }
.route.reg-volcano { background: linear-gradient(135deg, #E2643A, #A3341C); box-shadow: 0 4px 0 #6B2010; }
.route.reg-castle { background: linear-gradient(135deg, #9A85CC, #5A4790); box-shadow: 0 4px 0 #3A2C66; }
.route.reg-lake, .route.reg-grass { background: linear-gradient(135deg, #3BA0E6, #2A5FB8); box-shadow: 0 4px 0 #1B3E7A; }
.evBox { display: grid; gap: 4px; }
.evBox .btn { margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: 14px; background: rgba(255, 255, 255, 0.1); }
.chip svg { width: 16px; height: 16px; }
.chip.up { color: var(--good); }
.chip.down { color: var(--bad); }
.gotCard { width: 96px; margin: 4px auto 0; animation: pop 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(0.4) rotate(-10deg); opacity: 0; } }
.shopRow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.offer { display: grid; gap: 4px; padding: 0; border: 0; background: none; }
.offer:disabled { opacity: 0.45; }
.price { display: inline-flex; align-items: center; justify-content: center; gap: 3px; font-weight: 800; }
.price svg { width: 15px; height: 15px; }

/* ---- バトル ---- */
.battle {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  max-width: 480px; margin: 0 auto;
  background: radial-gradient(90% 50% at 50% 45%, rgba(255, 255, 255, 0.08), transparent 70%), linear-gradient(180deg, #2A1E4E, #141632);
  opacity: 0; transform: scale(1.04); transition: opacity 0.25s, transform 0.25s;
}
.battle.open { opacity: 1; transform: none; }
.battle.reg-grass { --rg: #6BC25A; } .battle.reg-forest { --rg: #2E8C55; } .battle.reg-volcano { --rg: #D2552D; } .battle.reg-lake { --rg: #3596DD; } .battle.reg-castle { --rg: #8A78B8; }
.battle::before { content: ''; position: absolute; inset: 0; background: radial-gradient(70% 30% at 50% 0%, var(--rg), transparent 70%); opacity: 0.45; pointer-events: none; }
.bHead { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.bFoe { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bPortrait { width: 48px; height: 48px; flex: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2.5px var(--rg, #fff); display: grid; place-items: center; background: #333; font-weight: 800; }
.bPortrait svg, .bPortrait img { width: 100%; height: 100%; object-fit: cover; }
.bKind { margin: 0; font-size: 11px; color: var(--soft); }
.bName { margin: 0; font-weight: 800; font-size: 15px; line-height: 1.3; }
.bScore { display: grid; justify-items: center; gap: 2px; flex: none; }
.bRound { font-size: 11px; color: var(--soft); }
.pips { display: flex; gap: 4px; }
.pips i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3); }
.foePips i.on { background: #FF6B5B; }
.myPips i.on { background: var(--gold); }
.field { position: relative; flex: 1; display: grid; grid-template-rows: 1fr auto 1fr; align-items: center; justify-items: center; min-height: 0; padding: 0 12px; }
.lane { position: relative; display: flex; align-items: center; gap: 10px; transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.slot.mon { width: 120px; min-height: 10px; }
.slot.mon .card.big { width: 120px; }
.slot.mon .card .cardText { display: none; }
.slot.sup { width: 64px; }
.slot .card[data-flip] { animation: flip 0.45s ease-out; }
@keyframes flip { from { transform: rotateY(90deg) scale(0.9); } }
.slot.adv .card { box-shadow: 0 0 0 3px #fff, 0 0 26px 6px var(--ca); }
.pow { position: absolute; right: -64px; min-width: 60px; text-align: center; font-family: var(--display); font-size: 28px; opacity: 0; transform: scale(0.6); transition: opacity 0.2s, transform 0.25s cubic-bezier(.3, 1.8, .5, 1); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.pow.show { opacity: 1; transform: none; }
.foeLane .pow { color: #FFB1A8; }
.myLane .pow { color: #FFE58A; }
.vs { font-family: var(--display); font-size: 22px; color: rgba(255, 255, 255, 0.35); }
.bNote { position: absolute; left: 0; right: 0; bottom: 4px; margin: 0; text-align: center; font-size: 13px; font-weight: 800; color: #FFE7A0; min-height: 20px; }
.field.winA .myLane { transform: translateY(-14px) scale(1.06); }
.field.winA .foeLane { animation: shake 0.4s; opacity: 0.5; }
.field.winB .foeLane { transform: translateY(14px) scale(1.06); }
.field.winB .myLane { animation: shake 0.4s; opacity: 0.5; }
.field.tie .lane { opacity: 0.7; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.handArea { position: relative; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(10, 10, 30, 0.55); border-radius: 20px 20px 0 0; }
.hint { margin: 0 0 6px; text-align: center; font-size: 12px; color: var(--soft); }
.hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.hand:has(.card:nth-child(6)) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.hand .card { transition: transform 0.18s, opacity 0.2s; cursor: pointer; }
.hand .card.picked { transform: translateY(-12px); box-shadow: 0 0 0 3px #fff, 0 10px 20px rgba(0, 0, 0, 0.5); }
.hand .card.gone { opacity: 0; transform: translateY(-40px) scale(0.8); }
.bBtns { margin-top: 10px; display: grid; }
.bEnd { position: relative; display: grid; justify-items: center; gap: 4px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: rgba(10, 10, 30, 0.7); border-radius: 20px 20px 0 0; animation: rise 0.3s cubic-bezier(.2, 1.2, .4, 1); }
.endTitle { margin: 0; font-family: var(--display); font-size: 32px; letter-spacing: 0.06em; }
.bEnd.win .endTitle { color: var(--gold); text-shadow: 0 0 18px rgba(246, 195, 74, 0.6); }
.bEnd.lose .endTitle { color: #C9CBEF; }
.endLine { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 800; }
.endLine .stat svg { width: 18px; height: 18px; }
.endCard { animation: pop 0.5s cubic-bezier(.2, 1.6, .4, 1); }
.endCard .card.big { width: 140px; }
.endBtn { width: 100%; margin-top: 8px; }

/* ---- 結果・デッキ・図鑑 ---- */
.ranking { list-style: none; margin: 8px 16px; padding: 0; display: grid; gap: 8px; }
.ranking li { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'rank name score' 'rank detail detail'; column-gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--table2); box-shadow: inset 4px 0 0 var(--tc); }
.ranking li.me { background: linear-gradient(90deg, rgba(246, 195, 74, 0.22), var(--table2)); }
.ranking .rank { grid-area: rank; font-family: var(--display); font-size: 22px; }
.ranking .rName { grid-area: name; font-weight: 800; }
.ranking .rScore { grid-area: score; font-size: 13px; }
.ranking .rScore b { font-family: var(--display); font-size: 20px; font-weight: 400; margin-right: 2px; }
.ranking .rDetail { grid-area: detail; display: flex; gap: 10px; font-size: 13px; color: var(--soft); align-items: center; }
.ranking em { font-style: normal; color: var(--gold); font-weight: 800; }
.unlock { margin: 12px 16px; padding: 12px; border-radius: 14px; text-align: center; font-weight: 800; background: linear-gradient(90deg, #6C4BD6, #3E7BE0); animation: pop 0.5s; }
.resultBtns, .deckBtns { display: grid; gap: 10px; padding: 20px 16px 0; }
.deckBtns { position: sticky; bottom: 0; grid-template-columns: 1fr 1.4fr; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--table) 30%); }
.deckMeter { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin: 8px 16px 0; padding: 10px 14px; border-radius: 14px; background: var(--table2); font-size: 14px; }
.deckMeter b { font-family: var(--display); font-weight: 400; font-size: 22px; margin-right: 2px; }
.deckMeter b.bad { color: var(--bad); }
.mLabel { display: block; font-size: 11px; color: var(--soft); }
.starMeter .bar { display: block; height: 6px; margin-top: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.starMeter .bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFE27A, #F08A24); }
.deckMsg { margin: 8px 16px 4px; font-size: 13px; font-weight: 800; }
.deckMsg.good { color: var(--good); }
.deckMsg.bad { color: var(--bad); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 16px; scrollbar-width: none; }
.tabs button { flex: none; padding: 6px 12px; border-radius: 999px; border: 0; background: var(--table2); font-size: 13px; font-weight: 800; color: var(--soft); }
.tabs button[aria-selected="true"] { background: var(--gold); color: #3A2600; }
.zukanCount { text-align: center; margin: 4px 0 12px; color: var(--soft); }
.zukanCount b { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--ink); }

/* ---- 大きく見る・お知らせ・音を聞く ---- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(6, 6, 20, 0.75); opacity: 0; transition: opacity 0.2s; }
.modal.open { opacity: 1; }
.modalBox { display: grid; justify-items: center; gap: 10px; }
.cardModal .card.big { width: min(260px, 70vw); }
.cardMeta { margin: 0; font-size: 13px; color: var(--soft); }
.toast { position: fixed; left: 50%; bottom: calc(130px + env(safe-area-inset-bottom)); z-index: 70; max-width: min(420px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 14px; background: rgba(12, 12, 32, 0.92); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); font-size: 14px; font-weight: 800; transform: translate(-50%, 16px); opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.soundAsk { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(6, 6, 20, 0.75); opacity: 0; transition: opacity 0.25s; }
.soundAsk.open { opacity: 1; }
.saBox { width: 100%; max-width: 340px; padding: 20px 18px 18px; border-radius: 22px; background: linear-gradient(180deg, #333A7A, #1F2350); box-shadow: 0 0 0 1.5px rgba(246, 195, 74, 0.4), 0 20px 50px rgba(0, 0, 0, 0.5); text-align: center; transform: scale(0.94); transition: transform 0.25s cubic-bezier(.2, 1.4, .4, 1); }
.soundAsk.open .saBox { transform: none; }
.saCard { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px var(--gold); }
.saCard svg, .saCard img { width: 100%; height: 100%; display: block; object-fit: cover; }
.saTitle { margin: 10px 0 0; font-family: var(--display); font-size: 20px; color: var(--gold); letter-spacing: 0.04em; }
.saNote { margin: 6px 0 0; font-size: 12px; color: var(--soft); }
.saBtns { display: grid; gap: 8px; margin-top: 14px; }
.saBtns button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 14px; border: 0; font-size: 16px; font-weight: 800; }
.saBtns svg { width: 20px; height: 20px; }
.saYes { background: linear-gradient(180deg, #FFD866, var(--gold)); color: #3A2600; box-shadow: 0 4px 0 var(--gold-deep); }
.saNo { background: rgba(255, 255, 255, 0.08); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
/* 小さいカードの名前は2行まで折り返す */
.card.mini .cardName { white-space: normal; font-size: 8.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card.mini .cardTop { align-items: flex-start; min-height: 22px; }
.card.mini .stars { font-size: 9px; letter-spacing: 0; }

/* 背の低いスマホでも、バトルの手札と「すごろくに戻る」まで届くように */
.battle { overflow-y: auto; }
@media (max-height: 680px) {
  .slot.mon, .slot.mon .card.big { width: 96px; }
  .slot.sup { width: 52px; }
  .endCard .card.big { width: 110px; }
}
