  @import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');
  :root { --bg:#0d0f14; --surface:#161920; --surface2:#1e2230; --border:rgba(255,255,255,0.07); --border-hi:rgba(255,255,255,0.15); --text:#e8eaf0; --text-muted:#6b7080; --text-dim:#3a3f50; --accent:#e8a020; --accent2:#c0781a; --red:#e05050; --evo:#8b5cf6; --hero:#e8a020; --font-head:'Rajdhani',sans-serif; --font-body:'Noto Sans JP',sans-serif; }
  * { box-sizing:border-box; margin:0; padding:0; }
  html { font-size:14px; }
  html, body { touch-action: manipulation; } /* ダブルタップ拡大無効（ピンチは可） */
  * { touch-action: manipulation; }
  body { background:var(--bg); color:var(--text); font-family:var(--font-body); min-height:100vh; overflow-x:hidden; }
  header { background:var(--surface); border-bottom:1px solid var(--border); padding:12px 20px; display:flex; align-items:center; gap:16px; position:sticky; top:0; z-index:100; }
  .logo { font-family:var(--font-head); font-size:20px; font-weight:700; letter-spacing:2px; color:var(--accent); text-transform:uppercase; }
  .logo span { color:var(--text-muted); font-size:11px; font-family:var(--font-body); font-weight:400; letter-spacing:0; display:block; margin-top:-3px; }
  header { flex-wrap:wrap; align-items:flex-start; row-gap:6px; }
  .nav-icons { display:flex; gap:4px; order:2; flex-basis:100%; justify-content:flex-end; margin-left:0; }
  .nav-icon { width:34px; height:34px; display:flex; align-items:center; justify-content:center; border-radius:8px; text-decoration:none; border:1px solid var(--border); background:var(--surface2); transition:all 0.12s; }
  .nav-icon .nav-emoji { font-size:17px; line-height:1; }
  .nav-icon:hover { border-color:var(--border-hi); background:var(--surface); transform:translateY(-1px); }
  .nav-icon.active { border-color:var(--accent); background:rgba(232,160,32,0.12); }
  .seg-tabs { display:flex; gap:4px; max-width:900px; margin:20px auto 0; padding:0 20px; }
  .seg-tab { flex:1; padding:12px; text-align:center; cursor:pointer; background:var(--surface); border:1px solid var(--border); border-radius:10px; font-weight:700; font-size:14px; color:var(--text-muted); transition:all 0.15s; font-family:var(--font-head); letter-spacing:1px; }
  .seg-tab.active { background:rgba(232,160,32,0.12); border-color:var(--accent); color:var(--accent); }
  /* 初期描画のチラつき防止：JS実行前に html[data-seg] で正しいタブ/セクションを確定させる */
  #secCards { display:none; }
  html[data-seg="cards"] #secDecks { display:none; }
  html[data-seg="cards"] #secCards { display:block; }
  html[data-seg="cards"] #topSeg .seg-tab[data-seg="cards"],
  html[data-seg="decks"] #topSeg .seg-tab[data-seg="decks"] { background:rgba(232,160,32,0.12); border-color:var(--accent); color:var(--accent); }
  /* overflow:visible にして position:sticky（分布図マップの上部固定）を効かせる。横スワイプは未使用 */
  .swipe-viewport { overflow:visible; max-width:900px; margin:0 auto; }
  .swipe-track { display:flex; transition:transform 0.3s ease; }
  .swipe-page { min-width:100%; padding:20px; }
  .page-title { font-family:var(--font-head); font-size:22px; font-weight:700; letter-spacing:1px; margin-bottom:6px; }
  .page-sub { color:var(--text-muted); font-size:13px; margin-bottom:20px; line-height:1.7; }
  .agg-note { font-size:11px; color:var(--text-dim); margin:-12px 0 14px; }
  .tab-desc { font-size:12px; color:var(--text-muted); margin:-4px 0 14px; line-height:1.7; }
  .tab-desc b { color:var(--text); }
  .deck-tabs { display:flex; gap:8px; margin:0 0 16px; }
  .deck-tab { flex:1; padding:11px 8px; text-align:center; cursor:pointer; font-family:inherit; font-size:13px; font-weight:700;
    background:var(--surface); border:1px solid var(--border); border-radius:10px; color:var(--text-muted); transition:all 0.15s; }
  .deck-tab.active { background:rgba(232,160,32,0.14); border-color:var(--accent); color:var(--accent); }
  .stat-win { color:var(--accent); }
  .owned-filter { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
  .owned-toggle { background:var(--surface); border:1px solid var(--border-hi); color:var(--text); border-radius:999px;
    padding:9px 14px; font-size:13px; font-weight:700; cursor:pointer; font-family:inherit; }
  .owned-toggle[aria-pressed="true"] { background:rgba(232,160,32,0.16); border-color:var(--accent); color:var(--accent); }
  .filter-notes { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:14px; }
  .filter-notes:empty { margin-bottom:0; }
  .owned-note { font-size:11px; color:var(--text-muted); }
  .card-filter { position:relative; margin-bottom:14px; }
  /* font-size:16px → iOSでフォーカス時に勝手にズームしない。右に×ボタン分の余白 */
  .card-filter input { width:100%; background:var(--surface); border:1px solid var(--border-hi); border-radius:999px;
    color:var(--text); padding:8px 38px 8px 12px; font-size:16px; outline:none; font-family:inherit; }
  .card-clear { position:absolute; right:6px; top:50%; transform:translateY(-50%); width:26px; height:26px;
    border:none; border-radius:50%; background:var(--surface2); color:var(--text-muted); cursor:pointer;
    font-size:13px; line-height:1; display:flex; align-items:center; justify-content:center; font-family:inherit; }
  .card-clear:hover { color:var(--text); background:var(--border-hi); }
  .card-filter input:focus { border-color:var(--accent); }
  .card-chip { display:inline-flex; align-items:center; gap:6px; padding:5px 10px; border-radius:999px;
    background:rgba(232,160,32,0.16); border:1px solid var(--accent); color:var(--accent); font-size:12px; font-weight:700; cursor:pointer; }
  .card-chip .x { font-size:13px; }
  /* 3×3=9枚が一度に見える高さ。10枚目以降はスクロール */
  .card-pop { display:none; position:absolute; z-index:50; top:44px; left:0; right:0; max-height:252px; overflow-y:auto;
    background:var(--surface); border:1px solid var(--border-hi); border-radius:12px; padding:8px;
    grid-template-columns:repeat(3,1fr); gap:6px; box-shadow:0 12px 30px rgba(0,0,0,.5); }
  .card-pop.open { display:grid; }
  .card-pop .pop-card { background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:7px 4px; cursor:pointer; text-align:center; transition:all .12s; }
  .card-pop .pop-card:hover, .card-pop .pop-card:active { border-color:var(--accent); background:rgba(232,160,32,0.1); }
  .card-pop .pop-card img { width:auto; height:46px; object-fit:contain; }
  .card-pop .pop-card .nm { font-size:10px; color:var(--text-muted); margin-top:3px; line-height:1.2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .card-pop .pop-empty { grid-column:1/-1; text-align:center; color:var(--text-muted); font-size:12px; padding:14px; }
  .deck-card.cant-build { opacity:0.5; }
  .deck-missing { font-size:11px; color:#e05050; margin-top:6px; }
  .deck-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px; margin-bottom:14px; }
  .deck-card-head { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
  .deck-rank { font-family:var(--font-head); font-size:20px; font-weight:700; color:var(--accent); min-width:30px; }
  .deck-stat-line { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 8px; font-size:15px; font-weight:700; }
  .deck-stat-line .stat-use { color:var(--text); }
  .deck-stat-line .stat-sep { color:var(--text-muted); font-weight:500; font-size:12px; }
  .deck-stat-line .stat-pct { color:var(--accent); }
  .deck-stat-line .stat-avg { color:var(--text-muted); font-weight:500; font-size:13px; }
  .deck-stat-line .stat-avg b { color:var(--text); font-weight:700; font-size:15px; }
  .deck-cards-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-bottom:12px; max-width:340px; }
  .mini-card { aspect-ratio:3/4; background:var(--surface2); border:1px solid var(--border); border-radius:8px; overflow:hidden; display:flex; align-items:flex-end; justify-content:center; position:relative; }
  .mini-card img { width:100%; height:100%; object-fit:contain; }
  .mini-card .pip { position:absolute; top:2px; left:2px; font-size:9px; font-weight:700; background:rgba(0,0,0,0.55); color:#fff; border-radius:4px; padding:0 3px; line-height:1.4; }
  .mini-card .slot-badge { position:absolute; top:2px; right:2px; font-size:9px; line-height:1.3; }
  .mini-card.is-evo { border-color:var(--evo); box-shadow:inset 0 0 8px rgba(139,92,246,0.45); }
  .mini-card.is-hero { border-color:var(--hero); box-shadow:inset 0 0 8px rgba(232,160,32,0.45); }
  .mini-card.is-champ { border-color:#f0c54a; box-shadow:inset 0 0 9px rgba(240,197,74,0.55); }
  .load-btn { width:100%; padding:11px; font-size:13px; font-weight:700; background:var(--accent); color:#000; border:none; border-radius:8px; cursor:pointer; transition:all 0.12s; text-decoration:none; display:block; text-align:center; }
  .load-btn:hover { background:var(--accent2); }
  .coming-soon { text-align:center; padding:60px 20px; color:var(--text-muted); }
  .coming-soon .big { font-size:40px; margin-bottom:12px; }
  .note { font-size:11px; color:var(--text-dim); text-align:center; margin:4px 0 18px; line-height:1.6; }
  .footer-signature { text-align:center; padding:24px 0; font-family:'Courier New',Courier,monospace; color:#888; letter-spacing:1px; border-top:1px solid var(--border); margin-top:40px; }
  .footer-signature .by-text { font-size:11px; opacity:0.6; margin-right:4px; }
  .footer-signature .creator-name { font-size:13px; font-weight:bold; color:#eaeaea; letter-spacing:3px; text-shadow:0 0 8px rgba(255,255,255,0.4); }
  /* ▼ 急上昇デッキ用のスタッツ表記 */
  .stat-trend { color:#ff8a3c; font-weight:700; }
  .stat-trend .arrow { font-size:13px; }
  .stat-flat { color:var(--text-muted); }

  /* ▼ トップのデッキ/カード切替（既存 .seg-tabs を流用） */
  .seg-tab .seg-emoji { margin-right:5px; }

  /* ▼ カード単体ランキング */
  .card-mode { display:flex; gap:6px; align-items:center; margin:10px 0; }
  .me-toggle { flex:1; padding:11px 10px; text-align:center; cursor:pointer; font-family:inherit; font-size:14px; font-weight:700;
    background:var(--surface); border:1px solid var(--border-hi); color:var(--text-muted); border-radius:10px; transition:all 0.18s; }
  .me-toggle.active { background:rgba(232,160,32,0.16); border-color:var(--accent); color:var(--accent);
    box-shadow:0 0 14px rgba(232,160,32,0.5); }
  #meRefresh { flex:none; }
  .crank-tabs { display:flex; gap:8px; margin:0 0 14px; }
  .crank-tab { flex:1; padding:11px 8px; text-align:center; cursor:pointer; font-family:inherit; font-size:13px; font-weight:700;
    background:var(--surface); border:1px solid var(--border); border-radius:10px; color:var(--text-muted); transition:all 0.15s; }
  .crank-tab.active { background:rgba(232,160,32,0.14); border-color:var(--accent); color:var(--accent); }
  .crank-hint { font-size:11px; color:var(--text-dim); margin:-6px 0 12px; line-height:1.6; }
  .crank-list { display:flex; flex-direction:column; gap:5px; }
  .crank-row { display:flex; align-items:center; gap:10px; padding:7px 10px; background:var(--surface); border:1px solid var(--border);
    border-radius:10px; cursor:pointer; transition:all 0.12s; }
  .crank-row:hover { border-color:var(--border-hi); }
  .crank-row.sel { border-color:var(--accent); background:rgba(232,160,32,0.10); }
  .crank-rank { font-family:var(--font-head); font-weight:700; font-size:15px; color:var(--text-muted); min-width:28px; text-align:center; }
  .crank-row.sel .crank-rank { color:var(--accent); }
  .crank-ico { width:40px; height:48px; flex-shrink:0; display:flex; align-items:flex-end; justify-content:center; position:relative; }
  .crank-ico img { width:100%; height:100%; object-fit:contain; }
  .crank-ico .pip { position:absolute; top:0; left:0; font-size:9px; font-weight:700; background:rgba(0,0,0,0.6); color:#fff; border-radius:4px; padding:0 3px; }
  .crank-name { flex:1; font-size:13px; font-weight:700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .crank-stat { text-align:right; flex-shrink:0; }
  .crank-stat .big { font-size:15px; font-weight:700; }
  .crank-stat.use .big { color:var(--text); }
  .crank-stat.win .big { color:var(--accent); }
  .crank-stat .sub { font-size:10px; color:var(--text-muted); display:block; line-height:1.3; }
  .crank-bar { width:54px; height:5px; background:rgba(255,255,255,0.06); border-radius:3px; overflow:hidden; flex-shrink:0; }
  .crank-bar > i { display:block; height:100%; border-radius:3px; }
  .crank-check { width:22px; flex-shrink:0; text-align:center; font-size:14px; color:var(--text-dim); }
  .crank-row.sel .crank-check { color:var(--accent); }
  .crank-go { flex:none; width:28px; height:28px; border:1px solid var(--border-hi); background:var(--surface2); color:var(--text-muted);
    border-radius:7px; cursor:pointer; font-size:12px; line-height:1; padding:0; }
  .crank-go:hover { border-color:var(--accent); color:var(--accent); }

  /* ▼ メタマップ（分布図） */
  /* 分布図マップを画面上部に固定（ヘッダーの高さぶん下げる）。下のランキングだけがスクロールする */
  .mm-sticky { position:sticky; top:var(--cr-header-h, 60px); z-index:30; background:var(--bg); padding-bottom:16px; }
  .mm-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin:10px 0 4px; flex-wrap:wrap; }
  .mm-title { font-family:var(--font-head); font-size:17px; font-weight:700; letter-spacing:1px; }
  .mm-clear { background:var(--surface); border:1px solid var(--border-hi); color:var(--text-muted); border-radius:999px;
    padding:5px 12px; font-size:11px; font-weight:700; cursor:pointer; font-family:inherit; }
  .mm-clear:hover { color:var(--text); }
  .mm-btns { display:flex; gap:6px; flex-shrink:0; }
  .mm-toggle { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:20px; padding:2px 10px 2px 0; line-height:1; vertical-align:-2px; }
  .mm-toggle:hover { color:var(--text); }
  .mm-sticky.mm-collapsed { padding-bottom:6px; }
  .mm-sticky.mm-collapsed .mm-hint,
  .mm-sticky.mm-collapsed #metaMap,
  .mm-sticky.mm-collapsed .mm-btns { display:none; }
  .mm-hint { font-size:11px; color:var(--text-dim); margin:0 0 10px; line-height:1.6; }
  .metamap { position:relative; width:100%; height:300px; background:var(--surface);
    border:1px solid var(--border); border-radius:12px; overflow:hidden; }
  .mm-q { position:absolute; width:50%; height:50%; opacity:0.05; }
  .mm-q.tl { top:0; left:0; background:#1d9e75; }
  .mm-q.tr { top:0; right:0; background:#378add; }
  .mm-q.bl { bottom:0; left:0; background:#888780; }
  .mm-q.br { bottom:0; right:0; background:#d85a30; }
  .mm-axis { position:absolute; background:rgba(255,255,255,0.14); }
  .mm-axis.v { left:50%; top:0; bottom:0; width:1px; }
  .mm-axis.h { top:50%; left:0; right:0; height:1px; }
  .mm-qlabel { position:absolute; font-size:9px; font-weight:700; color:var(--text-dim); padding:3px 6px; line-height:1.3; pointer-events:none;
    max-width:48%; z-index:1; text-shadow:0 1px 2px #0d0f14, 0 0 3px #0d0f14; }
  .mm-qlabel.tl { top:0; left:0; color:#3ec79b; }
  .mm-qlabel.tr { top:0; right:0; text-align:right; color:#6fb4ee; }
  .mm-qlabel.bl { bottom:0; left:0; color:#9a988f; }
  .mm-qlabel.br { bottom:0; right:0; text-align:right; color:#e8895f; }
  .mm-axlabel { position:absolute; font-size:10px; font-weight:700; color:var(--text-muted); pointer-events:none;
    z-index:1; text-shadow:0 1px 2px #0d0f14, 0 0 3px #0d0f14; }
  .mm-axlabel.x { left:50%; bottom:5px; transform:translateX(-50%); }      /* 下辺の中央 */
  .mm-axlabel.y { left:5px; top:50%; transform:translateY(-50%); }          /* 左辺の中央 */
  .mm-pt { position:absolute; transform:translate(-50%,-50%); width:24px; height:29px; z-index:3; transition:left .35s ease, top .35s ease; }
  .mm-pt img { width:100%; height:100%; object-fit:contain; filter:drop-shadow(0 2px 4px rgba(0,0,0,0.6)); }
  .mm-pt .lab { position:absolute; top:38px; left:50%; transform:translateX(-50%); white-space:nowrap;
    font-size:9px; font-weight:700; color:var(--text); background:rgba(0,0,0,0.55); border-radius:4px; padding:0 4px; }
  .mm-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--text-dim); font-size:12px; text-align:center; padding:20px; }
  /* 4領域はタップで拡大できる（全体表示時） */
  .metamap:not(.mm-zoomed) .mm-q { cursor:pointer; }
  .metamap:not(.mm-zoomed) .mm-q:hover { opacity:0.12; }
  /* ズーム時：中央線を強調・拡大マーカー・戻る/タイトル */
  .mm-axis.zoom { background:var(--accent); opacity:0.6; }
  .mm-axis.v.zoom { width:2px; } .mm-axis.h.zoom { height:2px; }
  .metamap.mm-zoomed .mm-pt { width:22px; height:26px; }
  .mm-zline { position:absolute; font-size:9px; font-weight:700; color:var(--accent); background:rgba(13,15,20,0.55); border-radius:5px; padding:1px 5px; pointer-events:none; }
  .mm-zhint { position:absolute; top:6px; left:8px; z-index:5; font-size:10px; font-weight:700; color:var(--text-muted); pointer-events:none; text-shadow:0 1px 2px #0d0f14; }
  .mm-ztitle { position:absolute; top:8px; right:8px; font-size:12px; font-weight:700; color:var(--accent); pointer-events:none; }
  /* プロット本体（左・下に軸メモリ用の余白） */
  .mm-plot { position:absolute; left:34px; right:6px; top:6px; bottom:18px; }
  .mm-tick { position:absolute; font-size:9px; font-weight:700; color:var(--text-muted); pointer-events:none; white-space:nowrap; }
  .mm-tick.y { left:0; width:30px; text-align:right; }
  .mm-tick.y-top { top:4px; } .mm-tick.y-mid { top:50%; transform:translateY(-50%); } .mm-tick.y-bot { bottom:16px; }
  .mm-tick.x { bottom:3px; }
  .mm-tick.x-left { left:34px; } .mm-tick.x-mid { left:50%; transform:translateX(-50%); } .mm-tick.x-right { right:6px; }

  @media (max-width:720px) { .logo { font-size:16px; } .nav-icon { width:30px; height:30px; } .nav-icon .nav-emoji { font-size:15px; } .page-title { font-size:19px; } .deck-cards-grid { gap:4px; max-width:none; }
    .crank-name { font-size:12px; } .crank-bar { display:none; } .metamap { height:260px; } .mm-pt { width:21px; height:25px; } }

  /* ロゴ左のアイコン（縦幅をEN+JPの2行に合わせる。大きさは .logo-icon の height/width で微調整） */
  .logo{display:flex;align-items:center;gap:10px}
  .logo-icon{height:2.2em;width:2.2em;flex:0 0 auto;border-radius:50%;display:block;box-shadow:0 2px 8px rgba(0,0,0,.4)}
  .logo-text{display:flex;flex-direction:column;justify-content:center;line-height:1.18}
  @media (max-width:600px){.logo-icon{height:1.9em;width:1.9em}}
  /* 4アイコンをボディ先頭のバーへ（ヘッダーはロゴ＋下線だけ＝Index統一） */
  .topbar { padding:10px 20px; border-bottom:1px solid var(--border); background:var(--surface); justify-content:flex-end; }
  /* ヘッダー＋アイコンバーをまとめて画面上部に固定 */
  .sitebar { position: sticky; top: 0; z-index: 100; }
  .sitebar header { position: static; }

/* ★形態バッジ（⚡=限界突破 / 👑=ヒーロー）：カードランキングとメタマップ */
.crank-ico .fbadge { position:absolute; bottom:-3px; right:-5px; font-size:12px; line-height:1; filter:drop-shadow(0 1px 2px rgba(0,0,0,.85)); z-index:2; }
.crank-name .fmark { font-size:11px; }
.mm-pt .fbadge { position:absolute; top:-7px; right:-8px; font-size:10px; line-height:1; filter:drop-shadow(0 1px 2px rgba(0,0,0,.85)); }
.mm-pt .lab .fm { font-style:normal; }

/* ★環境シェア（勝ち筋別） */
.meta-share { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 14px; margin:0 0 14px; }
.ms-title { font-family:var(--font-head); font-size:14px; font-weight:700; letter-spacing:.5px; margin-bottom:8px; color:var(--text); }
.ms-note { font-size:10.5px; color:var(--text-dim); margin:-4px 0 8px; line-height:1.5; }
.ms-list { max-height:320px; overflow-y:auto; margin:0 -2px; padding:0 2px; }
.ms-row { display:flex; align-items:center; gap:8px; padding:3px 0; }
.ms-ico { width:24px; height:29px; flex:0 0 auto; display:flex; align-items:center; }
.ms-ico img { width:100%; height:100%; object-fit:contain; }
.ms-name { flex:0 0 96px; font-size:11px; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ms-bar { flex:1; height:8px; background:rgba(255,255,255,.06); border-radius:4px; overflow:hidden; }
.ms-bar i { display:block; height:100%; background:linear-gradient(90deg,#3a8ef0,#8b5cf6); border-radius:4px; }
.ms-share { flex:0 0 44px; text-align:right; font-size:12px; font-weight:700; color:var(--text); }
.ms-win { flex:0 0 76px; text-align:right; font-size:10px; color:var(--text-muted); }
@media (max-width:480px){ .ms-name{flex-basis:78px;} .ms-win{flex-basis:64px;} }
.ms-suf { font-size:10px; margin-left:2px; }
