/* =========================================================
   買取サイト｜SP（スマートフォン）専用スタイル
   添付モバイル画像の構成（フルブリードヒーロー＋アクショングリッド＋結果テーブル）
   ※ assets/style.css を読み込んだ上で上書き／追加する
   ========================================================= */

.sp { background: #fff; }
.sp .container { max-width: 480px; padding-inline: 0; }
body.sp-body { background: #c9ced8; }           /* 端末外の余白 */
.sp-frame { max-width: 480px; margin-inline: auto; background: #fff; min-height: 100vh; box-shadow: 0 0 40px rgba(0,0,0,.18); }

/* ---- SPヘッダー ---- */
.sp-header { position: sticky; top: 0; z-index: 80; background: var(--color-brand); }
.sp-header-top { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px; }
.sp-hamburger { display: none; }  /* 一旦非表示に統一（style.css 側と揃える。復活時は両方戻す） */
.sp-logo { display: inline-flex; align-items: center; gap: 7px; }
.sp-logo .logo-mark { width: 26px; height: 26px; border-radius: 5px; background: #fff; color: var(--color-brand); display: grid; place-items: center; font-size: 13px; }
.sp-logo .logo-text { font-weight: 900; font-size: 17px; color: #fff; }
.sp-logo .logo-text .accent { color: #ffd34d; }
.sp-header-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.sp-hicon { width: 34px; height: 34px; display: grid; place-items: center; background: none; border: 0; color: #fff; font-size: 16px; position: relative; }
.sp-live { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 4px; background: var(--color-red); color: #fff; font-size: 11px; font-weight: 700; }

/* ナビタブ（横スクロール） */
.sp-nav { display: flex; gap: 0; overflow-x: auto; background: var(--color-nav); scrollbar-width: none; }
.sp-nav::-webkit-scrollbar { display: none; }
.sp-nav a { position: relative; white-space: nowrap; padding: 0 14px; height: 38px; display: inline-flex; align-items: center; gap: 5px; color: #c4cdf2; font-weight: 700; font-size: 13.5px; }
.sp-nav a.is-current { color: #fff; }
.sp-nav a.is-current::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: #fff; }
.sp-nav a .new-badge { font-size: 8px; font-weight: 700; color: #fff; background: var(--color-red); padding: 1px 4px; border-radius: 3px; }

/* ---- ドロワー（ハンバーガー展開） ---- */
.sp-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 80%; max-width: 320px; background: #fff; z-index: 120; transform: translateX(-100%); transition: transform .25s ease; overflow-y: auto; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
body.drawer-open .sp-drawer { transform: translateX(0); }
.sp-overlay { position: fixed; inset: 0; background: rgba(10,16,32,.5); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .25s; }
body.drawer-open .sp-overlay { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 14px; background: var(--color-brand); color: #fff; }
.drawer-head .logo-text { font-weight: 900; font-size: 16px; }
.drawer-close { margin-left: auto; background: none; border: 0; color: #fff; font-size: 19px; }
.drawer-sec { padding: 8px 0; border-bottom: 1px solid var(--color-border-soft); }
.drawer-sec h4 { margin: 0; padding: 8px 16px 6px; font-size: 11px; font-weight: 700; color: var(--color-text-muted); }
.sp-drawer a { display: flex; align-items: center; gap: 11px; padding: 11px 16px; font-size: 14px; font-weight: 700; color: var(--color-text); }
.sp-drawer a:active { background: var(--color-bg-section); }
.sp-drawer a i { width: 20px; text-align: center; color: var(--color-accent); }

/* ---- SPヒーロー（フルブリード画像＋オーバーレイ） ---- */
.sp-hero { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--color-brand-dark); }
.sp-hero image-slot { display: block; width: 100%; height: 100%; }
.sp-hero .sp-hero-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; background: linear-gradient(to top, rgba(8,14,30,.86) 0%, rgba(8,14,30,.25) 55%, transparent 100%); }
.sp-hero .grade-badge { align-self: flex-start; margin-bottom: 7px; }
.sp-hero h1 { margin: 0; font-size: 22px; font-weight: 900; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.5); line-height: 1.25; }
.sp-hero .sp-hero-meta { margin-top: 5px; font-size: 12px; color: #dfe5f5; font-weight: 500; }
.sp-hero .sp-hero-meta b { color: #fff; }
.sp-hero .sp-watermark { position: absolute; top: 10px; right: 12px; font-weight: 900; font-size: 13px; color: rgba(255,255,255,.6); }

/* ---- アクションボタングリッド（2×3） ---- */
.sp-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.sp-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 62px; background: #fff; border: 1px solid var(--color-border); border-radius: 6px; font-size: 11.5px; font-weight: 700; color: var(--color-text); }
.sp-action:active { background: var(--color-accent-soft); }
.sp-action i { font-size: 18px; color: var(--color-accent); }

/* ---- プロモバナー ---- */
.sp-promo { display: flex; align-items: center; gap: 10px; margin: 0 12px 12px; padding: 11px 14px; background: var(--color-accent-soft); border: 1px solid var(--color-accent); border-radius: 6px; }
.sp-promo .pico { width: 24px; height: 24px; border-radius: 50%; background: var(--color-accent); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.sp-promo .ptxt { font-size: 12.5px; font-weight: 700; color: var(--color-accent-dark); line-height: 1.35; }
.sp-promo .fa-angle-right { margin-left: auto; color: var(--color-accent); }

/* ---- セクション見出し（SP） ---- */
.sp-sec { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px; }
.sp-sec h2 { margin: 0; font-size: 16px; font-weight: 900; color: var(--color-text); display: inline-flex; align-items: center; gap: 7px; border-left: 4px solid var(--color-accent); padding-left: 9px; }
.sp-sec .more { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--color-link); }

/* ---- SPブロック余白 ---- */
.sp-block { padding: 0 12px; }
.sp-block.tight { padding: 0; }

/* ---- パック横スクロール（SP・パックごとのデザイン） ---- */
.sp-pack-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 12px 12px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.sp-pack-scroll::-webkit-scrollbar { display: none; }
.sp-pack-scroll .pack-card { flex: none; width: 150px; scroll-snap-align: start; }

/* ---- SPフィルター ---- */
.sp-filter { padding: 12px; }
.sp-search { display: flex; gap: 6px; }
.sp-search .search-input-wrap { flex: 1; }
.sp-tags { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.sp-tags::-webkit-scrollbar { display: none; }
.sp-tags .tag-chip { flex: none; }

/* SPソートバー */
.sp-sortbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }

/* ---- 結果テーブル（SP・コンパクト） ---- */
.sp .data-table { border-left: 0; border-right: 0; border-radius: 0; }
.sp .data-table thead th { font-size: 11px; padding: 7px 8px; }
.sp .data-table td { padding: 8px; }
.sp .data-table td.col-no { width: 36px; }
.sp .data-table td.col-thumb { width: 42px; }
.sp .data-table td.col-rarity { width: 44px; }
.sp .data-table td.col-price { width: 104px; }
.sp .no-badge { width: 24px; height: 24px; font-size: 13px; }
.sp .tbl-thumb { width: 36px; height: 48px; }
.sp .tbl-name { font-size: 13px; }
.sp .tbl-price { font-size: 17px; }
.sp .medal { width: 28px; height: 28px; font-size: 14px; }

/* ---- ランキングテーブル画像セル（SP・縦伸び対策） ---- */
/* tr/td が画像高さに引っ張られないよう中央寄せで固定し、画像は枠内contain */
.sp .rank-table tr{vertical-align:middle;}
.sp .rank-table td{vertical-align:middle;}
.sp .rank-table td.col-thumb{width:70px;}
.sp .rank-table td.col-thumb .tbl-thumb{width:60px;height:60px;}
.sp .rank-table td.col-thumb img{width:60px;height:60px;object-fit:contain;display:block;}

/* SPではヒーロー右側画像は非表示（縦並びで邪魔になるため） */
.sp .hero-image { display: none; }

/* SP画像グリッド */
.sp .card-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 12px; }
.sp .view-grid .data-table-wrap, .sp .view-list .card-grid { display: none; }

/* SPページネーション */
.sp .pagination { margin: 16px 12px; }

/* ---- SPシングル（カード詳細） ---- */
.sp .single { grid-template-columns: 1fr; border-left: 0; border-right: 0; border-radius: 0; margin-bottom: 14px; }
.sp .single-visual { width: 180px; }
.sp .spb-price { font-size: 32px; }
.sp .single-name { font-size: 19px; }
.sp .single-actions { grid-template-columns: 1fr 1fr; }
.sp .hist-box, .sp .rel-list { border-left: 0; border-right: 0; border-radius: 0; }
.sp .hist-val { font-size: 9px; }
.sp .sec-head { padding: 0 12px; }
.sp .sec-head h2 { font-size: 16px; }
.sp .hist-box, .sp .rel-list { margin-inline: 0; }

/* ---- SPフッター ---- */
.sp-footer { background: var(--color-brand); color: #c5cef0; margin-top: 16px; }
.sp-foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.sp-foot-links a { padding: 12px 14px; font-size: 12.5px; font-weight: 700; color: #dfe5f5; border-bottom: 1px solid rgba(255,255,255,.1); border-right: 1px solid rgba(255,255,255,.1); }
.sp-foot-note { padding: 14px; font-size: 10.5px; color: #9aa6d8; line-height: 1.6; }
.sp-foot-brand { padding: 16px 14px 6px; }
.sp-foot-brand .logo-text { font-weight: 900; font-size: 17px; color: #fff; }

/* PCナビへ戻る帯 */
.sp-pcbar { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; font-size: 12px; color: var(--color-text-sub); background: var(--color-bg-section); }
.sp-pcbar a { color: var(--color-link); font-weight: 700; }
.sp-theme-btn { width: 34px; height: 34px; padding: 0; background: rgba(255,255,255,.12); border: 0; border-radius: 6px; color: #fff; font-size: 15px; display: grid; place-items: center; }
.sp-theme-btn .swatch, .sp-theme-btn .fa-chevron-down { display: none; }
.sp-header .theme-switch .theme-menu { top: calc(100% + 4px); }

/* 大画面では中央寄せのモバイルフレームとして見せる */
@media (min-width: 540px) {
  .sp-frame { margin-top: 16px; margin-bottom: 16px; border-radius: 14px; overflow: hidden; min-height: auto; }
  .sp-header { border-radius: 14px 14px 0 0; }
}

/* =========================================================
   実機レスポンシブ追加スタイル
   ※ 本サイトの body には .sp が付かないため、上の .sp スコープは
     モックアップ用。実機SPにはメディアクエリで直接効かせる。
   ========================================================= */

/* ---- カード詳細：スマホで画像が縦長にはみ出す問題の修正 ---- */
/* style.css は .single-visual に aspect-ratio:3/4＋img を absolute cover で配置している。
   スマホではカード全体が見えるよう contain に変え、コンテナの固定比率を解除する。 */
@media (max-width: 700px) {
  .single-visual { aspect-ratio: auto; width: auto; height: auto; max-width: 60%; margin: 0 auto; overflow: hidden; }
  .single-visual img { position: static; inset: auto; width: 100%; height: auto; max-height: 320px; object-fit: contain; display: block; margin: 0 auto; }
}

/* ---- ランキング：スマホは横4カラム表を上下2段レイアウトへ ---- */
/* 上段＝順位＋画像（＋レアは右寄せ）／下段＝カード名・価格を幅100%で表示 */
@media (max-width: 600px) {
  .rank-table thead { display: none; }
  .rank-table, .rank-table tbody { display: block; width: 100%; }
  .rank-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; width: 100%; max-width: 100%; padding: 10px 8px; border-bottom: 1px solid var(--color-border); }
  .rank-table td { padding: 0; border: 0; }
  .rank-table td.rank-no-cell { order: 1; width: auto; text-align: left; }
  .rank-table td.col-thumb { order: 2; width: 80px; }
  .rank-table td.col-thumb .tbl-thumb { width: 80px; height: 80px; display: block; }
  .rank-table td.col-thumb img { width: 80px; height: 80px; object-fit: contain; display: block; }
  .rank-table td.col-rarity { order: 3; width: auto; margin-left: auto; }
  .rank-table td.col-name { order: 4; width: 100%; }
  .rank-table td.col-price { order: 5; width: 100%; display: flex; align-items: baseline; gap: 6px; }
}

/* ---- カード一覧：スマホでも既定は画像グリッド（1行3枚） ---- */
/* 既定表示は view-grid（テンプレ初期クラス＋app.jsの既定'grid'）。
   モバイルは base の repeat(2,1fr) を 3枚に上書きして密度を上げる。
   .home-top はトップ専用の minmax(110px) を維持（より小さいカード）。 */
@media (max-width: 767px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}
