/* AI活用度ラダー診断
   既存の経営者AI活用度診断（ai-literacy.sanpotrust.jp）の言語に寄せる:
   HUDバー / 極太の日本語見出し / 硬いオフセット影 / 等幅の英字ラベル。
   ※ JetBrains Mono・Anton は手元に無く font-src 'self' のため、
     等幅はシステムフォント、見出しは Noto Sans JP の 900 で当てている。
   notosansjp-ladder.woff2 は Windows 同梱の NotoSansJP-VF.ttf (SIL OFL 1.1) のサブセット。 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/inter-subset.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans JP";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/notosansjp-ladder.woff2") format("woff2");
}

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #111827;
  --ink-2: #344252;
  --muted: #6b7280;
  --line: #e5e7eb;
  --navy: #1b3a5c;
  --navy-deep: #18324a;

  /* 藍染の濃淡: 甕覗 → 浅縹 → 縹 → 藍 → 紺 → 留紺 */
  --lv0: #c6d9e0;
  --lv1: #9bbcce;
  --lv2: #6d97b5;
  --lv3: #3f6e92;
  --lv4: #2a4c6e;
  --lv5: #1b2c4b;

  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Courier New", monospace;

  /* 余白は 8px の倍数だけを使う */
  --s1: 0.5rem;   /*  8 */
  --s2: 1rem;     /* 16 */
  --s3: 1.5rem;   /* 24 */
  --s4: 2rem;     /* 32 */
  --s5: 3rem;     /* 48 */
  --s6: 4rem;     /* 64 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Noto Sans JP", sans-serif;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  line-height: 1.9;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== HUD ===== */
