/* ============================================================
   Skill Arena — Design System
   中性灰階 + 單一藍色強調,SF/Inter 字體階層,克制的動態。
   同一份 token 供淺色(表單/控制台)與深色(投影幕)兩種情境使用。
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --bg:        #ffffff;
  --bg-2:      #f5f5f7;
  --surface:   #ffffff;
  --surface-2: #f5f5f7;

  --text:   #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;

  --line:      #d2d2d7;
  --line-soft: rgba(0, 0, 0, .08);

  --accent:       #0071e3;
  --link:         #0066cc;
  --tint:         rgba(0, 113, 227, .09);

  --pink:  #d6205e;
  --tint-pink: rgba(214, 32, 94, .09);
  --green: #248a3d;
  --amber: #a35200;
  --red:   #d70015;

  --glass:     rgba(255, 255, 255, .72);
  --shadow-1:  0 1px 2px rgba(0, 0, 0, .05);
  --shadow-2:  0 2px 6px rgba(0, 0, 0, .05), 0 10px 30px rgba(0, 0, 0, .06);
  --shadow-3:  0 12px 44px rgba(0, 0, 0, .16);

  --r-xs: 8px;
  --r-s:  12px;
  --r-m:  16px;
  --r-l:  20px;
  --r-xl: 28px;
  --r-pill: 980px;

  --content: 980px;
  --content-wide: 1220px;
  --gutter: clamp(20px, 5vw, 40px);
  --nav-h: 52px;

  --ease: cubic-bezier(.28, .11, .32, 1);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
          'Inter', 'Helvetica Neue', 'Segoe UI', 'PingFang TC', 'Noto Sans TC',
          'Microsoft JhengHei', sans-serif;

  --card-w: 300px;
}

[data-theme='dark'] {
  color-scheme: dark;

  --bg:        #000000;
  --bg-2:      #0a0a0b;
  --surface:   #1c1c1e;
  --surface-2: #2c2c2e;

  --text:   #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8a8a8f;

  --line:      #38383a;
  --line-soft: rgba(255, 255, 255, .1);

  --accent:       #2997ff;
  --link:         #2997ff;
  --tint:         rgba(41, 151, 255, .16);

  --pink:  #ff456e;
  --tint-pink: rgba(255, 69, 110, .16);
  --green: #30d158;
  --amber: #ffd60a;
  --red:   #ff453a;

  --glass:    rgba(22, 22, 24, .72);
  --shadow-1: none;
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .5);
  --shadow-3: 0 16px 50px rgba(0, 0, 0, .7);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
}
h1 { font-size: clamp(30px, 4.2vw, 48px); letter-spacing: -.028em; }
h2 { font-size: clamp(22px, 2.6vw, 30px); }
h3 { font-size: 19px; }
h4 { font-size: 15px; font-weight: 600; }
p  { margin: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; }
img, svg { max-width: 100%; }

::selection { background: var(--tint); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap-wide { max-width: var(--content-wide); }
.wrap-narrow { max-width: 700px; }

.section { padding: clamp(36px, 6vw, 76px) 0; }
.section-tight { padding: clamp(24px, 4vw, 44px) 0; }

.stack   { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.stack-l { display: flex; flex-direction: column; gap: 28px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.spread  { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.center  { text-align: center; }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
}
.lead      { font-size: clamp(17px, 2vw, 21px); color: var(--text-2); line-height: 1.42; }
.muted     { color: var(--text-2); }
.muted-3   { color: var(--text-3); }
.small     { font-size: 14px; }
.tiny      { font-size: 12.5px; }
.num       { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.strong    { font-weight: 600; }
.nowrap    { white-space: nowrap; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-in {
  height: 100%;
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-brand {
  display: inline-flex; align-items: center; min-height: 44px; /* 觸控目標 ≥ 44pt */
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.02em;
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; opacity: .7; }
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.4vw, 26px);
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; /* 觸控目標 ≥ 44pt */
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  transition: color .2s var(--ease);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current='page'] { color: var(--text); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -.01em;
  cursor: pointer;
  text-align: center;
  transition: filter .2s var(--ease), transform .16s var(--ease), opacity .2s var(--ease);
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; filter: none; }

