/* ==========================================================================
   Endo — 元件層
   --------------------------------------------------------------------------
   命名：.e-<元件>、.e-<元件>__<部件>、.e-<元件>--<變體>
   前綴 e- 是為了貼進既有專案不會撞名。
   這裡面沒有任何寫死的顏色或尺寸，全部走 tokens.css 的變數。
   ========================================================================== */


/* ==========================================================================
   1. 頁首
   ========================================================================== */

.e-header {
  background: var(--e-brand-900);
  color: var(--e-on-dark);
}
.e-header__inner {
  display: flex;
  align-items: center;
  gap: var(--e-sp-13);
  height: 84px;
}

.e-logo { display: flex; align-items: center; gap: var(--e-sp-5); text-decoration: none; flex-shrink: 0; }
.e-logo:hover { text-decoration: none; }
.e-logo__mark { width: 36px; height: 36px; flex-shrink: 0; }
.e-logo__text { display: flex; flex-direction: column; gap: 1px; }
.e-logo__name {
  font-family: var(--e-font-num);
  font-weight: 800;
  font-style: italic;
  font-size: 25px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--e-on-dark);
}
.e-logo__sub {
  font-family: var(--e-font-body);
  font-size: var(--e-fs-xs);
  letter-spacing: 0.22em;
  line-height: 1;
  color: #bcc9a0;
}

.e-nav { display: flex; align-items: center; gap: var(--e-sp-10); flex-grow: 1; }
.e-nav a {
  font-family: var(--e-font-title);
  font-size: var(--e-fs-xl);
  color: var(--e-on-dark);
}
.e-nav a:hover { color: var(--e-brand-300); text-decoration: none; }
.e-nav a[aria-current] { color: var(--e-brand-300); }

/* 登入後的頭像選單 */
.e-avatar-menu {
  display: inline-flex;
  align-items: center;
  gap: var(--e-sp-4);
  height: 44px;
  padding: 0 var(--e-sp-6) 0 var(--e-sp-2);
  border: 1px solid var(--e-on-dark-line);
  border-radius: var(--e-r-pill);
  text-decoration: none;
}
.e-avatar-menu:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.e-avatar-menu__name { font-family: var(--e-font-title); font-size: var(--e-fs-lg); color: var(--e-on-dark); }

.e-avatar {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: var(--e-r-pill);
  background: var(--e-brand-500);
  color: var(--e-brand-900);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--e-font-title);
  font-size: var(--e-fs-lg);
  object-fit: cover;
}
.e-avatar--lg { width: 46px; height: 46px; font-size: var(--e-fs-3xl); background: var(--e-brand-100); color: var(--e-brand-700); }
.e-avatar--xl { width: 88px; height: 88px; font-size: 34px; background: var(--e-brand-100); color: var(--e-brand-700); }

@media (max-width: 900px) {
  .e-header__inner { height: 60px; gap: var(--e-sp-5); }
  .e-logo__mark { width: 30px; height: 30px; }
  .e-logo__name { font-size: 21px; }
  .e-logo__sub { font-size: 9px; }
  .e-nav { display: none; }            /* 手機改用漢堡選單 */
  .e-avatar-menu__name { display: none; }
  .e-avatar-menu { padding: 0; border: 0; }
}


/* ==========================================================================
   2. 頁尾
   ========================================================================== */

.e-footer {
  margin-top: auto;
  background: var(--e-brand-900);
  color: var(--e-on-dark-muted);
}
.e-footer__inner {
  display: flex;
  align-items: center;
  gap: var(--e-sp-10);
  min-height: 88px;
  padding-block: var(--e-sp-8);
}
.e-footer a { color: var(--e-on-dark-muted); font-size: var(--e-fs-md); }
.e-footer a:hover { color: var(--e-on-dark); }
.e-footer__copy {
  flex-grow: 1;
  font-family: var(--e-font-num);
  font-size: var(--e-fs-base);
  color: var(--e-on-dark-faint);
}

@media (max-width: 900px) {
  .e-footer__inner { flex-direction: column; align-items: flex-start; gap: var(--e-sp-4); }
  .e-footer__links { display: flex; gap: var(--e-sp-8); }
}


/* ==========================================================================
   3. 按鈕
   --------------------------------------------------------------------------
   橘色的 --primary 只給「這一頁唯一最重要的動作」。
   列表頁上八顆一樣的報名鈕請用 --brand。
   ========================================================================== */

.e-btn {
  --btn-h: var(--e-h-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--e-sp-3);
  height: var(--btn-h);
  padding-inline: var(--e-sp-9);
  border: 1px solid transparent;
  border-radius: var(--e-r-lg);
  background: transparent;
  font-family: var(--e-font-title);
  font-size: var(--e-fs-xl);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--e-dur) var(--e-ease), border-color var(--e-dur) var(--e-ease);
}
.e-btn:hover { text-decoration: none; }
.e-btn:disabled,
.e-btn[aria-disabled="true"] {
  cursor: not-allowed;
  background: var(--e-n-200);
  border-color: transparent;
  color: var(--e-text-disabled);
}

/* 主要：陶土橘。文字一定是深墨色，配白字對比不足。 */
.e-btn--primary {
  background: var(--e-accent);
  color: var(--e-on-accent);
  font-size: var(--e-fs-2xl);
  --btn-h: var(--e-h-control-lg);
}
.e-btn--primary:hover  { background: var(--e-accent-hover); color: var(--e-on-accent); }
.e-btn--primary:active { background: var(--e-accent-active); color: var(--e-n-0); }

/* 品牌綠：重複出現的同級動作 */
.e-btn--brand { background: var(--e-brand-700); color: var(--e-n-0); }
.e-btn--brand:hover { background: var(--e-brand-800); color: var(--e-n-0); }

/* 次要：白底外框 */
.e-btn--outline {
  background: var(--e-surface);
  border-color: var(--e-border-strong);
  color: var(--e-text);
  font-family: var(--e-font-body);
}
.e-btn--outline:hover { background: var(--e-n-50); color: var(--e-text); }

/* 幽靈：淺綠底，用在卡片內的次要動作 */
.e-btn--ghost {
  background: var(--e-brand-50);
  border-color: var(--e-border-strong);
  color: var(--e-text);
  font-family: var(--e-font-body);
}
.e-btn--ghost:hover { background: var(--e-brand-100); color: var(--e-text); }

/* 危險：只給不可復原的動作，按鈕文字要寫出真正會發生的事 */
.e-btn--danger { background: var(--e-danger-solid); color: var(--e-on-danger); }
.e-btn--danger:hover { background: var(--e-danger-solid-hover); color: var(--e-on-danger); }

/* 純文字連結鈕 */
.e-btn--link {
  height: auto;
  padding: var(--e-sp-3) var(--e-sp-4);
  color: var(--e-link);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-lg);
}
.e-btn--link:hover { color: var(--e-link-hover); text-decoration: underline; }

/* 尺寸 */
.e-btn--sm { --btn-h: var(--e-h-control-sm); padding-inline: var(--e-sp-7); font-size: var(--e-fs-md); }
.e-btn--lg { --btn-h: var(--e-h-control-lg); font-size: var(--e-fs-2xl); }
.e-btn--block { display: flex; width: 100%; }

/* 純圖示鈕：一定要給 aria-label */
.e-btn-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--e-r-pill);
  color: inherit;
  transition: background var(--e-dur) var(--e-ease);
}
.e-btn-icon:hover { background: rgba(43, 33, 24, 0.06); }
.e-btn-icon--outline { border-color: currentColor; }


/* ==========================================================================
   4. 徽章、標籤、計數
   ========================================================================== */

.e-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--e-sp-2);
  height: 24px;
  padding-inline: var(--e-sp-4);
  border-radius: var(--e-r-pill);
  background: var(--e-n-100);
  color: var(--e-text-muted);
  font-family: var(--e-font-title);
  font-size: var(--e-fs-sm);
  line-height: 1;
  white-space: nowrap;
}

/* 運動分類標籤。加 .e-tag--outlined 會多一圈外框（淺底疊淺底時用）。 */
.e-tag--tri   { background: var(--e-sport-tri-bg);   color: var(--e-sport-tri-fg); }
.e-tag--run   { background: var(--e-sport-run-bg);   color: var(--e-sport-run-fg); }
.e-tag--bike  { background: var(--e-sport-bike-bg);  color: var(--e-sport-bike-fg); }
.e-tag--trail { background: var(--e-sport-trail-bg); color: var(--e-sport-trail-fg); }
.e-tag--swim  { background: var(--e-sport-swim-bg);  color: var(--e-sport-swim-fg); }

.e-tag--outlined { border: 1px solid currentColor; }

