/* 構成の参考: SellYourMac のトップ（青いヘッダー・中央の検索・機種カード）。カード画像は Apple 公式（public/img/README.md） */
:root {
  --bg: #FFFFFF;
  --band: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #E3E8EF;
  --line-soft: #ECEFF4;
  --line-strong: #D3DAE3;
  --text: #0E1420;
  --text-2: #2B3644;
  --muted: #4A5668;
  --dim: #586476;
  --faint: #5F6B7C;
  --blue: #0B5BD3;
  --blue-dark: #0848AA;
  --accent: #1F6FEB;
  --accent-soft: #E8F0FE;
  --accent-soft-text: #1A56C4;
  --amber-soft: #FDF1DC;
  --amber-text: #8A5A00;
  --err: #A50E0E;
  --err-soft: #FDECEA;

  --font-sans: Inter, "Noto Sans JP", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font-family: var(--font-sans); line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); } a:hover { color: var(--accent-soft-text); }
.mono { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.center { text-align: center; }

/* 青いヘッダー */
.topbar { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(8, 40, 100, 0.15); }
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; }
.brand img { display: block; height: 32px; width: auto; }
.brand:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 4px; }
.brand-sub { font-size: 14px; font-weight: 500; opacity: 0.95; }

/* 上の帯：見出し・検索・カード */
.hero { background: var(--band); padding: clamp(36px, 6vw, 64px) 0 clamp(40px, 6vw, 64px); }
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero h1 { margin: 0; text-align: center; font-size: clamp(28px, 4.6vw, 46px); line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.lead { margin: 12px 0 28px; text-align: center; font-size: clamp(15px, 1.8vw, 19px); color: var(--muted); }

.search { width: 100%; max-width: 820px; }
.search-bar { display: flex; width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; overflow: hidden; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.15); }
.search-bar input { flex: 1 1 auto; min-width: 0; height: 60px; padding: 0 20px; border: 0; outline: none; background: transparent; color: var(--text); font-size: clamp(15px, 2vw, 18px); letter-spacing: 0.06em; }
.search-bar input::placeholder { color: #8893A2; letter-spacing: 0.02em; font-family: var(--font-sans); }
.search-btn { flex: 0 0 auto; border: 0; padding: 0 clamp(18px, 3vw, 32px); background: var(--accent); color: #fff; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; transition: background-color 150ms var(--ease); }
.search-btn:hover { background: var(--blue-dark); }
.search-btn:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.search-btn:disabled { opacity: 0.6; cursor: progress; }
.search-bar.small input { height: 50px; }
.search-meta { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--dim); }
.fine { margin: 8px 0 0; font-size: 12.5px; line-height: 1.8; color: var(--faint); }

/* 区切り「または 機種から選ぶ」 */
.divider { width: 100%; display: flex; align-items: center; gap: 16px; margin: clamp(28px, 4vw, 40px) 0 22px; color: var(--dim); font-size: 13px; letter-spacing: 0.08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

/* 機種カード */
.cards { width: 100%; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--text); cursor: pointer; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 150ms var(--ease); }
.card:hover { border-color: #B9C3D0; box-shadow: 0 6px 18px rgba(14, 20, 32, 0.08); transform: translateY(-2px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card-art { display: block; width: 100%; max-width: 160px; height: auto; aspect-ratio: 480 / 340; margin-bottom: 8px; }
.card-name { font-size: 15px; font-weight: 500; }
.card-sub { font-size: 13px; color: var(--accent); }

/* カードを押した後のモデル一覧 */
.models, .fallback { width: 100%; margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: clamp(16px, 3vw, 24px); }
.models-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.models-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.model-btn { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer; transition: border-color 150ms var(--ease), background-color 150ms var(--ease); }
.model-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.model-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.model-btn .yr { flex: 0 0 auto; font-family: var(--font-mono); font-size: 13px; color: var(--accent); }

/* お知らせ */
.status { width: 100%; max-width: 820px; margin-top: 16px; padding: 14px 18px; border-radius: 8px; background: var(--amber-soft); color: var(--amber-text); border: 1px solid #F2D9A6; }
.status.error { background: var(--err-soft); color: var(--err); border-color: #F5C2BD; }
.status.loading { background: #fff; color: var(--muted); border-color: var(--line); }

/* 結果（スペックシート） */
.result { width: 100%; max-width: 980px; margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(14, 20, 32, 0.06); animation: rise 400ms var(--ease); scroll-margin-top: 16px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .result, .card { animation: none; transition: none; } }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px clamp(18px, 3vw, 28px); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.flag { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.14em; color: var(--accent); }
.flag.catalog { color: var(--dim); }
.result-kind { font-size: 12px; color: var(--faint); }
.result-head { padding: clamp(20px, 3.5vw, 32px) clamp(18px, 3vw, 28px) clamp(16px, 3vw, 24px); }
.result-head h2 { margin: 0; font-size: clamp(24px, 3.8vw, 38px); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.result-head p { margin: 8px 0 0; font-size: clamp(13px, 1.6vw, 15px); color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tile { background: var(--surface); padding: 16px clamp(18px, 3vw, 28px); display: flex; flex-direction: column; gap: 6px; }
.tile-label { font-size: 12px; color: var(--faint); letter-spacing: 0.06em; }
.tile-value { font-size: clamp(18px, 2.2vw, 21px); font-weight: 600; line-height: 1.3; }
.tile-value .sep { color: #97A2B0; font-weight: 400; }
.tile .badge { align-self: flex-start; }
.rows { margin: 0; padding: 4px clamp(18px, 3vw, 28px); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: 0; }
.row dt { font-size: 14px; color: var(--dim); }
.row dd { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.row dd .muted { color: var(--faint); }
.result-foot { padding: 16px clamp(18px, 3vw, 28px) 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.actions:empty { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 54px; padding: 0 24px; border-radius: 8px; font-size: 16px; font-weight: 700; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: #fff; } .btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line-strong); } .btn-ghost:hover { border-color: var(--accent); color: var(--text); }

/* バッジ */
.badge { display: inline-block; font-size: 11px; line-height: 1.6; padding: 2px 9px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.badge-fixed { background: var(--accent-soft); color: var(--accent-soft-text); }
.badge-candidate { background: var(--amber-soft); color: var(--amber-text); }
.badge-spec { background: #E6F4EA; color: #1E7B34; }
.badge-ref { border: 1px solid #C5CDD8; color: var(--muted); }
.badge-unknown { border: 1px dashed #9AA5B4; color: var(--muted); }
.legend { width: 100%; max-width: 980px; display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--faint); margin-top: 12px; }
.legend > span { display: inline-flex; gap: 6px; align-items: center; }

/* 3ステップ・確認方法 */
.section-title { margin: 0 0 24px; font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; }
.steps { padding: clamp(48px, 7vw, 72px) 0; }
.step-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step-list li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 24px 16px; }
.step-num { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.step-list strong { font-size: 17px; }
.step-list span:last-child { font-size: 14px; color: var(--dim); line-height: 1.7; }
.guide { background: var(--band); padding: clamp(48px, 7vw, 72px) 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.tabs button { height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.tabs button:hover { color: var(--text); border-color: #9AA5B4; }
.tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-body { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px 24px; }
.guide-body figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.guide-body img { display: block; width: 100%; max-width: 480px; height: auto; }
.guide-body img.tall { width: auto; max-height: 360px; border-radius: 10px; box-shadow: 0 4px 16px rgba(14, 20, 32, 0.12); }
.guide-body figcaption { font-size: 15px; line-height: 1.8; color: var(--text-2); text-align: center; }


@media (max-width: 960px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .search-bar input { height: 54px; padding: 0 14px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile.wide { grid-column: span 2; }
  .actions .btn { flex: 1 1 100%; }
  .models-list { grid-template-columns: 1fr; }
}

/* macsell.jp に枠で埋め込んだとき（app.js が html に .embedded を付ける） */
.embedded .topbar { display: none; }

/* 入力の読み替えのお知らせ（FR-01） */
.input-note { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: #fff7e6; color: #7a4b00; font-size: 13px; line-height: 1.7; }
.input-note mark { background: #ffd666; color: inherit; padding: 0 2px; border-radius: 3px; font-family: 'JetBrains Mono', monospace; }
/* 文中のボタン（Appleで確認） */
.link-btn { padding: 0; border: 0; background: none; color: var(--accent, #0a66c2); font: inherit; text-decoration: underline; cursor: pointer; }
.copy-fallback { width: 100%; margin-top: 6px; font-family: 'JetBrains Mono', monospace; }

/* 買取査定の進め方（LINE か Web か。表示中の内容を引用して渡す） */
.assess-choice { margin-top: 16px; padding: 16px; border: 1px solid #d7e3f4; border-radius: 12px; background: #f7faff; }
.assess-choice h3 { margin: 0 0 4px; font-size: 16px; }
.assess-quote { margin: 10px 0; padding: 12px; border-radius: 8px; background: #fff; border: 1px solid #e3e8ef; font-family: 'JetBrains Mono', 'Noto Sans JP', monospace; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }
.assess-routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.assess-route .btn { display: flex; width: 100%; }
.btn-line { background: #06C755; color: #fff; border: 0; }
.btn-line:hover { background: #05b04b; color: #fff; }
