/* 画面の大きさごとの直し（中央・南関・地方で共通・2026-11-09）。ほかの CSS より後に読む。
   表示する項目や文言は変えない。崩れと読みにくさだけを直す。 */

/* iPhone が横向きで文字を勝手に拡大するのを止める */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

/* 日付の欄: WebKit の標準の見た目だと背景が白くなり、白い文字が読めない（手元の WebKit で確認） */
.date-select,body.dark .date-select{-webkit-appearance:none;appearance:none;padding-right:30px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:12px}

/* iPhone は 16px 未満の入力欄を押すと画面を拡大する */
@media (pointer:coarse){
  input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important}
}

/* 開いた箱の高さ: 100vh はスマホのアドレスバーぶんも含むので、見えている高さに合わせる */
@supports (height:100dvh){
  .reason-popover{max-height:calc(100dvh - 32px)}
  .reason-popover.rp-sheet{max-height:min(88dvh,calc(100dvh - 32px))}
}

/* 馬カード: 馬名が長いと閉じるボタンが次の行へ落ちる */
.reason-popover .rp-head .rp-name{flex:1 1 0}

/* 解錠の画面: 画面より高いと上下が切れて戻せない */
#authOverlay{align-items:flex-start;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:16px 0}
.auth-box{margin:auto}

/* 市場の見込みの一文: 細い画面で数字が画面の外へ出る */
@media (max-width:400px){
  .market-outlook .mo-points li small{display:block;margin-left:0;white-space:normal}
}

/* 出走表の移動ボタン: 320px 台で「次R」が切れる */
@media (max-width:359px){
  .detail-topbar .detail-race-nav{margin-left:0;flex-wrap:wrap;gap:3px}
  #view-detail #prevRaceBtn,#view-detail #nextRaceBtn,#view-detail #nextPostBtn{min-width:0;padding:8px 5px!important;font-size:12px!important}
  #view-detail #timeOrderPrevBtn,#view-detail #timeOrderNextBtn{padding:8px 3px!important;font-size:11.5px!important}
}

/* 一覧カード: 320px 台で頭数と馬名が次の行へ落ちる・切れる */
@media (max-width:360px){
  .race-meta span{margin-right:5px}
  /* 結果つきの行: 細い画面で馬名の幅が 0 になり 1 文字ずつ折れるので、確率は次の行へ送る */
  .race-list-top3-row{grid-template-columns:auto auto auto minmax(0,1fr) auto;grid-template-areas:"rank rel num name finish" "score score score pay pay"}
}
@media (max-width:340px){
  .race-meta{font-size:12px}
  .race-list-top3-name{font-size:11px}
}

/* 右の馬カードの幅: 画面が狭いときはカードを少し細くして、本文に幅を残す */
@media (min-width:900px) and (max-width:1100px){
  :root{--rp-w:440px}
  body.rp-drawer-open .pace-course.pc-tk .pc-lab-dim{transform:translate(-70%,-50%)}   /* 右端の「内ラチ」が切れない位置へ */
}
/* 右の馬カードで本文が 640px より細くなる幅は、スマホと同じ並びにする（幅の判定は画面の幅なので、カードの分を見込む） */
@media (min-width:900px) and (max-width:1210px){
  body.rp-drawer-open .detail-topbar{flex-wrap:wrap}
  body.rp-drawer-open .detail-race-nav{flex-wrap:wrap;gap:4px}
  body.rp-drawer-open #view-detail .nav-btn{white-space:nowrap}
  body.rp-drawer-open .pm-side{display:none}
  body.rp-drawer-open .pace-course{width:100%}
  body.rp-drawer-open .market-outlook .mo-hd{display:none}
  body.rp-drawer-open .market-outlook .mo-shape{grid-template-columns:repeat(2,1fr)}
  body.rp-drawer-open .market-outlook .mo-row{grid-template-columns:1fr 1fr;grid-template-areas:"band tag" "win top3";gap:6px 12px;padding:8px 4px}
  body.rp-drawer-open .market-outlook .mo-band{grid-area:band}
  body.rp-drawer-open .market-outlook .mo-tag{grid-area:tag}
  body.rp-drawer-open .market-outlook .mo-cell.win{grid-area:win}
  body.rp-drawer-open .market-outlook .mo-cell.top3{grid-area:top3}
  body.rp-drawer-open .market-outlook .mo-cap{display:block}
  body.rp-drawer-open .market-map .pm-flex{flex-direction:column}
  body.rp-drawer-open .market-map .mm-list{width:100%;max-height:230px}
  body.rp-drawer-open .market-map .mm-side{max-height:260px}
}

