/* 沖縄ITマップ — "quiet cartography"
   県のシルエットが紙の上に浮かぶ、静かで中立な地図。
   ライト基調・アクセントは琉球赤瓦のテラコッタ1色。警告色・ネガ含意のある赤（ベタな観光赤）は使わない、
   落ち着いた低彩度トーンでAAコントラストを確保する（2026-07-11 パレット刷新）。
   モバイルファースト。システムフォント（字間・階層・行間で品位を出す）。 */

:root {
  /* ---- design tokens: 琉球赤瓦 × 漆喰 ---- */
  --ink: #2b211c;             /* 焦茶 */
  --ink-2: #6b5d53;
  --ink-3: #a2907f;
  --paper: #f8f4ec;           /* 漆喰オフホワイト＝ページ背景。地図の海と完全に同色 */
  --surface: #fffdfa;
  --line: #ece2d3;
  --line-2: #ddccb5;

  --accent: #b0492f;          /* 赤瓦テラコッタ */
  --accent-ink: #8a3620;
  --accent-soft: #f3e0d6;
  --accent-wash: #faf0e9;

  --land: #ede3d3;            /* サンゴ砂ベージュ＝市町村ポリゴン */
  --land-hover: #e2d1b6;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 9px;

  --shadow-1: 0 1px 2px rgba(27, 35, 44, 0.05);
  --shadow-2: 0 4px 16px rgba(27, 35, 44, 0.08);
  --shadow-3: 0 16px 48px rgba(27, 35, 44, 0.16);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 150ms var(--ease);

  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", "Segoe UI", sans-serif;

  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button {
  font-family: inherit;
  letter-spacing: inherit;
}

a { color: var(--accent-ink); }

.icon {
  width: 17px;
  height: 17px;
  display: block;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

.icon-btn:hover {
  background: var(--line);
  color: var(--ink);
}

/* ================= Topbar ================= */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
}

/* WO-3b: ☆お気に入りボタン追加でボタンが2つになったため、折り返さず1行に収める
   （nav要素は既定でinline流れのため、ボタン2つ分の幅で自然に2行ラップし、tagline文言と衝突していた） */
.topbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
}

.brand-text h1 {
  margin: 0;
  font-size: 18.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.tagline {
  margin: 1px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-quiet {
  background: none;
  border: none;
  color: var(--ink-2);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: color var(--t), background var(--t);
  white-space: nowrap;
}

.btn-quiet:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
}

.btn-about {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-about .icon { color: var(--ink-3); transition: color var(--t); }
.btn-about:hover .icon { color: var(--accent); }

/* ================= Header search（ヘッダー常設・item4） =================
   Hiro追加指示: モバイルが主戦場。モバイルは虫眼鏡アイコン(44px)→タップで全幅展開、
   デスクトップは常に全幅表示（折りたたみ自体が存在しない・トグルボタンは非表示）。 */

.header-search {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 10px;
}

.header-search-toggle {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color var(--t), color var(--t);
}

.header-search-toggle:hover, .header-search-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.search-box--header { flex: 1 1 auto; min-width: 0; min-height: 44px; }

.search-clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  color: var(--ink-2);
  padding: 0;
  cursor: pointer;
}

.search-clear .icon { width: 11px; height: 11px; }
.search-clear:hover { background: var(--accent-soft); color: var(--accent-ink); }

@media (max-width: 899px) {
  .header-search { padding: 0 18px 8px; min-height: 44px; }
  .header-search-toggle { display: inline-flex; }
  /* 詳細度をベースの .search-box{display:flex}（後方で定義・単一クラス）より確実に上げるため、
     祖先 .header-search を含む2クラスセレクタにする（ソース順に依存させない） */
  .header-search .search-box--header { display: none; min-height: 44px; }
  .header-search.is-expanded .header-search-toggle { display: none; }
  .header-search.is-expanded .search-box--header { display: flex; }
}

@media (min-width: 900px) {
  .header-search { padding: 0 28px 12px; }
  .header-search-toggle { display: none !important; }
  .header-search .search-box--header { display: flex !important; max-width: 420px; }
}

/* ================= Control strip ================= */

.control-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 2px 18px 12px;
}

.stats {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.stat-num {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}

.stat-unit {
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.stat-sep {
  width: 1px;
  height: 18px;
  background: var(--line-2);
  align-self: center;
}

.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}

.btn-filter:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.btn-filter:active {
  transform: translateY(0);
}

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ================= Active filter chips ================= */

.active-chips {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 0 18px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.active-chips::-webkit-scrollbar { display: none; }

.active-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 8px 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t);
}