.btn.secondary { --btn-bg: var(--surface-2); --btn-fg: var(--text); }
.btn.outline {
  --btn-bg: transparent; --btn-fg: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.btn.quiet {
  --btn-bg: transparent; --btn-fg: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn.danger { --btn-bg: var(--red); --btn-fg: #fff; }
.btn.plain {
  --btn-bg: transparent; --btn-fg: var(--link);
  min-height: 36px; padding: 6px 8px;
}
.btn.sm { min-height: 34px; padding: 7px 15px; font-size: 14px; }
.btn.lg { min-height: 54px; padding: 15px 30px; font-size: 19px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 44px; min-height: 44px; border-radius: 50%; }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--link); font-size: 15px;
}
.linkish:hover { text-decoration: underline; }

/* ---------- Panels & lists ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: clamp(18px, 3vw, 26px);
}
.panel.flat { background: var(--surface-2); border-color: transparent; }
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.panel-head h2, .panel-head h3 { margin: 0; }

.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  overflow: hidden;
}
.list .r {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  min-height: 52px;
}
.list .r:first-child { border-top: 0; }
.list .r-head {
  background: var(--surface-2);
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-3);
  min-height: 38px; padding: 8px 16px;
}

.divider { height: 1px; background: var(--line); border: 0; margin: 22px 0; }

/* ---------- Form fields ---------- */
.field { position: relative; }
.field input, .field textarea {
  width: 100%;
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 24px 15px 8px;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field textarea { min-height: 96px; resize: vertical; padding-top: 26px; }
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--tint);
}
.field > label {
  position: absolute;
  left: 16px; top: 7px;
  font-size: 11.5px;
  color: var(--text-3);
  pointer-events: none;
  transition: all .18s var(--ease);
}
.field input:placeholder-shown:not(:focus) + label,
.field textarea:placeholder-shown:not(:focus) + label {
  top: 14px; font-size: 16px; color: var(--text-3);
}
.field .counter {
  position: absolute; right: 14px; bottom: 9px;
  font-size: 11.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.field.has-counter input { padding-right: 62px; }

.input-plain {
  width: 100%; font-size: 17px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 11px 14px; outline: none;
  min-height: 44px;
}
.input-plain:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }

.q { margin-bottom: 10px; }
.q-label { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.q-note  { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }

/* 選項卡(單選) */
.opts { display: grid; gap: 8px; }
.opts.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opts.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opts.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) {
  .opts.cols-3, .opts.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.opt {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  min-height: 52px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--text);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .16s var(--ease);
}
.opt:hover { border-color: var(--text-3); }
.opt:active { transform: scale(.985); }
.opt .t { display: block; font-size: 15.5px; font-weight: 500; letter-spacing: -.01em; }
.opt .d { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.opt[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--tint);
}
.opt[aria-pressed='true'] .t { font-weight: 600; }

/* 膠囊(多選) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 8px 15px;
  font-size: 15px; letter-spacing: -.01em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.chip:hover { border-color: var(--text-3); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed='true'] {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500;
}
.chip:disabled { opacity: .38; cursor: not-allowed; }
.chip-group-label {
  width: 100%; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); margin: 6px 0 -2px;
}

/* 分段控制 */
.segmented {
  display: flex; gap: 2px; padding: 2px;
  background: var(--surface-2); border-radius: 12px;
}
.segmented button {
  flex: 1; min-height: 38px; padding: 8px 12px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--text-2); font-size: 15px; cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.segmented button[aria-selected='true'] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: -.005em;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.badge.accent { background: var(--tint); color: var(--accent); }