/* 報名狀態。顏色之外一定要有文字，不可以只靠顏色表達狀態。 */
.e-status {
  display: inline-flex;
  align-items: center;
  gap: var(--e-sp-2);
  height: 28px;
  padding-inline: var(--e-sp-5);
  border-radius: var(--e-r-pill);
  font-family: var(--e-font-title);
  font-size: var(--e-fs-base);
  line-height: 1;
  white-space: nowrap;
}
.e-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.e-status--open   { background: var(--e-success-bg); color: var(--e-success-fg); }  /* 報名中 */
.e-status--wait   { background: var(--e-info-bg);    color: var(--e-info-fg); }     /* 尚未開放 */
.e-status--soon   { background: var(--e-warning-bg); color: var(--e-warning-fg); }  /* 即將截止 */
.e-status--closed { background: var(--e-n-100);      color: var(--e-text-faint); }  /* 已截止 */
.e-status--full   { background: var(--e-danger-bg);  color: var(--e-danger-fg); }   /* 已額滿 */
.e-status--due    { background: var(--e-warning-bg); color: var(--e-warning-fg); }  /* 待繳費 */
.e-status--paid   { background: var(--e-success-bg); color: var(--e-success-fg); }  /* 已完成 */

/* 倒數：帶時鐘圖示，用強調色但不是實心底 */
.e-countdown {
  display: inline-flex;
  align-items: center;
  gap: var(--e-sp-2);
  height: 28px;
  padding-inline: var(--e-sp-5);
  border-radius: var(--e-r-pill);
  background: var(--e-danger-bg);
  color: var(--e-danger-fg);
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: var(--e-fs-base);
}

/* 側欄與頁籤上的計數 */
.e-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding-inline: var(--e-sp-2);
  border-radius: var(--e-r-pill);
  background: var(--e-n-100);
  color: var(--e-text-muted);
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: var(--e-fs-sm);
  line-height: 1;
}
.e-count--active { background: var(--e-success-bg); color: var(--e-success-fg); }


/* ==========================================================================
   5. 表單
   ========================================================================== */

.e-field { display: flex; flex-direction: column; gap: var(--e-sp-2); }

.e-label {
  font-family: var(--e-font-body);
  font-size: var(--e-fs-base);
  color: var(--e-text-muted);
}
.e-label__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--e-sp-5); }
.e-label__req { color: var(--e-danger-fg); }

.e-input,
.e-select,
.e-textarea {
  width: 100%;
  height: var(--e-h-control);
  padding-inline: var(--e-sp-6);
  background: var(--e-surface-field);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-md);
  font-family: var(--e-font-mixed);
  font-size: var(--e-fs-lg);
  color: var(--e-text);
  transition: border-color var(--e-dur) var(--e-ease), box-shadow var(--e-dur) var(--e-ease);
}
.e-textarea { height: auto; min-height: 120px; padding-block: var(--e-sp-5); line-height: var(--e-lh-body); resize: vertical; }
.e-select { padding-inline: var(--e-sp-5); }

.e-input::placeholder,
.e-textarea::placeholder { color: var(--e-text-disabled); }

.e-input:focus,
.e-select:focus,
.e-textarea:focus {
  outline: none;
  border-color: var(--e-brand-700);
  box-shadow: var(--e-focus-ring);
}

.e-input[readonly],
.e-input:disabled,
.e-select:disabled {
  background: var(--e-surface-sunken);
  color: var(--e-text-muted);
  cursor: not-allowed;
}

/* 錯誤：紅框之外一定要有文字訊息，不可以只把框變紅 */
.e-input[aria-invalid="true"],
.e-select[aria-invalid="true"] { border-color: var(--e-danger-fg); }

.e-hint  { font-family: var(--e-font-body); font-size: var(--e-fs-sm); line-height: var(--e-lh-snug); color: var(--e-text-faint); }
.e-error {
  display: flex; align-items: flex-start; gap: var(--e-sp-2);
  font-family: var(--e-font-body); font-size: var(--e-fs-base); line-height: var(--e-lh-snug);
  color: var(--e-danger-fg);
}

/* 密碼欄：右邊塞一顆顯示／隱藏 */
.e-field--password { position: relative; }
.e-field--password .e-input { padding-right: 48px; }
.e-field__toggle {
  position: absolute;
  right: var(--e-sp-3);
  bottom: 7px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--e-r-sm);
  color: var(--e-text-faint);
}
.e-field__toggle:hover { background: rgba(43, 33, 24, 0.06); color: var(--e-text-muted); }

/* 核取方塊與單選 */
.e-check { display: flex; align-items: flex-start; gap: var(--e-sp-4); }
.e-check input {
  width: 18px; height: 18px;
  margin: 3px 0 0;
  flex-shrink: 0;
  accent-color: var(--e-brand-700);
}
.e-check label {
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  line-height: var(--e-lh-snug);
  color: var(--e-text-secondary);
}

/* 密碼強度條 */
.e-strength { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-strength__bars { display: flex; gap: var(--e-sp-2); }
.e-strength__bars span { flex-grow: 1; height: 5px; border-radius: 3px; background: var(--e-n-200); }
.e-strength[data-level="1"] .e-strength__bars span:nth-child(-n+1),
.e-strength[data-level="2"] .e-strength__bars span:nth-child(-n+2) { background: var(--e-danger-fg); }
.e-strength[data-level="3"] .e-strength__bars span:nth-child(-n+3) { background: var(--e-warning-fg); }
.e-strength[data-level="4"] .e-strength__bars span { background: var(--e-brand-500); }

/* 規則即時打勾 */
.e-rules { display: flex; flex-wrap: wrap; gap: var(--e-sp-3) var(--e-sp-8); }
.e-rule {
  display: inline-flex; align-items: center; gap: var(--e-sp-2);
  font-family: var(--e-font-body); font-size: var(--e-fs-base);
  color: var(--e-text-faint);
}
.e-rule--ok { color: var(--e-text-secondary); }
.e-rule__dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--e-text-disabled); flex-shrink: 0; }

/* 驗證碼：六格。用 input 而不是一個框裡擠六個字，
   貼上時靠 JS 把整串分配到各格（見 README 的 code-input 片段）。 */
.e-code { display: flex; justify-content: center; gap: var(--e-sp-5); }
.e-code input {
  width: 68px; height: 79px;
  padding: 0;
  text-align: center;
  background: var(--e-brand-50);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-lg);
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: 29px;
  color: var(--e-text);
}
.e-code input:not(:placeholder-shown) { background: var(--e-surface); }
.e-code input:focus {
  outline: none;
  background: var(--e-surface);
  border: 2px solid var(--e-brand-700);
  box-shadow: var(--e-focus-ring);
}
.e-code--sm input { width: 52px; height: 60px; font-size: 22px; }

@media (max-width: 900px) {
  .e-code { gap: var(--e-sp-3); }
  .e-code input { width: 44px; height: 51px; font-size: 18px; }
}

/* 表單底部的動作列 */
.e-form-actions { display: flex; align-items: center; gap: var(--e-sp-5); padding-top: var(--e-sp-1); }

/* 分隔線（「或使用 Email 註冊」） */
.e-divider { display: flex; align-items: center; gap: var(--e-sp-6); }
.e-divider::before,
.e-divider::after { content: ""; flex-grow: 1; height: 1px; background: var(--e-border); }
.e-divider span { font-family: var(--e-font-body); font-size: var(--e-fs-base); color: var(--e-text-faint); }


/* ==========================================================================
   6. 開關
   --------------------------------------------------------------------------
   三種狀態要分清楚：
   · 開／關      — 可以點
   · 跟隨預設    — 由 custom 旗標決定，做成不可點的靜態樣式
   · 這場不適用  — 由賽事資料決定（無早鳥、已開放報名），反灰並在旁邊標原因
   ========================================================================== */

.e-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--e-sp-4);
  cursor: pointer;
}
.e-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.e-switch__track {
  position: relative;
  width: 46px; height: 26px;
  flex-shrink: 0;
  border-radius: var(--e-r-pill);
  background: #c3b49c;
  transition: background var(--e-dur) var(--e-ease);
}
.e-switch__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--e-n-0);
  box-shadow: 0 1px 3px rgba(43, 33, 24, 0.25);
  transition: transform var(--e-dur) var(--e-ease);
}
.e-switch input:checked + .e-switch__track { background: var(--e-brand-700); }
.e-switch input:checked + .e-switch__track::after { transform: translateX(20px); }
.e-switch input:focus-visible + .e-switch__track { box-shadow: var(--e-focus-ring); }