.active-chip:hover { background: #d4e9e5; }

.active-chip .x {
  font-size: 14px;
  line-height: 1;
  opacity: 0.65;
}

/* ================= Map ================= */

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

#map {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--paper);   /* 海＝ページ背景に溶かす */
  outline: none;
}

.leaflet-container {
  background: var(--paper);
  font-family: var(--font);
}

/* 市町村ラベル */
.muni-label {
  background: none;
  border: none;
  box-shadow: none;
}

.muni-label span {
  display: inline-block;
  transform: translate(-50%, -50%);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #8b959d;
  text-shadow:
    0 0 3px var(--paper), 0 0 3px var(--paper),
    0 0 6px var(--paper);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity var(--t);
}

.labels-off .muni-label span { opacity: 0; }

/* 企業マーカー（40px・円形。favicon画像 or 社名頭文字のイニシャルアバター） */
.company-marker {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 7px rgba(138, 54, 32, 0.35);
  transition: transform var(--t), box-shadow var(--t);
}

.company-marker-initials {
  position: relative;
  z-index: 1;
  line-height: 1;
  pointer-events: none;
}

.company-marker img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.leaflet-marker-icon:hover .company-marker {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(138, 54, 32, 0.45);
  z-index: 650 !important;
}

/* クラスタ */
.cluster-marker {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(138, 54, 32, 0.32);
  transition: transform var(--t);
}

.leaflet-marker-icon:hover .cluster-marker { transform: scale(1.08); }

.cluster-sm { background: #c1704f; }
.cluster-md { background: var(--accent); }
.cluster-lg { background: var(--accent-ink); }

/* Leafletズームコントロール調整 */
.leaflet-bar {
  border: none !important;
  box-shadow: var(--shadow-2) !important;
  border-radius: var(--radius-xs) !important;
  overflow: hidden;
}

.leaflet-bar a {
  color: var(--ink-2) !important;
  border-bottom-color: var(--line) !important;
  transition: color var(--t), background var(--t);
}

.leaflet-bar a:hover {
  color: var(--accent-ink) !important;
  background: var(--accent-wash) !important;
}

/* ================= Empty state ================= */

.empty-state {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 22px;
  font-size: 14.5px;
  text-align: center;
  color: var(--ink-2);
  box-shadow: var(--shadow-2);
  z-index: 800;
  pointer-events: none;
  margin: 0;
  max-width: min(320px, calc(100vw - 48px));
}

/* item4: 0件時の「条件を1つ外す」提案（Hiroフィードバック#4）。
   親要素はクリックを透過させる(pointer-events:none)ため、ボタン自体だけ復活させる */
.empty-state-relax {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  pointer-events: auto;
  font-weight: 600;
}

/* ================= Detail (mobile bottom sheet) ================= */

.detail-scrim {
  position: absolute;
  inset: 0;
  background: rgba(27, 35, 44, 0.28);
  z-index: 900;
  animation: fadeIn 150ms var(--ease);
}

.detail-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 76%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-3);
  z-index: 950;
  overflow-y: auto;
  padding: 20px 20px 30px;
  animation: sheetUp 200ms var(--ease);
}

/* デスクトップ「マーカー吹き出し」モード（JSが is-bubble を付与した時のみ）。
   位置は positionBubble() が計算した --arrow-x / left / top で決める。
   scale+fade 1つだけのアニメーション・prefers-reduced-motion は下部の全体ルールで無効化される。 */
.detail-panel.is-bubble {
  position: fixed;
  left: 0;
  top: 0;
  right: auto;
  bottom: auto;
  width: 400px;
  max-width: min(400px, calc(100vw - 32px));
  max-height: min(72vh, 560px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 22px 22px 26px;
  z-index: 980;
  opacity: 0;
  transform: scale(0.96);
  transform-origin: var(--arrow-x, 50%) var(--arrow-origin-y, 100%);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  animation: none;
}

.detail-panel.is-bubble.is-visible {
  opacity: 1;
  transform: scale(1);
}

.detail-panel.is-bubble::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  width: 16px;
  height: 16px;
  background: var(--surface);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.detail-panel.is-bubble.arrow-bottom {
  --arrow-origin-y: 100%;
}

.detail-panel.is-bubble.arrow-bottom::after {
  bottom: -9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-panel.is-bubble.arrow-top {
  --arrow-origin-y: 0%;
}

.detail-panel.is-bubble.arrow-top::after {
  top: -9px;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--paper);
}

/* --- 個票の情報階層: 社名・所在地 → 事業 → 働く条件 → 出典 --- */

.detail-card { padding-top: 2px; }

.co-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 34px 6px 0;
}

