/* MiniMax H3 動作環境チェック Web簡易版 */
* { box-sizing: border-box; }

/* hidden 属性を CSS の display 指定（.guard の flex 等）より必ず優先させる */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  background: #eef2f7;
  color: #1e293b;
  line-height: 1.65;
  font-size: 15px;
}

header {
  background: linear-gradient(120deg, #0f172a, #4c1d95 85%);
  color: #fff;
  padding: 28px 16px 24px;
  text-align: center;
}
/* 言語の切り替え（日本語 | English）。ヘッダーの右上と、非 Windows 向け案内カードの右上に置く。
   文字色は親から受け継ぐ（濃いグラデーションの上では白、白いカードの上では濃色）ので、どちらでも読める。
   ヘッダーの上の余白は切り替えの行のぶんだけ詰めてあり、見出しの位置はほとんど変わらない */
.lang-switch {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
}
.lang-switch a, .lang-switch .lang-current { padding: 2px 4px; border-radius: 4px; }
.lang-switch a { color: inherit; opacity: 0.85; text-decoration: underline; text-underline-offset: 2px; }
.lang-switch a:hover { opacity: 1; }
.lang-switch a:focus-visible { opacity: 1; outline: 2px solid currentColor; outline-offset: 1px; }
.lang-switch .lang-current { font-weight: 700; }
.lang-switch .lang-sep { opacity: 0.45; }
header .lang-switch { margin: -20px 0 2px; }
.guard .card .lang-switch { margin: -6px 0 4px; }

/* 英語表示（<html lang="en">）だけの微調整。日本語の見た目は変えない */
:root[lang="en"] header .thin { white-space: nowrap; } /* "Web quick version" を途中で折り返さない */
:root[lang="en"] .stars { letter-spacing: 0.04em; } /* 字間は★の並び用。英字の段階名には広すぎる */

header h1 { margin: 0 0 6px; font-size: 1.45rem; letter-spacing: 0.02em; }
header .thin { font-weight: 400; opacity: 0.85; font-size: 1.05rem; }
header p { margin: 0 auto; max-width: 640px; opacity: 0.92; font-size: 0.92rem; }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
footer { text-align: center; color: #64748b; font-size: 0.8rem; padding: 8px 0 24px; }

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  padding: 18px 20px;
  margin: 14px 0;
}
.card h2 { margin: 0 0 10px; font-size: 1.05rem; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.card h3 { margin: 0 0 4px; font-size: 0.98rem; color: #0f172a; }
.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: #4c1d95;
  color: #fff;
  font-size: 0.85rem;
  flex: none;
}
/* カード見出しの右にボタンを置く行 */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; }
.card.compact { padding: 14px 18px; }
.card.compact .note { margin: 2px 0 10px; }
button.mini { padding: 4px 12px; font-size: 0.85rem; }
/* 見出し行右端のボタン群（「RX対応表」を「再スキャン」の左に並べる） */
.head-actions { display: flex; gap: 8px; align-items: center; flex: none; }
button.rx-btn { border-color: #b3302a; color: #b3302a; background: #fff5f4; font-weight: 700; }
button.rx-btn:hover { background: #fde8e6; }

/* 判定結果 */
.result { border-top: 4px solid #4c1d95; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-head h2 { margin: 0; }
.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  background: #6b7280;
}
.badge.na { background: #dc2626; }
.badge.marginal { background: #d97706; }
.badge.min { background: #ea580c; }
.badge.rec { background: #16a34a; }
.badge.full { background: #7c3aed; }
.badge.unknown { background: #6b7280; }

.result-main { display: grid; grid-template-columns: 200px 1fr; gap: 20px; margin-top: 14px; align-items: start; }

/* 動作スコアのゲージ */
.gauge-box { text-align: center; }
.gauge-title { font-weight: 700; color: #475569; font-size: 0.9rem; }
.gauge { width: 100%; max-width: 180px; display: block; margin: 0 auto -46px; }
.gauge-bg, .gauge-fg { fill: none; stroke-width: 11; stroke-linecap: round; }
.gauge-bg { stroke: #e2e8f0; stroke-dasharray: 245 327; }
.gauge-fg { stroke: #16a34a; stroke-dasharray: 0 327; transition: stroke-dasharray 0.5s ease; }
.gauge-value { font-size: 2.6rem; font-weight: 800; line-height: 1; color: #16a34a; }
.gauge-max { font-size: 0.85rem; font-weight: 500; color: #64748b; margin-left: 4px; }
.gauge-grade { font-weight: 700; color: #334155; margin-top: 20px; }
.gauge-box .note { margin-top: 4px; font-size: 0.75rem; }

/* このPCの状態 */
.headline { font-size: 1.18rem; color: #b45309; margin: 0 0 6px; line-height: 1.4; }
.explanation { margin: 0 0 8px; }
.stars { color: #f59e0b; letter-spacing: 0.12em; margin: 0 0 10px; font-weight: 600; }
.counts { color: #475569; font-size: 0.9rem; margin: 0 0 8px; }

/* 配点内訳 */
.breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin: 8px 0; }
.bd-cell { background: #f1f5f9; border-radius: 8px; padding: 8px 6px; text-align: center; }
.bd-cell.unknown { opacity: 0.55; }
.bd-label { font-size: 0.78rem; color: #475569; }
.bd-value { font-weight: 700; color: #334155; }
.bd-value.full { color: #16a34a; }

/* 無料の調整 */
.tips { margin-top: 14px; padding: 12px 16px; background: #f0fdf4; border-radius: 10px; border: 1px solid #bbf7d0; }
.tips h3 { margin: 0 0 6px; font-size: 0.95rem; color: #15803d; }
.tips ol { margin: 0; padding-left: 1.4em; }
.tips li { margin: 3px 0; font-size: 0.92rem; }

/* 100点への推奨変更 */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.rec-card { border: 1px solid #e2e8f0; border-left: 4px solid #4c1d95; border-radius: 8px; padding: 12px 14px; background: #fcfcfd; }
.rec-card h3 { margin: 0 0 6px; font-size: 0.98rem; color: #4c1d95; }
.rec-card .gain { color: #16a34a; font-weight: 700; margin-left: 6px; }
.rec-card p { margin: 3px 0; font-size: 0.88rem; }
.rec-key { color: #64748b; font-weight: 600; }
.rec-action { color: #475569; line-height: 1.55; }
/* 特設ページ「高いGPUが、いちばん安い。」への案内（GPU の推奨変更・RX対応表） */
.gpu-cost { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: #fff7e0; border: 1px solid #f5d98b; color: #3f3a2e; line-height: 1.6; font-size: 0.86rem; overflow-wrap: anywhere; }
.gpu-cost strong { color: #92400e; }
.gpu-cost a { font-weight: 700; }
.rx-dialog .gpu-cost { margin: 0 0 10px; }

/* 表の共通ルール（全ての表形式で統一。js/table-resize.js が全 table に適用）:
   ・列幅は Excel／スプレッドシートと同じく、見出しの境目をドラッグして変えられる（table-layout: fixed ＋ col 幅）
   ・長い説明は列内でワードブレイクして全文字を表示し、横にはみ出させない（枠に収まらないぶんは .table-wrap が横スクロール）
   ・既定の列幅は各 table の data-col-widths で指定する */
th, td { overflow-wrap: anywhere; word-break: break-word; }
table.resizable { table-layout: fixed; border-collapse: collapse; }
table.resizable th { position: relative; }
.col-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  z-index: 2;
}
.col-resizer:hover, .col-resizer.active { background: rgba(76, 29, 149, 0.35); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }
.table-hint { color: #94a3b8; font-size: 0.78rem; margin: 4px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table-hint .link-btn { padding: 0; font-size: 0.78rem; }

/* 調査項目 */
.checks-table { border-collapse: collapse; font-size: 0.85rem; }
.checks-table th, .checks-table td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; vertical-align: top; }
.checks-table thead th { background: #f1f5f9; }
.chk-label { font-weight: 600; }
.chk-state { font-weight: 700; }
.chk-state.rec { color: #16a34a; }
.chk-state.min { color: #ea580c; }
.chk-state.ng, .chk-state.blocking { color: #dc2626; }
.chk-state.unknown { color: #64748b; }
.checks-table td.note { font-size: 0.8rem; }

.msg { margin: 6px 0; padding-left: 1.3em; }
.msg li { margin: 3px 0; }
.blockers li { color: #b91c1c; font-weight: 600; }
.pending li { color: #b45309; }
.warnings li { color: #92400e; font-size: 0.92rem; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
button {
  font: inherit;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
}
button:hover { background: #eef2f7; }
.link-btn { border: none; background: none; color: #2563eb; text-decoration: underline; padding: 8px 4px; }
.copy-done { color: #16a34a; font-size: 0.9rem; }

/* 検出結果・入力（ラベル｜値 の 1 行形式） */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; align-items: baseline; }
.kv dt { color: #64748b; font-weight: 600; white-space: nowrap; }
.kv dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv select {
  font: inherit;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
}
.inline-select { font-size: 0.85rem; color: #475569; max-width: 15em; }
.hint { color: #94a3b8; font-size: 0.8rem; }
.kv .note { margin: 0; flex-basis: 100%; }
.note { color: #64748b; font-size: 0.85rem; margin: 8px 0 0; }


/* 判定ボタン */
.judge-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
button.primary {
  background: #4c1d95;
  color: #fff;
  border-color: #4c1d95;
  font-weight: 700;
  padding: 10px 32px;
  font-size: 1.02rem;
}
button.primary:hover:not(:disabled) { background: #5b21b6; }
button.primary:disabled { background: #cbd5e1; border-color: #cbd5e1; color: #94a3b8; cursor: not-allowed; }
.judge-row .note { margin: 0; }

/* 改善ヒント */
#suggestions { margin: 4px 0 0; padding-left: 1.4em; }
#suggestions li { margin: 6px 0; }

/* 判定基準表 */
.table-wrap { overflow-x: auto; margin-top: 10px; }
.criteria { border-collapse: collapse; font-size: 0.82rem; }
.criteria th:first-child, .criteria td:first-child { font-weight: 600; }
.criteria th, .criteria td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; vertical-align: top; }
.criteria thead th { background: #f1f5f9; }
.criteria td:nth-child(2) { color: #b91c1c; }
.criteria td:nth-child(5) { color: #6d28d9; }

.footer-card { background: #f8fafc; }

/* 非対応環境の案内 */
.guard { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.guard .card { max-width: 560px; }
.guard h1 { font-size: 1.25rem; margin-top: 0; }

@media (max-width: 640px) {
  .result-main { grid-template-columns: 1fr; }
  .gauge { max-width: 150px; }
}

@media (max-width: 560px) {
  /* minmax(0, 1fr) と min-width: 0 が無いと、GPU のプルダウン（長い選択肢）の幅に引っ張られて列が画面より広くなり、
     スマホでページ全体が横にはみ出す（日本語でも 390px 幅で 466px になっていた。英語はさらに長い） */
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { min-width: 0; }
  /* 英語は①の見出しが長く、右のボタンに押されて 3 行に割れるので、ボタンを次の行へ送る */
  :root[lang="en"] .card-head { flex-wrap: wrap; }
  :root[lang="en"] .head-actions { margin-left: auto; }
  .kv dt { margin-top: 8px; }
  .hint { flex-basis: 100%; }
  header h1 { font-size: 1.2rem; }
  .headline { font-size: 1.05rem; }
}

/* Radeon RX 対応表ダイアログ（①の「RX対応表」ボタン） */
.rx-dialog {
  width: min(96vw, 1440px);
  max-height: 92vh;
  overflow: auto; /* 内容が長いときはダイアログ内でスクロールし、末尾のボタンも必ず届く */
  border: none;
  border-radius: 12px;
  padding: 0 22px 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  color: #1e293b;
  font: inherit;
}
.rx-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
/* 見出し行（閉じるボタン付き）はスクロールしても常に見える */
.rx-dialog-head { position: sticky; top: 0; z-index: 1; background: #fff; padding: 16px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rx-dialog h2 { margin: 0; font-size: 1.1rem; color: #0f172a; }
.rx-dialog h3 { margin: 14px 0 4px; font-size: 0.98rem; color: #4c1d95; }
.rx-dialog .table-wrap { margin-top: 6px; }
.rx-table { border-collapse: collapse; font-size: 0.82rem; }
.rx-table th, .rx-table td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; vertical-align: top; }
.rx-table thead th { background: #f1f5f9; }
.rx-table td.strong { font-weight: 700; }
.rx-table td.note { font-size: 0.78rem; margin: 0; }
.rx-tier-full td { background: #e2effa; }
.rx-tier-rec td { background: #e2f6e8; }
.rx-tier-min td { background: #fff6d6; }
.rx-tier-na td { background: #f5f5f5; }
.rx-dialog .note.legend { margin-top: 12px; padding: 10px 12px; background: #fff8e1; border-radius: 8px; color: #5b4a1a; }
