/* ==========================================================
   外国人材 定着・戦力化診断 — JOL Design System 踏襲
   tokens: JOL UI (orange #ff6b1a / Noto Sans JP + DM Sans)
   ベースは shiji-shindan/styles.css と共通トークン。
   定着診断固有UI (5段階ボタン・領域バー・コスト計算フォーム) を追加。
   ========================================================== */
:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e8e8f0;
  --border-2: #dde6ef;
  --primary: #ff6b1a;
  --primary-btn: #ff7020;
  --primary-soft: #ffece2;
  --primary-soft-border: rgba(255, 107, 26, 0.22);
  --ok: #00db6b;
  --ok-soft: #e5f9ed;
  --danger: #f6182f;
  --danger-soft: #ffe9e9;
  --warn: #f59e0b;
  --warn-soft: #fff5e6;
  --info: #2f6df6;
  --info-soft: #eaf1ff;
  --text: #1b1b1b;
  --text-dark: #1a1a2e;
  --text-muted: #8a8a99;
  --text-soft: #5b5b6b;
  --track: rgba(0, 0, 0, 0.07);
  --orange-shadow: 0 6px 20px 0 rgba(255, 107, 26, 0.3);
  --card-shadow: 0 2px 14px rgba(20, 20, 50, 0.05);

  --font-ja: "Noto Sans JP", sans-serif;
  --font-en: "DM Sans", "Noto Sans JP", sans-serif;

  --r-card: 16px;
  --r-option: 12px;
  --r-badge: 8px;
  --r-button: 9px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ja);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.en { font-family: var(--font-en); }

.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  background: var(--bg);
  position: relative;
  z-index: 1;
}

/* PC: 左右をブランド背景で埋める */
@media (min-width: 960px) {
  body {
    background: url("/tools/shiji-shindan/assets/bg-desktop.jpg") center top / cover no-repeat fixed #ff6b1a;
  }
  .app { box-shadow: 0 0 48px rgba(0, 0, 0, 0.18); }
  body::before, body::after {
    content: "";
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(200px, 40vw - 260px, 560px);
    aspect-ratio: 599 / 220;
    background: url("/tools/shiji-shindan/assets/watermark.svg") center / contain no-repeat;
    z-index: 0;
    pointer-events: none;
  }
  body::before { left: 2vw; }
  body::after { right: 2vw; }
}

/* ---------- ヘッダー ---------- */
.top-header {
  display: flex; justify-content: space-between; align-items: center;
  min-height: 40px; margin-bottom: 20px;
}
.header-logo { height: 22px; width: auto; }

/* ---------- screen 共通 ---------- */
.screen { display: flex; flex-direction: column; flex: 1; animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--font-en); font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--primary); text-transform: uppercase;
}
.h1 { font-size: 25px; font-weight: 700; line-height: 1.4; margin: 8px 0 12px; color: var(--text-dark); }
.h1 .accent { color: var(--primary); }
.lead { font-size: 14px; line-height: 1.85; color: var(--text-soft); }
.lead b { color: var(--text); }

/* ---------- buttons ---------- */
.btn-primary {
  display: block; width: 100%; min-height: 56px; border: none;
  border-radius: var(--r-button); background: var(--primary-btn); color: #fff;
  font-weight: 700; font-size: 16px; box-shadow: var(--orange-shadow);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-primary:active { transform: scale(0.985); filter: brightness(0.96); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; cursor: default; }

.btn-secondary {
  display: block; width: 100%; min-height: 52px;
  border: 1.5px solid var(--primary); border-radius: var(--r-button);
  background: #fff; color: var(--primary); font-weight: 700; font-size: 15px;
  transition: transform 0.15s ease;
}
.btn-secondary:active { transform: scale(0.985); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 500; padding: 10px 4px; width: 100%;
}
.btn-ghost:hover { color: var(--primary); }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* ---------- 進捗バー ---------- */
.progress { margin: 2px 0 18px; }
.progress-top {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px;
}
.progress-count { font-family: var(--font-en); font-size: 13px; font-weight: 700; color: var(--text-dark); }
.progress-count .cur { color: var(--primary); font-size: 17px; }
.progress-axis { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.progress-track { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.4s var(--ease-out); }

/* ---------- 属性選択（profile） ---------- */
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 1.5px solid var(--border); border-radius: var(--r-option);
  background: var(--surface); padding: 16px 16px; font-size: 15px; font-weight: 600;
  color: var(--text); line-height: 1.5; box-shadow: var(--card-shadow);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}
.option:active { transform: scale(0.99); }
.option:hover { border-color: var(--primary-soft-border); }
.option .mark {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border-2); display: grid; place-items: center;
  font-family: var(--font-en); font-weight: 700; font-size: 13px; color: var(--text-muted);
}