.detail-card .co-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* ================= WO-3b: ☆お気に入りトグル ================= */

.fav-star {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--ink-3);
  transition: color var(--t), transform var(--t);
}

.fav-star:hover { color: var(--accent); transform: scale(1.08); }
.fav-star:active { transform: scale(0.94); }

.fav-star.is-active { color: var(--accent); }

.fav-star--sm .fav-star-icon { width: 15px; height: 15px; }
.fav-star--md .fav-star-icon { width: 19px; height: 19px; }
.fav-star--lg .fav-star-icon { width: 23px; height: 23px; margin-top: 2px; }

.fav-star-icon { display: block; }

/* ヘッダー「☆ お気に入り」ボタン */
.btn-favorites {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-favorites .icon { color: var(--ink-3); transition: color var(--t); }
.btn-favorites:hover .icon { color: var(--accent); }

/* 狭い画面（スマホ）ではヘッダーが窮屈になるため3段構えで畳む（2026-07-11 ブランド統合で実測・調整）:
   1) 「お気に入り」の文字ラベルを畳んでアイコン＋件数のみに
   2) 「データについて」もアイコンのみに畳む（テキストはaria-labelで残す）
   3) タグライン（サービス説明文）を非表示にし、ブランド名(h1)だけを1行で確実に表示する
   これをしないとタグラインのnowrap最小幅(≈184px)がbrand-mark/お気に入り/データについてと
   衝突し、390px幅で「お気に入り」バッジが重なって見える（実機検証で確認済み）。 */
@media (max-width: 480px) {
  .btn-favorites-label { display: none; }
  .btn-favorites { padding-left: 9px; padding-right: 9px; }

  .btn-about-label { display: none; }
  .btn-about {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .tagline { display: none; }
}

.detail-card .co-address {
  font-size: 13.5px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  margin: 0 0 4px;
}

.detail-card .co-city {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 10px;
  margin: 2px 0 6px;
}

/* 事業内容: 1行ellipsis、クリックで全文展開（Layer1） */
.co-business {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 4px 0 0;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 16px;
  position: relative;
}

.co-business::after {
  content: "▾";
  position: absolute;
  right: 0;
  top: 0;
  font-size: 10px;
  color: var(--ink-3);
  transition: transform var(--t);
}

.co-business.expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.co-business.expanded::after {
  transform: rotate(180deg);
}

/* ================= いいところハイライト（Layer1） ================= */

.highlight-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.highlight-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 5px 11px 5px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.hl-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  display: block;
}

/* ================= キーファクト（スタットタイル・Layer2） ================= */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat-tile-num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-tile-unit {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-left: 1px;
}

.stat-tile-label {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.stat-tile-asof {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
  margin-top: 1px;
}

.stat-tile-details {
  margin-top: 3px;
}

.stat-tile-details summary {
  font-size: 11.5px;
  color: var(--accent-ink);
  cursor: pointer;
  list-style: none;
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.stat-tile-details summary::-webkit-details-marker { display: none; }
.stat-tile-details summary::marker { content: ""; }

.stat-tile-details-body {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--paper);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
}

/* 中途年収タイル: 「XXX〜XXXX万円」は4桁レンジになる社もあり、1カラム幅だと
   他タイルと同じ20pxでは末尾が省略されてしまうため2カラム分の幅を確保する */
.stat-tile-salary {
  grid-column: span 2;
}

.stat-tile-salary .stat-tile-num {
  font-size: 21px;
}

/* パース不能な自由記述: 数値枠には簡潔な案内文のみを表示し、原文全文は「詳細」トグルへ集約する
   （長文の生テキストをそのまま数値枠に出さない・情報は詳細側に必ず残す） */
.stat-tile-num-fallback {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: normal;
  overflow: visible;
}

.stat-tile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

/* 出典タイプバッジ: official=公式(ティール)/ jobboard=求人票・媒体名(ニュートラル)/
   estimate=参考値・◯◯調べ(控えめグレー)。警告色は使わない（トーン原則） */
.salary-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.salary-badge--official {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.salary-badge--jobboard {
  background: var(--land);
  color: var(--ink-2);
}

.salary-badge--estimate {
  background: var(--paper);
  color: var(--ink-3);
  border: 1px solid var(--line-2);
}

.salary-employment-note {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  line-height: 1.4;
}

/* 何の数字かを明記する定義ラベル（出典タイプに応じた説明文・item6） */
.salary-def-note {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.45;
}

/* 参考値（estimate）はより控えめに＝数値も一段トーンダウンする */
.stat-tile-num--muted {
  color: var(--ink-2);
  font-weight: 600;
}

/* ================= 募集職種（コンパクト縦並び・Layer2） ================= */

.position-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.position-item {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px 10px;
  background: var(--paper);
  border-radius: var(--radius-xs);
}

.position-rest {
  margin-top: 5px;
}

.chip-more {
  margin-top: 7px;
}

/* ================= 出典・取得日（Layer3・末尾に集約） ================= */

.sources-disclosure {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sources-disclosure summary {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  cursor: pointer;
  list-style: none;
}

.sources-disclosure summary::-webkit-details-marker { display: none; }

.sources-disclosure summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 5px;
  font-size: 10px;
  transition: transform var(--t);
}

.sources-disclosure[open] summary::before {
  transform: rotate(90deg);
}

.sources-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.source-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.source-label {
  color: var(--ink-2);
  font-weight: 600;
  flex: 0 0 auto;
}

.source-meta {
  color: var(--ink-3);
  text-align: right;
}

.source-meta a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t);
}

.source-meta a:hover { color: var(--accent-ink); }

.detail-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-block-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin: 0 0 10px;
}