/* 跟隨預設：看得到目前生效的值，但不能在這裡改 */
.e-switch--inherited { cursor: default; }
.e-switch--inherited .e-switch__track { background: #ded2bf; }
.e-switch--inherited input:checked + .e-switch__track { background: var(--e-brand-400); }

/* 這場不適用 */
.e-switch--na { cursor: not-allowed; opacity: 1; }
.e-switch--na .e-switch__track { background: var(--e-n-200); }
.e-switch--na .e-switch__track::after { background: #f7f2e8; box-shadow: none; }

.e-switch__label { font-family: var(--e-font-body); font-size: var(--e-fs-md); color: var(--e-text-secondary); }
.e-switch__why  { font-family: var(--e-font-body); font-size: var(--e-fs-sm); color: var(--e-text-faint); }


/* ==========================================================================
   7. 卡片
   ========================================================================== */

.e-card {
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-2xl);
  padding: var(--e-sp-9);
}
.e-card--tight { padding: var(--e-sp-8); border-radius: var(--e-r-xl); }
.e-card--flush { padding: 0; overflow: hidden; }

/* 整張卡可點 */
.e-card--link { display: block; text-decoration: none; color: inherit; transition: border-color var(--e-dur) var(--e-ease), box-shadow var(--e-dur) var(--e-ease); }
.e-card--link:hover { border-color: var(--e-border-strong); box-shadow: var(--e-shadow-raised); text-decoration: none; color: inherit; }

.e-card__head { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-card__title { font-family: var(--e-font-title); font-size: var(--e-fs-h4); line-height: var(--e-lh-title); color: var(--e-text); }
.e-card__desc  { font-family: var(--e-font-body); font-size: var(--e-fs-md); line-height: var(--e-lh-snug); color: var(--e-text-muted); }
.e-card__divider { height: 1px; background: var(--e-border-subtle); }


/* ==========================================================================
   8. 賽事：日期方塊、名額進度、卡片、列表列
   ========================================================================== */

/* 日期方塊，底色跟著運動分類走 */
.e-datebox {
  width: 72px;
  flex-shrink: 0;
  padding: var(--e-sp-4) 0;
  border-radius: var(--e-r-lg);
  text-align: center;
  background: var(--e-n-100);
  color: var(--e-text-muted);
}
.e-datebox__day   { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-h3); line-height: 1.1; }
.e-datebox__month { font-family: var(--e-font-num); font-size: var(--e-fs-sm); letter-spacing: 0.08em; }
.e-datebox--tri   { background: var(--e-sport-tri-bg);   color: var(--e-sport-tri-fg); }
.e-datebox--run   { background: var(--e-sport-run-bg);   color: var(--e-sport-run-fg); }
.e-datebox--bike  { background: var(--e-sport-bike-bg);  color: var(--e-sport-bike-fg); }
.e-datebox--trail { background: var(--e-sport-trail-bg); color: var(--e-sport-trail-fg); }
.e-datebox--swim  { background: var(--e-sport-swim-bg);  color: var(--e-sport-swim-fg); }

/* 名額進度。--pct 用行內樣式帶進來。
   進度條本身不承載資訊，底下那行文字才是；只看得到條的人也要看得懂。 */
.e-quota { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-quota__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--e-n-200);
  overflow: hidden;
}
.e-quota__fill {
  height: 100%;
  width: var(--pct, 0%);
  border-radius: 3px;
  background: var(--e-brand-500);
  transition: width var(--e-dur) var(--e-ease);
}
.e-quota--warn .e-quota__fill { background: var(--e-warning-fg); }
.e-quota--full .e-quota__fill { background: var(--e-danger-fg); }
.e-quota__text { font-family: var(--e-font-mixed); font-size: var(--e-fs-sm); color: var(--e-text-faint); }

/* 賽事卡：首頁與分類頁用的直式卡 */
.e-race-card {
  display: flex;
  flex-direction: column;
  gap: var(--e-sp-6);
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
  text-decoration: none;
  color: inherit;
}
.e-race-card:hover { border-color: var(--e-border-strong); box-shadow: var(--e-shadow-raised); text-decoration: none; color: inherit; }
.e-race-card__name {
  font-family: var(--e-font-title);
  font-size: var(--e-fs-3xl);
  line-height: var(--e-lh-title);
  color: var(--e-text);
}
.e-race-card__meta {
  display: flex; flex-direction: column; gap: var(--e-sp-2);
  font-family: var(--e-font-mixed);
  font-size: var(--e-fs-md);
  color: var(--e-text-muted);
}

/* 賽事列：搜尋結果用的橫式列 */
.e-race-row {
  display: flex;
  align-items: center;
  gap: var(--e-sp-8);
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-race-row__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-3); }
.e-race-row__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); line-height: var(--e-lh-title); }
.e-race-row__name a { color: var(--e-text); }
.e-race-row__side { width: 180px; flex-shrink: 0; display: flex; flex-direction: column; gap: var(--e-sp-4); }

@media (max-width: 900px) {
  .e-race-row { flex-direction: column; align-items: stretch; gap: var(--e-sp-5); }
  .e-race-row__side { width: auto; }
}

/* 組別卡（手機版的組別與費用表） */
.e-group-card {
  display: flex; flex-direction: column; gap: var(--e-sp-5);
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-group-card__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--e-sp-5); }
.e-group-card__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-group-card__price { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-xl); }
.e-group-card__specs { display: flex; flex-wrap: wrap; gap: var(--e-sp-3) var(--e-sp-7); font-size: var(--e-fs-base); color: var(--e-text-muted); }


/* ==========================================================================
   9. 表格
   --------------------------------------------------------------------------
   桌機用表格，手機一律換成上面的 .e-group-card。
   不要讓表格橫捲，橫捲的表格沒人看。
   ========================================================================== */

.e-table { font-size: var(--e-fs-md); }
.e-table th {
  padding: var(--e-sp-5) var(--e-sp-6);
  text-align: left;
  border-bottom: 1px solid var(--e-border);
  font-family: var(--e-font-title);
  font-size: var(--e-fs-base);
  color: var(--e-text-muted);
  white-space: nowrap;
}
.e-table td {
  padding: var(--e-sp-6);
  border-bottom: 1px solid var(--e-border-subtle);
  vertical-align: middle;
}
.e-table tbody tr:last-child td { border-bottom: 0; }
.e-table__num { font-family: var(--e-font-num); font-weight: 600; text-align: right; white-space: nowrap; }

/* 窄螢幕把表格拆成一列一張。每個 td 的內容要先包一層 .e-cell，
   否則儲存格裡有兩個以上的元素時，space-between 會把它們拆到左右兩端。 */
@media (max-width: 900px) {
  .e-table--stack thead { display: none; }
  .e-table--stack tr {
    display: block;
    padding: var(--e-sp-7) var(--e-sp-8);
    border-bottom: 1px solid var(--e-border);
  }
  .e-table--stack tr:last-child { border-bottom: 0; }
  .e-table--stack td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--e-sp-7);
    padding: var(--e-sp-2) 0;
    border: 0;
  }
  .e-table--stack td::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: var(--e-text-faint);
    font-size: var(--e-fs-base);
  }
  .e-table--stack td:not([data-label])::before { display: none; }
  .e-table--stack .e-cell {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end;
    gap: var(--e-sp-1) var(--e-sp-3);
    min-width: 0;
    text-align: right;
  }
  /* 第一格是賽事名稱，整寬靠左，當成這一列的標題 */
  .e-table--stack td.e-td--title { padding-bottom: var(--e-sp-5); }
  .e-table--stack td.e-td--title .e-cell { justify-content: flex-start; text-align: left; flex-grow: 1; }
  /* 沒有標籤的儲存格（動作鈕）靠右 */
  .e-table--stack td:not([data-label]) { justify-content: flex-end; padding-top: var(--e-sp-5); }
}


/* ==========================================================================
   10. 會員中心：側欄與頁籤
   ========================================================================== */

.e-member { display: flex; gap: var(--e-sp-14); align-items: flex-start; }
.e-member__side { width: var(--e-sidebar); flex-shrink: 0; display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-member__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-9); }

.e-sidenav-card {
  display: flex; align-items: center; gap: var(--e-sp-5);
  padding: var(--e-sp-8) var(--e-sp-7);
  margin-bottom: var(--e-sp-4);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-sidenav-card__text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.e-sidenav-card__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-sidenav-card__mail { font-family: var(--e-font-num); font-size: var(--e-fs-sm); color: var(--e-text-faint); }

.e-sidenav a {
  display: flex; align-items: center; gap: var(--e-sp-5);
  height: var(--e-h-control);
  padding-inline: var(--e-sp-6);
  border-radius: var(--e-r-md);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-lg);
  color: var(--e-text-secondary);
}
.e-sidenav a:hover { background: var(--e-n-50); text-decoration: none; }
.e-sidenav a[aria-current] {
  background: var(--e-brand-100);
  color: var(--e-text);
  font-family: var(--e-font-title);
}
.e-sidenav a span:first-of-type { flex-grow: 1; }
.e-sidenav__rule { height: 1px; background: var(--e-border); margin-block: var(--e-sp-4); }

/* 頁籤 */
.e-tabs { display: flex; align-items: center; border-bottom: 1px solid var(--e-border); overflow-x: auto; }
.e-tabs a {
  display: inline-flex; align-items: center; gap: var(--e-sp-3);
  height: 46px;
  padding-inline: var(--e-sp-1);
  margin-right: var(--e-sp-10);
  border-bottom: 3px solid transparent;
  font-family: var(--e-font-body);
  font-size: var(--e-fs-xl);
  color: var(--e-text-muted);
  white-space: nowrap;
}
.e-tabs a:hover { color: var(--e-text); text-decoration: none; }
.e-tabs a[aria-current] {
  border-bottom-color: var(--e-brand-500);
  color: var(--e-text);
  font-family: var(--e-font-title);
}

