/* ===== 基礎 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #ededee;
  --ink: #1c1c1e;
  --ink-2: #6b6b70;
  --line: #dedee0;
  --card-w: 118px;
  --card-h: 192px;
  --pink: #ef4b6b;
  --navy: #232f63;
  --radius-pill: 999px;
}
html, body { height: 100%; }
body {
  background: #e8e8ea;
  font-family: "Noto Sans TC", "Noto Sans SC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  overflow: hidden;
}
#viewport { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage {
  position: relative;
  width: 1280px; height: 720px;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cg fill='none' stroke='%23dfdfE2' stroke-width='1'%3E%3Ccircle cx='0' cy='0' r='70'/%3E%3Ccircle cx='140' cy='0' r='70'/%3E%3Ccircle cx='0' cy='140' r='70'/%3E%3Ccircle cx='140' cy='140' r='70'/%3E%3Ccircle cx='70' cy='70' r='70'/%3E%3Ccircle cx='0' cy='70' r='70'/%3E%3Ccircle cx='140' cy='70' r='70'/%3E%3Ccircle cx='70' cy='0' r='70'/%3E%3Ccircle cx='70' cy='140' r='70'/%3E%3C/g%3E%3C/svg%3E");
  transform-origin: center center;
  overflow: hidden;
  user-select: none;
}
.hidden { display: none !important; }

/* ===== 通用元件 ===== */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: none; border-radius: var(--radius-pill);
  padding: 10px 18px; font-size: 14.5px; font-family: inherit; color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.10); cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease;
}
.pill:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.14); }
.pill .ic, .action-btn .ic { width: 18px; height: 18px; }
.round-btn {
  width: 46px; height: 46px; border-radius: 50%; border: none; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); cursor: pointer; color: #333;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 14px;
  transition: transform .15s ease;
}
.round-btn:hover { transform: translateY(-1px); }
.round-btn svg { width: 24px; height: 24px; }
.x-btn {
  width: 40px; height: 40px; border-radius: 10px; border: none; background: transparent;
  cursor: pointer; color: #222; display: inline-flex; align-items: center; justify-content: center;
}
.x-btn svg { width: 22px; height: 22px; }
.x-btn.framed { border: 1.6px solid #e2a23c; border-radius: 10px; }
.coin { width: 19px; height: 17px; color: #2c2c2e; }
.coin.sm { width: 16px; height: 15px; }

/* ===== 頂欄 ===== */
#hdr-info { position: absolute; top: 16px; left: 20px; z-index: 1500; }
#hdr-coin { position: absolute; top: 16px; left: 84px; z-index: 1500; font-weight: 500; cursor: default; }
#hdr-user { position: absolute; top: 16px; right: 20px; z-index: 1500; }

/* ===== 首頁／提問頁共用 ===== */
.screen { position: absolute; inset: 0; }
.studio-badge {
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%);
  background: #0d0d0f; color: #fff; border-radius: 6px;
  padding: 9px 16px 10px; text-align: left; min-width: 196px; z-index: 5;
  font-family: "Baloo Paaji 2", "Noto Sans TC", sans-serif;
}
.studio-badge b { display: block; font-size: 17.5px; font-weight: 700; letter-spacing: .02em; }
.studio-badge .studio-sub { display: block; font-size: 12.5px; opacity: .92; margin-top: 2px; font-family: "Noto Sans TC", sans-serif; }
.new-pill {
  position: absolute; top: -11px; right: -24px;
  background: #f6d94a; color: #1c1c1e; font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 3px 9px;
  font-family: "Baloo Paaji 2", sans-serif;
}
.site-title {
  position: absolute; top: 128px; left: 0; right: 0; text-align: center;
  font-family: "Noto Serif TC", serif; font-weight: 900;
  font-size: 56px; letter-spacing: .16em; text-indent: .16em; color: #111;
  z-index: 4;
}
.lang-btn { position: absolute; top: 258px; left: 50%; transform: translateX(-50%); z-index: 5; font-size: 15px; }
.lang-btn i { font-style: normal; font-size: 12px; margin-left: 1px; }
.home-card {
  position: absolute; top: 350px; left: 50%; transform: translateX(-50%);
  width: 127px; height: 206px; cursor: pointer; z-index: 5;
  transition: transform .2s ease;
}
.home-card:hover { transform: translateX(-50%) translateY(-4px); }
.home-card .card-inner {
  position: absolute; inset: 0;
  background: url("assets/cards/back-sm.jpg") center/cover no-repeat;
  border: 3.5px solid #fff; border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.22);
}
#home-actions {
  position: absolute; top: 350px; left: calc(50% + 88px);
  display: flex; flex-direction: column; gap: 13px; z-index: 5;
}
.action-btn { justify-content: flex-start; }
.home-hint {
  position: absolute; top: 612px; left: 0; right: 0; text-align: center;
  font-size: 15.5px; color: #2b2b2e; z-index: 4;
}