/* ---------- 立場選択 ---------- */
.aud-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.aud-btn {
  display: flex; align-items: center; gap: 16px;
  border: 1.5px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); padding: 18px 18px; text-align: left;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.aud-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.aud-btn:active { transform: scale(0.99); }
.aud-icon { font-size: 28px; flex: 0 0 auto; line-height: 1; }
.aud-label { font-size: 16px; font-weight: 700; color: var(--text-dark); line-height: 1.4; }

/* ---------- 5段階スケールボタン ---------- */
.scale-opts { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.scale-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  border: 1.5px solid var(--border); border-radius: var(--r-option);
  background: var(--surface); padding: 14px 16px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.scale-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.scale-btn:active { transform: scale(0.99); border-color: var(--primary); }
.scale-num {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border-2); display: grid; place-items: center;
  font-family: var(--font-en); font-weight: 700; font-size: 14px; color: var(--text-muted);
  background: var(--surface-2);
}
.scale-label { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.45; }
.q-text {
  font-size: 18px; font-weight: 700; line-height: 1.6; color: var(--text-dark);
  margin-bottom: 4px;
}

/* ---------- 診断中演出 ---------- */
.loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; text-align: center; }
.loading .spin {
  width: 62px; height: 62px; border-radius: 50%;
  border: 5px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading .l-title { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.loading .bubbles { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.bubble {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 11px 15px; font-size: 13px; color: var(--text-soft); line-height: 1.5;
  box-shadow: var(--card-shadow); text-align: left; opacity: 0;
  animation: bubbleIn 0.5s var(--ease-out) forwards;
}
.bubble b { color: var(--primary); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 結果: スコアヒーロー ---------- */
.result-head {
  background: linear-gradient(135deg, #ff8a3d 0%, var(--primary) 100%);
  color: #fff; border-radius: var(--r-card); padding: 26px 22px 24px;
  box-shadow: var(--orange-shadow); text-align: center; position: relative; overflow: hidden;
}
.result-head::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% -10%, rgba(255,255,255,0.35), transparent 55%);
  pointer-events: none;
}
.result-head .r-eyebrow { font-size: 11.5px; font-weight: 700; opacity: 0.92; letter-spacing: 0.06em; }
.result-head .r-score-big { font-family: var(--font-en); font-weight: 700; margin: 10px 0 2px; line-height: 1; }
.result-head .r-num { font-size: 80px; }
.result-head .r-pct { font-size: 30px; }
.result-head .r-score-label { font-size: 11.5px; opacity: 0.86; margin-bottom: 12px; }
.result-head .r-type-badge {
  display: inline-block; background: rgba(255,255,255,0.22); border-radius: 999px;
  padding: 7px 20px; font-size: 17px; font-weight: 700; margin-bottom: 12px;
  backdrop-filter: blur(4px);
}
.result-head .r-catch {
  font-size: 14px; font-weight: 700; line-height: 1.6;
  background: rgba(255,255,255,0.18); border-radius: var(--r-option); padding: 11px 14px;
  backdrop-filter: blur(4px);
}

/* ---------- タイプ本文 ---------- */
.type-body {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--card-shadow); padding: 18px 20px; margin-top: 16px;
  font-size: 13.5px; line-height: 1.85; color: var(--text-soft);
}

/* ---------- セクションラベル ---------- */
.section-label {
  font-size: 13px; font-weight: 700; color: var(--text-dark);
  margin: 24px 0 12px; display: flex; align-items: center; gap: 8px;
}
.section-label::before { content: ""; width: 3px; height: 15px; background: var(--primary); border-radius: 2px; }

/* ---------- 7領域バーグラフ ---------- */
.domain-list {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--card-shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px;
}
.domain-row {}
.dr-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.dr-name { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.dr-val { font-family: var(--font-en); font-size: 13px; font-weight: 700; color: var(--primary); }
.dr-track { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; margin-bottom: 4px; }
.dr-fill { height: 100%; border-radius: 4px; transition: width 0.6s var(--ease-out); }
.dr-fill.bar--hi { background: var(--ok); }
.dr-fill.bar--mid { background: var(--warn); }
.dr-fill.bar--lo { background: var(--danger); }
.dr-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ---------- ボトルネックカード ---------- */
.bottleneck-card {
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--r-card);
  padding: 18px 20px; margin-top: 16px;
}
.bn-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: #92400e;
  background: rgba(245, 158, 11, 0.2); border-radius: var(--r-badge);
  padding: 3px 10px; margin-bottom: 8px;
}
.bn-title { font-size: 20px; font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.bn-desc { font-size: 13px; color: var(--text-soft); line-height: 1.65; }
.bn-qw {
  font-size: 13px; line-height: 1.8; color: var(--text);
  background: var(--surface); border-radius: var(--r-option); padding: 12px 14px;
  border: 1px solid var(--border-2); margin-top: 8px;
}

/* ---------- CTA / gate ---------- */
.gate {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 22px; margin-top: 16px; box-shadow: var(--card-shadow);
}
.gate .g-eyebrow { font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: 0.06em; }
.gate h3 { font-size: 17px; font-weight: 700; color: var(--text-dark); margin: 4px 0 8px; line-height: 1.5; }
.gate .g-lead { font-size: 12px; color: var(--text-muted); line-height: 1.7; margin-bottom: 12px; }
.report-teaser { list-style: none; display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.report-teaser li { font-size: 12.5px; line-height: 1.6; color: var(--text-soft); padding-left: 22px; position: relative; }
.report-teaser li::before {
  content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 700;
  font-size: 12px; width: 16px; height: 16px;
}
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
.req { font-size: 10px; font-weight: 700; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 6px; }
.opt { font-size: 10px; font-weight: 700; color: var(--text-muted); background: var(--track); border-radius: 4px; padding: 1px 6px; }
.input {
  width: 100%; min-height: 50px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--r-option);
  background: var(--surface); font-size: 15px; color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease; -webkit-appearance: none; appearance: none;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field.error .input { border-color: var(--danger); }
.field-err { font-size: 11.5px; color: var(--danger); font-weight: 500; display: none; }
.field.error .field-err { display: block; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--text-soft); line-height: 1.6; margin-top: 2px; }
.consent input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex: 0 0 auto; }
.consent a { color: var(--primary); text-decoration: underline; }

.cta-card {
  background: linear-gradient(135deg, #fff 0%, var(--primary-soft) 100%);
  border: 1px solid var(--primary-soft-border); border-radius: var(--r-card);
  padding: 22px; margin-top: 16px; text-align: center;
}
.cta-card .c-icon { font-size: 30px; }
.cta-card h3 { font-size: 17px; font-weight: 700; color: var(--text-dark); margin: 6px 0; line-height: 1.5; }
.cta-card p { font-size: 12.5px; color: var(--text-soft); line-height: 1.7; margin-bottom: 16px; }

/* ---------- コスト計算機 ---------- */
.cost-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.unit-badge {
  font-size: 10px; font-weight: 700; color: var(--text-muted); background: var(--track);
  border-radius: 4px; padding: 1px 7px; margin-left: 4px;
}
.cost-disclaimer {
  font-size: 11px; color: var(--text-muted); line-height: 1.65;
  border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 14px;
}

/* ---------- コスト結果表示 ---------- */
.cost-result { margin-top: 4px; }
.cr-total {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--primary-soft); border: 1px solid var(--primary-soft-border);
  border-radius: var(--r-option); padding: 14px 16px; margin-bottom: 12px;
}
.cr-label { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.cr-value { font-family: var(--font-en); font-size: 20px; font-weight: 700; color: var(--primary); }
.cr-effects { display: flex; flex-direction: column; gap: 8px; }
.effect-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-badge); padding: 11px 14px;
}
.er-label { font-size: 12px; color: var(--text-soft); flex: 1; line-height: 1.5; }
.er-value { font-size: 13px; font-weight: 700; color: var(--ok); white-space: nowrap; flex: 0 0 auto; }