.hud {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.7rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.hud-in {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.hud .dot {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 0.7em;
  border-radius: 50%;
  background: #2563eb;
  vertical-align: middle;
}
.hud-r { color: #9ca3af; }

/* ===== 枠 ===== */
#app {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s5) 1.5rem var(--s6);
}
.screen { display: none; }
.screen.is-on { display: block; }

/* ===== 共通の部品 ===== */
.badge {
  display: inline-block;
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.badge-live::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 0.7em;
  border-radius: 50%;
  background: #2563eb;
  animation: blink 1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }

.display {
  margin-top: var(--s3);
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 900;
  font-size: clamp(2.1rem, 8.2vw, 3.5rem);
  line-height: 1.16;
  letter-spacing: -0.01em;
}
.display-sm { font-size: clamp(1.7rem, 6vw, 2.5rem); }

.tagline {
  margin-top: var(--s2);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.94rem;
  font-weight: 400;
  line-height: 2;
  color: var(--ink-2);
}
.tagline em { font-style: normal; font-weight: 700; color: var(--ink); }

.body {
  margin-top: 1.4rem;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 400;
  font-size: 0.94rem;
  line-height: 2.05;
  color: var(--ink-2);
}
.note {
  margin-top: var(--s2);
  font-size: 0.7rem;
  line-height: 1.9;
  color: var(--muted);
}

/* ===== ボタン（硬いオフセット影） ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  margin-top: var(--s4);
  padding: 0 2.4rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-main {
  color: #fff;
  background: var(--navy);
  box-shadow: 7px 7px 0 rgba(27, 58, 92, 0.22);
}
.btn-main:hover { transform: translate(2px, 2px); box-shadow: 5px 5px 0 rgba(27, 58, 92, 0.22); }
.btn-main:active { transform: translate(7px, 7px); box-shadow: 0 0 0 rgba(27, 58, 92, 0.22); }
.btn-quiet {
  margin-left: var(--s1);
  padding: 0 1.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}
.btn-quiet:hover { color: var(--ink); border-color: var(--navy); }
.btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

/* ===== スタート: Lvカードの列 ===== */
.deck {
  margin-top: var(--s5);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
}
.deck-card {
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  overflow: hidden;
}
.deck-bar { display: block; height: 12px; background: var(--lv); }
.deck-body { display: block; padding: 0.6rem 0.3rem 0.7rem; }
.deck-no {
  display: block;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  color: #9ca3af;
}
.deck-lv {
  display: block;
  margin-top: 0.2rem;
  font-family: "Inter", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--lv5);
}
.deck-name {
  display: block;
  margin-top: 0.25rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.stats {
  list-style: none;
  margin-top: var(--s4);
  padding-top: var(--s2);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.6rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.stats li + li { position: relative; padding-left: 1.6rem; }
.stats li + li::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 1px; height: 11px;
  margin-top: -5px;
  background: var(--line);
}

/* ===== 設問 ===== */
.qbar { display: flex; align-items: center; gap: 1rem; }
.qbar-no {
  flex: none;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--navy);
}
.progress { flex: 1; height: 3px; background: var(--line); }
.progress span {
  display: block; height: 100%; width: 0;
  background: var(--navy);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.question {
  margin-top: var(--s3);
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 4.2vw, 1.65rem);
  line-height: 1.65;
}
.q-help {
  margin-top: 0.9rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.95;
  color: var(--muted);
}
.choices-hint {
  margin-top: var(--s3);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.choices-hint::before { content: "↓"; margin-right: 0.5em; color: var(--navy); }

.choices { counter-reset: ch; margin-top: var(--s1); display: grid; gap: 0.5rem; }
.choice {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem 1.2rem 1rem 3.1rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.choice::before {
  counter-increment: ch;
  content: counter(ch, decimal-leading-zero);
  position: absolute;
  left: 1.1rem; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: #9ca3af;
}
.choice:hover {
  border-color: var(--navy);
  box-shadow: 4px 4px 0 rgba(27, 58, 92, 0.14);
  transform: translate(-1px, -1px);
}
.choice:hover::before { color: var(--navy); }
.choice:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.choice.is-picked { border-color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); }

/* ===== 判定中 ===== */
.loading-bar {
  margin-top: 2.6rem;
  height: 3px;
  background: var(--line);
  overflow: hidden;
}
.loading-bar span {
  display: block; height: 100%; width: 100%;
  background: var(--navy);
  transform-origin: 0 50%;
  animation: loading-fill 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes loading-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ===== 結果 ===== */
.verdict {
  margin-top: var(--s3);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 1.1rem;
  padding-bottom: var(--s2);
  border-bottom: 2px solid var(--navy);
}
.verdict-lv {
  font-family: "Inter", sans-serif;
  font-size: clamp(3.4rem, 15vw, 5.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.verdict-name {
  font-family: "Noto Sans JP", sans-serif;
  font-size: clamp(1.4rem, 5.4vw, 2.1rem);
  font-weight: 900;
  line-height: 1.2;
}
.reason {
  margin-top: var(--s2);
  padding: 0.95rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.95;
  color: var(--ink-2);
}
.early { margin-top: 0.8rem; font-size: 0.74rem; line-height: 1.9; color: var(--muted); }

/* ===== ラダー ===== */
.ladder { margin-top: var(--s4); border-top: 1px solid var(--line); }
.rung {
  position: relative;
  display: grid;
  grid-template-columns: 3.2rem 6.4rem 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.78rem 0.6rem 0.78rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.rung::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--lv);
}
.rung-lv {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--muted);
}
.rung-name { font-family: "Noto Sans JP", sans-serif; font-size: 0.92rem; font-weight: 500; }
.rung-gauge { display: flex; gap: 3px; }
.rung-gauge i { display: block; width: 22px; height: 8px; background: #e8e6e0; }
.lv-0 .rung-gauge i:nth-child(-n+1),
.lv-1 .rung-gauge i:nth-child(-n+2),
.lv-2 .rung-gauge i:nth-child(-n+3),
.lv-3 .rung-gauge i:nth-child(-n+4),
.lv-4 .rung-gauge i:nth-child(-n+5),
.lv-5 .rung-gauge i:nth-child(-n+6) { background: var(--lv); }
.lv-0 { --lv: var(--lv0); }
.lv-1 { --lv: var(--lv1); }
.lv-2 { --lv: var(--lv2); }
.lv-3 { --lv: var(--lv3); }
.lv-4 { --lv: var(--lv4); }
.lv-5 { --lv: var(--lv5); }

.ladder-result .rung { opacity: 0.38; }
.ladder-result .rung.is-next { opacity: 0.8; }
.ladder-result .rung.is-here {
  opacity: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(17,24,39,0.05);
}
.ladder-result .rung.is-here::before { width: 6px; }
.ladder-result .rung.is-here .rung-lv { color: var(--navy); }
.ladder-result .rung.is-here .rung-name { font-weight: 900; }
.rung-tag {
  justify-self: end;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--navy);
  white-space: nowrap;
}

/* ===== 次の1段 / 進め方 ===== */
.next { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.next-label {
  font-family: var(--mono);
  font-size: 0.62rem; letter-spacing: 0.2em; color: var(--muted);
  text-transform: uppercase;
}
.next-head {
  margin-top: 0.7rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 1.3rem; font-weight: 900;
}
.next-desc {
  margin-top: 0.5rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.9rem; font-weight: 400; line-height: 2; color: var(--ink-2);
}
.cycle {
  margin-top: var(--s4);
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
}
.cycle-label {
  font-family: var(--mono);
  font-size: 0.6rem; letter-spacing: 0.16em; color: var(--navy);
  text-transform: uppercase;
}
.cycle-body {
  margin-top: 0.5rem;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.85rem; font-weight: 400; line-height: 2; color: var(--ink-2);
}

/* ===== 回答サマリ ===== */
.answers {
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 0.85rem;
}
.answers > summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.answers dl { margin-top: 1rem; }
.answers dt { margin-top: 0.9rem; font-size: 0.72rem; color: var(--muted); }
.answers dd { margin-top: 0.15rem; font-weight: 500; }

/* ===== フッター ===== */
.foot {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0;
  padding: 1.4rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--navy); }

/* ===== 狭い画面 ===== */
@media (max-width: 620px) {
  #app { padding-top: 2.8rem; }
  .bracket { display: none; }
  .hud { font-size: 0.55rem; letter-spacing: 0.1em; }
  .hud-r { display: none; }
  .deck { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; }
  .deck-name { white-space: normal; }
  .deck-name { font-size: 0.6rem; }
  .btn { width: 100%; text-align: center; margin-left: 0; }
  .rung { grid-template-columns: 3rem 1fr auto; gap: 0.2rem 0.7rem; }
  .rung-lv { grid-column: 1; grid-row: 1; }
  .rung-name { grid-column: 2; grid-row: 1; }
  .rung-tag { grid-column: 3; grid-row: 1; }
  .rung-gauge { grid-column: 2 / -1; grid-row: 2; margin-top: 0.3rem; }
}

/* 極端に狭い端末では2列に落とす */
@media (max-width: 360px) {
  .deck { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #app { padding-left: 1.1rem; padding-right: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .loading-bar span { animation: none; transform: scaleX(1); }
  .badge-live::before { animation: none; }
}