/* ===== 提問頁 ===== */
.q-panel {
  position: absolute; top: 224px; left: 50%; transform: translateX(-50%);
  width: 646px; background: #fff; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.10);
  padding: 20px 22px 22px; z-index: 5;
}
.notice {
  background: #fdf0a0; color: #4c440a; font-size: 14.5px; font-weight: 500;
  border-radius: 6px; padding: 11px 14px; margin-bottom: 16px;
}
#question-input {
  width: 100%; height: 108px; resize: none; border: 1.4px solid #c9c9cd; border-radius: 8px;
  font-family: inherit; font-size: 15px; padding: 11px 13px; color: var(--ink);
  outline: none; background: #fff;
}
#question-input:focus { border-color: #8f8f96; }
.q-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: #86868c; margin: 7px 2px 14px; }
.mode-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #f4f4f5; border-radius: 10px; padding: 12px 18px; margin-bottom: 14px;
}
.mode { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 15px; }
.mode input { appearance: none; width: 20px; height: 20px; border: 1.8px solid #b9b9bf; border-radius: 6px; background: #fff; cursor: pointer; position: relative; }
.mode input:checked { background: var(--pink); border-color: var(--pink); }
.mode input:checked::after {
  content: ""; position: absolute; left: 5.5px; top: 2px; width: 4.5px; height: 9px;
  border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: rotate(42deg);
}
.beta { font-size: 10.5px; font-weight: 700; color: #55555c; background: #e7e7ea; border-radius: 5px; padding: 2px 6px; margin-left: -4px; }
.mode-tip {
  background: var(--navy); color: #fff; font-size: 13.5px; line-height: 1.65;
  border-radius: 10px; padding: 11px 15px; margin-bottom: 14px;
  box-shadow: inset 0 0 0 1.4px rgba(255,255,255,.22);
}
.big-btn {
  width: 100%; border: none; border-radius: 10px; background: #dcdce0; color: #3a3a3e;
  font-family: inherit; font-size: 16.5px; font-weight: 500; padding: 15px 18px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s ease, transform .1s ease;
}
.big-btn:not(:disabled):hover { background: #cfcfd5; }
.big-btn:not(:disabled):active { transform: scale(.99); }
.big-btn:disabled { cursor: not-allowed; color: #86868c; }
.coin-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600;
}

/* ===== 抽牌場景 ===== */
#screen-draw { cursor: default; }
#deck-layer { position: absolute; inset: 0; z-index: 10; }
.card-el {
  position: absolute; width: var(--card-w); height: var(--card-h);
  transition: left .8s cubic-bezier(.3,.75,.3,1), top .8s cubic-bezier(.3,.75,.3,1),
              width .8s cubic-bezier(.3,.75,.3,1), height .8s cubic-bezier(.3,.75,.3,1),
              transform .8s cubic-bezier(.3,.75,.3,1);
  will-change: left, top, transform;
}
.card-el.no-trans { transition: none; }
.card-el .card-inner {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  background-repeat: no-repeat; border: 3px solid #fff; border-radius: 9px;
  box-shadow: 0 5px 14px rgba(0,0,0,.20); background-color: #fff;
}
.card-el.pickable { cursor: pointer; }
.card-el.pickable .card-inner { transition: box-shadow .15s ease, filter .15s ease; }
.card-el.pickable:hover { filter: brightness(1.06); }
.card-el .card-inner .face-img { position: absolute; inset: 0; background-size: cover; background-position: center; border-radius: 6px; }
.card-el.reversed .card-inner { transform: rotate(180deg); }
.card-el.reversed .card-inner.jitter { animation: none; }
.card-badge {
  position: absolute; top: -7px; left: -7px; z-index: 3;
  width: 27px; height: 27px; border-radius: 50%; background: #111; color: #fff;
  font-size: 13.5px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.card-el .card-inner.jitter { animation: jitter .55s ease-in-out infinite alternate; }
@keyframes jitter {
  from { transform: translate(-1.6px, .8px) rotate(-1.1deg); }
  to   { transform: translate(1.6px, -.8px) rotate(1.1deg); }
}
.skip-btn { position: absolute; top: 402px; left: 738px; z-index: 60; font-size: 15px; padding: 11px 20px; }
.skip-btn .ic { width: 19px; height: 19px; }
.draw-status {
  position: absolute; top: 640px; left: 0; right: 0; text-align: center;
  font-size: 15.5px; color: #2b2b2e; z-index: 60;
}
.draw-status .robot { width: 26px; height: 26px; vertical-align: -7px; margin-right: 8px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
.drag-hint {
  position: absolute; top: 496px; left: 536px; z-index: 60;
  width: 46px; height: 46px; animation: hintFloat 1.4s ease-in-out infinite;
}
.drag-hint svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }
@keyframes hintFloat { 0%,100% { transform: translateX(-14px); } 50% { transform: translateX(14px); } }

/* ===== 結果彈窗 ===== */
.overlay {
  position: absolute; inset: 0; z-index: 2000;
  background: rgba(120,120,126,.45); backdrop-filter: blur(1.5px);
  display: flex; align-items: flex-start; justify-content: center;
}
#result-modal {
  margin-top: 12px; width: 508px; max-height: 696px; background: #fff;
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden;
  animation: rise .28s cubic-bezier(.2,.8,.3,1);
}
@keyframes rise { from { transform: translateY(26px); opacity: 0; } to { transform: none; opacity: 1; } }
.rm-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; flex: none; }
.sm-pill { font-size: 13.5px; padding: 8px 15px; box-shadow: none; border: 1px solid #ececef; }
.sm-pill.danger:hover { border-color: #f3b0bf; color: #d5305377; color: #d53053; }
.rm-scroll { overflow-y: auto; padding: 4px 26px 20px; }
.rm-cards { display: flex; justify-content: center; gap: 22px; padding: 10px 0 6px; flex-wrap: wrap; }
.rm-card { text-align: center; width: 124px; }
.rm-card img {
  width: 118px; height: 200px; object-fit: cover; border-radius: 8px;
  border: 2.5px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.18); background: #fff;
}
.rm-card img.reversed { transform: rotate(180deg); }
.rm-card .en { font-size: 13.5px; color: #7a7a80; margin-top: 9px; }
.rm-card .zh { font-size: 14.5px; font-weight: 500; margin-top: 2px; }
.rm-card .pos { font-size: 12px; color: #a2a2a8; margin-top: 2px; }
.rm-question { background: #f4f4f5; border-radius: 10px; padding: 14px 16px; margin: 12px 0 4px; }
.rq-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14.5px; }
.rq-head span { font-size: 12.5px; color: #9a9aa0; }
#rm-question { font-size: 14.5px; margin-top: 10px; line-height: 1.7; }
#rm-articles { padding-bottom: 4px; }
.rm-entry-head {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #8b8b92; margin: 16px 0 2px;
}
.rm-entry-head::after { content: ""; flex: 1; height: 1px; background: #ececef; }
#rm-articles article { padding-top: 6px; }
#rm-articles h3 { font-size: 19px; font-weight: 700; margin: 6px 0 12px; line-height: 1.5; }
#rm-articles p { font-size: 14.8px; line-height: 1.95; text-align: justify; color: #26262a; margin-bottom: 14px; }
#rm-articles .insight-list { background: #f6f6f8; border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; }
#rm-articles .insight-list p { margin-bottom: 4px; font-size: 14px; }
/* ===== 追加澄清建議條 ===== */
.clarify-box { background: #eef3ff; border: 1.4px solid #c9d6ff; border-radius: 10px; padding: 12px 15px; margin-top: 10px; }
.clarify-box .cb-head { font-size: 14.5px; font-weight: 600; color: #1c1c1e; }
.clarify-box .cb-conf { font-size: 12px; font-weight: 600; color: #2b3bbd; background: #dde5ff; border-radius: 999px; padding: 2px 9px; margin-left: 6px; }
.clarify-box .cb-reason { font-size: 13.5px; color: #4a4a52; line-height: 1.7; margin: 7px 0 11px; }
.clarify-box.muted { background: #f6f6f8; border-color: #e6e6ea; }
.clarify-box.muted .cb-head { font-weight: 500; color: #55555c; }
.clarify-box.muted .cb-conf { color: #77777d; background: #ececef; }
.rm-actions { margin-top: 8px; }
.ask-box { border-top: 1px solid #ececef; margin-top: 14px; padding-top: 14px; }
.ask-label { font-size: 14.5px; font-weight: 500; margin-bottom: 9px; }
#ask-input {
  width: 100%; resize: none; border: 1.4px solid #d4d4d8; border-radius: 8px;
  font-family: inherit; font-size: 14px; padding: 9px 12px; outline: none;
}
#ask-input:focus { border-color: #8f8f96; }
.ask-meta { display: flex; justify-content: space-between; font-size: 12px; color: #9a9aa0; margin: 6px 2px 12px; }
.big-btn.slim { padding: 12px 16px; font-size: 15px; }
.rm-foot { display: flex; justify-content: space-between; margin-top: 16px; }

/* ===== 歷史紀錄 ===== */
#history-modal {
  margin-top: 60px; width: 560px; max-height: 600px; background: #fff;
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden; animation: rise .28s cubic-bezier(.2,.8,.3,1);
}
.hm-title { font-size: 17px; font-weight: 700; padding-left: 8px; }
.hm-list { overflow-y: auto; padding: 6px 18px 18px; }
.hm-item {
  display: flex; gap: 14px; align-items: center; padding: 12px 10px;
  border-bottom: 1px solid #f0f0f2; cursor: pointer; border-radius: 8px;
}
.hm-item:hover { background: #f7f7f9; }
.hm-item img { width: 34px; height: 58px; object-fit: cover; border-radius: 4px; border: 1.5px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.hm-item .hm-q { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-item .hm-date { font-size: 12px; color: #9a9aa0; }
.hm-empty { text-align: center; color: #9a9aa0; font-size: 14px; padding: 40px 0; }

/* ===== 規則／方案彈窗 ===== */
#rules-modal {
  margin-top: 40px; width: 508px; max-height: 640px; background: #fff;
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  padding: 22px 30px 24px; overflow-y: auto; animation: rise .28s cubic-bezier(.2,.8,.3,1);
}
#rules-modal h2 { font-size: 21px; margin-bottom: 16px; }
.rules-body p { font-size: 14.8px; line-height: 1.85; color: #333338; margin-bottom: 14px; display: flex; gap: 10px; }
.rules-body p::before { content: "•"; color: #b8b8be; }
.rules-body .rules-tail { color: #55555c; }
.dlg-btns { display: flex; gap: 14px; margin-top: 18px; }
.outline-btn {
  flex: 1; padding: 13px; border-radius: 9px; border: 1.8px solid #e2a23c; background: #fff;
  font-family: inherit; font-size: 15.5px; font-weight: 500; cursor: pointer; color: #1c1c1e;
}
.outline-btn:hover { background: #fdf6ea; }
.gray-btn {
  flex: 1; padding: 13px; border-radius: 9px; border: none; background: #e9e9ec;
  font-family: inherit; font-size: 15.5px; font-weight: 500; cursor: pointer; color: #1c1c1e;
}
.gray-btn:hover { background: #dfdfe3; }
#plan-modal {
  margin-top: 20px; width: 920px; max-height: 680px; background: #fff;
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.25);
  padding: 18px 26px 24px; overflow-y: auto; animation: rise .28s cubic-bezier(.2,.8,.3,1);
}
.plan-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 26px; }
.plan-col { display: flex; flex-direction: column; }
.plan-col hr { border: none; border-top: 1px solid #ececef; margin: 12px 0; }
.plan-recommend { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #55555c; }
.plan-recommend .new-pill { position: static; }
.plan-brand { font-family: "Baloo Paaji 2", sans-serif; font-weight: 700; font-size: 27px; line-height: 1.15; margin-top: 6px; }
.plan-sub { font-size: 13px; color: #55555c; margin-top: 4px; }
.plan-muted-title { font-size: 14px; color: #55555c; }
.plan-big { font-size: 34px; font-weight: 700; margin-top: 4px; }
.plan-big small { font-size: 14px; font-weight: 500; color: #77777d; }
.plan-col p { font-size: 13.5px; line-height: 1.7; margin-bottom: 10px; }
.plan-col p .muted { color: #8b8b92; font-size: 12.5px; }
.plan-chip-row {
  display: flex; justify-content: space-between; align-items: center;
  border: 1.4px solid #e6e6ea; border-radius: 9px; padding: 9px 13px; font-size: 14px;
}
.primary-btn {
  margin-top: auto; padding: 13px; border-radius: 9px; border: none; background: #2b3bbd; color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
}
.primary-btn:hover { background: #2433a8; }
.primary-btn:disabled { background: #e9e9ec; color: #a5a5ab; cursor: not-allowed; }

/* ===== Toast ===== */
#toast {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  background: rgba(20,20,24,.92); color: #fff; font-size: 14px;
  border-radius: 999px; padding: 11px 22px; z-index: 3000;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); white-space: nowrap;
  animation: rise .2s ease;
}
