/**
 * TOP（pages#index）の多段グリッドのみ。試験一覧の余白は layouts/_cops_exams_index_viewport_style.html.erb（head 直埋め込み）。
 * 変更時はレイアウトの ?v= を更新。
 */

/* ============================================
   PCレイアウト幅 1440px 固定
   - 1440px超: 中央寄せ（左右均等余白）
   - 1440px未満: JS zoom でそのまま縮小
   ============================================ */
html {
  min-width: 1440px;
  overflow-x: hidden;
  /* スクロールバーを左右対称に確保 */
  scrollbar-gutter: stable both-edges;
  background: #f5f5f5;
  scrollbar-color: #c0c0c0 #f5f5f5;
}
body {
  min-width: 1440px;
}
.uk-container {
  width: 1440px !important;
  max-width: none !important;
  padding: 0 32px !important;
  box-sizing: border-box !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Webkit スクロールバースタイル */
html::-webkit-scrollbar {
  width: 10px;
}
html::-webkit-scrollbar-track {
  background: #f5f5f5;
}
html::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 5px;
  border: 2px solid #f5f5f5;
}

/* ナビバー常時表示（zoom 時にビューポート px が小さくなっても非表示にしない） */
.cops-pc-navbar {
  display: block !important;
}

/* cops-pc-only: PCレイアウトでは常時表示（zoom 時にビューポートが狭くなっても非表示にしない） */
.cops-pc-only {
  display: list-item !important;
}

/* ============================================
   タブレット幅でのグリッド縦積み（スマホ/タブレット UA のみ）
   - body.cops-handheld-ua: application.html.haml でハンドヘルド UA かつ ?ui=pc でない時に付与
   - PC ユーザーは zoom 縮小のみ → グリッドは縦積みしない
   ============================================ */
@media (max-width: 1024px) {
  body.cops-handheld-ua .cops-features.uk-grid,
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid,
  body.cops-handheld-ua .cops-pages-howto .uk-grid {
    margin-left: 0 !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
  }

  body.cops-handheld-ua .cops-features.uk-grid > .uk-width-1-3,
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid > .uk-width-1-3,
  body.cops-handheld-ua .cops-pages-howto .uk-grid > .uk-width-1-4 {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    flex: 0 0 auto !important;
    flex-basis: auto !important;
    float: none !important;
    box-sizing: border-box !important;
  }

  /* 縦積みの段間は gap のみ 10px（margin-top と UIKit の gap が二重にならない） */
  body.cops-handheld-ua .cops-features.cops-pages-home-block.uk-grid,
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid,
  body.cops-handheld-ua .cops-pages-howto .uk-grid {
    gap: 10px !important;
    row-gap: 10px !important;
    column-gap: 10px !important;
  }

  body.cops-handheld-ua .cops-features.uk-grid > [class*="uk-width"],
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid > [class*="uk-width"],
  body.cops-handheld-ua .cops-pages-howto .uk-grid > [class*="uk-width"] {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
}

#logs-teacher-results td .uk-flex.uk-flex-middle > a.uk-button.cops-row-action-tile {
  flex: 0 0 auto;
}

/* PC zoom: application.css の @media(max-width:1024px) レスポンシブ変換を PC ではキャンセル */
@media (max-width: 1024px) {
  body:not(.cops-handheld-ua) .cops-mobile-full-btn {
    display: inline-block !important;
    width: auto !important;
    text-align: left !important;
    margin-bottom: 0 !important;
  }
  body:not(.cops-handheld-ua) .back-link {
    display: inline !important;
    width: auto !important;
  }
}