@media (max-width: 900px) {
  /* 直排時要改回 stretch：flex-start 會讓內容用 max-content 寬度把版面撐爆 */
  .e-member { flex-direction: column; align-items: stretch; gap: var(--e-sp-8); }
  .e-member__side { width: 100%; }
}


/* ==========================================================================
   11. 對話框
   --------------------------------------------------------------------------
   全站的警示、確認、提示都走這一個元件。
   用原生 <dialog> 就能免費拿到 focus trap、Esc 關閉與 ::backdrop。
   四種語意只換圖示底色與圖示色，不換整張卡的顏色。
   什麼時候不要用它：欄位錯誤寫在欄位底下；儲存成功用角落 toast；
   需要捲動的長內容是頁面或抽屜；永遠不要疊兩層。
   ========================================================================== */

.e-dialog {
  width: min(440px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  padding: var(--e-sp-11);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-3xl);
  background: var(--e-surface);
  color: var(--e-text);
  box-shadow: var(--e-shadow-dialog);
}
.e-dialog::backdrop { background: var(--e-overlay); }
.e-dialog__inner { display: flex; flex-direction: column; gap: var(--e-sp-8); }

.e-dialog__close {
  position: absolute;
  top: var(--e-sp-9); right: var(--e-sp-9);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--e-r-sm);
  color: var(--e-text-faint);
}
.e-dialog__close:hover { background: var(--e-n-50); color: var(--e-text-muted); }

.e-dialog__icon {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.e-dialog--info    .e-dialog__icon { background: var(--e-info-bg);    color: var(--e-info-fg); }
.e-dialog--success .e-dialog__icon { background: var(--e-success-bg); color: var(--e-success-fg); }
.e-dialog--warning .e-dialog__icon { background: var(--e-warning-bg); color: var(--e-warning-fg); }
.e-dialog--danger  .e-dialog__icon { background: var(--e-danger-bg);  color: var(--e-danger-fg); }

.e-dialog__title { font-family: var(--e-font-display); font-size: var(--e-fs-h3); line-height: var(--e-lh-title); }
.e-dialog__text  { font-family: var(--e-font-body); font-size: var(--e-fs-lg); line-height: var(--e-lh-loose); color: var(--e-text-secondary); }
.e-dialog__note  { font-family: var(--e-font-body); font-size: var(--e-fs-sm); line-height: var(--e-lh-snug); color: var(--e-text-faint); }

/* 按鈕等寬並排，取消永遠在左邊 */
.e-dialog__actions { display: flex; gap: var(--e-sp-5); }
.e-dialog__actions > .e-btn { flex-grow: 1; flex-basis: 0; --btn-h: 50px; font-size: var(--e-fs-xl); }

/* 不用原生 <dialog> 的話，自己疊遮罩 */
.e-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--e-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--e-sp-8);
}


/* ==========================================================================
   12. 提示框
   ========================================================================== */

.e-notice {
  display: flex;
  gap: var(--e-sp-5);
  padding: var(--e-sp-7) var(--e-sp-8);
  border: 1px solid;
  border-radius: var(--e-r-xl);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  line-height: var(--e-lh-body);
}
.e-notice__icon { flex-shrink: 0; margin-top: 2px; }
.e-notice__title { font-family: var(--e-font-title); font-size: var(--e-fs-lg); }
.e-notice--info    { background: var(--e-info-bg);    border-color: var(--e-info-border);    color: var(--e-info-fg); }
.e-notice--success { background: var(--e-success-bg); border-color: var(--e-success-border); color: var(--e-success-fg); }
.e-notice--warning { background: var(--e-warning-bg); border-color: var(--e-warning-border); color: var(--e-warning-fg); }
.e-notice--danger  { background: var(--e-danger-bg);  border-color: var(--e-danger-border);  color: var(--e-danger-fg); }


/* ==========================================================================
   13. 手風琴（常見問題）
   ========================================================================== */

.e-accordion { background: var(--e-surface); border: 1px solid var(--e-border); border-radius: var(--e-r-xl); overflow: hidden; }
.e-accordion details + details { border-top: 1px solid var(--e-border-subtle); }
.e-accordion summary {
  display: flex; align-items: center; gap: var(--e-sp-5);
  padding: var(--e-sp-7) var(--e-sp-8);
  font-family: var(--e-font-title);
  font-size: var(--e-fs-xl);
  color: var(--e-text);
}
.e-accordion summary:hover { background: var(--e-n-50); }
.e-accordion summary::before {
  content: "";
  width: 9px; height: 9px;
  flex-shrink: 0;
  border-right: 2px solid var(--e-text-faint);
  border-bottom: 2px solid var(--e-text-faint);
  transform: rotate(-45deg);
  transition: transform var(--e-dur) var(--e-ease);
}
.e-accordion details[open] summary::before { transform: rotate(45deg); }
.e-accordion__body {
  padding: 0 var(--e-sp-8) var(--e-sp-8) calc(var(--e-sp-8) + 9px + var(--e-sp-5));
  font-family: var(--e-font-body);
  font-size: var(--e-fs-lg);
  line-height: var(--e-lh-body);
  color: var(--e-text-secondary);
}


/* ==========================================================================
   14. 頁內導覽
   ========================================================================== */

.e-anchornav {
  display: flex;
  gap: var(--e-sp-8);
  border-bottom: 1px solid var(--e-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.e-anchornav::-webkit-scrollbar { display: none; }
.e-anchornav a {
  padding: var(--e-sp-5) var(--e-sp-1);
  border-bottom: 3px solid transparent;
  font-family: var(--e-font-body);
  font-size: var(--e-fs-lg);
  color: var(--e-text-muted);
  white-space: nowrap;
}
.e-anchornav a[aria-current] { border-bottom-color: var(--e-brand-500); color: var(--e-text); font-family: var(--e-font-title); }


/* ==========================================================================
   15. 麵包屑與頁面標題
   ========================================================================== */

.e-crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--e-sp-3);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-base);
  color: var(--e-text-faint);
}
.e-crumbs__sep { color: var(--e-text-disabled); }

.e-pagehead { display: flex; flex-direction: column; gap: var(--e-sp-5); padding-top: var(--e-sp-10); }


/* ==========================================================================
   16. 空狀態
   ========================================================================== */

.e-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--e-sp-11);
  padding: var(--e-sp-13) var(--e-sp-12);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-2xl);
  text-align: center;
}
.e-empty__icon {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--e-brand-100);
  color: var(--e-brand-700);
  display: flex; align-items: center; justify-content: center;
}
.e-empty__title { font-family: var(--e-font-display); font-size: var(--e-fs-h2); line-height: var(--e-lh-title); }
.e-empty__text  { max-width: 52ch; font-family: var(--e-font-body); font-size: var(--e-fs-lg); line-height: var(--e-lh-loose); color: var(--e-text-muted); }

/* 空狀態裡的運動入口 */
.e-sport-links { display: flex; gap: var(--e-sp-7); width: 100%; flex-wrap: wrap; }
.e-sport-link {
  flex-grow: 1; flex-basis: 140px;
  display: flex; flex-direction: column; align-items: center; gap: var(--e-sp-5);
  padding: var(--e-sp-9) var(--e-sp-7);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
  text-decoration: none;
  color: inherit;
}
.e-sport-link:hover { border-color: var(--e-border-strong); box-shadow: var(--e-shadow-raised); text-decoration: none; color: inherit; }
.e-sport-link__icon {
  width: 56px; height: 56px;
  border-radius: var(--e-r-xl);
  display: flex; align-items: center; justify-content: center;
}
.e-sport-link__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-sport-link__count { font-family: var(--e-font-mixed); font-size: var(--e-fs-sm); color: var(--e-text-faint); }


/* ==========================================================================
   17. 分頁
   ========================================================================== */

.e-pager { display: flex; align-items: center; justify-content: center; gap: var(--e-sp-3); }
.e-pager a,
.e-pager span {
  min-width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding-inline: var(--e-sp-4);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-md);
  background: var(--e-surface);
  font-family: var(--e-font-num);
  font-weight: 500;
  font-size: var(--e-fs-lg);
  color: var(--e-text-secondary);
}
.e-pager a:hover { background: var(--e-n-50); text-decoration: none; }
.e-pager [aria-current] { background: var(--e-brand-700); border-color: var(--e-brand-700); color: var(--e-n-0); }
.e-pager__gap { border: 0; background: transparent; color: var(--e-text-disabled); }


/* ==========================================================================
   18. 行動選單抽屜
   --------------------------------------------------------------------------
   用 <details> 做，不寫 JS：鍵盤可操作、沒有 JS 也能展開，
   而且 Esc 不會意外關掉整頁。900px 以上直接隱藏。
   ========================================================================== */