.detail-field { margin-bottom: 13px; }
.detail-field:last-child { margin-bottom: 0; }

/* ================= WO-3c: レーダーチャート「この会社のかたち」 =================
   優劣ではなく形を見せるため、数値・凡例の主張は最小限に。塗りは低透明度・線は細め（dataviz基準）。
   比較画面（favorites.js）でも同じクラスを使い回す。 */
.radar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.radar-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  overflow: visible;
}

.radar-grid {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.radar-spoke {
  stroke: var(--line-2);
  stroke-width: 1;
}

.radar-spoke--missing {
  stroke: var(--ink-3);
  stroke-dasharray: 2 3;
  opacity: 0.6;
}

.radar-axis-hit { cursor: default; }

.radar-axis-label {
  font-size: 10px;
  font-weight: 600;
  fill: var(--ink-2);
  letter-spacing: 0.01em;
}

.radar-axis-label--missing {
  fill: var(--ink-3);
  font-weight: 500;
}

.radar-series {
  stroke-width: 2;
  stroke-linejoin: round;
  transition: opacity var(--t);
}

.radar-series--dashed {
  stroke-dasharray: 4 3;
}

.radar-dot {
  stroke: var(--surface);
  stroke-width: 1.2;
}

.radar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 2px;
}

.radar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-2);
}

.radar-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 2px solid;
  flex: 0 0 auto;
}

.radar-legend-swatch--dashed {
  border-radius: 999px;
  border-style: dashed;
}

.radar-caption {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-3);
  text-align: center;
  max-width: 240px;
}

.detail-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.detail-field-value {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.tag-row .tag {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: border-color var(--t);
}

/* 技術スタックの「+N」展開分は tag-row の flex 子として直接並べる */
.tag-rest {
  display: contents;
}

/* WO-3a: 働く条件タグ（flex + work_style_notes）。技術スタックのタグと見分けがつくよう、
   サンゴ砂ベージュ地の控えめな見た目にする（警告色・強調色は使わない・トーン原則） */
.tag-row .tag.tag--neutral {
  background: var(--land);
  border-color: var(--line-2);
  color: var(--ink-2);
}

.tag-row button.chip-more.stack-more-btn {
  padding: 3px 10px;
  font-size: 13px;
}

.co-address-block {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
}

.field-source {
  display: block;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  margin-top: 4px;
}

.field-source a {
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t);
}

.field-source a:hover { color: var(--accent-ink); }

.detail-links {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.detail-links a {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border-radius: 999px;
  transition: background var(--t), transform var(--t), box-shadow var(--t);
}

.detail-links a:hover {
  background: var(--accent-ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.detail-links a.secondary {
  background: var(--surface);
  color: var(--accent-ink);
  border: 1px solid var(--line-2);
}

.detail-links a.secondary:hover {
  background: var(--accent-wash);
  border-color: var(--accent);
}

/* ================= Filter drawer ================= */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(27, 35, 44, 0.32);
  z-index: 1100;
  animation: fadeIn 150ms var(--ease);
}

.filter-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 84%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-3);
  z-index: 1150;
  display: flex;
  flex-direction: column;
  animation: sheetUp 200ms var(--ease);
}

