:root {
  --fde-navy: #0f1b33;
  --fde-navy-2: #17274a;
  --fde-accent: #2f6df6;
  --fde-accent-2: #17c3a2;
  --fde-warn: #f2a33c;
  --fde-bad: #e5484d;
  --fde-ink: #1c2436;
  --fde-line: #e3e8f0;
  --fde-bg: #f4f6fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fde-bg);
  color: var(--fde-ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.fde-shell { min-height: 100vh; }

/* ---------------------------------------------------------------- header */
.fde-header {
  background: linear-gradient(135deg, var(--fde-navy) 0%, var(--fde-navy-2) 60%, #1d3a6e 100%);
  color: #fff;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 4px 18px rgba(15, 27, 51, 0.25);
}
.fde-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.fde-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 17px;
}
.fde-logo .badge {
  background: var(--fde-accent);
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 16px;
  box-shadow: 0 0 0 4px rgba(47, 109, 246, 0.2);
}
.fde-header .spacer { flex: 1; }
.fde-header .hud {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}

/* ---------------------------------------------------------------- layout */
.fde-main { max-width: 1180px; margin: 0 auto; padding: 20px; }
.fde-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; }
@media (max-width: 900px) { .fde-grid { grid-template-columns: 1fr; } }

.fde-card {
  background: #fff;
  border: 1px solid var(--fde-line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(24, 42, 84, 0.06);
}
.fde-card + .fde-card { margin-top: 16px; }

.fde-stage-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #eaf1ff; color: #1c47a8;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
}
.fde-mission {
  background: #f7f9ff;
  border-left: 4px solid var(--fde-accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  margin: 12px 0 4px;
}

/* ---------------------------------------------------------------- dialogue */
.fde-scene {
  font-size: 13px;
  color: #5a6b8c;
  background: #f8fafc;
  border: 1px dashed #d7e0ee;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.fde-dialogue {
  display: flex; gap: 14px; align-items: flex-start;
}
.fde-avatar {
  width: 108px; height: 108px;
  flex: 0 0 108px;
  border-radius: 14px;
  background: #eef3fb;
  border: 2px solid #dbe6f7;
  overflow: hidden;
  display: grid; place-items: center;
}
.fde-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fde-bubble {
  position: relative;
  background: #f3f7ff;
  border: 1px solid #d8e4fb;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.75;
  flex: 1;
}
.fde-bubble .who {
  font-size: 12.5px; font-weight: 800; color: #1c47a8; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}

/* ---------------------------------------------------------------- choices */
.fde-choices { display: grid; gap: 10px; margin-top: 16px; }
.fde-choice {
  text-align: left;
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--fde-line);
  border-radius: 12px;
  padding: 13px 15px 13px 46px;
  font-size: 14.5px;
  line-height: 1.65;
  cursor: pointer;
  position: relative;
  transition: all 0.16s ease;
  font-family: inherit;
  color: inherit;
}
.fde-choice:hover:not(:disabled) {
  border-color: var(--fde-accent);
  background: #f6f9ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(47, 109, 246, 0.12);
}
.fde-choice:disabled { cursor: default; opacity: 0.96; }
.fde-choice .key {
  position: absolute; left: 12px; top: 12px;
  width: 24px; height: 24px; border-radius: 7px;
  background: #eef2f9; color: #45557a;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12.5px;
}
.fde-choice.best { border-color: #17c3a2; background: #effcf8; }
.fde-choice.best .key { background: #17c3a2; color: #fff; }
.fde-choice.partial { border-color: #f2a33c; background: #fff9ef; }
.fde-choice.partial .key { background: #f2a33c; color: #fff; }
.fde-choice.poor { border-color: #8a9ab5; background: #f6f8fb; }
.fde-choice.harmful { border-color: var(--fde-bad); background: #fff3f3; }
.fde-choice.harmful .key { background: var(--fde-bad); color: #fff; }
.fde-choice.picked { box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.18); }

.fde-verdict-tag {
  position: absolute; right: 12px; top: 11px;
  font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
}
.v-best { background: #d7f7ee; color: #0b7a63; }
.v-partial { background: #fdedd5; color: #a3630a; }
.v-poor { background: #e6ebf3; color: #51607d; }
.v-harmful { background: #fde0e0; color: #b3282c; }

/* ---------------------------------------------------------------- feedback */
.fde-feedback {
  margin-top: 14px;
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--fde-line);
  background: #fbfcfe;
  animation: fde-in 0.28s ease;
}
@keyframes fde-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.fde-feedback h4 { margin: 0 0 8px; font-size: 14px; }
.fde-feedback .model {
  margin-top: 10px; background: #eff5ff; border-left: 3px solid var(--fde-accent);
  border-radius: 6px; padding: 9px 12px; font-size: 13.5px; line-height: 1.7;
}
.fde-skills-inline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.fde-skill-pill {
  font-size: 11px; font-weight: 700; background: #eaf1ff; color: #1c47a8;
  border: 1px solid #cfe0ff; border-radius: 999px; padding: 2px 9px;
}
.fde-kw { font-size: 11.5px; color: #6b7b99; margin-top: 8px; line-height: 1.7; }

/* ---------------------------------------------------------------- methods */
.fde-methods {
  margin-top: 16px;
  border: 1px solid #d7e3f7;
  border-radius: 12px;
  background: #f6f9ff;
  overflow: hidden;
}
.fde-methods-head {
  font-size: 13.5px;
  font-weight: 800;
  color: #1c47a8;
  padding: 10px 14px;
  background: #eaf1ff;
  border-bottom: 1px solid #d7e3f7;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fde-method { border-bottom: 1px solid #e3ecfb; }
.fde-method:last-child { border-bottom: none; }
.fde-method > summary {
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 13.5px;
  list-style: none;
  transition: background 0.15s ease;
}
.fde-method > summary::-webkit-details-marker { display: none; }
.fde-method > summary:hover { background: #eef4ff; }
.fde-method > summary::before {
  content: "\f0da";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 11px;
  color: #2f6df6;
  transition: transform 0.15s ease;
}
.fde-method[open] > summary::before { transform: rotate(90deg); }
.fde-method .m-cat {
  font-size: 10.5px; font-weight: 800; color: #fff; background: #2f6df6;
  border-radius: 5px; padding: 2px 7px; letter-spacing: 0.04em;
}
.fde-method .m-name { font-weight: 800; color: #1c2436; }
.fde-method .m-skills { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.fde-method .m-body { padding: 4px 16px 14px 30px; }
.fde-method .m-purpose { font-size: 13px; color: #3d4d6d; line-height: 1.75; margin: 4px 0 8px; }
.fde-method .m-steps { margin: 0 0 8px; padding-left: 20px; }
.fde-method .m-steps li { font-size: 13px; line-height: 1.8; color: #33415c; margin-bottom: 2px; }
.fde-method .m-template {
  font-size: 12.5px; line-height: 1.7; color: #0b5c4c;
  background: #eefbf6; border: 1px solid #c8ede2; border-radius: 8px; padding: 8px 11px;
}
.fde-bubble { white-space: pre-line; }

/* --------------------------------------------------- 読み上げボタン */
.fde-voice-btn {
  position: absolute; top: 10px; right: 12px;
  border: 1px solid #c7dbff; border-radius: 999px;
  background: #fff; color: #2f6df6;
  font-size: 11.5px; font-weight: 700; font-family: inherit;
  padding: 4px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.15s ease;
}
.fde-voice-btn:hover { background: #eef4ff; }
.fde-voice-btn.off { color: #8a99b8; border-color: #dbe6f7; }
.fde-voice-btn.off:hover { background: #f3f6fb; }
.fde-bubble .who { padding-right: 92px; }
.fde-replay {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 9px; padding: 4px 11px;
  border: 1px solid #c7dbff; border-radius: 999px;
  background: #fff; color: #2f6df6;
  font-size: 11.5px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: all 0.15s ease;
}
.fde-replay:hover { background: #eef4ff; }

/* ------------------------------------------------------- FDE本人の発言 */
.fde-voice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 14px;
  animation: fde-in 0.3s ease;
}
.fde-voice-avatar {
  width: 108px;
  height: 108px;
  flex: 0 0 108px;
  border-radius: 14px;
  background: #e9f0ff;
  border: 2px solid #c7dbff;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.fde-voice-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fde-voice-bubble {
  position: relative;
  background: linear-gradient(135deg, #eef4ff 0%, #e6f7f3 100%);
  border: 1.5px solid #b9d7ee;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.8;
  color: #1c2436;
  white-space: pre-line;
  flex: 1;
}
.fde-voice-bubble .who {
  font-size: 12.5px;
  font-weight: 800;
  color: #1c47a8;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- HUD gauges */
.hud-item {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 6px 11px;
  font-size: 12px;
  min-width: 92px;
}
.hud-item .lbl { opacity: 0.8; font-size: 10.5px; display: flex; gap: 5px; align-items: center; }
.hud-item .val { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,0.2); margin-top: 4px; overflow: hidden; }
.hud-bar > span { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }

/* ---------------------------------------------------------------- side panels */
.fde-side-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6b7b99; margin: 0 0 12px; display: flex; align-items: center; gap: 8px;
}
.fde-progress-dots { display: grid; gap: 7px; }
.fde-stage-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; padding: 6px 9px; border-radius: 9px; border: 1px solid transparent;
}
.fde-stage-row .num {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: #eef2f9; color: #5b6b8c;
}
.fde-stage-row.active { background: #eaf1ff; border-color: #cfe0ff; font-weight: 700; }
.fde-stage-row.active .num { background: var(--fde-accent); color: #fff; }
.fde-stage-row.done .num { background: var(--fde-accent-2); color: #fff; }
.fde-stage-row .sc-pos { margin-left: auto; font-size: 11px; color: #8a99b8; }

.fde-skill-list { display: grid; gap: 8px; }
.fde-skill-row { font-size: 12.5px; }
.fde-skill-row .top { display: flex; justify-content: space-between; margin-bottom: 3px; }
.fde-skill-row .bar { height: 7px; border-radius: 999px; background: #eef2f9; overflow: hidden; }
.fde-skill-row .bar > span { display: block; height: 100%; border-radius: 999px; transition: width 0.45s ease; }

/* ---------------------------------------------------------------- buttons */
.fde-btn {
  font-family: inherit; font-weight: 700; font-size: 14px;
  border-radius: 10px; border: 1px solid transparent; padding: 10px 18px;
  cursor: pointer; transition: all 0.16s ease; display: inline-flex; align-items: center; gap: 8px;
}
.fde-btn-primary { background: var(--fde-accent); color: #fff; }
.fde-btn-primary:hover { background: #2159d4; transform: translateY(-1px); }
.fde-btn-ghost { background: #fff; border-color: var(--fde-line); color: #33415c; }
.fde-btn-ghost:hover { border-color: var(--fde-accent); color: var(--fde-accent); }
.fde-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------- misc */
.fde-hero {
  background: linear-gradient(135deg, #10203d 0%, #1b3a70 100%);
  color: #fff; border-radius: 18px; padding: 30px; margin-bottom: 20px;
  box-shadow: 0 14px 38px rgba(16, 32, 61, 0.28);
}
.fde-hero h1 { margin: 0 0 10px; font-size: 27px; line-height: 1.4; }
.fde-hero p { margin: 0; opacity: 0.9; line-height: 1.8; font-size: 14px; }
.fde-hero .pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.fde-hero .pill {
  background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px; padding: 5px 13px; font-size: 12px; font-weight: 700;
}
.fde-input, .fde-textarea {
  font-family: inherit; font-size: 14px; border: 1.5px solid var(--fde-line);
  border-radius: 10px; padding: 10px 13px; width: 100%; background: #fff; color: var(--fde-ink);
}
.fde-input:focus, .fde-textarea:focus { outline: none; border-color: var(--fde-accent); }
.fde-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fde-table th, .fde-table td { padding: 9px 11px; border-bottom: 1px solid var(--fde-line); text-align: left; }
.fde-table th { color: #6b7b99; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

.fde-grade {
  font-size: 52px; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #2f6df6, #17c3a2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fde-review-item {
  border-left: 3px solid var(--fde-bad); background: #fff8f8;
  border-radius: 8px; padding: 10px 13px; margin-bottom: 9px; font-size: 13.5px; line-height: 1.7;
}
.fde-review-item.ok { border-left-color: var(--fde-accent-2); background: #f3fdfa; }

.fde-loading { text-align: center; padding: 60px 20px; color: #6b7b99; }
.fde-spinner {
  width: 34px; height: 34px; border: 3px solid #dbe4f3; border-top-color: var(--fde-accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fde-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.fde-tab {
  font-family: inherit; font-size: 13px; font-weight: 700; padding: 8px 15px;
  border-radius: 9px; border: 1px solid var(--fde-line); background: #fff;
  color: #46587c; cursor: pointer;
}
.fde-tab.active { background: var(--fde-navy); color: #fff; border-color: var(--fde-navy); }

.fde-note { font-size: 12.5px; color: #6b7b99; line-height: 1.75; }
.fde-footer { text-align: center; padding: 26px 16px 36px; color: #8a99b8; font-size: 12px; }