/* 低い画面（スマホの横向きなど） */
@media (max-height:500px){
  .auth-box{padding:16px 24px}

  /* 表示列のパネル: 下に切れて中身が見えないので、下から出すシートにする */
  #colPickerPanel.cpk-panel{position:fixed;top:auto;left:0;right:0;bottom:0;margin:0 auto;width:auto;max-width:560px;max-height:92vh;z-index:1000;border-radius:12px 12px 0 0;border-width:1px 1px 0;box-shadow:0 -4px 20px rgba(25,34,77,.16)}
  #colPickerPanel .cpk-top{padding:6px 14px 2px}
  #colPickerPanel .cpk-close{width:34px;height:34px}
  #colPickerPanel .cpk-sec{margin:6px 0 6px}
  #colPickerPanel .cpk-tile{min-height:36px}
  #colPickerPanel .cpk-row,#colPickerPanel .cpk-check{min-height:40px}
  #colPickerPanel .cpk-handle{height:40px}
  #colPickerPanel .cpk-foot{padding:6px 14px calc(6px + env(safe-area-inset-bottom))}
  #colPickerPanel .cpk-reset,#colPickerPanel .cpk-done{min-height:38px}
  body.cpk-open{overflow:hidden}

  /* 検索: 見出しと下のボタンで高さを使い切り、条件が見えない */
  .search-compact-viewport .search-dialog-header{padding-block:2px;padding-top:calc(2px + env(safe-area-inset-top,0px))}
  .search-dialog-header h2{font-size:15px}
  .search-dialog-header button{width:36px;height:36px;font-size:22px}
  .search-compact-viewport .search-query-area{padding-bottom:4px}
  .search-query-wrap input{min-height:34px}
  .search-section-tabs>button{height:34px;padding-block:2px}
  .search-dialog-body{padding-block:8px}
  .search-compact-viewport .search-dialog-footer{display:flex;align-items:center;gap:8px;padding-block:4px calc(4px + env(safe-area-inset-bottom,0px))}
  .search-compact-viewport .search-draft-conditions{flex:1 1 40%;min-width:0;height:36px;margin:0}
  .search-footer-actions{flex:1 1 60%;min-width:0}
  .search-footer-actions button{min-height:36px;padding-block:4px}
}
@supports (height:100dvh){
  @media (max-height:500px){
    #colPickerPanel.cpk-panel{max-height:92dvh}
  }
  @media (min-height:501px) and (max-width:640px){
    #colPickerPanel.cpk-panel{max-height:82dvh}
  }
  @media (min-height:501px) and (min-width:641px){
    #colPickerPanel.cpk-panel{max-height:min(72dvh,600px)}
  }
}

/* スマホの横向き: 見出しが画面を埋めて、一覧も表もほとんど見えない */
@media (max-height:500px) and (orientation:landscape){
  .kc-navbar{position:static;padding-block:4px}

  /* 一覧の見出し（日付を見出しの横へ、会場と画面の切り替えを 1 行へ） */
  .race-header-gradient{padding:6px 0 8px}
  .central-header-top{flex-wrap:nowrap;gap:8px}
  .date-select{width:auto;flex:0 1 auto;min-width:0;max-width:260px;min-height:36px;padding-block:4px}
  .central-header-navigation{margin-top:6px!important;flex-wrap:nowrap;justify-content:space-between}
  .venue-tabs{flex:0 1 auto;min-width:0}
  .venue-tab{min-height:36px;padding:5px 14px}
  .view-toggle{flex:0 1 320px;width:auto;margin:0 0 0 auto}
  .view-toggle .view-toggle-btn{min-height:36px;padding:4px 6px}
  .race-header-gradient .container>div.race-search-toolbar:last-child{margin-top:6px!important}
  .central-search-launcher,.race-search-toolbar .race-order-toggle{min-height:38px;padding-block:2px}
  .central-search-launcher strong,.central-search-launcher small{display:inline}
  .central-search-launcher small{margin-left:8px}

  /* 出走表の見出し（荒れ度を★の左へ） */
  .detail-topbar{margin-bottom:4px}
  #view-detail .nav-btn,.venue-jump-btn{min-height:32px;padding-block:4px}
  #detailHeader{padding:6px 10px 8px}
  .detail-race-identity{min-height:24px;padding-right:96px}
  .detail-race-heading h2{font-size:15px;margin:1px 0}
  .detail-upset-ring{grid-row:1 / span 3;width:44px;height:44px;margin-right:42px}
  .detail-upset-value strong{font-size:16px}
  .detail-upset-note{margin-top:2px}
  #detailFavoriteBtn{top:4px;right:4px;width:40px;height:40px;font-size:24px}
}

/* 出走表: 右にまだ列があるあいだの影と矢印、画面の上に残す見出し（web/table-aids.js と対） */
.rt-outer{position:relative}
.rt-outer::before,.rt-outer::after,.rt-float::after{content:"";position:absolute;top:0;width:22px;pointer-events:none;opacity:0;transition:opacity .15s}
.rt-outer::before,.rt-outer::after{left:calc(var(--rt-left,0px) + var(--rt-width,100%) - 22px)}
.rt-float::after{right:0}
.rt-outer::after{bottom:0;z-index:7;background:linear-gradient(to right,rgba(21,28,66,0),rgba(21,28,66,.16));border-radius:0 var(--rt-radius,0) var(--rt-radius,0) 0}
.rt-outer::before,.rt-float::after{height:var(--rt-head-h,0px);background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 2l4 4-4 4' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 4px center/10px,linear-gradient(to right,rgba(21,28,66,0),#151c42 70%)}
.rt-outer::before{z-index:8;border-top-right-radius:var(--rt-radius,0)}
.rt-more-right::before,.rt-more-right::after,.rt-more-right .rt-float::after{opacity:1}
body.dark .rt-outer::after{background:linear-gradient(to right,rgba(0,0,0,0),rgba(0,0,0,.42))}
body.dark .rt-outer::before,body.dark .rt-float::after{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 2l4 4-4 4' fill='none' stroke='%23ddddf0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 4px center/10px,linear-gradient(to right,rgba(24,25,36,0),#181924 70%)}
.rt-float{position:fixed;top:0;left:var(--rt-fixed-left,0px);width:var(--rt-width,100%);z-index:50;visibility:hidden}  /* html と body の overflow-x:hidden で sticky は効かない */
.rt-float.on{visibility:visible}
.rt-float-scroll{overflow:hidden;touch-action:pan-y;box-shadow:0 2px 6px rgba(21,28,66,.24)}  /* 指では動かさず web/table-aids.js が表に合わせる。hidden でも固定列は効く */
.rt-float-inner{box-sizing:border-box;background:#151c42}
body.dark .rt-float-inner{background:#181924}
.rt-float-scroll table.race-table{table-layout:fixed;margin:0}
