:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1d232b;
  --muted: #5f6975;
  --line: #d9dee7;
  --accent: #0f7b6c;
  --accent-strong: #07594f;
  --warn: #b4541d;
  --risk: #9d2d3a;
  --good: #0b6b3a;
  --shadow: 0 16px 40px rgba(28, 39, 52, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button {
  -webkit-tap-highlight-color: rgba(15, 123, 108, 0.18);
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:disabled,
button.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary,
.tag button,
.feedback button,
#clearResume,
#clearProfile {
  background: #eef2f5;
  color: var(--ink);
}

button.secondary:hover,
.tag button:hover,
.feedback button:hover,
#clearResume:hover,
#clearProfile:hover {
  background: #e0e6ec;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  margin-bottom: 14px;
}

h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
  max-width: 760px;
}

.status-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.status-panel span,
.status-panel small {
  color: var(--muted);
  display: block;
}

.status-panel strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  margin: 10px 0 6px;
}

.workflow {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.panel,
.recommendations {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0; /* グリッド/フレックス内で長い文字列があっても画面幅を超えないように */
}

.panel-heading {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading > span {
  align-items: center;
  background: #e6f3f0;
  border-radius: 999px;
  color: var(--accent-strong);
  display: flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.panel-heading p,
.section-title span,
.message,
.summary-card,
.tag small,
.job-meta,
.job-card p {
  color: var(--muted);
}

.upload-box,
.manual-form {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  margin-bottom: 12px;
}

.manual-form {
  grid-template-columns: 160px 1fr auto;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.chat-form {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.message {
  min-height: 22px;
}

.summary-card {
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0;
  padding: 14px;
}

/* 抽出テキスト・要約・メッセージの長い文字列（URL等）を折り返す */
.summary-card,
.summary-card p,
.message,
#textPreview,
#profileSummary {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary-card p {
  line-height: 1.65;
  margin-bottom: 8px;
}

.hidden {
  display: none;
}

.section-title {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 18px 0 12px;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.section-title h2,
.section-title h3 {
  margin-bottom: 0;
}

.recommendation-tools {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.recommendation-tools label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 4px;
}

.recommendation-tools select {
  min-width: 150px;
}

.platform-section {
  margin-top: 18px;
}

.platform-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.platform-lead {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 14px;
}

.platform-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.platform-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto 1fr auto;
  min-height: 218px;
  padding: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.platform-card.selected {
  background: #f6fbfa;
  border-color: #a9cdc5;
  box-shadow: 0 10px 28px rgba(15, 123, 108, 0.08);
}

.platform-card.unsupported {
  background: #fbfcfd;
}

.platform-toggle {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
}

.platform-toggle input {
  margin-top: 4px;
  min-height: 0;
  width: auto;
}

.platform-toggle strong,
.platform-toggle small {
  display: block;
}

.platform-toggle small,
.platform-card p,
.platform-notice {
  color: var(--muted);
}

.platform-card p {
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 0;
}

.platform-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-badges span {
  background: #edf1f4;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.platform-badges .status-search {
  background: #dceee9;
  color: var(--good);
}

.platform-badges .status-api_available {
  background: #e8f0ff;
  color: #2456a4;
}

.platform-badges .status-unsupported {
  background: #f4e9e6;
  color: var(--warn);
}

.platform-notice {
  display: grid;
  gap: 6px;
  line-height: 1.55;
  margin-top: 12px;
}

.platform-notice p {
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 10px 12px;
}

.recommendation-status {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 12px;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
}

.tag-grid.empty {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 12px;
}

.tag {
  align-items: center;
  background: #f3f7f6;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  display: inline-flex;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px 6px 10px;
}

.tag.avoid {
  background: #fff3f2;
  border-color: #efcbc7;
}

.tag input {
  min-height: 0;
  width: auto;
}

.tag button {
  border-radius: 6px;
  min-height: 26px;
  padding: 0 8px;
}

.recommendations {
  margin-top: 18px;
}

.job-list {
  display: grid;
  gap: 12px;
}

.empty-state {
  background: #f9fafb;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 22px;
}

.empty-state strong {
  color: var(--ink);
  display: block;
  margin-bottom: 8px;
}

.empty-state p {
  line-height: 1.65;
  margin-bottom: 0;
}

.job-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: 98px 1fr;
  padding: 18px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.job-card:hover {
  border-color: #b7c5cf;
  box-shadow: 0 18px 42px rgba(28, 39, 52, 0.12);
  transform: translateY(-1px);
}

.job-card.viewed {
  background: #fbfcfd;
}

.rank-column {
  display: grid;
  gap: 8px;
  grid-template-rows: auto min-content;
}

.rank {
  align-items: center;
  border-radius: 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  justify-content: center;
  min-height: 86px;
}

.rank span {
  font-size: 34px;
  line-height: 1;
}

.rank small {
  font-size: 13px;
  margin-top: 6px;
  opacity: 0.9;
}

.action-label {
  background: #f2f5f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  padding: 8px;
  text-align: center;
}

.rank-a {
  background: var(--good);
}

.rank-b {
  background: var(--warn);
}

.rank-c {
  background: var(--risk);
}

.job-body {
  min-width: 0;
}

.job-header {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 10px;
}

.source-line {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 800;
  gap: 8px;
  margin-bottom: 6px;
}

.source-line span {
  background: #eef3f2;
  border-radius: 999px;
  padding: 4px 9px;
}

.source-line .closed-badge {
  background: #f8e6e5;
  color: var(--risk);
}

.source-line .open-badge {
  background: #dceee9;
  color: var(--good);
}

.job-card h3 {
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 0;
}

.primary-link {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

.primary-link:hover {
  background: var(--accent-strong);
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.job-meta span {
  background: #f6f8fa;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  padding: 6px 8px;
}

.decision-strip {
  align-items: center;
  background: #f8fbfa;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto auto minmax(0, 1fr);
  margin: 12px 0;
  padding: 10px 12px;
}

.decision-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.decision-strip strong {
  color: var(--accent-strong);
}

.decision-strip em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.reason-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.reason-grid ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.checklist {
  background: #fffaf3;
  border: 1px solid #f0d8ba;
  border-radius: 8px;
  margin-top: 12px;
  padding: 10px 12px;
}

.checklist strong {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

.checklist div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.checklist span {
  background: #fff;
  border: 1px solid #efd7b6;
  border-radius: 999px;
  color: #76522d;
  font-size: 12px;
  padding: 4px 8px;
}

.related-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.related-tags span {
  background: #edf1f4;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
}

.feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.feedback button.selected {
  background: #dceee9;
  color: var(--accent-strong);
}

/* ---- 2ページ構成 / 検索バー ---- */
.run-search-bar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 18px;
  padding: 18px 20px;
}

.run-search-hint {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.run-search-hint.warn {
  color: var(--risk);
  font-weight: 700;
}

.run-search-button {
  font-size: 16px;
  min-height: 52px;
  padding: 0 28px;
  white-space: nowrap;
}

/* ---- 結果ビュー ヘッダ ---- */
.results-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.results-header-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.results-header-tools label {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.results-header-tools select {
  min-width: 150px;
  width: auto;
}

.deck-remaining {
  background: #eef3f2;
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
}

/* ---- スワイプデッキ ---- */
.deck {
  margin: 0 auto;
  max-width: 520px;
  min-height: 340px;
  overscroll-behavior: contain;
  position: relative;
}

.deck-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  left: 0;
  padding: 22px;
  position: absolute;
  right: 0;
  top: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
  user-select: none;
}

.deck-card.depth-0 {
  cursor: grab;
  touch-action: none;
  z-index: 3;
}

.deck-card.dragging {
  cursor: grabbing;
  transition: none;
}

.deck-card.depth-1 {
  transform: translateY(14px) scale(0.96);
  z-index: 2;
}

.deck-card.depth-2 {
  transform: translateY(28px) scale(0.92);
  z-index: 1;
}

.deck-card.fly-right {
  opacity: 0;
  transform: translate(140%, -20px) rotate(18deg) !important;
}

.deck-card.fly-left {
  opacity: 0;
  transform: translate(-140%, -20px) rotate(-18deg) !important;
}

.deck-stamp {
  border: 3px solid;
  border-radius: 10px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0;
  padding: 4px 14px;
  pointer-events: none;
  position: absolute;
  top: 24px;
  transition: opacity 0.1s ease;
}

.deck-stamp-like {
  border-color: var(--good);
  color: var(--good);
  right: 24px;
  transform: rotate(12deg);
}

.deck-stamp-nope {
  border-color: var(--risk);
  color: var(--risk);
  left: 24px;
  transform: rotate(-12deg);
}

.deck-card-top {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.deck-source {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.deck-rank {
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 12px;
}

.deck-rank.rank-a {
  background: var(--good);
}

.deck-rank.rank-b {
  background: var(--warn);
}

.deck-rank.rank-c {
  background: var(--risk);
}

.deck-title {
  font-size: 20px;
  line-height: 1.4;
  margin: 0;
}

.deck-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deck-meta span {
  background: #f6f8fa;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
}

.deck-reasons {
  color: var(--ink);
  line-height: 1.55;
  margin: 0;
  padding-left: 18px;
}

.deck-reasons li {
  margin-bottom: 4px;
}

.deck-link {
  align-self: flex-start;
  color: var(--accent);
  font-weight: 800;
  margin-top: auto;
  text-decoration: none;
}

.deck-link:hover {
  text-decoration: underline;
}

/* ---- デッキ操作ボタン ---- */
.deck-controls {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 22px auto 0;
  max-width: 520px;
}

/* .deck-controls の display:flex が後勝ちで .hidden を上書きするのを防ぐ */
.deck-controls.hidden {
  display: none;
}

.deck-action {
  flex: 1;
  font-size: 16px;
  min-height: 52px;
}

.deck-nope {
  background: #fff;
  border: 1px solid #efcbc7;
  color: var(--risk);
}

.deck-nope:hover {
  background: #fff3f2;
}

.deck-like {
  background: var(--good);
}

.deck-like:hover {
  background: #08562e;
}

/* ---- 興味ありリスト ---- */
.interest-list {
  margin: 0 auto;
  max-width: 640px;
}

.interest-summary {
  background: #f8fbfa;
  border: 1px solid #cfe0dc;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 16px 18px;
}

.interest-summary strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.interest-summary p {
  color: var(--muted);
  margin: 0;
}

.interest-items {
  display: grid;
  gap: 10px;
}

.interest-item {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.interest-item h3 {
  font-size: 16px;
  line-height: 1.4;
  margin: 0 0 6px;
}

.interest-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
}

.interest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

/* ---- アップロードファイルの明示 ---- */
.uploaded-file {
  align-items: center;
  background: #eef5f3;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.uploaded-file-icon {
  font-size: 22px;
  line-height: 1;
}

.uploaded-file-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.uploaded-file-text small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.uploaded-file-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploaded-file-when {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
  white-space: nowrap;
}

/* ---- 端末間同期パネル ---- */
.sync-panel {
  margin-top: 18px;
}

.sync-badge {
  background: #edf1f4;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
}

.sync-badge.on {
  background: #dceee9;
  color: var(--good);
}

.sync-lead {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 12px;
}

.sync-form {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  margin-bottom: 10px;
}

.sync-status {
  color: var(--muted);
  line-height: 1.55;
  min-height: 20px;
}

#syncStop {
  margin-top: 10px;
}

/* ---- 設定ページのアクションバー ---- */
.run-search-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

/* ---- ウォッチリスト ---- */
.watchlist-body {
  margin: 0 auto;
  max-width: 720px;
}

.watch-section {
  margin-bottom: 24px;
}

.watch-section-title {
  align-items: center;
  border-bottom: 2px solid var(--line);
  display: flex;
  font-size: 18px;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

.watch-section-title small {
  background: #eef3f2;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 2px 10px;
}

.watch-section-title.is-closed {
  color: var(--muted);
}

.watch-empty {
  color: var(--muted);
}

.watch-item {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 10px;
  padding: 14px 16px;
}

.watch-item.is-closed {
  background: #fbfafa;
  opacity: 0.8;
}

.watch-item h3 {
  font-size: 16px;
  line-height: 1.4;
  margin: 6px 0;
}

.watch-item-top {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watch-source {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.watch-checked {
  color: var(--muted);
  font-size: 12px;
}

.watch-status {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
}

.watch-status.open {
  background: #dceee9;
  color: var(--good);
}

.watch-status.closed {
  background: #f8e6e5;
  color: var(--risk);
}

.watch-status.unknown {
  background: #f4eee6;
  color: var(--warn);
}

.watch-status.checking {
  background: #eef1f4;
  color: var(--muted);
}

.watch-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
}

.watch-item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watch-item-actions .primary-link {
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
}

@media (max-width: 860px) {
  .intro,
  .workflow,
  .platform-grid,
  .job-card,
  .reason-grid,
  .job-header,
  .decision-strip,
  .run-search-bar,
  .interest-item,
  .watch-item {
    grid-template-columns: 1fr;
  }

  .run-search-actions {
    justify-content: stretch;
  }

  .run-search-actions button {
    flex: 1;
  }

  .watch-item-actions {
    flex-direction: row;
  }

  .watch-item-actions .primary-link {
    flex: 1;
  }

  .run-search-button {
    width: 100%;
  }

  .interest-item .primary-link {
    justify-content: center;
    width: 100%;
  }

  .upload-box,
  .manual-form,
  .sync-form,
  .recommendation-tools {
    grid-template-columns: 1fr;
  }

  .recommendation-tools {
    align-items: stretch;
    display: grid;
  }

  .app-shell {
    padding: 20px 14px calc(20px + env(safe-area-inset-bottom));
  }

  /* プラットフォームカードを「行」に圧縮（説明文・連携ボタンはモバイルでは省略） */
  .platform-card {
    min-height: 0;
    grid-template-rows: auto;
    gap: 6px;
    padding: 12px 14px;
  }

  .platform-card p,
  .platform-card > button[data-platform-action],
  .platform-badges span:not(.platform-status) {
    display: none;
  }

  .platform-toggle {
    align-items: center;
  }

  .platform-toggle input {
    margin-top: 0;
  }

  /* スワイプ操作ボタンを画面下に固定（親指で届く） */
  .deck-controls {
    bottom: 0;
    margin: 16px auto 0;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    position: sticky;
    z-index: 5;
  }

  /* 絶対配置のデッキが sticky ボタンの下に潜らないよう下余白を確保 */
  .deck {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .deck-action {
    min-height: 56px;
  }

  .rank {
    min-height: 58px;
  }

  .rank-column {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto;
  }

  .action-label {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .primary-link {
    justify-content: center;
    width: 100%;
  }

  .decision-strip em {
    text-align: left;
  }
}

/* ---- スマホ（縦持ち）優先の微調整 ---- */
@media (max-width: 560px) {
  .app-shell {
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
  }

  /* 先頭の見出しを詰める：eyebrowは隠し、h1とリードを小さく */
  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 26px;
    line-height: 1.15;
    margin-bottom: 8px;
  }

  .lead {
    font-size: 14px;
    line-height: 1.6;
  }

  .intro {
    gap: 12px;
    margin-bottom: 14px;
  }

  /* ステータスパネル（確定タグ数）は1行にコンパクト化 */
  .status-panel {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 12px 14px;
  }

  .status-panel strong {
    font-size: 24px;
    margin: 0;
  }

  .status-panel span,
  .status-panel small {
    display: inline;
  }

  /* パネル全体の余白と見出しを詰める */
  .panel {
    padding: 16px;
  }

  .panel-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .panel-heading > span {
    height: 30px;
    width: 30px;
  }

  .panel-heading p {
    font-size: 13px;
    line-height: 1.5;
  }

  h2 {
    font-size: 19px;
  }

  .section-title {
    margin: 14px 0 10px;
  }

  .workflow {
    gap: 12px;
  }

  .platform-grid {
    gap: 8px;
  }

  .platform-lead {
    font-size: 13px;
    margin-bottom: 10px;
  }

  /* デッキは画面の縦をしっかり使う（小マージン＋vh基準） */
  .deck {
    max-width: none;
    min-height: min(62vh, 460px);
  }

  .deck-card {
    border-radius: 14px;
    padding: 18px;
  }

  .deck-title {
    font-size: 18px;
  }

  .deck-controls {
    gap: 10px;
    max-width: none;
  }

  /* ヘッダのツール群はコンパクトに折返す */
  .results-header,
  .results-header-tools {
    gap: 8px;
  }

  .results-header-tools {
    width: 100%;
  }

  .results-header-tools select {
    min-width: 0;
  }

  .watch-item-actions {
    flex-direction: row;
  }

  /* 興味あり/見送りリストや保存リストのボタンを押しやすく */
  .interest-actions button,
  .run-search-actions button,
  .deck-action {
    min-height: 50px;
  }
}