.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.btn-primary {
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 11px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t), transform var(--t), box-shadow var(--t);
}

.btn-primary:hover {
  background: var(--accent-ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  background: var(--surface);
  transition: border-color var(--t);
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box .icon {
  flex: 0 0 auto;
  color: var(--ink-3);
}

.search-box input {
  border: none;
  outline: none;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
}

.search-box input::placeholder {
  color: var(--ink-3);
}

/* type=search のデフォルト装飾（クリアボタン等）をリセット */
.search-box input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

#city-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  padding: 10px 34px 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' stroke='%2359636e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center / 12px,
    var(--surface);
  color: var(--ink);
  max-width: 280px;
  cursor: pointer;
  transition: border-color var(--t);
}

#city-select:hover, #city-select:focus {
  border-color: var(--accent);
  outline: none;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  line-height: 1.3;
  transition: border-color var(--t), background var(--t), color var(--t), transform var(--t);
}

.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ロングテールタグの折りたたみトグル（技術スタックが多いため） */
.chip.chip-more {
  border-style: dashed;
  color: var(--ink-2);
  background: var(--paper);
}

.chip.chip-more:hover {
  color: var(--accent-ink);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--t), background var(--t);
}

.toggle-chip:hover { border-color: var(--accent); }

.toggle-chip input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
}

.toggle-chip:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ================= About modal ================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 35, 44, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1200;
  animation: fadeIn 150ms var(--ease);
}

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px 22px 34px;
  position: relative;
  animation: sheetUp 200ms var(--ease);
}

.modal h2 {
  font-size: 19px;
  letter-spacing: 0.04em;
  margin: 0 34px 16px 0;
}

.modal h3 {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  margin: 20px 0 6px;
  color: var(--accent-ink);
}

.modal h3:first-of-type { margin-top: 0; }

.modal p {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-2);
  margin: 0 0 4px;
}

.modal .contact {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  color: var(--ink);
  font-weight: 600;
  margin-top: 8px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--paper);
}

/* ================= WO-3b: お気に入り比較画面 =================
   モバイル＝全画面オーバーレイ／PC＝大型モーダル（>=900pxで上書き）。
   数値の優劣は色分けしない・警告色は使わない（トーン原則）。 */

.compare-scrim {
  z-index: 1250;
}

.compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 1260;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.compare-overlay.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.compare-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

/* WO-3b: 「共有性」— スクショで拡散されやすいよう、上部にサービス名ロゴを小さく置く（配布の種） */
.compare-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.compare-brand-mark {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}

.compare-brand-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
}

.compare-head h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.compare-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compare-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.compare-empty p {
  font-size: 15.5px;
  color: var(--ink-2);
  margin: 0;
}

.compare-radar-section {
  flex: 0 0 auto; /* flexの既定min-height:autoで縮められると内容が親の.compare-bodyスクロール外にはみ出すため固定する */
  display: flex;
  justify-content: center;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--line);
}

.compare-radar { display: flex; flex-direction: column; align-items: center; }

.compare-radar-note {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* 横スクロールは専用コンテナに閉じ込める（ページ全体は横スクロールさせない）。
   flex: 0 0 auto が必須: 指定なしだと .compare-body の縦flexで自動的に圧縮され、
   overflow-x:auto は横しか面倒を見ないため、圧縮しきれない縦方向のはみ出しがモーダル外に
   クリップされず漏れ出す不具合があった（W3自己検証で発見・表が比較画面の下端からはみ出す）。 */
.compare-table-wrap {
  flex: 0 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.compare-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  width: 100%;
}

.compare-table th, .compare-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.ct-rowlabel-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--paper);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.03em;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.ct-col {
  min-width: 128px;
  white-space: normal;
}

.ct-col--median {
  position: sticky;
  left: 84px;
  z-index: 1;
  background: var(--accent-wash);
  border-right: 1px solid var(--line-2);
  font-weight: 600;
  color: var(--accent-ink);
}

thead .ct-col--median {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

thead .ct-col {
  background: var(--surface);
}

.ct-remove-star {
  display: inline-flex;
  background: none;
  border: none;
  padding: 2px;
  margin: 0 0 4px;
  color: var(--accent);
  cursor: pointer;
  transition: transform var(--t), color var(--t);
}

.ct-remove-star:hover { transform: scale(1.1); color: var(--accent-ink); }
.ct-remove-star .fav-star-icon { width: 15px; height: 15px; display: block; }

.ct-company-name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  white-space: normal;
}