.e-drawer { display: none; position: relative; }
.e-drawer > summary {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--e-r-md);
  color: var(--e-on-dark);
}
.e-drawer > summary::marker,
.e-drawer > summary::-webkit-details-marker { display: none; content: ""; }
.e-drawer[open] > summary { background: rgba(255, 255, 255, 0.1); }

.e-drawer__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  width: max(240px, 60vw);
  padding: var(--e-sp-5);
  background: var(--e-surface);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-xl);
  box-shadow: var(--e-shadow-dialog);
  display: flex;
  flex-direction: column;
  gap: var(--e-sp-1);
}
.e-drawer__panel a {
  padding: var(--e-sp-5) var(--e-sp-6);
  border-radius: var(--e-r-sm);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-xl);
  color: var(--e-text-secondary);
}
.e-drawer__panel a:hover { background: var(--e-n-50); text-decoration: none; }
.e-drawer__panel a[aria-current] { background: var(--e-brand-100); color: var(--e-text); font-family: var(--e-font-title); }
.e-drawer__rule { height: 1px; background: var(--e-border); margin-block: var(--e-sp-3); }

@media (max-width: 900px) {
  .e-drawer { display: block; }
}


/* ==========================================================================
   19. 搜尋列
   --------------------------------------------------------------------------
   導覽列底下那條。桌機一排、平板兩排、手機一欄。
   ========================================================================== */

.e-searchbar {
  background: var(--e-brand-100);
  border-bottom: 1px solid var(--e-border);
}
.e-searchbar__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: var(--e-sp-5);
  align-items: end;
  padding-block: var(--e-sp-8);
}
.e-searchbar .e-label { color: var(--e-text-muted); }
.e-searchbar .e-input,
.e-searchbar .e-select { background: var(--e-n-0); }

@media (max-width: 1100px) {
  .e-searchbar__inner { grid-template-columns: 1fr 1fr 1fr; }
  .e-searchbar__inner > :first-child { grid-column: 1 / -1; }
  .e-searchbar__inner > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .e-searchbar__inner { grid-template-columns: 1fr; }
  .e-searchbar__inner > * { grid-column: 1 / -1 !important; }
}


/* ==========================================================================
   20. 篩選欄
   --------------------------------------------------------------------------
   桌機是左側固定欄，900px 以下整個收進一個 <details>。
   ========================================================================== */

.e-results { display: flex; align-items: flex-start; gap: var(--e-sp-12); }
.e-results__rail { width: var(--e-filter-rail); flex-shrink: 0; }
.e-results__list { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-7); }

.e-filter { background: var(--e-surface); border: 1px solid var(--e-border); border-radius: var(--e-r-2xl); }
.e-filter > summary {
  display: flex; align-items: center; gap: var(--e-sp-4);
  padding: var(--e-sp-7) var(--e-sp-8);
  font-family: var(--e-font-title);
  font-size: var(--e-fs-xl);
}
.e-filter__body { padding: 0 var(--e-sp-8) var(--e-sp-8); display: flex; flex-direction: column; gap: var(--e-sp-8); }
.e-filter__group { display: flex; flex-direction: column; gap: var(--e-sp-4); }
.e-filter__legend {
  font-family: var(--e-font-title);
  font-size: var(--e-fs-base);
  letter-spacing: 0.04em;
  color: var(--e-text-faint);
}
.e-filter__opt { display: flex; align-items: center; gap: var(--e-sp-4); }
.e-filter__opt input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--e-brand-700); }
.e-filter__opt label { flex-grow: 1; font-family: var(--e-font-body); font-size: var(--e-fs-lg); color: var(--e-text-secondary); }
.e-filter__opt--locked label { color: var(--e-text); font-family: var(--e-font-title); }
.e-filter__opt--off label { color: var(--e-text-disabled); }
.e-filter__n { font-family: var(--e-font-num); font-size: var(--e-fs-base); color: var(--e-text-faint); }

/* 已套用的條件 */
.e-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-sp-3); }
.e-chip {
  display: inline-flex; align-items: center; gap: var(--e-sp-3);
  height: 32px;
  padding-inline: var(--e-sp-5);
  background: var(--e-surface);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-pill);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  color: var(--e-text-secondary);
}
.e-chip button { display: flex; background: none; border: 0; padding: 0; color: var(--e-text-faint); }
.e-chip button:hover { color: var(--e-danger-fg); }
/* 鎖定的條件（分類頁的運動種類）：不能拿掉，所以不給叉叉 */
.e-chip--locked { background: var(--e-brand-100); border-color: var(--e-brand-300); color: var(--e-brand-800); font-family: var(--e-font-title); }

.e-results__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--e-sp-5); }

@media (max-width: 900px) {
  .e-results { flex-direction: column; align-items: stretch; gap: var(--e-sp-8); }
  .e-results__rail { width: 100%; }
}


/* ==========================================================================
   21. 區塊標頭
   --------------------------------------------------------------------------
   「近期開放報名」「三鐵 · 鐵人三項」那種：英文 eyebrow ＋ 中文標題 ＋ 右邊的「查看全部」。
   ========================================================================== */

.e-sechead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--e-sp-8);
  flex-wrap: wrap;
  padding-bottom: var(--e-sp-5);
  border-bottom: 2px solid var(--e-brand-500);
}
.e-sechead__text { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-sechead__desc { font-family: var(--e-font-body); font-size: var(--e-fs-md); color: var(--e-text-muted); }
.e-sechead--plain { border-bottom-color: var(--e-border); }


/* ==========================================================================
   22. 資料列（標籤：值）
   ========================================================================== */

.e-kv { display: flex; flex-direction: column; }
.e-kv__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e-sp-6);
  padding-block: var(--e-sp-5);
  border-bottom: 1px solid var(--e-border-subtle);
}
.e-kv__row:last-child { border-bottom: 0; }
.e-kv__k { flex-shrink: 0; font-family: var(--e-font-body); font-size: var(--e-fs-md); color: var(--e-text-muted); }
.e-kv__v { text-align: right; font-family: var(--e-font-mixed); font-weight: 600; font-size: var(--e-fs-lg); color: var(--e-text); }


/* ==========================================================================
   23. 詳情頁報名卡
   --------------------------------------------------------------------------
   桌機是右欄 sticky，900px 以下變成標題底下的整寬卡——
   它是這一頁唯一的行動，不能捲到最下面才看到。
   ========================================================================== */

.e-detail { display: flex; align-items: flex-start; gap: var(--e-sp-12); }
.e-detail__main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-12); }
.e-detail__side { width: 360px; flex-shrink: 0; position: sticky; top: var(--e-sp-8); }

.e-signup {
  display: flex; flex-direction: column; gap: var(--e-sp-7);
  padding: var(--e-sp-9);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-2xl);
  box-shadow: var(--e-shadow-raised);
}
.e-signup__top { display: flex; align-items: center; justify-content: space-between; gap: var(--e-sp-5); flex-wrap: wrap; }
.e-signup__actions { display: flex; gap: var(--e-sp-5); }
.e-signup__actions > * { flex-grow: 1; flex-basis: 0; }

@media (max-width: 900px) {
  .e-detail { flex-direction: column; align-items: stretch; gap: var(--e-sp-9); }
  .e-detail__side { width: 100%; position: static; order: -1; }
  .e-signup { box-shadow: none; }
}


/* ==========================================================================
   24. 賽程表
   ========================================================================== */

.e-day {
  display: flex; flex-direction: column; gap: var(--e-sp-7);
  padding: var(--e-sp-9);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-2xl);
}
.e-day__head { display: flex; align-items: center; gap: var(--e-sp-6); flex-wrap: wrap; }
.e-day__title { font-family: var(--e-font-title); font-size: var(--e-fs-h4); }
.e-day__sub { font-family: var(--e-font-body); font-size: var(--e-fs-md); color: var(--e-text-muted); }

.e-sched { display: flex; flex-direction: column; }
.e-sched__row {
  display: flex; gap: var(--e-sp-8);
  padding-block: var(--e-sp-5);
  border-bottom: 1px solid var(--e-border-subtle);
}
.e-sched__row:last-child { border-bottom: 0; }
.e-sched__t {
  width: 108px; flex-shrink: 0;
  font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-lg);
  color: var(--e-brand-700);
  font-variant-numeric: tabular-nums;
}
.e-sched__d { font-family: var(--e-font-body); font-size: var(--e-fs-lg); color: var(--e-text-secondary); }

@media (max-width: 640px) {
  .e-sched__row { flex-direction: column; gap: var(--e-sp-1); }
  .e-sched__t { width: auto; }
}


/* ==========================================================================
   25. 路線分段
   ========================================================================== */