.badge.pink   { background: var(--tint-pink); color: var(--pink); }
.badge.green  { background: rgba(36, 138, 61, .12); color: var(--green); }
.badge.amber  { background: rgba(163, 82, 0, .12); color: var(--amber); }
.badge.red    { background: rgba(215, 0, 21, .1); color: var(--red); }
[data-theme='dark'] .badge.green { background: rgba(48, 209, 88, .16); }
[data-theme='dark'] .badge.amber { background: rgba(255, 214, 10, .16); }
[data-theme='dark'] .badge.red   { background: rgba(255, 69, 58, .16); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Stat ---------- */
/* 分隔線用每格的 1px 外框疊出來,而不是靠容器底色,這樣格數不整齊時不會露出灰塊 */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px;
  background: var(--surface); border-radius: var(--r-m); overflow: hidden; border: 1px solid var(--line);
}
.stat { background: var(--surface); padding: 14px 16px; box-shadow: 0 0 0 1px var(--line); }
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.stat .k { font-size: 12px; color: var(--text-3); letter-spacing: .02em; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ============================================================
   Skill card
   ============================================================ */
.skill-card {
  width: min(var(--card-w), calc(100vw - 32px));
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  position: relative;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.skill-card.interactive:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

.sc-top {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px 11px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
}
.tier-ssr  .sc-top { background: linear-gradient(180deg, var(--tint), transparent 140%); }
.tier-buff .sc-top { background: linear-gradient(180deg, var(--tint-pink), transparent 140%); }

.sc-avatar {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  font-size: 21px; line-height: 1;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line-soft);
}
.sc-id { min-width: 0; flex: 1; }
.sc-name {
  font-size: 14.5px; font-weight: 600; letter-spacing: -.015em;
  line-height: 1.25; overflow-wrap: anywhere; margin: 0;
}
.sc-role { font-size: 11.5px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-tier {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  padding: 3px 7px; border-radius: 6px; flex: none;
}
.tier-ssr  .sc-tier { background: var(--tint); color: var(--accent); }
.tier-buff .sc-tier { background: var(--tint-pink); color: var(--pink); }

.sc-body { padding: 12px 14px 0; display: flex; flex-direction: column; flex: 1; container-type: inline-size; }

/* 雷達 + 資訊欄:卡片夠寬時並排,窄時上下堆疊(以卡片自身寬度判斷) */
.sc-grid { display: grid; grid-template-columns: 1fr; gap: 6px 12px; align-items: center; }
.sc-radar { margin: 0 auto; width: 100%; max-width: 176px; }
@container (min-width: 250px) {
  .sc-grid { grid-template-columns: 148px minmax(0, 1fr); }
  .sc-radar { max-width: none; }
}
.sc-facts { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sc-fact { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 6px; font-size: 11.5px; line-height: 1.4; }
.sc-fact b { color: var(--text-3); font-weight: 600; letter-spacing: .02em; }
.sc-fact span { color: var(--text); overflow-wrap: anywhere; }
.sc-fact i { font-style: normal; color: var(--text-3); margin: 0 4px; }
.sc-fact em { font-style: normal; color: var(--text-3); margin-left: 4px; }

.sc-intro {
  font-size: 13px; color: var(--text); line-height: 1.45;
  margin: 10px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sc-power {
  font-size: 11.5px; color: var(--text-2); margin: 6px 0 0;
  display: flex; gap: 6px; align-items: flex-start;
}
.sc-power b { color: var(--text-3); font-weight: 600; flex: none; }
.sc-power span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 自由介紹(Markdown):卡面上裁到約 8 行並淡出,詳情面板(.full)完整顯示 */
.sc-bio {
  margin: 10px 0 0; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px; line-height: 1.5; color: var(--text-2);
  max-height: 11.5em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 72%, transparent);
  mask-image: linear-gradient(#000 72%, transparent);
}
@container (max-width: 300px) {
  .sc-grid { grid-template-columns: 1fr; gap: 8px; }
  .sc-radar { width: min(100%, 178px); }
  .sc-facts { gap: 6px; }
  .sc-fact { grid-template-columns: 3.5em minmax(0, 1fr); font-size: 12px; line-height: 1.45; }
}
.skill-card.full .sc-bio { max-height: none; -webkit-mask-image: none; mask-image: none; }
.skill-card.full .sc-intro { -webkit-line-clamp: unset; display: block; }
.skill-card.full .sc-power span { white-space: normal; }

/* Markdown 輸出的通用樣式 */
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 .55em; }
.md h4 { font-size: 1.05em; font-weight: 600; color: var(--text); margin: .7em 0 .3em; letter-spacing: -.01em; }
.md ul, .md ol { margin: 0 0 .55em; padding-left: 1.3em; }
.md li { margin: .12em 0; }
.md li::marker { color: var(--text-3); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: .7em 0; }
.md strong { color: var(--text); font-weight: 600; }
.md code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .92em; padding: .1em .38em; border-radius: 5px;
  background: var(--surface-2); color: var(--text);
}
.md a { color: var(--link); }

.sc-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px 12px;
  min-height: 44px;
}
.sc-status { font-size: 12px; color: var(--text-3); }
.sc-price {
  font-size: 15px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.sc-real {
  font-size: 13px; font-weight: 600;
  padding: 2px 9px; border-radius: var(--r-xs);
  background: var(--tint); color: var(--accent);
}

.skill-card.sold::after {
  content: 'SOLD';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700; letter-spacing: .3em; text-indent: .3em;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(2px);
}

/* 卡片尺寸變體 */
.cards { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.cards.center { justify-content: center; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  align-items: stretch;
}
.cards-grid .skill-card { width: 100%; }
.card-sm { --card-w: 236px; }
.card-lg { --card-w: 340px; }

/* 翻面(揭曉) */
.flip { perspective: 1200px; width: var(--card-w); flex: none; }
.flip-in { position: relative; transition: transform .8s var(--ease); transform-style: preserve-3d; }
.flip.flipped .flip-in { transform: rotateY(180deg); }
.flip .skill-card { backface-visibility: hidden; width: 100%; }
.flip-back {
  position: absolute; inset: 0;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid; place-items: center; text-align: center; padding: 18px;
}

/* ---------- Countdown ---------- */
.countdown { position: relative; width: 148px; height: 148px; margin: 0 auto; }
.countdown svg { transform: rotate(-90deg); display: block; }
.countdown .cd-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 46px; font-weight: 600; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.countdown.urgent .cd-num { color: var(--red); }

.cd-bar { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.cd-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s linear; }
.cd-bar.urgent i { background: var(--red); }

/* ---------- Progress ---------- */
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .35s var(--ease); }

/* ---------- Toast ---------- */
#toasts {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; padding: 0 12px; width: max-content; max-width: 100%;
}
.toast {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line-soft);
  color: var(--text);
  border-radius: var(--r-pill);
  padding: 10px 20px;
  font-size: 15px;
  box-shadow: var(--shadow-3);
  max-width: min(92vw, 520px);
  text-align: center;
  animation: toast-in .28s var(--ease);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.toast.gold { color: var(--accent); font-weight: 500; }
.toast.err  { color: var(--red); font-weight: 500; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }

/* ---------- 連線狀態 ---------- */
.conn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3); white-space: nowrap;
}
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; transition: background .3s; }
.conn.ok i { background: var(--green); }
.conn.down i { background: var(--red); }
.conn-float {
  position: fixed; top: 10px; right: 12px; z-index: 70;
  background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line-soft); border-radius: var(--r-pill);
  padding: 5px 12px;
}