.ct-company-city {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}

.ct-empty { color: var(--ink-3); }

.ct-salary { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ct-salary-num { font-weight: 600; color: var(--ink); }

.ct-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  white-space: normal;
  max-width: 220px;
}

.ct-tag {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

/* 共通タグのハイライト＝比較企業間で一致する技術。優劣ではなく「共通点」を示す（トーン原則） */
.ct-tag--common {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.compare-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* ================= 3秒アンドゥトースト ================= */

.compare-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 1400;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 10px 10px 16px;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  max-width: calc(100vw - 32px);
}

.compare-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.compare-toast-text {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-toast-undo {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.compare-toast-undo:hover { background: rgba(255, 255, 255, 0.24); }

/* ================= モバイル タップターゲット44px原則 =================
   Hiro追加指示（スマホが主戦場）: モバイルは主要な操作要素を44px以上のタップ領域にする。
   デスクトップの密度は既存のまま変えない（max-width:899pxのみに限定）。
   密なリスト/テーブル（アクティブチップの横スクロール列・比較表内の☆等）は情報密度を優先し、
   実用的な範囲（36〜40px）で妥協する（Appleの人間工学ガイドラインも密なリストは許容範囲あり）。 */
@media (max-width: 899px) {
  .icon-btn { width: 44px; height: 44px; }
  .btn-quiet { min-height: 44px; display: inline-flex; align-items: center; }
  .btn-filter { min-height: 44px; }
  .btn-primary { min-height: 44px; }
  #filter-reset.btn-quiet { min-height: 44px; }
  #city-select { min-height: 44px; }
  .chip { min-height: 44px; display: inline-flex; align-items: center; }
  .toggle-chip { min-height: 44px; }
  .active-chip { min-height: 38px; }
  .sp-tab { min-height: 42px; display: inline-flex; align-items: center; }
  .sp-rank-row { min-height: 44px; }
  .fav-star--sm { min-width: 34px; min-height: 34px; }
  .fav-star--md { min-width: 38px; min-height: 38px; }
  .fav-star--lg { min-width: 42px; min-height: 42px; }
  .position-more-btn, .stack-more-btn { min-height: 40px; }
  /* item1のスタット数字拡大(27px)で「50 社掲載」が横に伸び、絞り込みボタンと1行に収まりきらず
     ユニット文字が文字間で折り返される事故があった（nowrap化とは別に隙間も詰める） */
  .stats { gap: 10px; }
}

/* ================= Desktop (>=900px) ================= */

@media (min-width: 900px) {
  .topbar {
    padding: 18px 28px 12px;
  }

  .brand-text h1 { font-size: 20px; }
  .tagline { font-size: 13px; }

  .control-strip {
    padding: 4px 28px 14px;
  }

  .active-chips { padding: 0 28px 12px; }

  /* 個票 → マーカー吹き出し（右スライドパネルは廃止。位置は .is-bubble ルール参照） */
  .detail-scrim { display: none !important; }

  .detail-close {
    top: 18px;
    right: 18px;
  }

  /* フィルタ → 右ドロワー */
  .filter-drawer {
    left: auto;
    top: 0;
    bottom: 0;
    right: 0;
    width: 380px;
    max-height: none;
    border-radius: 0;
    animation: drawerIn 200ms var(--ease);
  }

  @keyframes drawerIn {
    from { transform: translateX(40px); opacity: 0.4; }
    to { transform: translateX(0); opacity: 1; }
  }

  .drawer-head { padding: 22px 24px 10px; }
  .drawer-body { padding: 8px 24px 18px; }
  .drawer-foot { padding: 14px 24px 18px; }

  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius); padding: 30px 28px 36px; }

  /* WO-3b: PC＝大型モーダル（全画面オーバーレイではなく余白付きで中央配置） */
  .compare-scrim { background: rgba(27, 35, 44, 0.4); }

  .compare-overlay {
    inset: 40px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(-50% + 10px));
    width: min(920px, calc(100vw - 80px));
    height: min(720px, calc(100vh - 80px));
    border-radius: var(--radius);
    box-shadow: var(--shadow-3);
    border: 1px solid var(--line);
  }

  .compare-overlay.is-visible {
    transform: translate(-50%, -50%);
  }

  .compare-head { padding: 20px 24px 14px; }
  .compare-body { padding: 20px 24px 26px; }

  .ct-col { min-width: 150px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