.e-leg {
  display: flex; gap: var(--e-sp-7);
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-leg__icon {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: var(--e-r-lg);
  display: flex; align-items: center; justify-content: center;
}
.e-leg__body { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-leg__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-leg__dist { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-md); letter-spacing: 0.06em; color: var(--e-text-faint); }
.e-leg__desc { font-family: var(--e-font-body); font-size: var(--e-fs-md); line-height: var(--e-lh-body); color: var(--e-text-muted); }

/* 地圖或 GPX 的佔位框 */
.e-placeholder {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px;
  padding: var(--e-sp-9);
  background: var(--e-brand-50);
  border: 1px dashed var(--e-brand-300);
  border-radius: var(--e-r-xl);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  color: var(--e-text-faint);
  text-align: center;
}


/* ==========================================================================
   26. 文件按鈕列
   ========================================================================== */

.e-docs { display: flex; flex-wrap: wrap; gap: var(--e-sp-4); }
.e-doc {
  display: inline-flex; align-items: center; gap: var(--e-sp-4);
  height: var(--e-h-control);
  padding-inline: var(--e-sp-7);
  background: var(--e-brand-50);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-md);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-lg);
  color: var(--e-text);
}
.e-doc:hover { background: var(--e-brand-100); color: var(--e-text); text-decoration: none; }

/* 主辦單位列 */
.e-org { display: flex; align-items: center; gap: var(--e-sp-7); flex-wrap: wrap; }
.e-org__mark {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: var(--e-r-lg);
  background: var(--e-brand-100);
  color: var(--e-brand-700);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--e-font-title); font-size: var(--e-fs-h4);
}
.e-org__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }


/* ==========================================================================
   27. 大頁尾（首頁用的四欄版）
   ========================================================================== */

.e-footer--big .e-footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--e-sp-12);
  align-items: start;
  padding-block: var(--e-sp-12);
}
.e-footer__col { display: flex; flex-direction: column; gap: var(--e-sp-4); }
.e-footer__colhead {
  font-family: var(--e-font-title);
  font-size: var(--e-fs-md);
  letter-spacing: 0.08em;
  color: var(--e-on-dark);
}
.e-footer__tag { font-family: var(--e-font-body); font-size: var(--e-fs-md); line-height: var(--e-lh-body); color: var(--e-on-dark-muted); max-width: 40ch; }
.e-footer__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--e-sp-8); flex-wrap: wrap;
  padding-block: var(--e-sp-7);
  border-top: 1px solid var(--e-on-dark-line);
}

@media (max-width: 900px) {
  .e-footer--big .e-footer__inner { grid-template-columns: 1fr 1fr; gap: var(--e-sp-9); }
  .e-footer--big .e-footer__col:first-child { grid-column: 1 / -1; }
}


/* ==========================================================================
   28. 會員帳號頁的版面
   --------------------------------------------------------------------------
   左邊是「為什麼要註冊」的說明，右邊是表單。900px 以下說明欄整個收掉——
   手機上使用者已經決定要註冊了才會點進來，說明放在表單上面只會把表單推下去。
   ========================================================================== */

.e-auth {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--e-sp-14);
}
.e-auth__brand { width: 460px; flex-shrink: 0; padding-top: var(--e-sp-4); }
.e-auth__card  { width: 520px; flex-shrink: 0; }

/* 1100px 以下就收掉說明欄：兩欄加起來要 1044，比內容寬度先撐破 */
@media (max-width: 1100px) {
  .e-auth { flex-direction: column; align-items: center; gap: var(--e-sp-9); }
  .e-auth__brand { display: none; }
}
@media (max-width: 900px) {
  .e-auth { align-items: stretch; }
  .e-auth__card { width: 100%; padding: var(--e-sp-8); }
}


/* ==========================================================================
   29. 追蹤清單
   --------------------------------------------------------------------------
   桌機是一張表：賽事 ｜ 個別設定 ｜ 三種通知。
   900px 以下整列拆成上下堆疊的卡，欄位標題靠 data-label 帶出來。
   ========================================================================== */

.e-watch { display: flex; flex-direction: column; }
.e-watch__head,
.e-watch__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px repeat(3, 150px);
  gap: var(--e-sp-7);
  align-items: center;
  padding: var(--e-sp-7) var(--e-sp-8);
  border-bottom: 1px solid var(--e-border-subtle);
}
.e-watch__head {
  padding-block: var(--e-sp-5);
  border-bottom: 1px solid var(--e-border);
  font-family: var(--e-font-title);
  font-size: var(--e-fs-base);
  color: var(--e-text-muted);
}
.e-watch__row:last-child { border-bottom: 0; }
.e-watch__race { display: flex; flex-direction: column; gap: var(--e-sp-2); min-width: 0; }
.e-watch__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-watch__name a { color: var(--e-text); }
.e-watch__dates {
  display: flex; flex-wrap: wrap; gap: var(--e-sp-2) var(--e-sp-4);
  font-family: var(--e-font-mixed); font-size: var(--e-fs-base); color: var(--e-text-faint);
}
.e-watch__cell { display: flex; flex-direction: column; gap: var(--e-sp-3); }
.e-watch__cell select { height: 40px; font-size: var(--e-fs-md); }
.e-watch__cell--center { align-items: center; }

@media (max-width: 1100px) {
  .e-watch__head { display: none; }
  .e-watch__row {
    grid-template-columns: 1fr 1fr;
    align-items: start;
    row-gap: var(--e-sp-8);
    padding: var(--e-sp-8);
    border-bottom: 1px solid var(--e-border);
  }
  .e-watch__race { grid-column: 1 / -1; }
  .e-watch__cell::before {
    content: attr(data-label);
    font-family: var(--e-font-title);
    font-size: var(--e-fs-base);
    color: var(--e-text-muted);
  }
  .e-watch__cell--center { align-items: flex-start; }
}
@media (max-width: 520px) {
  .e-watch__row { grid-template-columns: 1fr; }
}


/* ==========================================================================
   30. 步驟指示器
   --------------------------------------------------------------------------
   四步的報名流程用。已完成的步驟可以點回去，還沒走到的不可點——
   讓人跳到還沒填的步驟只會得到一個空表單。
   ========================================================================== */

.e-steps {
  display: flex;
  align-items: center;
  gap: var(--e-sp-3);
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: var(--e-sp-1);
}
.e-steps::-webkit-scrollbar { display: none; }

.e-step {
  display: inline-flex;
  align-items: center;
  gap: var(--e-sp-4);
  padding: var(--e-sp-4) var(--e-sp-6);
  border-radius: var(--e-r-pill);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-lg);
  color: var(--e-text-faint);
  white-space: nowrap;
  text-decoration: none;
}
.e-step__n {
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: var(--e-fs-base);
  line-height: 1;
}
/* 已完成：可點回去 */
.e-step--done { color: var(--e-brand-700); }
.e-step--done:hover { background: var(--e-brand-50); color: var(--e-brand-700); text-decoration: none; }
.e-step--done .e-step__n { background: var(--e-brand-700); border-color: var(--e-brand-700); color: var(--e-n-0); }
/* 目前這一步 */
.e-step--now { background: var(--e-brand-100); color: var(--e-text); font-family: var(--e-font-title); }
.e-step--now .e-step__n { background: var(--e-brand-500); border-color: var(--e-brand-500); color: var(--e-brand-900); }
/* 還沒走到 */
.e-step--todo { color: var(--e-text-disabled); }

.e-steps__sep { flex-shrink: 0; color: var(--e-border-strong); }

@media (max-width: 640px) {
  .e-step { padding-inline: var(--e-sp-4); font-size: var(--e-fs-md); }
  .e-steps__sep { display: none; }
}


/* ==========================================================================
   31. 卡片式選項
   --------------------------------------------------------------------------
   組別、付款方式這類「選一個」的清單。整張卡是 label，點哪裡都會選中；
   radio 本身留著不隱藏，鍵盤與螢幕閱讀器才正常。
   ========================================================================== */

.e-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--e-sp-6);
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-xl);
  cursor: pointer;
  transition: border-color var(--e-dur) var(--e-ease), background var(--e-dur) var(--e-ease);
}
.e-choice:hover { border-color: var(--e-brand-500); }
.e-choice input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--e-brand-700); }
.e-choice__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-3); }
.e-choice__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--e-sp-6); flex-wrap: wrap; }
.e-choice__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-choice__price { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-xl); white-space: nowrap; }
.e-choice__meta { display: flex; flex-wrap: wrap; gap: var(--e-sp-3) var(--e-sp-7);
                  font-family: var(--e-font-mixed); font-size: var(--e-fs-base); color: var(--e-text-muted); }
.e-choice__note { font-family: var(--e-font-body); font-size: var(--e-fs-base); line-height: var(--e-lh-snug); color: var(--e-text-faint); }

/* 選中：有 :has() 的瀏覽器自動生效，沒有的話後端／JS 補 .is-on */
.e-choice:has(input:checked),
.e-choice.is-on { border-color: var(--e-brand-700); background: var(--e-brand-50); }
.e-choice:has(input:focus-visible) { box-shadow: var(--e-focus-ring); }

/* 額滿或不符資格：看得到但不能選，旁邊一定要寫原因 */
.e-choice--off { cursor: not-allowed; background: var(--e-n-50); border-color: var(--e-border); }
.e-choice--off .e-choice__name,
.e-choice--off .e-choice__price { color: var(--e-text-disabled); }
.e-choice--off:hover { border-color: var(--e-border); }