/* ---------- 詳細レポート ---------- */
.report-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--card-shadow); padding: 18px 20px; margin-top: 14px;
}
.report-block h4 { font-size: 15px; font-weight: 700; color: var(--text-dark); margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.report-block h4 .rn { font-family: var(--font-en); color: var(--primary); }
.report-block p { font-size: 13px; line-height: 1.85; color: var(--text-soft); }

/* 30日アクション */
.action-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.action-item {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 13.5px; line-height: 1.7; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-option); padding: 13px 14px;
}
.action-n {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-family: var(--font-en); font-size: 13px; font-weight: 700;
}

/* ---------- サンクス ---------- */
.thanks { text-align: center; padding-top: 8px; }
.thanks .t-check {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--ok-soft); display: grid; place-items: center; font-size: 32px;
  animation: pop 0.5s var(--ease-spring) both;
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ---------- フッター ---------- */
.logo-footer { margin-top: 22px; padding-top: 8px; display: flex; justify-content: center; }
.logo-footer img { height: 24px; width: auto; opacity: 0.85; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text-dark); color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; box-shadow: 0 8px 28px rgba(0,0,0,0.25);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- print (PDF出力) ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff !important; }
  body::before, body::after { display: none !important; }
  .app { box-shadow: none !important; max-width: none; padding: 0; }
  .no-print,
  .actions,
  .btn-primary,
  .btn-secondary,
  .btn-ghost,
  .cta-card { display: none !important; }
  .report-block { break-inside: avoid; }
  .result-head,
  .domain-list,
  .bottleneck-card,
  .dr-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Figma差し替えイントロ（fig-*） ===== */
