/* ==========================================================================
   G1WC UI v3 — 共通デザインシステム
   --------------------------------------------------------------------------
   ベット画面のアーケード調（金 × 濃紺）に合わせ、育成・銀行など
   「アプリ画面（.app-screen）」を同じ部品で組む。
     .app-head   … 戻る / タイトル / アイコンボタン / CREDIT
     .ui-card    … 角丸カード（中身の区切り）
     .ui-tabs / .ui-seg / .ui-amount / .ui-lbl / .ui-note / .ui-empty
   PC（1280×720 ステージ）では px、スマホ（.sp-mode）では vw/vh で拡大する。
   ========================================================================== */
:root{
  --ui-bg-1:#0b1a30; --ui-bg-2:#060e1b;
  --ui-card:linear-gradient(180deg,rgba(30,58,98,.62),rgba(12,26,48,.62));
  --ui-line:rgba(120,165,220,.22);
  --ui-gold:#ffd23a; --ui-gold-2:#f0a02e; --ui-txt:#e9f3ff; --ui-dim:#9fb6d2;
  --ui-plus:#8fe3a0; --ui-minus:#ff9a8a;
  --ui-r:12px;
}

/* ---------------- シェル ---------------- */
.app-screen{background:
  radial-gradient(ellipse at 50% -10%,rgba(255,200,80,.14),transparent 55%),
  linear-gradient(180deg,var(--ui-bg-1),var(--ui-bg-2))}
