/* 豆苗決鬥（public/js/cards.js）：全螢幕畫面 .cd-view。手機直式 375×812 與桌機都要好讀；
   卡片 .cards-card 的文字層用容器寬度（cqw）縮放，卡框 768×1120（插圖窗 x 8%～92%、y 7.5%～65.5%）。 */

/* ---------- 一張卡 ---------- */
.cards-card {
  position: relative; width: 100%; aspect-ratio: 768 / 1120; container-type: inline-size; flex: none;
  border-radius: 7px; overflow: hidden; background: #fbf3dd; box-shadow: 0 2px 0 rgba(120, 90, 50, .25); user-select: none;
}
.cards-card.thumb { width: 100%; }
.cards-card.big { width: min(270px, 62vw); border-radius: 14px; box-shadow: 0 6px 22px rgba(60, 40, 10, .35); }
.cards-card.mini { width: 64px; border-radius: 5px; }
.cards-card.hand { width: var(--hw, 94px); border-radius: 8px; }
.cards-card.zone { width: 100%; border-radius: 6px; }
.cards-card.dim { filter: grayscale(.85); opacity: .5; }
.cards-card[role="button"] { cursor: pointer; }
.cards-card[role="button"]:active { transform: scale(.97); }
.cards-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.cards-win { position: absolute; left: 8%; top: 7.2%; width: 84%; height: 58.6%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #e8dcc0; }
.cards-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.cards-ph { font-size: 34cqw; font-weight: 700; color: rgba(255, 255, 255, .9); text-shadow: 0 2cqw 0 rgba(0, 0, 0, .12); line-height: 1; }
.cards-name { position: absolute; left: 18%; right: 18%; top: 2.2%; height: 4.4%; display: flex; align-items: center; justify-content: center; font-size: 6.6cqw; font-weight: 700; line-height: 1; color: #5a4128; white-space: nowrap; overflow: hidden; }
.cards-sub { position: absolute; left: 9%; right: 9%; top: 66.6%; height: 5%; font-size: 5.4cqw; line-height: 1.1; color: #8a6e3e; white-space: nowrap; overflow: hidden; display: flex; align-items: center; }
.cards-text { position: absolute; left: 9%; right: 9%; top: 72%; height: 11.5%; font-size: 5.6cqw; line-height: 1.32; color: #5a4128; overflow: hidden; overflow-wrap: anywhere; }
/* 攻守放在插圖窗下緣兩角（避開卡框下面的裝飾） */
.cards-stats { position: absolute; left: 8%; right: 8%; top: 57.6%; height: 8%; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.cards-stats span { font-size: 6.4cqw; font-weight: 700; line-height: 1; padding: 1.4cqw 2.2cqw; border-radius: 3cqw; font-variant-numeric: tabular-nums; color: #fff; }
.cards-stats .st-atk { background: rgba(214, 84, 58, .92); }
.cards-stats .st-def { background: rgba(62, 120, 184, .92); }
.cards-kind { position: absolute; left: 9%; top: 58%; font-size: 6.4cqw; font-weight: 700; padding: 1.4cqw 2.6cqw; border-radius: 3cqw; color: #fff; line-height: 1; }
.cards-kind.k-spell { background: rgba(55, 150, 110, .92); }
.cards-kind.k-trap { background: rgba(140, 90, 190, .92); }
.cards-level { position: absolute; right: 9%; top: 8.5%; display: none; font-size: 8cqw; font-weight: 700; line-height: 1; padding: 1.4cqw 2.4cqw; border-radius: 3cqw; color: #7a4f00; background: rgba(255, 236, 160, .95); }
.cards-rarity { position: absolute; right: 3%; bottom: 1.4%; font-size: 4.6cqw; font-weight: 700; line-height: 1.5; padding: 0 1.6cqw; border-radius: 2cqw; background: rgba(255, 255, 255, .85); }
.cards-count { position: absolute; left: 3%; top: 8.5%; white-space: nowrap; font-size: 7cqw; font-weight: 700; line-height: 1.4; padding: 0 2.4cqw; border-radius: 3cqw; background: rgba(0, 0, 0, .6); color: #fff; }
.cards-count.zero { background: rgba(0, 0, 0, .35); }
.r-N { color: #8a7559; }
.r-R { color: #2f7fb4; }
.r-SR { color: #7a4fc0; }
.r-UR { color: #a8770b; }
.tag.cards-rtag { background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; }
/* 手牌、場上：只留名字、插圖、大大的攻守與等級 */
.cards-card.hand .cards-text, .cards-card.hand .cards-sub, .cards-card.hand .cards-rarity,
.cards-card.zone .cards-text, .cards-card.zone .cards-sub, .cards-card.zone .cards-rarity { display: none; }
.cards-card.hand .cards-level, .cards-card.zone .cards-level { display: block; }
.cards-card.hand .cards-name, .cards-card.zone .cards-name { left: 7%; right: 7%; top: 1.6%; height: 5.6%; font-size: 10cqw; }
.cards-card.hand .cards-win, .cards-card.zone .cards-win { height: 62%; }
/* 場上：插圖放滿整張（不用卡框），名字在上、目前的攻守在下（.cd-zone-stat） */
.cards-card.zone .cards-stats, .cards-card.zone .cards-kind, .cards-card.zone .cards-frame { display: none; }
.cards-card.zone .cards-win { inset: 0; width: 100%; height: 100%; }
.cards-card.zone { box-shadow: inset 0 0 0 3px var(--frame, #e0a93a), 0 2px 0 rgba(120, 90, 50, .3); --frame: #e0a93a; }
.cards-card.zone.kind-spell { --frame: #6cbf5a; }
.cards-card.zone.kind-trap { --frame: #a77ad0; }
.cards-card.zone .cards-win { border: 3px solid var(--frame); border-radius: inherit; }
.cards-card.zone .cards-name { left: 0; right: 0; top: 0; height: 15%; padding: 0 4%; background: linear-gradient(rgba(255, 250, 235, .95), rgba(255, 250, 235, .75)); font-size: 11cqw; }
.cards-card.zone .cards-level { top: 17%; }
.cards-card.hand .cards-stats, .cards-card.zone .cards-stats { top: 70%; height: 14%; left: 6%; right: 6%; flex-direction: column; justify-content: center; gap: 2cqw; }
.cards-card.hand .cards-stats span, .cards-card.zone .cards-stats span { font-size: 11.5cqw; width: 100%; text-align: center; padding: 1.6cqw 0; }
.cards-card.hand .cards-kind, .cards-card.zone .cards-kind { top: 72%; left: 10%; right: 10%; text-align: center; font-size: 13cqw; padding: 3cqw 0; }
.cards-card.mini .cards-text, .cards-card.mini .cards-sub, .cards-card.mini .cards-stats, .cards-card.mini .cards-kind, .cards-card.mini .cards-rarity { display: none; }
.cards-card.mini .cards-name { left: 6%; right: 6%; font-size: 11cqw; top: 1%; height: 7%; }
.cards-card.mini .cards-count { font-size: 14cqw; top: auto; bottom: 4%; left: auto; right: 4%; }
/* 沒有卡框圖時用 CSS 畫的框 */
.cards-card.css-frame { box-shadow: inset 0 0 0 3px var(--frame, #c9b58e), 0 2px 0 var(--line); background: var(--frame-bg, #fbf3dd); }
.cards-card.css-frame.big { box-shadow: inset 0 0 0 6px var(--frame, #c9b58e), 0 6px 22px rgba(60, 40, 10, .35); }
.cards-card.kind-spell { --frame: #5cb89e; --frame-bg: #e6f5ee; }
.cards-card.kind-trap { --frame: #b48ad8; --frame-bg: #f1e8f8; }
.cards-card.attr-sand { --frame: #d8b367; --frame-bg: #fbf0d4; }
.cards-card.attr-light { --frame: #f0c84a; --frame-bg: #fff6d2; }
.cards-card.attr-shadow { --frame: #8b7bb5; --frame-bg: #ebe6f3; }
.cards-card.attr-green { --frame: #84c86c; --frame-bg: #e7f5df; }
.cards-card.attr-water { --frame: #6fb9e3; --frame-bg: #e1f1fa; }
.cards-card.attr-sand .cards-win { background: #d8b367; }
.cards-card.attr-light .cards-win { background: #f0c84a; }
.cards-card.attr-shadow .cards-win { background: #8b7bb5; }
.cards-card.attr-green .cards-win { background: #84c86c; }
.cards-card.attr-water .cards-win { background: #6fb9e3; }
.cards-card.kind-spell .cards-win { background: #7fd0b8; }
.cards-card.kind-trap .cards-win { background: #c3a2e2; }

/* 卡背 */
.cards-back { position: relative; width: 72px; aspect-ratio: 768 / 1120; flex: none; border-radius: 6px; overflow: hidden; background: #6b4f2e; box-shadow: 0 2px 0 rgba(120, 90, 50, .3); }
.cards-back-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.cards-back.css-back { display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(45deg, #7a5a34 0 6px, #6b4f2e 6px 12px); box-shadow: inset 0 0 0 3px #d8b367; }
.cards-back-mark { width: 60%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #d8b367; color: #5a3d1e; font-weight: 700; font-size: 22px; }
.cards-back.hero { width: 120px; }
.cards-back.pack { width: 110px; }
.cards-back.slot { width: 100%; border-radius: 4px; box-shadow: none; }
.cards-back.slot .cards-back-mark { font-size: 12px; }

/* 手機 App 裡留的按鈕 */
.cards-phone { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 12px; text-align: center; }

/* ---------- 全螢幕畫面 ---------- */
body.in-cards #phoneButton, body.in-cards .tray, body.in-cards .broom-btn, body.in-cards .job-chip { visibility: hidden; }
.cd-view {
  position: fixed; inset: 0; z-index: 24; overflow: hidden; color: var(--ink);
  background: radial-gradient(120% 80% at 50% 0%, #fff6dc 0%, #f3e2b8 55%, #e6cc93 100%);
  padding: var(--safe-t) 0 var(--safe-b);
  /* 卡的寬度：直式手機看寬度，桌機看高度（上下兩排角色區 + 手牌要塞得進一個畫面） */
  --zw: clamp(62px, min(26vw, calc((100dvh - 390px) / 4.4)), 128px);
  --hw: var(--zw);
}
@media (min-width: 720px) { .cd-view { --zw: clamp(70px, calc((100dvh - 280px) / 4.4), 140px); } }
@keyframes cd-in { from { opacity: 0; } to { opacity: 1; } }
.cd-hub, .cd-duel { position: absolute; inset: var(--safe-t) 0 var(--safe-b); display: flex; flex-direction: column; min-height: 0; }
.cd-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(253, 248, 232, .92); box-shadow: 0 2px 0 rgba(200, 170, 110, .35); z-index: 3; }
.cd-top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.cd-top-title b { font-size: 18px; }
.cd-top-title span { font-size: 12.5px; color: var(--ink-soft); }
.cd-x { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 0 var(--line); font-size: 18px; font-weight: 700; color: var(--ink); }
.cd-x.small { width: 32px; height: 32px; font-size: 14px; }
.cd-tabs { display: flex; gap: 6px; padding: 8px 12px 6px; overflow-x: auto; scrollbar-width: none; }
.cd-tabs::-webkit-scrollbar { display: none; }
.cd-tab { flex: 1 0 auto; min-width: 64px; min-height: 44px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .6); font-size: 16px; font-weight: 700; color: var(--ink-soft); box-shadow: 0 3px 0 rgba(200, 170, 110, .35); }
.cd-tab.on { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 #dfb73f; }
.cd-tab:disabled { opacity: .45; }
.cd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 28px; -webkit-overflow-scrolling: touch; }
.cd-body > * { max-width: 1080px; margin: 0 auto; }
.cd-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px; background: #fff; box-shadow: 0 2px 0 var(--line); font-size: 14.5px; line-height: 1.5; margin-bottom: 10px; }
.cd-banner.soft { background: rgba(255, 255, 255, .65); }
.cd-banner.hot { background: #fff1e0; box-shadow: inset 0 0 0 2px #f2b46d; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-chips .chip, .cd-filters > .chip { min-height: 36px; font-size: 14px; }
.cd-note { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.cd-why { font-size: 14px; color: #b4503a; line-height: 1.5; background: #fff1ec; padding: 6px 10px; border-radius: 10px; }
.empty { text-align: center; color: var(--ink-soft); padding: 24px; }

/* 歡迎 */
.cd-welcome { display: flex; gap: 18px; align-items: center; padding: 18px; background: #fff; border-radius: 20px; box-shadow: 0 3px 0 var(--line); flex-wrap: wrap; justify-content: center; }
.cd-welcome-main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; font-size: 15.5px; line-height: 1.6; }
.cd-welcome-main h2 { font-size: 22px; }

/* 大廳：對手卡片 */
.cd-lobby { display: grid; gap: 10px; }
.cd-foe { display: flex; gap: 12px; align-items: center; padding: 12px; background: #fff; border-radius: 18px; box-shadow: 0 3px 0 var(--line); }
.cd-foe.tutorial.first { background: #fffbe6; box-shadow: inset 0 0 0 3px var(--sun), 0 3px 0 #dfb73f; }
.cd-foe.locked { opacity: .7; }
.cd-foe.picked { box-shadow: inset 0 0 0 3px var(--mint), 0 3px 0 var(--line); }
.cd-foe > .btn { flex: none; min-width: 84px; }
.cd-foe-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; line-height: 1.45; }
.cd-foe-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 17px; }
.cd-say { background: var(--paper-2); border-radius: 12px; padding: 6px 10px; line-height: 1.5; }
.cd-foe-reward, .cd-foe-left { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; color: var(--ink-soft); }
.cd-face { width: 64px; height: 64px; flex: none; border-radius: 50%; object-fit: cover; background: var(--paper-2); box-shadow: 0 2px 0 var(--line); }
.cd-face.small { width: 34px; height: 34px; }
.cd-face.ph { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; color: #fff; background: #d8b367; }
.cd-face.ph.small { font-size: 16px; }
.cd-face.ph.nara { background: #e9b93a; }
.cd-face.ph.pharaoh { background: #8b7bb5; }
.cd-face.ph.tutorial { background: #7fc3a8; }
.cd-lessons { display: flex; flex-wrap: wrap; gap: 4px; }
.cd-lesson { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .06); color: var(--ink-soft); }
.cd-lesson.on { background: var(--sun); color: var(--ink); font-weight: 700; }
.cd-lesson.past { background: #dff2d5; color: #4c7f3a; }
.tag.diff-easy { background: #dff2d5; color: #4c7f3a; }
.tag.diff-medium { background: #fbe9b4; color: #8a6a1a; }
.tag.diff-hard { background: #ffe0d8; color: #b4503a; }

/* 卡冊 */
.cd-filters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cd-filters .cd-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.cd-filters .cd-chips::-webkit-scrollbar { display: none; }
.cd-filters .chip { flex: none; }
.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 12px; }
.cd-grid.small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
@media (max-width: 420px) { .cd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 卡冊上面的系列一覽（2026-11-11：島嶼生活、島民夥伴、四季節慶） */
.cd-series { margin-bottom: 12px; }
.cd-series-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cd-series-one { padding: 9px 12px; border-radius: 14px; background: #fff; box-shadow: 0 2px 0 var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cd-series-one.on { box-shadow: inset 0 0 0 2px #e0a93a, 0 2px 0 var(--line); background: #fff8e6; }
.cd-series-one.is-life { background: linear-gradient(135deg, #ffffff, #f0f9ea); }
.cd-series-one.is-life.on { background: #fff8e6; }
.cd-series-head { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.cd-series-head b { white-space: nowrap; }
.cd-series-n { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; color: #8a6e3e; }
.cd-series-one .tag.new { white-space: nowrap; background: #dff2d5; color: #3f7a32; font-size: 12px; padding: 1px 7px; }
.cd-series-bar { height: 8px; border-radius: 99px; background: #efe5cf; overflow: hidden; }
.cd-series-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8fd16f, #e0b23a); }
.cd-series-one.full .cd-series-bar i { background: linear-gradient(90deg, #f2c230, #f59f3a); }
.cd-series-reward { font-size: 12.5px; line-height: 1.4; color: #8a6e3e; }
.cd-series-reward.ok { color: #3f7a32; font-weight: 700; }
.cd-series-detail { margin-top: 8px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .7); font-size: 14px; line-height: 1.55; }
.cd-series-detail p { margin: 0 0 4px; }
@media (max-width: 420px) { .cd-series-list { grid-template-columns: 1fr 1fr; } .cd-series-one .tag.new { display: none; } .cd-series-head { font-size: 14px; } .cd-series-reward { display: none; } .cd-series-one.on .cd-series-reward { display: block; } .cd-series-one.on { grid-column: 1 / -1; } }
/* 新系列還沒有專屬插圖：暫用島上的圖，縮小放在屬性顏色的柔光圓裡（cards/<id>.png 放進來就自動換掉） */
.cards-card .cards-win.ph-art { background-image: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, .85) 0 34%, rgba(255, 255, 255, .25) 58%, rgba(255, 255, 255, 0) 72%); }
.cards-card .cards-win.ph-art .cards-art { object-fit: contain; width: 74%; height: 74%; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .12)); }
.cards-card.zone .cards-win.ph-art .cards-art { width: 66%; height: 66%; margin-top: 6%; }

/* 牌組 */
.cd-deck { display: flex; flex-direction: column; gap: 12px; }
.cd-deck-sum { position: sticky; top: -8px; z-index: 2; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: #fff; border-radius: 16px; box-shadow: 0 3px 0 var(--line); }
.cd-deck-meter { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; align-items: baseline; }
.cd-deck-meter b { font-size: 20px; }
.cd-deck-meter .ok, .cd-deck-why.ok { color: #3f8a4a; }
.cd-deck-meter .bad, .cd-deck-why.bad { color: #b4503a; }
.cd-deck-why { font-size: 14px; }
.cd-deck-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-deck-list, .cd-deck-pool { padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 2px rgba(200, 170, 110, .35); }
.cd-deck-list h3, .cd-deck-pool h3 { font-size: 15px; margin-bottom: 8px; }
.cd-deck-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.cd-deck-tile .cards-card.mini .cards-name { display: none; }
/* 牌組列表的小卡：正方形大頭貼（不用卡框），一眼看完 20 張 */
.cd-deck-tile .cards-card.mini { aspect-ratio: 1; --frame: #e0a93a; box-shadow: 0 2px 0 rgba(120, 90, 50, .3); }
.cd-deck-tile .cards-card.mini.kind-spell { --frame: #6cbf5a; }
.cd-deck-tile .cards-card.mini.kind-trap { --frame: #a77ad0; }
.cd-deck-tile .cards-card.mini .cards-frame { display: none; }
.cd-deck-tile .cards-card.mini .cards-win { inset: 0; width: 100%; height: 100%; border: 3px solid var(--frame); border-radius: inherit; }
@media (min-width: 900px) {
  .cd-deck { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
  .cd-deck-sum { grid-column: 1 / -1; }
  .cd-deck-list { position: sticky; top: 150px; max-height: calc(100dvh - 260px); overflow-y: auto; }
}
.cd-deck-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cd-deck-tile .cards-card.mini { width: 100%; max-width: 84px; }
.cd-deck-tile-name { font-size: 12px; text-align: center; line-height: 1.2; }
.cd-deck-pool .cd-chips { margin-bottom: 8px; }
.cd-pool-one { position: relative; }
.cd-info-btn { position: absolute; right: -4px; top: -6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 var(--line); font-size: 16px; color: var(--ink); }

/* 卡包 */
.cd-packs { display: grid; gap: 12px; }
.cd-pack { display: flex; gap: 18px; align-items: center; padding: 16px; background: #fff; border-radius: 20px; box-shadow: 0 3px 0 var(--line); flex-wrap: wrap; justify-content: center; }
.cd-pack-main { flex: 1 1 240px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.5; }
.cd-pack-main p { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.cd-odds { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-odd { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--paper-2); }
.cd-open { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; padding: 6px 0; }
.cd-open-one { position: relative; animation: cd-flip .5s ease-out both; }
.cd-new { position: absolute; top: -8px; right: -6px; }
@keyframes cd-flip { from { transform: rotateY(90deg) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* 規則 */
.cd-rules { display: grid; gap: 12px; }
.cd-rule-hero { display: flex; gap: 18px; align-items: center; padding: 14px; background: #fff; border-radius: 20px; box-shadow: 0 3px 0 var(--line); flex-wrap: wrap; justify-content: center; }
.cd-rule-hero .cards-card.big { width: min(220px, 52vw); }
.cd-anatomy { flex: 1 1 240px; display: flex; flex-direction: column; gap: 8px; }
.cd-anatomy dl, .cd-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 15px; line-height: 1.5; }
.cd-anatomy dt, .cd-facts dt { font-weight: 700; color: #8a6e3e; white-space: nowrap; }
.cd-anatomy dd, .cd-facts dd { margin: 0; }
.cd-rule { padding: 12px 16px; background: #fff; border-radius: 18px; box-shadow: 0 3px 0 var(--line); }
.cd-rule h3 { font-size: 17px; margin-bottom: 6px; }
.cd-rule ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; font-size: 15px; line-height: 1.6; }

/* ---------- 決鬥盤 ---------- */
.cd-duel-main { flex: 1; min-height: 0; display: flex; justify-content: center; gap: 12px; }
.cd-board { position: relative; flex: 1 1 auto; max-width: 620px; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 8px; overflow-y: auto; overflow-x: hidden; }
.cd-top.duel .cd-top-title { align-items: center; text-align: center; }
.cd-side { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; border-radius: 18px; transition: box-shadow .3s; }
.cd-side.foe { background: linear-gradient(#f4dccd, #efe2d2); box-shadow: inset 0 0 0 2px #e5c7b3; }
.cd-side.me { background: linear-gradient(#e7f1dc, #dcebd7); box-shadow: inset 0 0 0 2px #bfd8b2; }
.cd-side.active.foe { box-shadow: inset 0 0 0 3px #e0866e; }
.cd-side.active.me { box-shadow: inset 0 0 0 3px #6fbf8f; }
/* 名字、生命、張數、妙招機關區一列 */
.cd-info { display: flex; align-items: center; gap: 8px; min-height: 44px; flex: none; }
.cd-who { display: flex; align-items: center; gap: 6px; font-size: 15px; flex: none; max-width: 32%; }
.cd-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-lp { position: relative; flex: 1; min-width: 74px; display: flex; flex-direction: column; gap: 2px; padding: 3px 8px; border-radius: 12px; background: rgba(255, 255, 255, .7); }
.cd-lp-num { display: flex; align-items: baseline; gap: 4px; line-height: 1; }
.cd-lp-num small { font-size: 12px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; flex: none; }
.cd-lp-num b { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.cd-lp-bar { height: 6px; border-radius: 4px; background: rgba(0, 0, 0, .1); overflow: hidden; }
.cd-lp-bar i { display: block; height: 100%; background: #5cb89e; transition: width .5s ease; }
.cd-lp.npc .cd-lp-bar i { background: #e2765e; }
.cd-lp.target { cursor: pointer; box-shadow: 0 0 0 3px #e2553e; animation: cd-pulse-red 1s infinite; }
.cd-lp.aimed { background: #ffe1d8; }
.cd-lp.fx-hurt { animation: cd-shake .45s; background: #ffd9cf; }
.cd-counts { display: flex; flex-direction: column; font-size: 11.5px; line-height: 1.3; color: var(--ink-soft); flex: none; font-variant-numeric: tabular-nums; }
.cd-slots { display: flex; gap: 4px; flex: none; align-items: center; }
.cd-slot { width: calc(var(--zw) * .32); height: calc(var(--zw) * .32 * 1.458); flex: none; border-radius: 5px; }
.cd-slot .cards-card.zone .cards-name { display: none; }
.cd-slot.empty { border: 2px dashed rgba(0, 0, 0, .15); background: rgba(255, 255, 255, .3); }
/* 三格角色區 */
.cd-field { flex: none; display: grid; grid-template-columns: repeat(3, var(--zw)); justify-content: center; gap: clamp(6px, 3vw, 18px); }
.cd-zone { position: relative; width: var(--zw); aspect-ratio: 768 / 1120; border-radius: 9px; }
.cd-zone.empty { border: 2px dashed rgba(0, 0, 0, .14); background: rgba(255, 255, 255, .28); display: flex; align-items: center; justify-content: center; }
.cd-zone-ph { font-size: 11px; color: rgba(0, 0, 0, .25); }
.cd-zone-card { position: absolute; inset: 0; transition: transform .25s; }
.cd-zone.def .cd-zone-card { transform: rotate(-90deg) scale(.7); }
.cd-zone-stat { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; white-space: nowrap; z-index: 1; }
.cd-zone-stat b { font-size: 14px; font-weight: 700; padding: 1px 8px; border-radius: 999px; color: #fff; background: #d6543a; box-shadow: 0 2px 0 rgba(0, 0, 0, .15); font-variant-numeric: tabular-nums; }
.cd-zone-stat b.def { background: #3e78b8; }
.cd-bonus { font-size: 12px; font-weight: 700; color: #2f8a4c; background: #fff; padding: 0 5px; border-radius: 999px; }
.cd-zone-tags { position: absolute; left: 4px; right: 4px; top: 17%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; z-index: 1; }
.cd-pos { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.cd-pos.def { color: #3e78b8; }
.cd-pos.wait, .cd-pos.done { color: var(--ink-soft); }
.cd-zone.can-attack { cursor: pointer; }
.cd-zone.can-attack .cd-zone-card { box-shadow: 0 0 0 3px #5ccf8a, 0 0 16px 4px rgba(92, 207, 138, .7); border-radius: 7px; animation: cd-glow 1.3s ease-in-out infinite; }
.cd-zone.selected .cd-zone-card { transform: translateY(-8px) scale(1.04); box-shadow: 0 0 0 4px #f7c430, 0 8px 18px rgba(0, 0, 0, .25); animation: none; }
.cd-zone.target { cursor: crosshair; }
.cd-zone.target .cd-zone-card { box-shadow: 0 0 0 3px #e2553e; border-radius: 7px; animation: cd-pulse-red 1s infinite; }
.cd-zone.aimed .cd-zone-card { box-shadow: 0 0 0 5px #e2553e, 0 0 18px rgba(226, 85, 62, .8); animation: none; }
.cd-zone.pickable { cursor: pointer; }
.cd-zone.pickable .cd-zone-card { box-shadow: 0 0 0 3px #8fc9f0; border-radius: 7px; }
.cd-zone.picked .cd-zone-card { box-shadow: 0 0 0 4px #ee8d78; filter: brightness(.85); }
.cd-zone.picked::after { content: '讓位'; position: absolute; inset: 40% 10% auto; text-align: center; font-weight: 700; font-size: 15px; color: #fff; background: rgba(214, 84, 58, .9); border-radius: 8px; z-index: 2; }
.cd-zone.fx-summon .cd-zone-card, .cd-slot.fx-summon { animation: cd-pop .5s ease-out; }
.cd-zone.fx-dying .cd-zone-card { animation: cd-die .42s ease-in forwards; }
.cd-zone.fx-hit .cd-zone-card { animation: cd-shake .5s .25s; }
.cd-zone.fx-buff .cd-zone-card { animation: cd-buff .8s; }
/* 中間的提示 */
/* 桌機：名字與生命放在角色區左邊，省下高度讓卡變大 */
@media (min-width: 720px) {
  .cd-board { max-width: 760px; }
  .cd-side { flex-direction: row; align-items: center; }
  .cd-side.me { flex-direction: row-reverse; }
  .cd-side.me .cd-field, .cd-side.foe .cd-field { flex: 1; }
  .cd-info { flex-direction: column; align-items: stretch; width: 150px; flex: none; }
  .cd-who { max-width: none; }
  .cd-counts { flex-direction: row; gap: 8px; }
  .cd-slots { justify-content: flex-start; }
  .cd-slot { width: calc(var(--zw) * .42); }
}
.cd-prompt { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 12px; border-radius: 16px; background: rgba(255, 255, 255, .82); box-shadow: 0 2px 0 rgba(200, 170, 110, .35); text-align: center; }
.cd-prompt.tone-foe { background: #fbe4dc; }
.cd-prompt-head { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.cd-prompt-title { font-size: 17px; }
.cd-prompt-text { font-size: 14px; line-height: 1.4; margin: 0; }
.cd-phases { display: flex; gap: 4px; }
.cd-phase { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .06); color: var(--ink-soft); }
.cd-phase.on { background: var(--sun); color: var(--ink); font-weight: 700; }
.cd-phase.past { text-decoration: line-through; }
.cd-prompt.coach-box { background: #fffbe0; box-shadow: inset 0 0 0 3px var(--sun), 0 3px 0 #dfb73f; align-items: stretch; text-align: left; }
.cd-coach-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cd-coach-n { font-size: 12px; font-weight: 700; color: #8a6a1a; }
.cd-coach-head .cd-lessons { margin-left: auto; }
.cd-duel.is-tutorial { --zw: clamp(60px, min(26vw, calc((100dvh - 430px) / 4.4)), 128px); --hw: var(--zw); }
@media (min-width: 720px) { .cd-duel.is-tutorial { --zw: clamp(70px, calc((100dvh - 320px) / 4.4), 140px); --hw: var(--zw); } }
@media (max-width: 520px) {
  .cd-coach-head .cd-lesson { font-size: 0; width: 10px; height: 10px; padding: 0; }
  .cd-coach-head .cd-lessons { gap: 3px; }
}
.cd-prompt.coach-box .btn { align-self: flex-end; }
/* 手牌 */
.cd-hand { flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 12px 6px 6px; margin: 0 -10px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; justify-content: safe center; }
.cd-hand .cards-card.hand { transition: transform .15s, box-shadow .15s; }
.cd-hand .cards-card.hand.playable { box-shadow: 0 0 0 3px #5ccf8a, 0 4px 10px rgba(0, 0, 0, .18); }
.cd-hand .cards-card.hand.on { transform: translateY(-10px); box-shadow: 0 0 0 4px #f7c430, 0 8px 16px rgba(0, 0, 0, .25); }
.cd-hand .cards-card.hand.pickable { box-shadow: 0 0 0 3px #8fc9f0; }
@media (hover: hover) { .cd-hand .cards-card.hand:hover { transform: translateY(-6px); } }
/* 動作列 */
.cd-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 10px; border-radius: 18px; background: rgba(253, 248, 232, .95); box-shadow: 0 3px 0 rgba(200, 170, 110, .45); }
.cd-bar-text { flex: 1 1 170px; min-width: 0; font-size: 14px; line-height: 1.4; }
.cd-bar-btns { display: flex; gap: 6px; flex: 1 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.cd-bar .btn { min-height: 46px; padding: 6px 14px; }
.cd-end { background: #7fd0b8; box-shadow: 0 3px 0 #4fa98f; }
.cd-end.pulse { animation: cd-glow 1.2s ease-in-out infinite; }
.cd-forecast { font-weight: 700; }
.cd-forecast.good { color: #2f8a4c; }
.cd-forecast.bad { color: #b4503a; }
/* 攻擊的連線 */
.cd-arrow { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.cd-arrow svg { position: absolute; left: 0; top: 0; overflow: visible; }
.cd-arrow-line { stroke: #e2553e; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 14 9; animation: cd-dash .6s linear infinite; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
/* 戰鬥紀錄：手機是抽屜，桌機是右邊一欄 */
.cd-log { position: absolute; right: 8px; top: 58px; bottom: 8px; width: min(340px, 86vw); display: none; flex-direction: column; background: #fff; border-radius: 18px; box-shadow: 0 8px 26px rgba(60, 40, 10, .3); z-index: 6; overflow: hidden; }
.cd-log.open { display: flex; }
.cd-log-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 2px solid var(--paper-2); }
.cd-log-list { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.cd-log-line { display: flex; gap: 6px; color: var(--ink-soft); }
.cd-log-line:first-child { color: var(--ink); font-weight: 700; }
.cd-log-line.npc { color: #a0533f; }
.cd-log-line.k-damage, .cd-log-line.k-destroy { color: #bb5a44; }
.cd-log-line.k-trap, .cd-log-line.k-spell { color: #6a4fa3; }
.cd-log-line.k-end { color: #3f8a4a; font-weight: 700; }
.cd-log-turn { flex: none; min-width: 20px; height: 20px; border-radius: 50%; background: var(--paper-2); text-align: center; font-size: 11px; line-height: 20px; }
@media (min-width: 1000px) {
  .cd-duel-main { padding-right: 12px; }
  .cd-log { position: static; display: flex; flex: 0 0 300px; margin: 8px 0; box-shadow: 0 3px 0 var(--line); }
  .cd-log-btn, .cd-log .cd-x { display: none; }
}
/* 飄字、大卡橫幅、回合橫幅 */
.cd-float { position: absolute; right: 8px; top: -6px; font-size: 26px; font-weight: 700; pointer-events: none; animation: cd-float 1s ease-out forwards; text-shadow: 0 2px 0 #fff, 0 0 6px #fff; z-index: 5; }
.cd-float.hurt { color: #d6402a; }
.cd-float.heal { color: #2f8a4c; }
.cd-float.info { color: #6a4fa3; font-size: 20px; }
.cd-banner-fx { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(40, 30, 10, .45); pointer-events: none; animation: cd-in .2s; }
.cd-banner-fx .cards-card.big { width: min(220px, 52vw, 34dvh); animation: cd-pop .45s ease-out; }
.cd-banner-text { font-size: 24px; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); padding: 4px 18px; border-radius: 999px; background: rgba(120, 70, 160, .85); }
.cd-banner-fx.npc .cd-banner-text { background: rgba(190, 80, 55, .9); }
.cd-banner-fx.me .cd-banner-text { background: rgba(60, 150, 110, .9); }
.cd-turn-fx { position: absolute; left: 0; right: 0; top: 42%; z-index: 7; display: flex; justify-content: center; pointer-events: none; }
.cd-turn-fx b { font-size: 28px; color: #fff; padding: 10px 40px; background: linear-gradient(90deg, transparent, rgba(80, 60, 20, .85) 15%, rgba(80, 60, 20, .85) 85%, transparent); animation: cd-sweep .9s ease-out; }
.cd-duel.playing .cd-hand, .cd-duel.playing .cd-field { pointer-events: none; }
/* 教學：要點的東西會一閃一閃 */
.coach { position: relative; }
.cards-card.coach, .cd-zone.coach .cd-zone-card, .cd-zone.empty.coach { box-shadow: 0 0 0 4px #f7c430, 0 0 20px 6px rgba(247, 196, 48, .9) !important; animation: cd-coach 1s ease-in-out infinite !important; }
.btn.coach { animation: cd-coach 1s ease-in-out infinite; box-shadow: 0 0 0 4px #f7c430, 0 3px 0 #dfb73f; }
.cd-lp.coach { box-shadow: 0 0 0 4px #f7c430; animation: cd-coach 1s infinite; }
/* 結果 */
.cd-result { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 16px; background: rgba(40, 30, 10, .5); animation: cd-in .3s; }
.cd-result-box { width: min(440px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; border-radius: 24px; background: var(--paper); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); text-align: center; }
.cd-result.win .cd-result-box h2 { color: #c88a12; font-size: 32px; }
.cd-result.lose .cd-result-box h2 { color: #8a6e3e; font-size: 28px; }
.cd-result-lp { font-size: 14px; color: var(--ink-soft); }
.cd-result-say { display: flex; align-items: center; gap: 8px; background: var(--paper-2); border-radius: 14px; padding: 8px 12px; font-size: 15px; line-height: 1.5; text-align: left; }
.cd-reward { display: flex; align-items: center; gap: 14px; }
.cd-reward .cards-card.thumb { width: 110px; }
.cd-reward .cards-back.pack { width: 80px; }
.cd-reward-list { display: flex; flex-direction: column; gap: 4px; font-size: 15px; text-align: left; }
.cd-reward-list > div { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.cd-result-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- 彈出：卡片說明（手機從下面滑上來，桌機在中間） ---------- */
.cd-sheet-wrap { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: rgba(40, 30, 10, .45); animation: cd-in .15s; }
.cd-sheet { position: relative; width: min(720px, 100%); max-height: 92%; overflow-y: auto; padding: 18px 16px calc(18px + var(--safe-b)); border-radius: 24px 24px 0 0; background: var(--paper); box-shadow: 0 -6px 24px rgba(0, 0, 0, .25); animation: cd-up .22s ease-out; }
.cd-sheet h3 { font-size: 18px; margin: 0 40px 10px 0; }
.cd-grave-title { font-size: 14px; margin: 12px 0 6px; color: var(--ink-soft, #7a6a55); }
.cd-sheet-x { position: absolute; right: 12px; top: 12px; z-index: 2; }
.cd-card-sheet { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.cd-card-sheet > .cards-card.big { width: min(250px, 58vw, 40dvh); }
.cd-card-info { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cd-card-title { display: flex; align-items: center; gap: 8px; font-size: 21px; padding-right: 44px; }
.cd-flavor { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin: 0; }
.cd-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-opts .btn { min-width: 112px; min-height: 50px; font-size: 17px; }
.cd-opts .btn:disabled { opacity: .5; }
.cd-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cd-menu .btn { flex: 1 1 100px; }
@media (min-width: 760px) and (min-height: 560px) {
  .cd-sheet-wrap { align-items: center; padding: 20px; }
  .cd-sheet { border-radius: 24px; max-height: 88%; }
}

@keyframes cd-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.12); } }
@keyframes cd-pulse-red { 0%, 100% { box-shadow: 0 0 0 3px #e2553e; } 50% { box-shadow: 0 0 0 5px rgba(226, 85, 62, .55); } }
@keyframes cd-coach { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes cd-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes cd-die { to { transform: scale(.6) rotate(-12deg); opacity: 0; filter: grayscale(1) brightness(1.6); } }
@keyframes cd-shake { 0%, 100% { translate: 0; } 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 4px 0; } }
@keyframes cd-buff { 50% { filter: brightness(1.5) drop-shadow(0 0 10px #8de08f); } }
@keyframes cd-float { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-36px); opacity: 0; } }
@keyframes cd-sweep { from { transform: translateX(-40%); opacity: 0; } 30% { transform: none; opacity: 1; } }
@keyframes cd-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cd-dash { to { stroke-dashoffset: -23; } }
@media (prefers-reduced-motion: reduce) { .cd-view *, .cd-view *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }
@media (max-width: 520px) {
  .cd-foe { flex-wrap: wrap; }
  .cd-foe-main { flex: 1 1 200px; }
  .cd-foe > .btn { flex: 1 1 100%; }
  .cd-face { width: 52px; height: 52px; }
}

/* ---------- 2026-11-10 上線前的修正：手機上也看得懂 ---------- */
/* 手牌的名字：卡框上的名字條太小，改成蓋在最上面的大字名牌（跟場上的卡一樣） */
.cards-card.hand .cards-name {
  left: 0; right: 0; top: 0; height: 15%; padding: 0 5%;
  background: linear-gradient(rgba(255, 250, 235, .97), rgba(255, 250, 235, .86));
  font-size: 12.5cqw; letter-spacing: -.02em; box-shadow: 0 1px 0 rgba(120, 90, 50, .25);
}
.cards-card.hand .cards-level { top: 17%; }
/* 大廳 */
.tag.next { background: var(--sun); color: var(--ink); font-weight: 700; }
.cd-foe.first { background: #fffbe6; box-shadow: inset 0 0 0 3px var(--sun), 0 3px 0 #dfb73f; }
.cd-foe.tutorial.done { opacity: .92; }
.cd-say.lock { background: #f3ece0; color: var(--ink-soft); }
.cd-foe.by-level .cd-face { filter: grayscale(.6) brightness(.9); }
/* 卡包的圖 */
.cards-pack-art { width: 120px; flex: none; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(90, 60, 20, .3)); }
.cards-pack-art.pack { width: 120px; }
.cd-reward .cards-pack-art { width: 86px; }
/* 手機：生命的數字不要擠到旁邊的張數 */
@media (max-width: 520px) {
  .cd-lp { overflow: hidden; }
  .cd-lp-num small { font-size: 11px; }
  .cd-lp-num b { font-size: 22px; letter-spacing: 0; }
}

/* ---------- 2026-11-10 角色卡改版：每個角色都是一張卡、像真的卡牌對戰一樣有份量 ---------- */
/* 角色卡的插圖：沒有專屬插圖時用頭像，放在屬性顏色的光暈前面 */
.cards-card.is-char .cards-win { background: radial-gradient(120% 90% at 50% 100%, #fff8e0 0%, var(--frame-bg, #fbf3dd) 45%, var(--frame, #e0a93a) 130%); }
.cards-win.bust .cards-art { object-fit: contain; object-position: 50% 100%; transform: scale(1.04); transform-origin: 50% 100%; }
.cards-card.is-reverent .cards-win { background: radial-gradient(120% 90% at 50% 30%, #fffbe8 0%, #f6e7c0 60%, #e7cf95 120%); }
/* 效果名稱的小牌子（手牌看得到） */
.cards-fx { position: absolute; left: 8%; right: 8%; top: 49%; display: none; text-align: center; font-size: 8.4cqw; font-weight: 700; line-height: 1.5; color: #5a3d1e; background: rgba(255, 244, 205, .94); border-radius: 3cqw; box-shadow: 0 .8cqw 0 rgba(160, 110, 40, .35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards-card.hand .cards-fx { display: block; top: 52%; }
/* 夥伴卡：金色外框、一道光掃過、左上角「夥伴」緞帶 */
.cards-card.is-partner { box-shadow: 0 0 0 3px #f2c230, 0 0 14px 2px rgba(247, 196, 48, .75), 0 3px 0 rgba(120, 90, 50, .3); }
.cards-card.is-partner::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 45%, transparent 60%); background-size: 260% 100%; animation: cd-foil 3.2s ease-in-out infinite; mix-blend-mode: soft-light; }
.cards-partner { position: absolute; left: -2%; top: 12%; padding: .6cqw 3cqw .6cqw 2.6cqw; font-size: 7.4cqw; font-weight: 700; color: #6b4300; background: linear-gradient(#ffe68a, #f2c230); border-radius: 0 3cqw 3cqw 0; box-shadow: 0 .8cqw 0 rgba(140, 90, 0, .35); z-index: 2; }
.cards-card.zone .cards-partner, .cards-card.mini .cards-partner { font-size: 11cqw; top: 17%; }
.cards-card.mini .cards-fx { display: none; }
.cards-card.big .cards-text { font-size: 5.2cqw; }
.cards-card.hand .cards-level, .cards-card.zone .cards-level { font-size: 9cqw; }
@keyframes cd-foil { 0% { background-position: 120% 0; } 60%, 100% { background-position: -40% 0; } }
.tag.partner { background: linear-gradient(#ffe68a, #f2c230); color: #6b4300; font-weight: 700; }
.cd-hl { margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff6d6; box-shadow: inset 0 0 0 2px #f2d27a; font-size: 14.5px; line-height: 1.55; }
.cd-welcome .cards-card.big.hero { width: min(200px, 46vw); }

/* 大廳：夥伴卡 */
.cd-partner { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 20px; background: linear-gradient(110deg, #fff7d8, #fff 60%); box-shadow: inset 0 0 0 3px #f2d27a, 0 3px 0 #e2c062; }
.cd-partner > .cards-card { width: 108px; flex: none; }
.cd-partner-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cd-partner-title { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.cd-partner-fx { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.5; color: #6b4a14; }
.cd-partner-main .cd-note { margin: 0; font-size: 13px; }
.cd-partner-ok { font-size: 14px; font-weight: 700; color: #3f8a4a; }
.cd-partner-main .btn { align-self: flex-start; }
.cd-foe-partner { font-size: 13px; color: #8a6a1a; }

/* ---------- 決鬥盤：桌上的角色區 ---------- */
.cd-view { --zw: clamp(62px, min(25vw, calc((100dvh - 400px) / 4.4)), 132px); --hw: var(--zw); }
@media (min-width: 720px) { .cd-view { --zw: clamp(74px, calc((100dvh - 250px) / 4.75), 156px); --hw: calc(var(--zw) * 1.12); } }
.cd-duel.is-tutorial { --zw: clamp(60px, min(25vw, calc((100dvh - 465px) / 4.4)), 128px); --hw: var(--zw); }
@media (min-width: 720px) { .cd-duel.is-tutorial { --zw: clamp(70px, calc((100dvh - 272px) / 4.75), 150px); --hw: calc(var(--zw) * 1.1); } }
.cd-duel { background: radial-gradient(90% 60% at 50% 48%, rgba(255, 252, 238, .65), transparent 70%); }
.cd-side.foe { background: linear-gradient(#f1d4c2, #efe0cf); }
.cd-side.me { background: linear-gradient(#dcebd1, #e5f0db); }
/* 角色區往後傾一點，像放在桌上；立牌另外站直 */
.cd-field { perspective: 900px; padding-top: 4px; }
.cd-zone-card { transform-origin: 50% 70%; transform: rotateX(14deg); border-radius: 9px; }
.cd-zone.def .cd-zone-card { transform: rotateX(14deg) rotate(-90deg) scale(.7); }
.cd-zone.has-standee .cd-zone-card .cards-art { filter: saturate(.85) brightness(.95); }
/* 角色本人站在卡上（從卡裡跳出來） */
.cd-standee { position: absolute; left: 50%; bottom: 15%; height: 68%; width: auto; max-width: 112%; transform: translateX(-50%); transform-origin: 50% 100%; pointer-events: none; z-index: 1; filter: drop-shadow(0 6px 3px rgba(60, 40, 10, .35)); animation: cd-idle 2.6s ease-in-out infinite; }
.cd-zone.def .cd-standee { height: 56%; bottom: 22%; }
.cd-zone.partner .cd-standee { filter: drop-shadow(0 0 8px rgba(255, 214, 90, .95)) drop-shadow(0 6px 3px rgba(60, 40, 10, .35)); }
.cd-zone.partner .cd-zone-card { box-shadow: 0 0 0 3px #f2c230, 0 0 16px rgba(247, 196, 48, .8); }
.cd-zone-stat { z-index: 2; bottom: -6px; }
.cd-zone-stat b { font-size: 15px; padding: 2px 9px; }
.cd-zone-stat b.up { background: #e0602f; box-shadow: 0 0 0 2px #ffd65a, 0 2px 0 rgba(0, 0, 0, .15); }
.cd-zone-stat b.down { background: #8a6e9e; }
.cd-zone-tags { z-index: 2; }
.cd-pos.guard { color: #b4503a; }
.cd-zone.guarded { opacity: .55; filter: grayscale(.4); }
.cd-zone.can-attack .cd-standee { animation: cd-ready 1s ease-in-out infinite; }
@keyframes cd-idle { 0%, 100% { transform: translateX(-50%) scaleY(1); } 50% { transform: translateX(-50%) scaleY(1.025); } }
@keyframes cd-ready { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }

/* 召喚：卡重重落在場上 → 衝擊波 → 角色本人從卡裡跳出來 */
.cd-zone.fx-summon .cd-zone-card { animation: cd-slam .55s cubic-bezier(.3, 1.4, .6, 1) both; }
.cd-zone.fx-summon.from-foe .cd-zone-card { animation-name: cd-slam-foe; }
.cd-zone.fx-summon::before { content: ''; position: absolute; left: 50%; top: 58%; width: 150%; aspect-ratio: 2.2; border-radius: 50%; transform: translate(-50%, -50%) scale(.2); border: 5px solid rgba(255, 220, 120, .95); box-shadow: 0 0 18px rgba(255, 210, 90, .9); opacity: 0; animation: cd-wave .6s .38s ease-out; pointer-events: none; z-index: 0; }
.cd-zone.fx-summon.partner::before { border-color: #ffd34d; animation-duration: .9s; width: 220%; }
.cd-zone.fx-summon .cd-standee { animation: cd-rise .7s .42s cubic-bezier(.2, 1.6, .5, 1) both, cd-idle 2.6s 1.2s ease-in-out infinite; }
.cd-slot.fx-set { animation: cd-set .5s ease-out; }
@keyframes cd-slam { 0% { transform: translateY(120%) scale(1.7) rotate(-10deg); opacity: 0; } 55% { transform: rotateX(14deg) scale(1.06); opacity: 1; } 75% { transform: rotateX(14deg) scale(.97); } 100% { transform: rotateX(14deg); } }
@keyframes cd-slam-foe { 0% { transform: translateY(-120%) scale(1.7) rotate(10deg); opacity: 0; } 55% { transform: rotateX(14deg) scale(1.06); opacity: 1; } 75% { transform: rotateX(14deg) scale(.97); } 100% { transform: rotateX(14deg); } }
@keyframes cd-wave { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.2); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
@keyframes cd-rise { 0% { transform: translateX(-50%) scale(.1, 0); opacity: 0; } 60% { transform: translateX(-50%) scale(1.12, 1.18); opacity: 1; } 100% { transform: translateX(-50%) scale(1); } }
@keyframes cd-set { 0% { transform: translateY(-30px) rotate(-12deg) scale(1.3); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* 攻擊：往目標衝過去（方向在 afterRender 算好放在 --dx/--dy），目標閃白光、搖晃 */
.cd-zone.fx-lunge { z-index: 6; }
.cd-zone.fx-lunge .cd-zone-card, .cd-zone.fx-lunge .cd-standee { animation: cd-lunge .7s cubic-bezier(.5, -0.3, .4, 1.3) both; }
.cd-zone.fx-impact::after, .cd-lp.fx-impact::after { content: ''; position: absolute; left: 50%; top: 50%; width: 160%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%) scale(.1); background: radial-gradient(circle, #fff 0%, rgba(255, 236, 160, .95) 25%, rgba(255, 140, 60, .55) 50%, transparent 70%); opacity: 0; animation: cd-burst .5s .3s ease-out; pointer-events: none; z-index: 7; }
.cd-zone.fx-impact .cd-zone-card, .cd-zone.fx-impact .cd-standee { animation: cd-shake .45s .32s; }
@keyframes cd-lunge { 0% { translate: 0 0; } 25% { translate: calc(var(--dx, 0px) * -.08) calc(var(--dy, 0px) * -.08); } 50% { translate: var(--dx, 0px) var(--dy, 0px); } 100% { translate: 0 0; } }
@keyframes cd-burst { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
/* 離場：閃白、裂開、飛走 */
.cd-zone.fx-dying .cd-zone-card, .cd-zone.fx-dying .cd-standee { animation: cd-shatter .5s ease-in forwards; }
@keyframes cd-shatter { 0% { filter: brightness(1); } 25% { filter: brightness(2.2) saturate(0); transform: rotateX(14deg) scale(1.08); } 100% { filter: brightness(1.6) grayscale(1) blur(2px); transform: rotateX(14deg) translateY(18px) scale(.5) rotate(-18deg); opacity: 0; } }
/* 平安、蹦蹦跳：留下來的角色亮一圈 */
.cd-zone.fx-saved .cd-zone-card { animation: cd-saved .9s ease-out; }
@keyframes cd-saved { 0% { box-shadow: 0 0 0 0 rgba(255, 240, 170, .9); } 60% { box-shadow: 0 0 0 10px rgba(255, 240, 170, .7), 0 0 30px 10px rgba(255, 230, 140, .7); } 100% { box-shadow: none; } }
.cd-zone.fx-buff .cd-zone-card { animation: cd-buff .9s; }
/* 效果名稱的對話框 */
.cd-callout { position: absolute; left: 50%; bottom: 92%; transform: translateX(-50%); z-index: 8; display: flex; flex-direction: column; align-items: center; padding: 4px 12px 6px; border-radius: 14px; background: #fffbe8; box-shadow: 0 0 0 3px #f2c230, 0 6px 14px rgba(60, 40, 10, .35); white-space: nowrap; pointer-events: none; animation: cd-callout 1.25s ease-out both; }
.cd-callout::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px; background: #fffbe8; transform: translateX(-50%) rotate(45deg); box-shadow: 3px 3px 0 #f2c230; }
.cd-callout small { font-size: 11px; color: #8a6a1a; line-height: 1.2; }
.cd-callout b { font-size: 16px; color: #6b4300; line-height: 1.2; }
.cd-zone.npc .cd-callout { bottom: auto; top: 92%; }
.cd-zone.npc .cd-callout::after { bottom: auto; top: -8px; box-shadow: -3px -3px 0 #f2c230; }
@keyframes cd-callout { 0% { opacity: 0; transform: translateX(-50%) scale(.4); } 18% { opacity: 1; transform: translateX(-50%) scale(1.1); } 30% { transform: translateX(-50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* 生命：數字倒數、條先掉、淡黃色的「剛剛被扣的」慢慢追上；剩不到 1000 心跳 */
.cd-lp { overflow: visible; }
.cd-lp-bar { position: relative; height: 9px; border-radius: 5px; }
.cd-lp-bar i { position: relative; z-index: 1; border-radius: 5px; background: linear-gradient(#7fd8b8, #47a888); }
.cd-lp.npc .cd-lp-bar i { background: linear-gradient(#f0927a, #d65a40); }
.cd-lp-bar em { position: absolute; left: 0; top: 0; bottom: 0; background: #ffe58a; border-radius: 5px; animation: cd-drain .9s .35s ease-in both; }
@keyframes cd-drain { from { width: var(--from); } to { width: var(--to); } }
.cd-lp.danger .cd-lp-num b { color: #d0402a; animation: cd-beat .9s ease-in-out infinite; }
.cd-lp.danger { box-shadow: inset 0 0 0 2px rgba(214, 64, 42, .55); }
@keyframes cd-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
.cd-lp-num b { display: inline-block; transform-origin: 0 70%; }
.cd-float { right: auto; left: calc(100% + 4px); top: 50%; translate: 0 -50%; font-size: 30px; white-space: nowrap; z-index: 9; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 3px 0 #fff, 0 0 10px rgba(255, 255, 255, .9); }
.cd-float.hurt { font-size: 40px; font-weight: 800; animation: cd-dmg 1.1s ease-out forwards; }
.cd-float.hurt.big { font-size: 54px; }
.cd-float.heal { animation: cd-float 1.1s ease-out forwards; }
@keyframes cd-dmg { 0% { transform: translateY(6px) scale(.3); opacity: 0; } 18% { transform: translateY(-10px) scale(1.35); opacity: 1; } 32% { transform: translateY(-8px) scale(1); } 80% { opacity: 1; } 100% { transform: translateY(-34px); opacity: 0; } }
.cd-board.shake { animation: cd-quake .5s ease-out; }
@keyframes cd-quake { 0%, 100% { translate: 0 0; } 15% { translate: -7px 3px; } 30% { translate: 6px -3px; } 45% { translate: -5px 2px; } 60% { translate: 4px -1px; } 75% { translate: -2px 1px; } }

/* 抽牌 → 準備 → 戰鬥 → 結束 */
.cd-phases { gap: 2px; }
.cd-phase { position: relative; font-size: 12px; padding: 2px 9px; }
.cd-phase + .cd-phase::before { content: '›'; position: absolute; left: -5px; color: rgba(0, 0, 0, .25); }
.cd-phases.foe .cd-phase.on { background: #f0927a; color: #fff; }
.cd-phase.past { text-decoration: none; opacity: .55; }
.cd-prompt.tone-foe .cd-prompt-text { color: #8a3f2c; }

/* 回合橫幅：緞帶從左邊掃進來 */
.cd-turn-fx { top: 36%; }
.cd-turn-fx b { all: unset; }
.cd-turn-ribbon { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: min(560px, 92vw); padding: 14px 40px 18px; background: linear-gradient(90deg, transparent, rgba(80, 60, 20, .9) 12%, rgba(80, 60, 20, .9) 88%, transparent); animation: cd-ribbon 1.35s ease-out both; }
.cd-turn-ribbon.art { min-width: 0; width: min(520px, 94vw); aspect-ratio: 768 / 257; padding: 0 0 2%; background-color: transparent; background-size: 100% 100%; background-repeat: no-repeat; }
.cd-turn-ribbon small { font-size: 14px; font-weight: 700; color: #fff3c4; letter-spacing: .1em; }
.cd-turn-ribbon b { font-size: clamp(26px, 7vw, 40px); font-weight: 800; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .3); letter-spacing: .06em; }
.cd-turn-ribbon.art small { color: #8a5a20; order: 2; margin-top: -1px; }
.cd-turn-ribbon.art b { color: #6b3f12; text-shadow: 0 2px 0 rgba(255, 255, 255, .8); }
.cd-turn-fx.foe .cd-turn-ribbon.art b { color: #a43c25; }
.cd-turn-fx.me .cd-turn-ribbon.art b { color: #2f7a52; }
@keyframes cd-ribbon { 0% { transform: translateX(-70vw) scale(.9); opacity: 0; } 22% { transform: translateX(3vw); opacity: 1; } 32% { transform: none; } 82% { transform: none; opacity: 1; } 100% { transform: translateX(60vw); opacity: 0; } }
.cd-turn-fx::before { content: ''; position: fixed; inset: 0; background: rgba(40, 30, 10, .25); animation: cd-dim 1.35s ease-out both; }
@keyframes cd-dim { 0%, 100% { opacity: 0; } 20%, 80% { opacity: 1; } }

/* 妙招／機關發動的大卡 */
.cd-banner-fx .cards-card.big { width: min(240px, 56vw, 36dvh); animation: cd-reveal .55s cubic-bezier(.2, 1.4, .5, 1) both; }
.cd-banner-fx.trap .cd-banner-text { background: rgba(140, 90, 190, .92); }
.cd-banner-fx.spell .cd-banner-text { background: rgba(55, 150, 110, .92); }
@keyframes cd-reveal { 0% { transform: rotateY(90deg) scale(.6); } 100% { transform: none; } }

/* 夥伴登場的特寫 */
.cd-cutin { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; pointer-events: none; background: rgba(30, 20, 5, .45); animation: cd-dim 2.3s ease-out both; }
.cd-cutin-band { position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(10px, 4vw, 40px); padding: 10px 16px; background: linear-gradient(100deg, rgba(255, 214, 90, 0) 0%, rgba(255, 214, 90, .95) 10%, rgba(255, 244, 205, .97) 50%, rgba(255, 214, 90, .95) 90%, rgba(255, 214, 90, 0) 100%); box-shadow: 0 0 40px rgba(255, 210, 90, .7); animation: cd-band 2.3s cubic-bezier(.2, .9, .3, 1) both; }
.cd-cutin.foe .cd-cutin-band { background: linear-gradient(100deg, rgba(240, 146, 122, 0) 0%, rgba(240, 146, 122, .95) 10%, rgba(255, 232, 220, .97) 50%, rgba(240, 146, 122, .95) 90%, rgba(240, 146, 122, 0) 100%); animation-name: cd-band-foe; }
.cd-cutin-art { height: clamp(150px, 34dvh, 280px); display: flex; align-items: flex-end; margin: -50px 0 -14px; }
.cd-cutin-standee { height: 100%; width: auto; filter: drop-shadow(0 8px 6px rgba(60, 40, 10, .4)); animation: cd-hop 2.3s ease-out both; }
.cd-cutin-art .cards-card.thumb { width: clamp(110px, 24dvh, 170px); }
.cd-cutin-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cd-cutin-text small { font-size: 15px; font-weight: 700; color: #8a5a10; letter-spacing: .08em; }
.cd-cutin-text b { font-size: clamp(30px, 8vw, 48px); color: #5a3a10; line-height: 1.1; }
.cd-cutin-fx { font-size: 20px; font-weight: 700; color: #b0601a; }
.cd-cutin-text em { font-style: normal; font-size: 15px; color: #6b4a14; }
@keyframes cd-band { 0% { transform: translateX(-100%) skewX(-12deg); } 18% { transform: translateX(0) skewX(-6deg); } 26%, 84% { transform: none; } 100% { transform: translateX(100%); opacity: 0; } }
@keyframes cd-band-foe { 0% { transform: translateX(100%) skewX(12deg); } 18% { transform: translateX(0) skewX(6deg); } 26%, 84% { transform: none; } 100% { transform: translateX(-100%); opacity: 0; } }
@keyframes cd-hop { 0%, 12% { transform: translateY(40%) scale(.6); opacity: 0; } 28% { transform: translateY(-8%) scale(1.06); opacity: 1; } 36% { transform: none; } 100% { transform: none; } }

/* 桌機：滑鼠移到卡上，左邊浮出一張大卡 */
.cd-duel-main { position: relative; }
.cd-preview { display: none; }
@media (hover: hover) and (min-width: 900px) {
  .cd-preview { display: block; position: absolute; left: 14px; top: 50%; z-index: 7; width: min(250px, 22vw); transform: translateY(-50%) translateX(-12px); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
  .cd-preview.show { opacity: 1; transform: translateY(-50%); }
  .cd-preview .cards-card.big { width: 100%; }
  .cd-hand .cards-card.hand:hover { transform: translateY(-14px) scale(1.06); z-index: 2; }
}
/* 手牌：剛抽到的牌從牌堆飛進來 */
.cd-hand { padding-top: 16px; }
.cd-hand .cards-card.hand.fx-drawn { animation: cd-draw .55s cubic-bezier(.2, 1.2, .5, 1) both; }
@keyframes cd-draw { 0% { transform: translate(40vw, -30vh) rotate(25deg) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* 結果：贏了彩帶、夥伴跳出來 */
.cd-result-standee { height: 120px; width: auto; margin: -70px 0 -6px; filter: drop-shadow(0 6px 4px rgba(60, 40, 10, .3)); animation: cd-hop 1.4s ease-out both; }
.cd-result.win .cd-result-box { overflow: visible; margin-top: 50px; }
.cd-result.win .cd-result-box h2 { font-size: 40px; animation: cd-pop .6s ease-out; }
.cd-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cd-confetti i { position: absolute; top: -20px; left: calc(var(--i) * 5.6%); width: 10px; height: 16px; border-radius: 3px; background: hsl(calc(var(--i) * 47deg) 80% 62%); animation: cd-fall calc(1.8s + var(--i) * .07s) calc(var(--i) * .06s) ease-in infinite; }
@keyframes cd-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(540deg); opacity: .6; } }
.cd-open-one.r-SR .cards-card, .cd-open-one.r-UR .cards-card { box-shadow: 0 0 0 3px #f2c230, 0 0 18px rgba(247, 196, 48, .8); }

@media (max-width: 520px) {
  .cd-partner { flex-wrap: wrap; }
  .cd-partner > .cards-card { width: 92px; }
  .cd-partner-main { flex: 1 1 180px; }
  .cd-callout b { font-size: 14px; }
  .cd-zone-stat b { font-size: 13px; padding: 1px 7px; }
  .cd-cutin-text small, .cd-cutin-text em { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .cd-standee { animation: none !important; } }

/* ---------- 好友對決（v2.5）：大廳的好友清單、邀請小卡、回合倒數 ---------- */
.cd-friends { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #fff; border-radius: 18px; box-shadow: 0 3px 0 var(--line); }
.cd-friends-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.cd-friends-head h3 { margin: 0; font-size: 17px; }
.cd-friends > .cd-note { margin: 0; }
.cd-friend-list { display: flex; flex-direction: column; gap: 6px; }
.cd-friend { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--paper-2, #faf3df); }
.cd-friend.online { background: #effaf1; }
.cd-friend.invite { background: #fffbe6; box-shadow: inset 0 0 0 2px var(--sun, #f2c230); }
.cd-friend.waiting { box-shadow: inset 0 0 0 2px #f2b46d; }
.cd-friend-face { position: relative; flex: none; }
.cd-friend-face .cd-face.small { width: 40px; height: 40px; }
.cd-friend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cd-friend-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; }
.cd-friend-sub { font-size: 13px; color: var(--ink-soft); line-height: 1.4; }
.cd-friend-btns { flex: none; display: flex; gap: 6px; }
.cd-friend-btns .btn { min-width: 64px; }
.cd-practiced { font-size: 13px; color: var(--ink-soft); }
.cd-practiced ul { margin: 4px 0 0; padding-left: 18px; }
.cd-face.friend { background: #fdf6e3; }
.cd-away { font-size: 11px; }
.cd-result-vs { font-size: 14px; color: var(--ink-soft); }

.cd-timer { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .8); box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.cd-timer.mine { background: #e7f7ee; box-shadow: inset 0 0 0 1px #7cc79a; }
.cd-timer.low { background: #ffe4dc; box-shadow: inset 0 0 0 1px #e2553e; color: #b13a24; animation: cd-pulse-t 1s ease-in-out infinite; }
@keyframes cd-pulse-t { 50% { transform: scale(1.08); } }

.pvp-invite { position: fixed; left: 50%; top: calc(62px + env(safe-area-inset-top, 0px)); z-index: 35; transform: translateX(-50%); width: min(440px, calc(100vw - 32px)); display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px; background: #fffbe6; color: var(--ink, #4a3a28); box-shadow: inset 0 0 0 3px var(--sun, #f2c230), 0 8px 24px rgba(60, 40, 10, .25); animation: pvp-in .3s ease-out; }
.pvp-invite[hidden] { display: none; }
.pvp-invite-face { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; background: #fdf6e3; }
.pvp-invite-face.ph { display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: #d8b367; }
.pvp-invite-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.35; }
.pvp-invite-left { font-size: 12.5px; color: var(--ink-soft, #8a7a5a); }
.pvp-invite-btns { flex: none; display: flex; gap: 6px; }
@keyframes pvp-in { from { transform: translate(-50%, -16px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@media (max-width: 420px) {
  .pvp-invite { flex-wrap: wrap; }
  .pvp-invite-main { flex: 1 1 160px; }
  .pvp-invite-btns { flex: 1 1 100%; justify-content: flex-end; }
  .cd-friend { flex-wrap: wrap; }
  .cd-friend-main { flex: 1 1 150px; }
  .cd-friend-btns { margin-left: auto; }
}