.fig-screen{margin:-22px -20px calc(-28px - env(safe-area-inset-bottom));background:none;}
.fig-intro{position:relative;flex:1;display:flex;flex-direction:column;align-items:center;
  background:linear-gradient(180deg,#ff7d33 0%,#ff6a1a 46%,#f7590b 100%);color:#fff;overflow:hidden;
  padding:22px 22px calc(26px + env(safe-area-inset-bottom));text-align:center;}
.fig-top{width:100%;display:flex;justify-content:flex-start;position:relative;z-index:2;}
.fig-logo{height:30px;width:auto;}
.fig-wm{position:absolute;top:54px;left:0;right:0;text-align:center;font-family:'DM Sans','Noto Sans JP',sans-serif;
  font-style:italic;font-weight:800;font-size:clamp(120px,42vw,180px);line-height:1;color:rgba(255,255,255,0.10);
  letter-spacing:2px;z-index:0;pointer-events:none;}
.fig-body{position:relative;z-index:2;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  width:100%;max-width:430px;margin:0 auto;}
.fig-badge{display:inline-block;background:rgba(255,255,255,0.22);color:#fff;font-weight:700;font-size:14px;
  padding:8px 20px;border-radius:999px;margin-bottom:26px;}
.fig-title{font-size:clamp(29px,8vw,36px);font-weight:700;line-height:1.4;letter-spacing:1px;margin:0 0 22px;}
.fig-sub{font-size:14px;font-weight:500;line-height:1.95;margin:0 0 40px;}
.fig-pills{display:flex;gap:14px;justify-content:center;flex-wrap:wrap;margin-bottom:40px;}
.fig-pill{background:rgba(255,255,255,0.18);border-radius:16px;padding:12px 22px;min-width:92px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;}
.fig-pill-l{font-size:11px;font-weight:600;opacity:.92;margin-bottom:2px;}
.fig-pill-v{font-size:22px;font-weight:700;line-height:1.2;}
.fig-pill--solo .fig-pill-v{font-size:18px;}
.fig-start{display:block;width:100%;max-width:360px;background:#fff;color:#ff6b1a;border:none;border-radius:999px;
  font-weight:700;font-size:21px;letter-spacing:2px;padding:23px 0;box-shadow:0 12px 30px rgba(0,0,0,0.18);
  transition:transform .2s ease,box-shadow .2s ease;}
.fig-start:hover{transform:translateY(-2px);box-shadow:0 14px 32px rgba(0,0,0,0.22);}
.fig-resume{display:block;margin:14px auto 0;background:none;border:none;color:rgba(255,255,255,0.92);
  font-weight:700;font-size:14px;text-decoration:underline;}
.fig-copy{position:relative;z-index:2;font-family:'DM Sans','Noto Sans JP',sans-serif;font-size:11px;color:rgba(255,255,255,0.6);margin:0;}
.fig-body .actions{display:block;width:100%;max-width:360px;margin:0 auto;}
.fig-start{margin:0 auto;}