/* ==========================================================================
   32. 訂單摘要
   --------------------------------------------------------------------------
   報名流程右側那張 sticky 卡。900px 以下移到內容上方——
   金額是使用者最想確認的東西，不能捲到最底才看到。
   ========================================================================== */

.e-checkout { display: flex; align-items: flex-start; gap: var(--e-sp-12); }
.e-checkout__main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-9); }
.e-checkout__side { width: 340px; flex-shrink: 0; position: sticky; top: var(--e-sp-8); }

.e-summary {
  display: flex; flex-direction: column; gap: var(--e-sp-7);
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-2xl);
}
.e-summary__race { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-summary__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); line-height: var(--e-lh-title); }
.e-summary__total {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--e-sp-5);
  padding-top: var(--e-sp-6);
  border-top: 2px solid var(--e-border);
}
.e-summary__total b { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-h3); }

@media (max-width: 900px) {
  .e-checkout { flex-direction: column; align-items: stretch; gap: var(--e-sp-9); }
  .e-checkout__side { width: 100%; position: static; order: -1; }
}


/* ==========================================================================
   33. 繳費代碼
   --------------------------------------------------------------------------
   ATM 虛擬帳號與超商代碼。數字要大、要能一鍵複製——
   使用者是拿著手機站在 ATM 前面看這一頁的。
   ========================================================================== */

.e-paycode {
  display: flex; flex-direction: column; gap: var(--e-sp-4);
  padding: var(--e-sp-8);
  background: var(--e-brand-50);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-paycode__label {
  font-family: var(--e-font-body);
  font-size: var(--e-fs-base);
  color: var(--e-text-muted);
}
.e-paycode__row { display: flex; align-items: center; gap: var(--e-sp-5); flex-wrap: wrap; }
.e-paycode__value {
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: 0.06em;
  color: var(--e-text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.e-paycode__copy {
  display: inline-flex; align-items: center; gap: var(--e-sp-3);
  height: 40px;
  padding-inline: var(--e-sp-6);
  background: var(--e-surface);
  border: 1px solid var(--e-border-strong);
  border-radius: var(--e-r-md);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  color: var(--e-text-secondary);
  white-space: nowrap;
}
.e-paycode__copy:hover { background: var(--e-n-50); }
.e-paycode__copy[data-copied] { border-color: var(--e-brand-700); color: var(--e-brand-700); }

@media (max-width: 520px) {
  .e-paycode__value { font-size: 23px; }
}


/* ==========================================================================
   34. 團體代報的隊員列
   ========================================================================== */

.e-members { display: flex; flex-direction: column; gap: var(--e-sp-5); }
.e-member-row {
  display: grid;
  grid-template-columns: 34px repeat(3, minmax(0, 1fr)) 44px;
  gap: var(--e-sp-5);
  align-items: end;
  padding: var(--e-sp-7);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-member-row__n {
  height: var(--e-h-control);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-lg);
  color: var(--e-text-faint);
}
.e-member-row__del {
  width: 44px; height: var(--e-h-control);
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--e-r-sm);
  color: var(--e-text-faint);
}
.e-member-row__del:hover { background: var(--e-danger-bg); color: var(--e-danger-fg); }

@media (max-width: 900px) {
  .e-member-row { grid-template-columns: 34px minmax(0, 1fr) 44px; }
  .e-member-row > .e-field { grid-column: 2 / 3; }
  .e-member-row__n { grid-row: 1; }
  .e-member-row__del { grid-row: 1; grid-column: 3; }
}


/* ==========================================================================
   35. 報名紀錄
   ========================================================================== */

.e-entry {
  display: flex; gap: var(--e-sp-8); align-items: flex-start;
  padding: var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-entry__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--e-sp-4); }
.e-entry__name { font-family: var(--e-font-title); font-size: var(--e-fs-xl); line-height: var(--e-lh-title); }
.e-entry__name a { color: var(--e-text); }
.e-entry__facts {
  display: flex; flex-wrap: wrap; gap: var(--e-sp-2) var(--e-sp-7);
  font-family: var(--e-font-mixed); font-size: var(--e-fs-base); color: var(--e-text-muted);
}
.e-entry__side {
  width: 200px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--e-sp-4);
}
.e-entry__amount { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-3xl); }

/* 待繳費要看得出急迫：整張卡帶一條左側色帶 */
.e-entry--due { border-color: var(--e-warning-border); background: #fffdf7; }

@media (max-width: 760px) {
  .e-entry { flex-direction: column; gap: var(--e-sp-6); }
  .e-entry__side { width: 100%; align-items: stretch; }
  .e-entry__side .e-btn { width: 100%; }
}


/* ==========================================================================
   36. 報名日曆
   --------------------------------------------------------------------------
   桌機是月曆格線，760px 以下同一份 DOM 直接變成逐日清單——
   七欄的月曆在 390 寬每格只剩 50px，塞不下賽事名稱，
   但複製一份 DOM 給手機用會讓兩邊的內容遲早對不上，所以用 CSS 轉。
   ========================================================================== */

.e-cal { display: flex; flex-direction: column; }

.e-cal__head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--e-border);
}
.e-cal__head span {
  padding: var(--e-sp-5) var(--e-sp-4);
  text-align: center;
  font-family: var(--e-font-title);
  font-size: var(--e-fs-base);
  color: var(--e-text-muted);
}
/* 週六日用不同色，讓人一眼抓到週末——賽事幾乎都在週末 */
.e-cal__head span:first-child,
.e-cal__head span:last-child { color: var(--e-brand-700); }

.e-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.e-cal__day {
  display: flex;
  flex-direction: column;
  gap: var(--e-sp-3);
  min-height: 116px;
  padding: var(--e-sp-4);
  border-right: 1px solid var(--e-border-subtle);
  border-bottom: 1px solid var(--e-border-subtle);
}
.e-cal__day:nth-child(7n) { border-right: 0; }
.e-cal__grid > .e-cal__day:nth-last-child(-n+7) { border-bottom: 0; }

.e-cal__n {
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: var(--e-fs-md);
  color: var(--e-text-secondary);
  font-variant-numeric: tabular-nums;
}
/* 不屬於這個月的日子 */
.e-cal__day--out { background: var(--e-n-50); }
.e-cal__day--out .e-cal__n { color: var(--e-text-disabled); }
/* 今天 */
.e-cal__day--today { background: var(--e-brand-50); }
.e-cal__day--today .e-cal__n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding-inline: var(--e-sp-2);
  border-radius: var(--e-r-pill);
  background: var(--e-brand-700);
  color: var(--e-n-0);
}

/* 一格裡的一筆事件 */
.e-cal__ev {
  display: flex;
  align-items: flex-start;
  gap: var(--e-sp-2);
  padding: 3px var(--e-sp-3);
  border-radius: var(--e-r-xs);
  border-left: 3px solid currentColor;
  font-family: var(--e-font-body);
  font-size: var(--e-fs-sm);
  line-height: 1.45;
  text-decoration: none;
}
.e-cal__ev:hover { text-decoration: none; filter: brightness(0.97); }
/* 前綴不能被擠成兩行，否則「開放」會變成「開／放」 */
.e-cal__ev b {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--e-font-title);
  font-weight: 400;
}
.e-cal__ev span { min-width: 0; }

/* 四種事件：開放報名、早鳥截止、報名截止、比賽日。
   顏色之外一定要有文字前綴，不能只靠顏色分辨。 */
.e-cal__ev--open  { background: var(--e-success-bg); color: var(--e-success-fg); }
.e-cal__ev--early { background: var(--e-info-bg);    color: var(--e-info-fg); }
.e-cal__ev--close { background: var(--e-warning-bg); color: var(--e-warning-fg); }
.e-cal__ev--race  { background: var(--e-n-100);      color: var(--e-n-900); }

.e-cal__more {
  font-family: var(--e-font-body);
  font-size: var(--e-fs-sm);
  color: var(--e-text-faint);
  padding-inline: var(--e-sp-3);
}

/* 圖例 */
.e-legend { display: flex; flex-wrap: wrap; gap: var(--e-sp-4) var(--e-sp-8); }
.e-legend__item {
  display: inline-flex; align-items: center; gap: var(--e-sp-3);
  font-family: var(--e-font-body); font-size: var(--e-fs-base); color: var(--e-text-muted);
}
.e-legend__swatch { width: 14px; height: 14px; border-radius: 4px; border-left: 3px solid currentColor; }

/* 月份切換 */
.e-cal__bar {
  display: flex; align-items: center; gap: var(--e-sp-5); flex-wrap: wrap;
  padding-bottom: var(--e-sp-7);
}
.e-cal__month {
  font-family: var(--e-font-display);
  font-size: var(--e-fs-h3);
  min-width: 170px;
}