/* ---------- Sticky action bar ---------- */
.actionbar {
  position: sticky; bottom: 0; z-index: 50;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line-soft);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  margin-top: 28px;
}
.actionbar-in {
  max-width: var(--content); margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}

/* ---------- Sheet(手機用底部面板) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(3px);
  animation: fade-in .25s var(--ease);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  background: var(--bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 12px var(--gutter) calc(24px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-3);
  animation: sheet-up .34s var(--ease);
}
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
/* 卡片詳情面板:手機貼底、桌機置中成一張大卡 */
.sheet.card-sheet { width: min(100%, 600px); margin: 0 auto; }
.card-sheet-holder { display: flex; justify-content: center; }
.card-sheet-holder .skill-card { --card-w: 100%; width: 100%; max-width: 560px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in  { from { opacity: 0; } }

/* ---------- 事件動態 ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.feed li {
  font-size: 13.5px; color: var(--text-2);
  padding: 6px 0; border-top: 1px solid var(--line-soft);
  display: flex; gap: 8px; align-items: baseline;
  animation: feed-in .4s var(--ease);
}
.feed li:first-child { border-top: 0; color: var(--text); }
.feed li time { font-size: 11.5px; color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- 隊伍列 ---------- */
.team-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) minmax(0, 1.4fr) auto auto;
  align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.team-row + .team-row { margin-top: 6px; }