.app-wrap{position:absolute;inset:0;display:flex;flex-direction:column;gap:10px;padding:10px 14px;overflow:hidden}
.app-head{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:14px;
  background:linear-gradient(180deg,#fff2b4 0%,#f0c94f 30%,#c9962a 100%);
  border:2px solid #6b4708;box-shadow:0 4px 14px rgba(0,0,0,.45)}
.app-back{flex:0 0 auto;width:38px;height:38px;border-radius:10px;cursor:pointer;font-size:16px;
  border:2px solid #6b4708;background:linear-gradient(180deg,#4b3a1c,#241a08);color:#ffe27a}
.app-title{flex:1 1 auto;min-width:0;margin:0;display:flex;align-items:center;gap:8px;
  font-family:var(--f-gothic);font-weight:900;font-size:20px;line-height:1.3;color:#1b3fd0;
  -webkit-text-stroke:.5px #fff;text-shadow:0 0 3px #fff,0 0 6px #fff}
.app-title i{color:#3a2500;-webkit-text-stroke:0;text-shadow:none;font-size:.9em}
.app-title span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.app-ibtn{flex:0 0 auto;display:flex;align-items:center;gap:5px;height:36px;padding:0 11px;border-radius:10px;
  cursor:pointer;font-family:var(--f-gothic);font-weight:900;font-size:12px;color:#3a2500;
  border:2px solid #7a5407;background:linear-gradient(180deg,#fff6c9,#f3cd5c 48%,#dba82c)}
.app-credit{flex:0 0 auto;display:flex;align-items:center;gap:6px;height:38px;padding:0 12px;border-radius:10px;
  background:#000;border:2px solid var(--ui-gold)}
.app-credit span{font-family:var(--f-num);font-size:11px;color:var(--ui-gold)}
.app-credit b{font-family:var(--f-num);font-size:21px;color:#fff;min-width:54px;text-align:right}
.app-body{flex:1 1 auto;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:10px;padding-bottom:6px}
.app-cols{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:start}
.app-col{display:flex;flex-direction:column;gap:10px;min-width:0}

/* ---------------- 部品 ---------------- */
.ui-card{display:flex;flex-direction:column;gap:9px;padding:12px 14px;border-radius:var(--ui-r);
  background:var(--ui-card);border:1px solid var(--ui-line);box-shadow:0 4px 14px rgba(0,0,0,.28);color:var(--ui-txt)}
.ui-h{margin:0;display:flex;align-items:center;gap:7px;font-size:13px;font-weight:900;color:var(--ui-gold);letter-spacing:.04em}
.ui-h i{color:#7fd4ff}
.ui-h small{margin-left:auto;font-size:11px;color:var(--ui-dim);font-weight:700}
.ui-lbl{display:flex;align-items:baseline;gap:8px;font-size:12px;font-weight:900;color:#ffe9a8}
.ui-lbl small{font-weight:700;color:var(--ui-dim);font-size:10.5px}
.ui-note{margin:0;font-size:11px;line-height:1.6;color:var(--ui-dim)}
.ui-note b{color:#fff}
.ui-note.warn{color:#ffd0a0}
.ui-note.warn i{color:#ffb35a}
.ui-empty{margin:0;padding:10px;text-align:center;font-size:11.5px;color:var(--ui-dim);
  border:1px dashed var(--ui-line);border-radius:10px}
.ui-tabs{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:4px;padding:4px;border-radius:12px;
  background:rgba(0,0,0,.35);border:1px solid var(--ui-line)}
.ui-tabs button{height:38px;border-radius:9px;border:none;cursor:pointer;font-family:var(--f-gothic);font-weight:900;
  font-size:13px;color:#cbb88a;background:transparent}
.ui-tabs button.on{color:#3a2500;background:linear-gradient(180deg,#fff3c0,#f0c94f 50%,#c9962a);box-shadow:0 2px 6px rgba(0,0,0,.4)}
.ui-seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:6px}
.ui-seg button{display:flex;flex-direction:column;align-items:center;gap:1px;padding:7px 2px;border-radius:10px;cursor:pointer;
  border:1.5px solid #3c5f8c;background:linear-gradient(180deg,#17325a,#0c1d36);color:#fff;font-family:var(--f-gothic)}
.ui-seg button b{font-family:var(--f-num);font-size:16px}
.ui-seg button small{font-size:10px;color:var(--ui-dim)}
.ui-seg button.on{border-color:var(--ui-gold);background:linear-gradient(180deg,#5a4008,#2a1c05);box-shadow:0 0 12px rgba(255,200,60,.35)}
.ui-seg button.on small{color:#ffe98a}
.ui-amount{display:flex;gap:6px;align-items:stretch}
.ui-amount input{flex:1 1 auto;min-width:0;height:44px;padding:0 12px;border-radius:10px;border:2px solid #2a4a70;
  background:#050d18;color:#fff;font-family:var(--f-num);font-size:22px;text-align:right;outline:none}
.ui-amount input:focus{border-color:var(--ui-gold)}
.ui-quick{display:flex;gap:4px}
.ui-quick button{min-width:46px;border-radius:9px;cursor:pointer;font-family:var(--f-gothic);font-weight:900;font-size:11px;
  color:#3a2500;border:1.5px solid #7a5407;background:linear-gradient(180deg,#fff3c0,#e8c258)}
.tbtn:disabled{opacity:.45;pointer-events:none;filter:grayscale(.5)}

/* ホームのメニュー：育成と銀行を横並び */
.title-menu-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.tbtn.stable{background:linear-gradient(180deg,#d9f2ff,#6fb8f0 48%,#3d8fd6 52%,#1f5fa0);color:#07233f;border-color:#12406e;
  box-shadow:0 3px 0 #0e3558,0 6px 12px rgba(0,0,0,.5);text-shadow:0 1px 0 rgba(255,255,255,.4)}
.tbtn.bank{background:linear-gradient(180deg,#dcffe8,#6fdc98 48%,#2fa85e 52%,#17683a);color:#062a15;border-color:#0e4a26;
  box-shadow:0 3px 0 #0b3b1e,0 6px 12px rgba(0,0,0,.5);text-shadow:0 1px 0 rgba(255,255,255,.4)}

/* ==========================================================================
   銀行
   ========================================================================== */
.bk-open{align-items:center;text-align:center;padding:26px 20px;max-width:560px;margin:10px auto;gap:12px}
.bk-open-ic{width:74px;height:74px;border-radius:50%;display:grid;place-items:center;font-size:34px;color:#3a2500;
  background:radial-gradient(circle at 35% 30%,#fff6c9,#f0c94f 55%,#b8811a);box-shadow:0 0 30px rgba(255,200,60,.4)}
.bk-open h3{margin:0;font-size:20px;color:#fff}
.bk-open p{margin:0;font-size:13px;line-height:1.7;color:var(--ui-dim)}
.bk-open p b{color:#fff}
.bk-feat{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;width:100%;text-align:left}
.bk-feat li{display:flex;gap:12px;align-items:center;padding:10px 12px;border-radius:10px;background:rgba(0,0,0,.3);border:1px solid var(--ui-line)}
.bk-feat i{font-size:22px;color:var(--ui-gold);width:28px;text-align:center}
.bk-feat div{display:flex;flex-direction:column;gap:2px}
.bk-feat b{font-size:14px;color:#fff}
.bk-feat span{font-size:11.5px;color:var(--ui-dim)}
.bk-big{width:100%;justify-content:center;font-size:16px !important;padding:13px 0 !important}

.bk-hero{position:relative;overflow:hidden;display:flex;flex-direction:column;gap:8px;padding:14px 18px;border-radius:16px;
  background:linear-gradient(125deg,#1f5fa0 0%,#12306a 45%,#0a1838 100%);border:2px solid #c9a227;
  box-shadow:0 8px 24px rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.15)}
.bk-hero:after{content:'';position:absolute;right:-60px;top:-70px;width:240px;height:240px;border-radius:50%;
  background:radial-gradient(circle,rgba(255,215,90,.22),transparent 65%);pointer-events:none}
.bk-hero-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.bk-brand{font-family:var(--f-num);font-size:14px;letter-spacing:.14em;color:var(--ui-gold)}
.bk-no{font-family:var(--f-num);font-size:12px;letter-spacing:.1em;color:#cfe0f5;opacity:.85}
.bk-net{display:flex;align-items:baseline;gap:8px}
.bk-net span{font-size:12px;color:#cfe0f5}
.bk-net b{font-family:var(--f-num);font-size:38px;line-height:1.1;color:#fff;text-shadow:0 0 18px rgba(255,210,58,.4)}
.bk-net em{font-style:normal;font-size:12px;color:#ffe9a8}
.bk-kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.bk-kpis div{display:flex;flex-direction:column;gap:2px;padding:7px 10px;border-radius:10px;background:rgba(0,0,0,.3)}
.bk-kpis span{font-size:10.5px;color:var(--ui-dim)}
.bk-kpis b{font-family:var(--f-num);font-size:18px;color:#fff}
.bk-kpis b.p,.bk-item b.p,.bk-log b.p{color:var(--ui-plus)}
.bk-kpis b.m,.bk-log b.m{color:var(--ui-minus)}
.bk-alert{display:flex;gap:8px;align-items:center;padding:8px 10px;border-radius:9px;font-size:11.5px;font-weight:900;
  color:#fff;background:rgba(200,30,20,.55);border:1px solid #ff8a7a}

.bk-form{display:flex;flex-direction:column;gap:9px}
.bk-rate{display:flex;align-items:flex-end;gap:3px;height:46px;padding:4px 6px;border-radius:9px;background:rgba(0,0,0,.3)}
.bk-rate i{flex:1 1 0;border-radius:3px 3px 0 0;background:linear-gradient(180deg,#ffe98a,#c8a02a)}
.bk-preview{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.bk-preview div{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-radius:10px;background:rgba(0,0,0,.35);border:1px solid var(--ui-line)}
.bk-preview span{font-size:10.5px;color:var(--ui-dim)}
.bk-preview b{font-family:var(--f-num);font-size:20px;color:var(--ui-gold)}
.bk-preview b.s{font-size:15px;color:#fff}
.bk-preview em{font-style:normal;font-size:10.5px;color:var(--ui-plus)}

.bk-item{display:flex;flex-direction:column;gap:6px;padding:10px 12px;border-radius:11px;background:rgba(0,0,0,.3);
  border:1px solid var(--ui-line)}
.bk-item.loan{border-color:rgba(255,180,90,.35)}
.bk-item.od{border-color:#ff6a5a;background:rgba(120,20,10,.35)}
.bi-top{display:flex;align-items:center;gap:8px}
.bi-top b{font-family:var(--f-num);font-size:19px;color:#fff}
.bi-tag{font-size:10.5px;font-weight:900;padding:2px 8px;border-radius:9px;background:#1f6fd0;color:#fff}
.bk-item.loan .bi-tag{background:#c8761a}
.bk-item.od .bi-tag{background:#c8102e}
.bi-lock{margin-left:auto;font-size:11px;color:var(--ui-dim);white-space:nowrap}
.bi-lock em{font-style:normal;font-family:var(--f-num);font-size:13px;color:#fff}
.bi-bar{height:6px;border-radius:4px;background:#0a1626;overflow:hidden}
.bi-bar i{display:block;height:100%;background:linear-gradient(90deg,#2fa84f,#8fe3a0)}
.bi-meta{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:11px;color:var(--ui-dim)}
.bi-meta b{font-family:var(--f-num);font-size:13px;color:#fff}
.bi-acts{display:flex;justify-content:flex-end}
.bk-logs{display:flex;flex-direction:column;gap:3px;max-height:220px;overflow-y:auto}
.bk-log{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:center;padding:5px 8px;border-radius:7px;
  background:rgba(0,0,0,.22);font-size:11px}
.bl-t{font-family:var(--f-num);color:var(--ui-dim)}
.bl-n{color:#e9f3ff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bk-log b{font-family:var(--f-num);font-size:13px}

/* ==========================================================================
   マイステーブル（共通シェルに合わせる）
   ========================================================================== */
#scr-stable.app-screen .stb-wrap{padding:10px 14px;gap:10px}
#scr-stable .stb-list{padding:2px 2px 4px}
#scr-stable .stb-card{border-radius:12px;border:2px solid #2f4e77;background:var(--ui-card);box-shadow:0 4px 12px rgba(0,0,0,.3)}
#scr-stable .stb-card.on{border-color:var(--ui-gold);box-shadow:0 0 0 1px var(--ui-gold) inset,0 0 16px rgba(255,200,60,.35)}
#scr-stable .stb-buy{border-radius:12px}
#scr-stable .stb-detail{padding:0;border:none;background:none;box-shadow:none;gap:10px}

.sd-top{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:14px;flex-wrap:nowrap !important;
  background:linear-gradient(125deg,#274a7c,#12294a 60%,#0b1a30);border:2px solid #c9a227;box-shadow:0 6px 18px rgba(0,0,0,.4)}
.sd-coat{flex:0 0 auto;width:12px;align-self:stretch;border-radius:6px;background:var(--coat,#6b4a2f);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.25)}
.sd-id{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:5px}
.sd-name{display:flex;align-items:center;gap:6px;min-width:0}
.sd-name b{font-size:21px;color:#fff;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sd-tags{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.sd-tags>span{height:22px;display:inline-flex;align-items:center;gap:4px;padding:0 8px;border-radius:11px;
  font-size:11px;font-weight:900;white-space:nowrap}
.sd-age{background:#2b4a70;color:#fff}
.sd-age small{font-size:9.5px;opacity:.9;font-weight:900;padding:0 5px;border-radius:7px;background:rgba(0,0,0,.3)}
.sd-age.a-grow{background:linear-gradient(180deg,#5fd6a5,#0f8c5f)}
.sd-age.a-peak{background:linear-gradient(180deg,#ffd76a,#d08a10);color:#3a2500}
.sd-age.a-decline{background:linear-gradient(180deg,#9aa6b8,#556274)}
.sd-rate{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-end;gap:0;margin-left:auto}
.sd-rate-l{font-size:10.5px;color:var(--ui-dim)}
.sd-rate b{font-family:var(--f-num);font-size:30px;line-height:1.1;color:var(--ui-gold);margin:0}
.sd-rate u{font-size:10px;color:var(--ui-dim);text-decoration:none;font-family:var(--f-gothic)}

.sd-prog{border-radius:12px !important;background:rgba(255,210,58,.08) !important}
#scr-stable .sd-card{background:var(--ui-card);border:1px solid var(--ui-line);border-radius:var(--ui-r)}
#scr-stable .sd-card .sd-sec-title{color:var(--ui-gold);font-size:13px}

/* 年齢バー */
.sd-agebar{display:flex;flex-direction:column;gap:6px;padding:8px 10px;border-radius:10px;background:rgba(0,0,0,.28)}
.ab-steps{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.ab-steps i{font-style:normal;text-align:center;font-family:var(--f-num);font-size:12px;padding:3px 0;border-radius:6px;
  color:rgba(255,255,255,.55)}
.ab-steps i.g{background:rgba(47,168,110,.25)}.ab-steps i.p{background:rgba(240,170,40,.25)}.ab-steps i.d{background:rgba(130,140,160,.22)}
.ab-steps i.on{color:#fff;font-weight:700;outline:2px solid #fff;box-shadow:0 0 10px rgba(255,255,255,.35)}
.ab-steps i.g.on{background:#1f9a68}.ab-steps i.p.on{background:#d08a10}.ab-steps i.d.on{background:#5a6678}
.ab-info{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:11px;color:var(--ui-dim)}
.ab-info b{font-family:var(--f-num);font-size:13px}
.ab-info b.up{color:var(--ui-plus)}.ab-info b.dn{color:var(--ui-minus)}
.ab-next{margin-left:auto}
.ab-next b{color:#fff}
.ss-bar s{position:absolute;top:-2px;bottom:-2px;width:3px;margin-left:-1px;border-radius:2px;background:#fff;
  box-shadow:0 0 4px rgba(255,255,255,.8);text-decoration:none}

/* ==========================================================================
   PC（1280×720 ステージ）
   ========================================================================== */
body:not(.sp-mode):not(.is-portrait) .sd-cols{display:grid;grid-template-columns:1.05fr 1fr;gap:10px;align-items:start}
body:not(.sp-mode):not(.is-portrait) .title-inner{gap:14px}
body:not(.sp-mode):not(.is-portrait) .title-menu{width:420px}

/* ==========================================================================
   スマホ（.sp-mode）— 共通シェルと各画面の仕上げ
   ========================================================================== */
body.sp-mode{--safe-t:env(safe-area-inset-top,0px);--safe-b:env(safe-area-inset-bottom,0px);--ui-r:3.4vw}
body.sp-mode #stage{background:#070b14}
body.sp-mode .app-wrap{padding:calc(var(--safe-t) + 1vh) 3vw calc(var(--safe-b) + 1vh);gap:1.2vh}
body.sp-mode .app-head{gap:1.8vw;padding:.8vh 2vw;border-radius:3.6vw;border-width:.25vh}
body.sp-mode .app-back,body.sp-mode .app-ibtn{width:10vw;height:10vw;max-width:5.4vh;max-height:5.4vh;padding:0;
  justify-content:center;border-radius:2.8vw;font-size:min(4.4vw,2.6vh);border-width:.25vh}
body.sp-mode .app-ibtn span{display:none}
body.sp-mode .app-title{font-size:min(5vw,3vh);gap:1.6vw}
body.sp-mode .app-credit{height:10vw;max-height:5.4vh;padding:0 2.4vw;border-radius:2.8vw;gap:1.4vw;border-width:.25vh}
body.sp-mode .app-credit span{font-size:min(2.6vw,1.5vh)}
body.sp-mode .app-credit b{font-size:min(5vw,3vh);min-width:0}
body.sp-mode .app-body{gap:1.2vh}
body.sp-mode .app-cols{grid-template-columns:1fr;gap:1.2vh}
body.sp-mode .app-col{gap:1.2vh}
body.sp-mode .ui-card{padding:1.6vh 3.6vw;gap:1.1vh}
body.sp-mode .ui-h{font-size:min(3.9vw,2.3vh)}
body.sp-mode .ui-h small{font-size:min(3vw,1.8vh)}
body.sp-mode .ui-lbl{font-size:min(3.6vw,2.1vh)}
body.sp-mode .ui-lbl small{font-size:min(3vw,1.8vh)}
body.sp-mode .ui-note{font-size:min(3.1vw,1.85vh)}
body.sp-mode .ui-empty{font-size:min(3.3vw,1.95vh);padding:1.6vh}
body.sp-mode .ui-tabs{border-radius:3vw;padding:.6vh 1vw}
body.sp-mode .ui-tabs button{height:5.6vh;border-radius:2.4vw;font-size:min(4vw,2.35vh)}
body.sp-mode .ui-seg{gap:1.6vw}
body.sp-mode .ui-seg button{padding:1.1vh 0;border-radius:2.6vw}
body.sp-mode .ui-seg button b{font-size:min(4.6vw,2.7vh)}
body.sp-mode .ui-seg button small{font-size:min(2.7vw,1.6vh)}
body.sp-mode .ui-amount input{height:6.6vh;font-size:min(6.4vw,3.8vh);border-radius:2.6vw}
body.sp-mode .ui-quick button{min-width:12vw;font-size:min(3.1vw,1.85vh);border-radius:2.4vw}
body.sp-mode .bk-big{font-size:min(4.6vw,2.7vh) !important;padding:2vh 0 !important;border-radius:3vw}
body.sp-mode .bk-open{padding:3vh 5vw;gap:1.6vh}
body.sp-mode .bk-open h3{font-size:min(5.6vw,3.3vh)}
body.sp-mode .bk-open p,body.sp-mode .bk-feat span{font-size:min(3.4vw,2vh)}
body.sp-mode .bk-feat b{font-size:min(4vw,2.35vh)}
body.sp-mode .bk-hero{padding:1.8vh 4.4vw;border-radius:4.4vw;gap:1vh}
body.sp-mode .bk-brand{font-size:min(3.6vw,2.1vh)}
body.sp-mode .bk-no{font-size:min(3vw,1.8vh)}
body.sp-mode .bk-net b{font-size:min(10vw,6vh)}
body.sp-mode .bk-net span,body.sp-mode .bk-net em{font-size:min(3.2vw,1.9vh)}
body.sp-mode .bk-kpis{gap:1.6vw}
body.sp-mode .bk-kpis div{padding:.9vh 2vw;border-radius:2.4vw}
body.sp-mode .bk-kpis span{font-size:min(2.6vw,1.55vh)}
body.sp-mode .bk-kpis b{font-size:min(4.4vw,2.6vh)}
body.sp-mode .bk-alert{font-size:min(3.1vw,1.85vh)}
body.sp-mode .bk-rate{height:6vh}
body.sp-mode .bk-preview span,body.sp-mode .bk-preview em{font-size:min(2.9vw,1.7vh)}
body.sp-mode .bk-preview b{font-size:min(5.4vw,3.2vh)}
body.sp-mode .bk-preview b.s{font-size:min(4vw,2.35vh)}
body.sp-mode .bk-item{padding:1.3vh 3vw;border-radius:3vw}
body.sp-mode .bi-top b{font-size:min(5vw,3vh)}
body.sp-mode .bi-tag{font-size:min(2.9vw,1.7vh)}
body.sp-mode .bi-lock,body.sp-mode .bi-meta{font-size:min(3vw,1.8vh)}
body.sp-mode .bi-lock em,body.sp-mode .bi-meta b{font-size:min(3.6vw,2.1vh)}
body.sp-mode .bk-log{font-size:min(3vw,1.8vh);padding:.8vh 2vw}
body.sp-mode .bk-log b{font-size:min(3.5vw,2.05vh)}

/* 育成（スマホ） */
body.sp-mode #scr-stable .stb-wrap{padding:calc(var(--safe-t) + 1vh) 3vw calc(var(--safe-b) + 1vh);gap:1.2vh}
body.sp-mode #scr-stable .stb-detail{padding:0;gap:1.2vh;overflow-y:auto}
body.sp-mode .sd-top{gap:3vw;padding:1.6vh 3.6vw;border-radius:4vw}
body.sp-mode .sd-coat{width:2.4vw}
body.sp-mode .sd-name b{font-size:min(5.6vw,3.3vh)}
body.sp-mode .sd-tags{gap:1.2vw}
body.sp-mode .sd-tags>span{height:3.2vh;font-size:min(3vw,1.8vh);padding:0 2.2vw;border-radius:3vw}
body.sp-mode .sd-age small{font-size:min(2.5vw,1.5vh)}
body.sp-mode .sd-rate-l,body.sp-mode .sd-rate u{font-size:min(2.6vw,1.55vh)}
body.sp-mode .sd-rate b{font-size:min(8vw,4.8vh)}
body.sp-mode .sd-agebar{padding:1vh 2.4vw;border-radius:2.6vw;gap:.8vh}
body.sp-mode .ab-steps i{font-size:min(3.2vw,1.9vh);padding:.5vh 0;border-radius:1.6vw}
body.sp-mode .ab-info{font-size:min(2.9vw,1.75vh)}
body.sp-mode .ab-info b{font-size:min(3.4vw,2vh)}
body.sp-mode .ab-next{margin-left:0;width:100%}

/* タイトル（スマホ）：ロゴとオプションの重なり解消・CREDIT を画面内に */
body.sp-mode .title-opts.corner{top:calc(var(--safe-t) + 1.2vh);left:3vw;right:3vw;
  flex-direction:row;flex-wrap:nowrap;justify-content:center;gap:1.6vw}
body.sp-mode .title-opts.corner .opt-btn{min-width:0;flex:1 1 0;justify-content:center;padding:.9vh 1vw;
  font-size:min(3.1vw,1.8vh);border-width:.25vh;border-radius:5vw;background:rgba(0,0,0,.45);backdrop-filter:blur(6px)}
body.sp-mode .title-opts.corner .opt-btn.on{background:linear-gradient(180deg,#fff3c0,#f0c94f 50%,#c9962a)}
body.sp-mode .title-opts.corner .opt-btn i{font-size:min(3.4vw,2vh)}
body.sp-mode .title-inner{justify-content:flex-start;gap:1.4vh;overflow-y:auto;
  padding:calc(var(--safe-t) + 7.5vh) 5vw calc(var(--safe-b) + 2.4vh)}
body.sp-mode .title-logo{margin:0}
body.sp-mode .tl-g1{font-size:min(19vw,11vh)}
body.sp-mode .tl-wc{font-size:min(6.6vw,3.7vh);margin-top:-.6vh}
body.sp-mode .tl-rising{font-size:min(9.4vw,5.3vh)}
body.sp-mode .title-live{width:100%;gap:.8vh}
body.sp-mode .tlv-row{grid-template-columns:8vw 11vw 1fr auto;gap:2vw;border-radius:3vw;padding:1.1vh 3vw;
  background:rgba(0,0,0,.5)}
body.sp-mode .tlv-s{white-space:nowrap}
body.sp-mode .title-menu{width:100%;gap:1.1vh}
body.sp-mode .title-menu .tbtn{padding:1.6vh 2vw;border-radius:3.4vw;font-size:min(4.7vw,2.75vh)}
body.sp-mode .title-menu-row{gap:2.4vw}
body.sp-mode .title-owner,body.sp-mode .title-credit{width:100%;box-sizing:border-box;justify-content:space-between;border-radius:3.4vw}
body.sp-mode .title-credit{padding:.9vh 4vw;flex:0 0 auto}
body.sp-mode .title-owner{flex:0 0 auto}
body.sp-mode .title-owner .to-bar{flex:1 1 auto;width:auto}
body.sp-mode .auth-inner{padding:calc(var(--safe-t) + 8vh) 5vw calc(var(--safe-b) + 3vh)}

/* ベット画面（スマホ） */
body.sp-mode #gi-header{padding-top:var(--safe-t);height:calc(16.4vh + var(--safe-t));box-shadow:0 .4vh 1.4vh rgba(0,0,0,.5)}
body.sp-mode #gi-body{top:calc(16.4vh + var(--safe-t));bottom:calc(19vh + var(--safe-b));background:linear-gradient(180deg,#0c1a2e,#070f1c)}
body.sp-mode #sp-nav{background:linear-gradient(180deg,#1a1206,#0d0904);padding:.5vh 1.4vw;gap:1.2vw}
body.sp-mode .sp-tab{border-radius:2.4vw;border-width:.2vh}
body.sp-mode #gi-types{gap:1.2vw;left:1.4vw;right:1.4vw}
body.sp-mode .type-tab{border-radius:2.4vw;border-width:.2vh;box-shadow:0 .3vh 0 #6a4906}
body.sp-mode #gi-list,body.sp-mode #gi-odds,body.sp-mode #gi-left,body.sp-mode #gi-right{left:1.4vw;right:1.4vw;border-radius:3vw;border-width:.2vh}
body.sp-mode .orow{padding:.4vh 1.2vw;gap:1.4vw}
body.sp-mode .ocell{border-radius:2.2vw;box-shadow:0 .3vh .8vh rgba(0,0,0,.35)}
body.sp-mode #gi-footer{height:calc(19vh + var(--safe-b));padding:.8vh 1.6vw calc(.8vh + var(--safe-b));gap:1.2vw;
  background:linear-gradient(180deg,#241a0a,#0d0904);box-shadow:0 -.4vh 1.4vh rgba(0,0,0,.5)}
body.sp-mode .ft-round,body.sp-mode .ft-btn{border-radius:2.4vw;border-width:.2vh}
body.sp-mode .ft-credit{border-radius:2.4vw;border-width:.25vh;background:linear-gradient(180deg,#000,#1a1206)}

/* モーダル（スマホはボトムシート） */
body.sp-mode #modal-layer{place-items:end center}
body.sp-mode .modal-box{width:100vw;max-height:86vh;border-radius:5vw 5vw 0 0;border-width:.3vh 0 0;
  padding-bottom:var(--safe-b);animation:sheetUp .22s ease-out}
@keyframes sheetUp{from{transform:translateY(30%);opacity:.4}to{transform:none;opacity:1}}
body.sp-mode .modal-head{padding:1.4vh 4vw}
body.sp-mode .modal-x{width:8vw;height:8vw;max-width:4.4vh;max-height:4.4vh}
body.sp-mode .modal-body{padding:1.6vh 4vw}
body.sp-mode .mb-btns{gap:2vw}
body.sp-mode .mb-btns .tbtn{flex:1 1 0;font-size:min(4.2vw,2.5vh);padding:1.6vh 2vw}
body.sp-mode #toast{bottom:calc(21vh + var(--safe-b))}
body.sp-mode[data-screen="scr-stable"] #toast,body.sp-mode[data-screen="scr-bank"] #toast,
body.sp-mode[data-screen="scr-title"] #toast{bottom:calc(4vh + var(--safe-b))}

/* 3D / 結果（スマホ）のセーフエリア */
body.sp-mode .hud-top{padding-top:calc(var(--safe-t) + .6vh)}
body.sp-mode .hud-cams{bottom:calc(var(--safe-b) + 1.2vh)}
body.sp-mode .res-wrap{padding:calc(var(--safe-t) + 1.2vh) 3vw calc(var(--safe-b) + 1.2vh)}

/* ==========================================================================
   育成：出走登録（次の開催）・結果ポップアップ・出馬表の育成馬
   ========================================================================== */
.sd-cols{display:flex;flex-direction:column;gap:10px}
.sd-col{display:flex;flex-direction:column;gap:10px;min-width:0}
.sd-card{display:flex;flex-direction:column;gap:8px;padding:12px 14px;box-shadow:0 4px 14px rgba(0,0,0,.25)}
.sd-card .sd-sec-title{border-bottom:none;padding:0;margin:0;display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;letter-spacing:.04em}
.sd-card .sd-sec-title>i{color:#7fd4ff}
.se-label i{color:var(--ui-gold)}

.en-ch{display:inline-grid;place-items:center;min-width:22px;height:20px;padding:0 4px;border-radius:5px;
  font-size:11px;font-weight:900;background:#f0c94f;color:#3a2500;line-height:1}
.en-ch.ura{background:#4a7fd0;color:#fff}
.en-g{display:inline-grid;place-items:center;height:20px;padding:0 7px;border-radius:10px;
  font-family:var(--f-num);font-size:11.5px;font-weight:700;color:#fff;line-height:1}
.en-g.g-GI{background:linear-gradient(180deg,#8b7ff5,#3b2bb5)}
.en-g.g-GII{background:linear-gradient(180deg,#5fd6a5,#0f8c5f)}
.en-g.g-GIII{background:linear-gradient(180deg,#f57fdd,#a01192)}

.sd-races{display:flex;flex-direction:column;gap:7px}
.sd-rbtn{display:flex !important;flex-direction:column;align-items:stretch;gap:5px;padding:10px 12px;border-radius:11px;
  border:1.5px solid #8a6412;text-align:left;background:linear-gradient(135deg,#3b2a0e 0%,#221707 60%,#1a1206 100%);
  box-shadow:0 3px 10px rgba(0,0,0,.35),inset 0 1px 0 rgba(255,230,160,.12);transition:transform .08s,filter .12s}
.sd-rbtn:not(.off):hover{filter:brightness(1.12)}
.sd-rbtn:not(.off):active{transform:scale(.985)}
.sd-rbtn .sr-top{display:flex;align-items:center;gap:6px;min-width:0}
.sd-rbtn .sr-n{font-size:14.5px;font-weight:900;color:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sr-bonus{margin-left:auto;font-size:10px;font-weight:900;color:#fff;padding:2px 7px;border-radius:9px;
  background:linear-gradient(180deg,#ff6a5a,#c8102e)}
.sd-rbtn .sr-meta{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:11px;color:#e8d7a8}
.sd-rbtn .sr-meta b{font-family:var(--f-num);color:var(--ui-gold);font-size:13px}
.fit{padding:0 5px;border-radius:4px;background:#333;color:#fff !important}
.fit.f-S{background:#e0157f}.fit.f-A{background:#e8751a}.fit.f-B{background:#2f8a4a}.fit.f-C{background:#3c5f8c}.fit.f-D{background:#555}
.sd-rbtn .sr-foot{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:10.5px;color:#cbb88a}
.sr-cd{font-family:var(--f-num);font-size:12px;color:var(--ui-plus)}
.sd-rbtn .sr-pt{font-size:10.5px;color:#ffe98a}
.sd-rbtn .sr-x{font-size:11px;color:var(--ui-minus);font-weight:900}
.sd-rbtn.off{opacity:.55}
.sd-rbtn.locked{border-color:#3a3a48;background:linear-gradient(135deg,#23232c,#15151b);filter:grayscale(.6)}

.sd-entry{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:12px;border:2px solid var(--ui-gold);
  background:linear-gradient(135deg,#4a3208,#241805);box-shadow:0 0 18px rgba(255,200,60,.25)}
.sd-entry.ph-bet{border-color:#37c95c;box-shadow:0 0 18px rgba(55,201,92,.3)}
.sd-entry.ph-race{border-color:#ff5a2a;animation:enPulse 1.2s infinite alternate}
@keyframes enPulse{from{box-shadow:0 0 14px rgba(255,90,40,.4)}to{box-shadow:0 0 30px rgba(255,90,40,.75)}}
.en-head{display:flex;align-items:center;gap:7px;min-width:0}
.en-name{font-size:17px;color:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.en-dist{margin-left:auto;font-family:var(--f-num);font-size:13px;color:#ffe9a8}
.en-state{font-size:12px;color:#ffe9a8}
.en-state i{color:var(--ui-gold)}
.en-state b{font-family:var(--f-num);font-size:16px;color:#fff;margin-left:2px}
.en-state b.live{color:#ff8a5a;font-family:var(--f-gothic);font-size:13px}
.en-acts{display:flex;gap:8px;flex-wrap:wrap}
.en-acts .tbtn{flex:1 1 0;min-width:0}

.sc-entry{display:flex;align-items:center;gap:4px;font-size:10px;font-weight:900;color:#3a2500;
  background:linear-gradient(180deg,#ffe6a0,#f0a02e);border-radius:5px;padding:1px 6px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.sc-entry.ura{background:linear-gradient(180deg,#9cc2ff,#4a7fd0);color:#fff}
.or-no{display:inline-grid;place-items:center;min-width:18px;height:16px;border-radius:3px;margin-right:5px;
  font-style:normal;font-family:var(--f-num);font-size:11px;background:var(--fc);color:var(--fct)}
.or-row .or-n em.o{color:#9fd8ff}

.hr-list{display:flex;flex-direction:column;gap:8px}
.hr-card{display:flex;gap:12px;align-items:center;padding:12px;border-radius:12px;background:linear-gradient(135deg,#15305a,#0a1a30);border:1px solid #2f5a90}
.hr-card.top{border-color:#c9a227}
.hr-card.win{border:2px solid var(--ui-gold);background:linear-gradient(135deg,#5a4008,#241805);box-shadow:0 0 24px rgba(255,200,60,.4)}
.hr-place{display:flex;align-items:baseline;flex:0 0 auto;min-width:74px;justify-content:center}
.hr-place b{font-family:var(--f-num);font-size:44px;line-height:1;color:#fff}
.hr-card.win .hr-place b{color:var(--ui-gold);text-shadow:0 0 14px #ff9a3a}
.hr-place em{font-style:normal;font-size:14px;color:#ffe9a8;margin-left:2px}
.hr-place small{font-size:10px;color:#9fb3cc;margin-left:3px}
.hr-body{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:4px}
.hr-name{font-size:17px;font-weight:900;color:#fff}
.hr-race{display:flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:11.5px;color:#cfe0f5}
.hr-tags{display:flex;gap:6px;flex-wrap:wrap}
.hr-tags span{font-size:11.5px;font-weight:900;padding:2px 9px;border-radius:10px;background:rgba(0,0,0,.35)}
.hr-prize{color:var(--ui-plus)}.hr-pt{color:#ffe98a}.hr-cd{color:#ffb35a}

.h-name .own{display:inline-block;width:max-content;font-size:9px;font-weight:900;padding:0 5px;border-radius:3px;
  background:#4a7fd0;color:#fff;line-height:1.5;margin-bottom:1px}
.h-name .own.me{background:linear-gradient(180deg,#ffe98a,#f0a02e);color:#3a2500}
.hrow.mine{box-shadow:inset 4px 0 0 var(--ui-gold),inset 0 0 0 1px rgba(255,210,58,.6)}
.hrow.mine:not(.sel){background:linear-gradient(90deg,rgba(255,200,60,.28),rgba(34,73,122,1) 55%)}
.ocell.mine{box-shadow:0 0 0 2px var(--ui-gold) inset,0 0 10px rgba(255,210,58,.4)}

/* スマホ */
body.sp-mode .sd-cols,body.sp-mode .sd-col{gap:1.2vh}
body.sp-mode .sd-card{padding:1.4vh 3.4vw;border-radius:3.6vw;gap:1vh}
body.sp-mode .sd-card .sd-sec-title{font-size:min(3.9vw,2.3vh)}
body.sp-mode .sd-card .sd-sec-title small{font-size:min(2.9vw,1.7vh)}
body.sp-mode .sd-energy{grid-template-columns:auto 1fr auto;row-gap:.6vh}
body.sp-mode .se-eta{grid-column:1/-1;text-align:right;font-size:min(2.9vw,1.7vh)}
body.sp-mode .sd-cbtn{padding:1.2vh 3vw;border-radius:3vw}
body.sp-mode .sd-cbtn i{font-size:min(5.6vw,3.2vh)}
body.sp-mode .sd-train{gap:1.6vw}
body.sp-mode .sd-tbtn{padding:1.4vh .4vw;border-radius:3vw;gap:.4vh}
body.sp-mode .sd-tbtn b{font-size:min(3.2vw,1.9vh)}
body.sp-mode .sd-tbtn em{font-size:min(2.6vw,1.55vh)}
body.sp-mode .sd-rbtn{padding:1.4vh 3.4vw;border-radius:3.4vw;gap:.7vh}
body.sp-mode .sd-rbtn .sr-n{font-size:min(4.4vw,2.6vh)}
body.sp-mode .sd-rbtn .sr-meta{font-size:min(3.2vw,1.9vh);gap:.4vh 3vw}
body.sp-mode .sd-rbtn .sr-meta b{font-size:min(3.8vw,2.2vh)}
body.sp-mode .sd-rbtn .sr-foot,body.sp-mode .sd-rbtn .sr-pt{font-size:min(3vw,1.8vh)}
body.sp-mode .sd-rbtn .sr-x{font-size:min(3.2vw,1.9vh)}
body.sp-mode .sr-cd{font-size:min(3.6vw,2.1vh)}
body.sp-mode .en-ch{min-width:6vw;height:3vh;font-size:min(3.2vw,1.9vh);border-radius:1.4vw}
body.sp-mode .en-g{height:3vh;font-size:min(3.2vw,1.9vh);padding:0 2vw;border-radius:3vw}
body.sp-mode .sd-entry{padding:1.6vh 3.6vw;border-radius:3.6vw;gap:1.1vh}
body.sp-mode .en-name{font-size:min(5vw,3vh)}
body.sp-mode .en-dist{font-size:min(3.8vw,2.2vh)}
body.sp-mode .en-state{font-size:min(3.4vw,2vh)}
body.sp-mode .en-state b{font-size:min(4.8vw,2.8vh)}
body.sp-mode .en-acts .tbtn{font-size:min(3.8vw,2.2vh);padding:1.4vh 2vw;border-radius:3vw}
body.sp-mode .stb-card{width:58vw;border-radius:3.6vw;padding:1.2vh 2.6vw}
body.sp-mode .stb-list{gap:2.4vw;scroll-snap-type:x mandatory}
body.sp-mode .stb-card,body.sp-mode .stb-buy{scroll-snap-align:start}
body.sp-mode .stb-buy{width:34vw;border-radius:3.6vw}
body.sp-mode .sc-entry{font-size:min(2.8vw,1.65vh);border-radius:1.4vw}
body.sp-mode .sh-row{padding:1vh 2.6vw;border-radius:2.4vw;grid-template-columns:12vw 1fr auto 3vw}
body.sp-mode .hrow.mine{box-shadow:inset 1.2vw 0 0 var(--ui-gold)}
body.sp-mode .h-name .own{font-size:min(2.8vw,1.6vh)}
body.sp-mode .hr-card{padding:1.6vh 3.6vw;border-radius:3.6vw;gap:3vw}
body.sp-mode .hr-place{min-width:18vw}
body.sp-mode .hr-place b{font-size:min(12vw,7vh)}
body.sp-mode .hr-name{font-size:min(4.8vw,2.8vh)}
body.sp-mode .hr-race,body.sp-mode .hr-tags span{font-size:min(3.2vw,1.9vh)}

/* ---- 調整（スクショ確認後） ---- */
/* flex 列の子が縮んでヒーローカードが潰れないように */
.app-body>*,.stb-detail>*,.bk-hero{flex-shrink:0}
body.sp-mode .title-opts.corner .opt-btn{gap:1vw}
body.sp-mode .title-opts.corner .opt-btn span{white-space:nowrap}
/* ログアウトは文字を省いてアイコンのみ（4 つを 1 行に収める） */
body.sp-mode .title-opts.corner .opt-btn[data-act="logout"]{flex:0 0 auto;width:11vw}
body.sp-mode .title-opts.corner .opt-btn[data-act="logout"] span{display:none}
body.sp-mode .title-inner{padding-top:calc(var(--safe-t) + 8.6vh)}
body.sp-mode .title-logo{margin-top:.6vh}
body.sp-mode .app-title{font-size:min(4.6vw,2.7vh)}
body.sp-mode .app-title span{overflow:visible;text-overflow:clip}
body.sp-mode #scr-stable .app-title i{display:none}
body.sp-mode #scr-stable .stb-detail{flex:1 1 auto;min-height:0}
body.sp-mode .stb-list{flex:0 0 auto}
/* タイトルロゴ：上部オプションと重ならないよう行高を詰めて下げる */
body.sp-mode .title-logo .tl-g1{line-height:1;padding-top:.4vh}
body.sp-mode .title-inner{padding-top:calc(var(--safe-t) + 10vh)}
body.sp-mode .kpi-wrap{}
body.sp-mode .bk-kpis span{white-space:nowrap}
body.sp-mode .title-opts.corner ~ .title-inner{padding-top:calc(var(--safe-t) + 7.4vh)}
body.sp-mode .title-opts.corner ~ .auth-inner{padding-top:calc(var(--safe-t) + 8vh)}

/* SP bet footer tidy */
body.sp-mode .ft-round span{white-space:nowrap;letter-spacing:-.02em}
body.sp-mode .ft-mission span{font-size:min(2.3vw,1.45vh)}
body.sp-mode .ft-mission b span{font-size:.7em}
body.sp-mode #list-col-toggle{white-space:nowrap;font-size:min(2.5vw,1.4vh);letter-spacing:-.04em;overflow:hidden;text-overflow:clip}

/* PC 16:9 title: fit everything in 720px */
body:not(.sp-mode) .title-inner{gap:10px;padding:14px 24px}
body:not(.sp-mode) .title-opts.corner ~ .title-inner{padding-top:14px}
body:not(.sp-mode) .tl-g1{font-size:76px}
body:not(.sp-mode) .tl-wc{font-size:30px}
body:not(.sp-mode) .tl-rising{font-size:40px}
body:not(.sp-mode) .title-menu{gap:8px}
body:not(.sp-mode) .title-menu .tbtn{padding:10px 18px}
body:not(.sp-mode) .title-credit{padding:5px 14px}