@media (max-width: 760px) {
  .e-cal__head { display: none; }
  .e-cal__grid { display: flex; flex-direction: column; }
  /* 沒有事件的日子在清單模式不必出現 */
  .e-cal__day { display: none; }
  .e-cal__day:has(.e-cal__ev) {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: var(--e-sp-5);
    align-items: start;
    min-height: 0;
    padding: var(--e-sp-6) var(--e-sp-4);
    border-right: 0;
  }
  .e-cal__day:has(.e-cal__ev) .e-cal__n { padding-top: 3px; }
  /* 事件排成第二欄的直列 */
  .e-cal__day:has(.e-cal__ev) > :not(.e-cal__n) { grid-column: 2; }
  .e-cal__ev { font-size: var(--e-fs-md); padding-block: var(--e-sp-3); }
}
/* :has() 不支援時的退路：全部顯示，至少不會整個月空白 */
@supports not selector(:has(*)) {
  @media (max-width: 760px) { .e-cal__day { display: flex; } }
}


/* ==========================================================================
   37. 法律文件
   --------------------------------------------------------------------------
   服務條款、隱私權政策這類。左側是目錄，右側是條文。
   行寬刻意壓在 70 個字以內——條文本來就難讀，行太長會更難。
   ========================================================================== */

.e-legal { display: flex; align-items: flex-start; gap: var(--e-sp-14); }
.e-legal__toc {
  position: sticky;
  top: var(--e-sp-8);
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--e-sp-2);
  max-height: calc(100vh - 80px);
  overflow: auto;
}
.e-legal__toc a {
  padding: var(--e-sp-3) var(--e-sp-5);
  border-left: 2px solid var(--e-border);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  line-height: var(--e-lh-snug);
  color: var(--e-text-muted);
}
.e-legal__toc a:hover { border-left-color: var(--e-brand-500); color: var(--e-text); text-decoration: none; }
.e-legal__toc a[aria-current] {
  border-left-color: var(--e-brand-700);
  color: var(--e-text);
  font-family: var(--e-font-title);
}

.e-legal__body { flex-grow: 1; min-width: 0; max-width: 70ch; display: flex; flex-direction: column; gap: var(--e-sp-12); }

.e-clause { display: flex; flex-direction: column; gap: var(--e-sp-6); scroll-margin-top: var(--e-sp-8); }
.e-clause h2 {
  display: flex;
  align-items: baseline;
  gap: var(--e-sp-5);
  font-family: var(--e-font-display);
  font-size: var(--e-fs-h3);
  line-height: var(--e-lh-title);
}
.e-clause h2 .e-clause__n {
  flex-shrink: 0;
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: var(--e-fs-xl);
  color: var(--e-brand-700);
}
.e-clause h3 { font-size: var(--e-fs-xl); margin-top: var(--e-sp-2); }
.e-clause p,
.e-clause li { font-family: var(--e-font-body); font-size: var(--e-fs-lg); line-height: var(--e-lh-loose); color: var(--e-text-secondary); }
.e-clause ol { padding-left: 1.6em; }
.e-clause ol > li::marker { color: var(--e-text-faint); }

.e-legal__meta {
  display: flex; flex-wrap: wrap; gap: var(--e-sp-3) var(--e-sp-8);
  padding: var(--e-sp-7) var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
  font-family: var(--e-font-mixed);
  font-size: var(--e-fs-md);
  color: var(--e-text-muted);
}

@media (max-width: 1000px) {
  .e-legal { flex-direction: column; align-items: stretch; gap: var(--e-sp-9); }
  .e-legal__toc { position: static; width: 100%; max-height: none; }
  .e-legal__body { max-width: none; }
}


/* ==========================================================================
   38. 主辦單位
   ========================================================================== */

.e-org-head {
  display: flex;
  align-items: flex-start;
  gap: var(--e-sp-9);
  flex-wrap: wrap;
}
.e-org-head__mark {
  width: 96px; height: 96px;
  flex-shrink: 0;
  border-radius: var(--e-r-2xl);
  background: var(--e-brand-100);
  color: var(--e-brand-700);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--e-font-display);
  font-size: 34px;
}
.e-org-head__body { flex-grow: 1; min-width: 260px; display: flex; flex-direction: column; gap: var(--e-sp-5); }

/* 數字帶：辦過幾場、累計多少人次 */
.e-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--e-sp-7);
}
.e-stat {
  display: flex; flex-direction: column; gap: var(--e-sp-2);
  padding: var(--e-sp-7) var(--e-sp-8);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-xl);
}
.e-stat__n {
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.1;
  color: var(--e-text);
  font-variant-numeric: tabular-nums;
}
.e-stat__k { font-family: var(--e-font-body); font-size: var(--e-fs-base); color: var(--e-text-faint); }


/* ==========================================================================
   39. 時間軸
   --------------------------------------------------------------------------
   賽事取消的處理進度、退款狀態這類「一連串已發生與將發生的事」。
   已完成的點是實心，還沒到的是空心——不要只用顏色區分。
   ========================================================================== */

.e-timeline { display: flex; flex-direction: column; }
.e-tl {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: var(--e-sp-6);
  padding-bottom: var(--e-sp-8);
  position: relative;
}
.e-tl:last-child { padding-bottom: 0; }
/* 連接線：畫在圓點那一欄，最後一項不畫 */
.e-tl:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--e-border);
}
.e-tl__dot {
  width: 18px; height: 18px;
  margin-top: 3px;
  border-radius: 50%;
  border: 2px solid var(--e-border-strong);
  background: var(--e-surface);
  z-index: 1;
}
.e-tl--done .e-tl__dot { border-color: var(--e-brand-700); background: var(--e-brand-700); }
.e-tl--now  .e-tl__dot { border-color: var(--e-accent); background: var(--e-accent); box-shadow: 0 0 0 4px var(--e-danger-bg); }
.e-tl__body { display: flex; flex-direction: column; gap: var(--e-sp-2); }
.e-tl__when { font-family: var(--e-font-num); font-weight: 600; font-size: var(--e-fs-base); color: var(--e-text-faint); }
.e-tl__what { font-family: var(--e-font-title); font-size: var(--e-fs-xl); }
.e-tl--todo .e-tl__what { color: var(--e-text-faint); }
.e-tl__desc { font-family: var(--e-font-body); font-size: var(--e-fs-md); line-height: var(--e-lh-body); color: var(--e-text-muted); }


/* ==========================================================================
   40. 已取消／已下架的賽事
   --------------------------------------------------------------------------
   整頁蓋一層灰，讓人一眼知道這一頁不是正常狀態。
   報名相關的東西不是隱藏而是明確劃掉——使用者需要確認自己沒看錯。
   ========================================================================== */

.e-cancelled { position: relative; }
.e-cancelled .e-cancelled__strike { text-decoration: line-through; color: var(--e-text-faint); }
.e-cancelled__banner {
  display: flex;
  gap: var(--e-sp-7);
  padding: var(--e-sp-9);
  background: var(--e-danger-bg);
  border: 1px solid var(--e-danger-border);
  border-radius: var(--e-r-2xl);
}
.e-cancelled__banner .e-notice__icon { color: var(--e-danger-fg); }


/* ==========================================================================
   41. 空白頁（404、已下架）
   ========================================================================== */

.e-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--e-sp-9);
  padding-block: var(--e-sp-14);
  text-align: center;
}
.e-blank__code {
  font-family: var(--e-font-num);
  font-weight: 800;
  font-style: italic;
  font-size: 88px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--e-brand-200);
}
.e-blank__title { font-family: var(--e-font-display); font-size: var(--e-fs-h1); line-height: var(--e-lh-tight); }
.e-blank__text { max-width: 48ch; font-family: var(--e-font-body); font-size: var(--e-fs-lg); line-height: var(--e-lh-loose); color: var(--e-text-muted); }


/* ==========================================================================
   42. 方案卡（主辦單位刊登）
   ========================================================================== */

.e-plan {
  display: flex;
  flex-direction: column;
  gap: var(--e-sp-7);
  padding: var(--e-sp-9);
  background: var(--e-surface);
  border: 1px solid var(--e-border);
  border-radius: var(--e-r-2xl);
}
.e-plan--lead { border-color: var(--e-brand-500); border-width: 2px; }
.e-plan__rate {
  display: flex;
  align-items: baseline;
  gap: var(--e-sp-3);
}
.e-plan__n {
  font-family: var(--e-font-num);
  font-weight: 600;
  font-size: 40px;
  line-height: 1;
  color: var(--e-text);
}
.e-plan__unit { font-family: var(--e-font-body); font-size: var(--e-fs-lg); color: var(--e-text-muted); }
.e-plan__list { display: flex; flex-direction: column; gap: var(--e-sp-4); }
.e-plan__item {
  display: flex;
  gap: var(--e-sp-4);
  font-family: var(--e-font-body);
  font-size: var(--e-fs-md);
  line-height: var(--e-lh-snug);
  color: var(--e-text-secondary);
}
.e-plan__item > span:first-child { flex-shrink: 0; color: var(--e-brand-700); margin-top: 2px; }
.e-plan__item--off { color: var(--e-text-disabled); }
.e-plan__item--off > span:first-child { color: var(--e-text-disabled); }