.team-row.active { border-color: var(--accent); background: var(--tint); }
.team-row .t-label { font-size: 14px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.team-row .t-captain { font-size: 12px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .t-members { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .t-count { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.team-row .t-budget { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 700px) {
  .team-row { grid-template-columns: auto 1fr auto; }
  .team-row .t-captain { grid-column: 1 / -1; grid-row: 2; }
  .team-row .t-members { grid-column: 1 / 3; grid-row: 3; }
  .team-row .t-count { grid-column: 3; grid-row: 3; }
  .team-row .t-budget { grid-column: 3; grid-row: 4; }
}

/* ---------- 盲盒 ---------- */
.blindbox {
  width: clamp(120px, 22vw, 168px);
  aspect-ratio: 1;
  margin: 22px auto;
  border-radius: 30px;
  display: grid; place-items: center;
  font-size: clamp(48px, 9vw, 68px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.blindbox.shaking { animation: box-shake 1.6s var(--ease) infinite; }
@keyframes box-shake {
  0%, 62%, 100% { transform: rotate(0) scale(1); }
  68% { transform: rotate(-5deg) scale(1.04); }
  74% { transform: rotate(5deg) scale(1.04); }
  80% { transform: rotate(-4deg) scale(1.03); }
  86% { transform: rotate(3deg) scale(1.02); }
}
.pop-in { animation: pop-in .5s var(--ease) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.9) translateY(10px); } }
.fade-up { animation: fade-up .55s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }

/* ---------- 空狀態 ---------- */
.empty {
  text-align: center; padding: clamp(32px, 7vw, 72px) 20px; color: var(--text-2);
}
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- 表格式清單 ----------
   以「列表本身的寬度」(container query)決定要不要堆疊,而不是看 viewport,
   這樣放在半欄面板裡的列表也會在正確的時機收合。頁面可用 .dt .xxx-row 覆寫成更緊湊的版面。 */
.dt { width: 100%; container-type: inline-size; }
.dt-head, .dt-row {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-top: 1px solid var(--line-soft);
}
.dt-head {
  border-top: 0;
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-3);
  background: var(--surface-2);
}
.dt-row:hover { background: var(--surface-2); }
.dt-cell-label { display: none; font-size: 11.5px; color: var(--text-3); }
@container (max-width: 720px) {
  .dt .dt-head { display: none; }
  .dt .dt-row { grid-template-columns: 1fr; gap: 4px; padding: 14px; }
  .dt .dt-row > * { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
  .dt .dt-cell-label { display: block; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  :root { --surface: #fff; --bg: #fff; --text: #000; --text-2: #444; --line: #bbb; }
  .nav, .actionbar, .conn, .conn-float, #toasts, .no-print { display: none !important; }
  body { background: #fff; }
  .skill-card { break-inside: avoid; box-shadow: none; }
}
