/* =============================================
   旭源營造 — AI 工作需求問卷｜三色躍動主題
   主色:藏青 #1B3178、紅 #CC1A27、暖陽金 #F5C300
   ============================================= */

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

:root {
  --navy: #1B3178;
  --red: #CC1A27;
  --gold: #F5C300;
  --ink: #242422;
  --sub: #585852;
  --hint: #7A7A73;
  --line: #DCDCD8;
  --bg: #F8F8F6;
}

body {
  font-family: 'Microsoft JhengHei', 'Microsoft JhengHei UI', 'PingFang TC', 'Noto Sans TC', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
}

/* ---- 頂部 Header ---- */
.topbar { background: #fff; box-shadow: 0 1px 0 rgba(27,49,120,.06); position: sticky; top: 0; z-index: 20; }
.topbar__inner { max-width: 760px; margin: 0 auto; padding: 13px 20px; display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo { width: 40px; height: 40px; flex-shrink: 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-weight: 900; font-size: 18px; color: var(--navy); letter-spacing: .02em; }
.brand__sub { font-size: 12px; color: var(--sub); letter-spacing: .04em; }
.topbar__stripe { display: flex; height: 3px; width: 100%; }
.topbar__stripe i { flex: 1; }
.topbar__stripe i:nth-child(1) { background: var(--gold); }
.topbar__stripe i:nth-child(2) { background: var(--red); }
.topbar__stripe i:nth-child(3) { background: var(--navy); }

/* ---- 版面 ---- */
.survey { width: 100%; max-width: 680px; margin: 0 auto; padding: 28px 20px 64px; }

/* ---- 進度條 ---- */
.progress-wrap { margin-bottom: 22px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.progress-label { font-size: 13px; font-weight: 700; color: var(--navy); }
.progress-step { font-size: 13px; color: #A0A09A; }
.progress { position: relative; height: 30px; display: flex; align-items: center; }
.progress__track { width: 100%; height: 10px; background: #EDEDEA; border-radius: 9999px; overflow: hidden; }
.progress__bar { height: 100%; width: 0%; background: var(--gold); border-radius: 9999px; transition: width .45s cubic-bezier(.4,0,.2,1); }
.progress__logo { position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%); transition: left .45s cubic-bezier(.4,0,.2,1); width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(27,49,120,.28); display: flex; align-items: center; justify-content: center; z-index: 2; }
.progress__logo svg { width: 22px; height: 22px; animation: xyBob 1.3s ease-in-out infinite; }
@keyframes xyBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* ---- 白卡容器 ---- */
.card-shell { background: #fff; border-radius: 16px; box-shadow: 0 8px 24px rgba(27,49,120,.10), 0 2px 6px rgba(27,49,120,.05); overflow: hidden; }
.card-shell__accent { height: 4px; width: 100%; background: var(--navy); }
.screen { padding: 30px 28px; }
.screen__q { font-size: 21px; font-weight: 800; color: var(--navy); margin-bottom: 6px; line-height: 1.35; }
.screen__hint { font-size: 14px; color: var(--sub); margin-bottom: 18px; line-height: 1.6; }

/* ---- Part A 單選 ---- */
.options { display: flex; flex-direction: column; gap: 10px; }
.option { display: block; width: 100%; text-align: left; padding: 15px 18px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; font-size: 16px; color: var(--ink); transition: all .15s; }
.option:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(27,49,120,.12); }
.option:nth-child(3n+1).is-selected { border-color: var(--gold); background: #FFFBE6; color: var(--navy); font-weight: 700; box-shadow: 0 2px 8px rgba(27,49,120,.08); }
.option:nth-child(3n+2).is-selected { border-color: var(--red); background: #FFF0F1; color: var(--red); font-weight: 700; box-shadow: 0 2px 8px rgba(27,49,120,.08); }
.option:nth-child(3n).is-selected { border-color: var(--navy); background: #EEF1FA; color: var(--navy); font-weight: 700; box-shadow: 0 2px 8px rgba(27,49,120,.08); }

/* ---- 卡片網格(複選/排序) ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 14px 30px 14px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; text-align: left; font-family: inherit; transition: all .15s; position: relative; min-height: 92px; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(27,49,120,.12); }
.card__name { font-weight: 700; font-size: 14px; color: var(--ink); line-height: 1.3; }
.card__ex { font-size: 12px; color: var(--hint); line-height: 1.45; }

/* 複選:三色輪替選中 */
.card:nth-child(3n+1).is-selected { border-color: var(--gold); background: #FFFBE6; box-shadow: 0 2px 8px rgba(27,49,120,.08); }
.card:nth-child(3n+2).is-selected { border-color: var(--red); background: #FFF0F1; box-shadow: 0 2px 8px rgba(27,49,120,.08); }
.card:nth-child(3n).is-selected { border-color: var(--navy); background: #EEF1FA; box-shadow: 0 2px 8px rgba(27,49,120,.08); }

/* 排序:名次徽章(1金 2紅 3藍),依名次而非位置 */
.card__rank { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 9999px; font-weight: 800; font-size: 14px; color: #fff; background: var(--navy); }
.card.rank-1 { border-color: var(--gold); background: #FFFBE6; }
.card.rank-1 .card__rank { background: var(--gold); color: var(--navy); }
.card.rank-2 { border-color: var(--red); background: #FFF0F1; }
.card.rank-2 .card__rank { background: var(--red); color: #fff; }
.card.rank-3 { border-color: var(--navy); background: #EEF1FA; }
.card.rank-3 .card__rank { background: var(--navy); color: #fff; }

/* ---- 補充欄位 ---- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field span { font-size: 14px; font-weight: 700; color: var(--ink); }
.field input, .field textarea { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line); font-family: inherit; font-size: 15px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(27,49,120,.18); }

/* ---- 導覽 + 按鈕 ---- */
.nav { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 22px; border-radius: 9999px; border: 1.5px solid #C4C4BE; background: #fff; color: var(--sub); font-weight: 600; font-size: 15px; cursor: pointer; font-family: inherit; transition: all .15s; }
.btn:hover { background: #F4F4F2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { padding: 12px 30px; border: none; background: var(--gold); color: #1B1200; font-weight: 700; font-size: 16px; box-shadow: 0 4px 14px rgba(245,195,0,.4); }
.btn--primary:hover { background: #E0A800; transform: translateY(-1px); }

/* ---- 錯誤訊息 ---- */
.error { color: var(--red); font-size: 14px; margin-top: 16px; font-weight: 600; }

/* ---- 完成畫面 ---- */
.done { text-align: center; padding: 8px 0 4px; }
.done__check { width: 72px; height: 72px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; background: var(--navy); }
.done__check svg { width: 34px; height: 34px; }
.done h2 { font-size: 24px; font-weight: 900; color: var(--navy); margin-bottom: 6px; }
.done__lead { font-size: 15px; color: var(--sub); margin-bottom: 18px; }
.done__top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.done__row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; max-width: 380px; margin: 0 auto; width: 100%; }
.done__row .badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9999px; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.done__row .name { font-size: 16px; font-weight: 700; color: var(--ink); }
.done__row.rank-1 { background: #FFFBE6; }
.done__row.rank-1 .badge { background: var(--gold); color: var(--navy); }
.done__row.rank-2 { background: #FFF0F1; }
.done__row.rank-2 .badge { background: var(--red); color: #fff; }
.done__row.rank-3 { background: #EEF1FA; }
.done__row.rank-3 .badge { background: var(--navy); color: #fff; }
.done__msg { font-size: 14px; color: var(--sub); margin: 0 0 20px; line-height: 1.7; }
.done__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.copied { display: block; margin-top: 14px; color: #1F8A5B; font-size: 14px; font-weight: 600; }

/* ---- 完成頁:填寫人數 ---- */
.done__count { font-size: 1rem; color: var(--navy); font-weight: 700; margin: 24px 0 6px; }
.done__count strong { font-size: 1.5rem; color: var(--red); }

/* ---- 完成頁:文字雲 ---- */
.cloud-section { margin: 8px 0 22px; }
.cloud-title, .bars-title { font-size: 13px; font-weight: 700; color: var(--navy); letter-spacing: .04em; margin-bottom: 10px; text-align: center; }
.cloud { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px 16px; padding: 22px; border: 1px solid #EDEDEA; border-radius: 12px; background: #FCFCFB; min-height: 60px; }
.cloud__item { line-height: 1.15; }
.cloud__hint, .bars__hint { color: #888; font-size: 0.9rem; text-align: center; }

/* ---- 完成頁:橫條比較圖 ---- */
.bars-section { margin: 22px 0; text-align: left; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 8em 1fr 2.5em; align-items: center; gap: 8px; font-size: 0.85rem; }
.bar-row__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row__track { background: #EDEDEA; border-radius: 6px; height: 16px; overflow: hidden; }
.bar-row__fill { display: block; height: 100%; min-width: 2px; background: var(--navy); border-radius: 6px; transition: width .4s; }
.bar-row:nth-child(3n+1) .bar-row__fill { background: var(--gold); }
.bar-row:nth-child(3n+2) .bar-row__fill { background: var(--red); }
.bar-row:nth-child(3n) .bar-row__fill { background: var(--navy); }
.bar-row__val { text-align: right; color: var(--sub); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---- 第2張:卡片情境說明(ⓘ + 浮窗) ---- */
.card__info { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; line-height: 16px; text-align: center; font-size: 0.72rem; font-style: italic; font-weight: bold; color: var(--navy); border: 1px solid #9CBEF5; border-radius: 50%; cursor: pointer; user-select: none; background: #fff; }
.card__info:hover { background: #EEF1FA; }
.card.show-scenario { z-index: 10; }
.scenario { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 6px; padding: 12px 14px; background: #fff; border: 1px solid var(--navy); border-radius: 10px; box-shadow: 0 8px 24px rgba(27,49,120,.18); font-size: 0.8rem; line-height: 1.6; color: var(--ink); }
.scenario__row { display: block; }
.scenario__row + .scenario__row { margin-top: 6px; }
.scenario__row b { color: var(--navy); }
@media (hover: hover) {
  .card:hover { z-index: 10; }
  .card:hover .scenario { display: block; }
}
.card.show-scenario .scenario { display: block; }

/* ---- Footer ---- */
.footer { text-align: center; font-size: 12px; color: #A0A09A; margin-top: 22px; }
