/* ==========================================================================
   中華職業圍棋協會 官方網站 — 共用樣式
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --ink:        #17191d;
  --ink-2:      #2c3037;
  --ink-3:      #565c66;
  --ink-4:      #8a909b;

  --paper:      #fbf9f5;
  --paper-2:    #f4efe6;
  --paper-3:    #ebe3d6;
  --white:      #ffffff;

  /* 三個色相，各有分工：
     朱紅＝行動（入會、報名、主要按鈕）
     深藍＝系統功能（登入、棋士專區、找老師）
     木金＝裝飾點綴（章節小標、分隔、提示框）
     原本還有玉綠與淺藍，各只用到一兩次，拿掉。 */
  --accent:      #9e3029;
  --accent-2:    #c2483f;
  --accent-tint: #f3e5e4;   /* 標籤、行事曆小方塊的底 */
  --accent-wash: #faf1f0;   /* 提示框的底，比 tint 更淡 */

  --navy:        #1e3a5f;
  --navy-2:      #2b5183;
  --navy-3:      #2b4a74;   /* 淺底上的深藍文字 */
  --navy-tint:   #e6eaf2;

  --wood:        #c9a063;
  --wood-deep:   #9c7434;
  --wood-tint:   #efe9e2;
  --wood-wash:   #fdf8ef;
  --ink-tint:    #e8e6e1;

  /* 狀態色。刻意與賽事系列的分類色分開：
     分類色代表「是哪一個」，狀態色代表「是什麼情況」，混用會讀錯。 */
  --good:        #0d7f4f;
  --good-tint:   #e3f0e9;

  /* 深色表面（頁首大圖、頁尾、後台列）上的文字。
     原本這裡散著八種不同的灰，各寫各的，收成三階。 */
  --on-dark:    #e9e5de;
  --on-dark-2:  #b7bcc5;
  --on-dark-3:  #8f96a1;

  /* 賽事系列配色：五個系列循環。
     顏色只是輔助——系列名稱一直顯示在圓點旁邊。
     這組是用 OKLab 的色差驗證挑的，舊的那八色有兩組對色盲幾乎無法分辨。 */
  --series-0: #9e3029;
  --series-1: #b8842c;
  --series-2: #2b6fc4;
  --series-3: #0d7f4f;
  --series-4: #8a4a9e;
  --series-0-tint: #f6e9e8;
  --series-1-tint: #f6eddb;
  --series-2-tint: #e7ecf5;
  --series-3-tint: #e3f0e9;
  --series-4-tint: #f0e8f2;

  /* 邊線加深一階。原本 #e2dace 對白卡片只有 1.39 的對比，
     卡片邊界看不出來，整頁因此顯得糊，不是顏色的問題是層次的問題。 */
  --line:       #d8cfbe;
  --line-2:     #c9bda7;

  --radius:   10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(23,25,29,.06), 0 2px 6px rgba(23,25,29,.04);
  --shadow:    0 2px 4px rgba(23,25,29,.05), 0 8px 24px rgba(23,25,29,.07);
  --shadow-lg: 0 4px 10px rgba(23,25,29,.06), 0 20px 50px rgba(23,25,29,.12);

  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", Georgia, serif;
  --sans:  "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;

  --header-h: 68px;
  --maxw: 1200px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.35;
  margin: 0 0 .6em;
  font-weight: 700;
  letter-spacing: .02em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.95rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: .4em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
small { font-size: .82rem; }
table { border-collapse: collapse; width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.wrap-narrow { max-width: 840px; }
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.section--paper2 { background: var(--paper-2); }
.section--ink { background: var(--ink); color: var(--on-dark-2); }
.section--ink h2, .section--ink h3 { color: var(--white); }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
/* 主內容 + 側欄：桌機欄寬寫在各頁行內樣式，此處負責窄螢幕時收合為單欄 */
.grid-aside { align-items: start; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stack > * + * { margin-top: 1rem; }

.section-head { margin-bottom: 36px; }
.section-head .eyebrow {
  display: inline-block;
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--wood-deep); font-weight: 700; margin-bottom: .5rem;
}
.section-head h2 { margin-bottom: .35em; }
.section-head h2::after {
  content: ""; display: block; width: 44px; height: 3px;
  background: var(--accent); margin-top: .55rem; border-radius: 2px;
}
.section-head p { color: var(--ink-3); max-width: 62ch; margin: 0; }
.section-head--row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}

/* ---------- Goban texture ---------- */
.goban-bg {
  background-color: var(--paper-2);
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 34px 34px;
  background-position: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .72em 1.5em;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500; font-size: .95rem;
  text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #000; box-shadow: var(--shadow); }
.btn-accent  { background: var(--accent); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-accent:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--ink); background: var(--white); }
.btn-light { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-sm { padding: .5em 1.1em; font-size: .86rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251,249,245,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__bar {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: flex; align-items: center; text-decoration: none !important; flex: none; }
.brand__logo { height: 32px; width: auto; }

.nav { display: flex; align-items: center; gap: 2px; }
/* 這層曾經是 display:contents，但那樣 <li> 拿不到 align-items: center，
   整排選單會貼齊頂端，只有清單外的「棋士專區」被置中——兩顆膠囊因此差 3px。
   改成真正的 flex 容器，兩邊就在同一條中線上。 */
.nav__list {
  display: flex; align-items: center; gap: 2px;
  list-style: none; margin: 0; padding: 0;
}
.nav__item { position: relative; }
.nav__link {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 13px; border-radius: 8px;
  font-size: .93rem; color: var(--ink-2); font-weight: 500;
  text-decoration: none !important; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav__link:hover { background: var(--paper-3); color: var(--ink); }
.nav__item.is-active > .nav__link { color: var(--accent); font-weight: 700; }
.nav__link .caret { width: 9px; height: 9px; opacity: .5; transition: transform .2s; }
.nav__item:hover .caret { transform: rotate(180deg); }

.nav__link--member {
  background: var(--accent); color: var(--white);
}
.nav__link--member:hover { background: var(--accent-2); color: var(--white); }

.dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 210px; padding: 8px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
  list-style: none; margin: 0;
}
.nav__item:hover .dropdown,
.nav__item:focus-within .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown li { margin: 0; }
.dropdown a {
  display: block; padding: 9px 12px; border-radius: 7px;
  font-size: .9rem; color: var(--ink-2); text-decoration: none !important;
}
.dropdown a:hover { background: var(--paper-2); color: var(--accent); }

.nav-toggle {
  display: none; width: 42px; height: 42px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--white); padding: 0;
  align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle span { position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after  { top: 6px; }
body.nav-open .nav-toggle span { background: transparent; }
body.nav-open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle span::after  { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #18202c 0%, #1e3a5f 58%, #16202e 100%);
  color: var(--on-dark);
  padding: 96px 0 104px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 80% at 72% 45%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 72% 45%, #000 20%, transparent 75%);
}
.hero > .wrap { position: relative; z-index: 2; }
/* 原為左文字／右棋盤的兩欄；棋盤移除後改單欄，限制行寬避免標題與內文過長 */
.hero__grid { display: grid; grid-template-columns: minmax(0, 760px); gap: 56px; align-items: center; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: .78rem; letter-spacing: .2em; color: var(--wood);
  text-transform: uppercase; font-weight: 700; margin-bottom: 20px;
}
.hero__eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--wood); }
.hero h1 {
  color: var(--white); font-size: clamp(2.1rem, 4.4vw, 3.2rem);
  line-height: 1.28; margin-bottom: .5em; letter-spacing: .03em;
}
.hero h1 em { font-style: normal; color: var(--wood); }
.hero__lead { font-size: 1.06rem; color: var(--on-dark-2); max-width: 44ch; margin-bottom: 2rem; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__stats {
  display: flex; gap: 40px; margin-top: 52px;
  padding-top: 28px; border-top: 1px solid rgba(255,255,255,.12); flex-wrap: wrap;
}
.hero__stat b {
  display: block; font-family: var(--serif); font-size: 2rem;
  color: var(--white); line-height: 1;
}
.hero__stat span { font-size: .82rem; color: var(--ink-4); letter-spacing: .08em; }

/* Page hero (inner pages) */
.page-hero {
  background: var(--ink); color: var(--on-dark-2);
  padding: 56px 0 52px; position: relative; overflow: hidden;
}
.page-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
  -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
}
.page-hero > .wrap { position: relative; z-index: 2; }
.page-hero h1 { color: var(--white); margin-bottom: .35em; }
.page-hero p { color: var(--on-dark-2); margin: 0; max-width: 60ch; }
.breadcrumb {
  font-size: .82rem; color: var(--ink-4); margin-bottom: 14px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.breadcrumb a { color: var(--ink-4); }
.breadcrumb a:hover { color: var(--wood); }
.breadcrumb span.sep { opacity: .5; }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card--link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card h3 { margin-bottom: .5em; }
.card p:last-child { margin-bottom: 0; }
.card__icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--paper-2); display: grid; place-items: center;
  margin-bottom: 16px; font-size: 1.2rem;
}
.card-link {
  display: block; text-decoration: none !important; color: inherit;
}
.card__more { color: var(--accent); font-size: .88rem; font-weight: 500; margin-top: 14px; display: inline-block; }

/* ---------- News ---------- */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-item {
  display: grid; grid-template-columns: 104px 92px 1fr auto;
  gap: 18px; align-items: center;
  padding: 18px 4px; border-bottom: 1px solid var(--line);
  text-decoration: none !important; color: inherit;
  transition: background .15s;
}
.news-item:hover { background: var(--white); }
.news-item:hover .news-item__title { color: var(--accent); }
.news-item__date { font-size: .85rem; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.news-item__title { font-weight: 500; color: var(--ink-2); margin: 0; }
.news-item__arrow { color: var(--ink-4); font-size: .9rem; }

.tag {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: .74rem; font-weight: 500; letter-spacing: .04em;
  background: var(--paper-3); color: var(--ink-3); white-space: nowrap;
}
.tag--match   { background: var(--navy-tint); color: var(--navy-3); }
.tag--event   { background: var(--wood-tint); color: var(--wood-deep); }
.tag--media   { background: var(--ink-tint); color: var(--ink-3); }
.tag--notice  { background: var(--accent-tint); color: var(--accent); }
.tag--dark    { background: rgba(255,255,255,.1); color: var(--on-dark-2); }

/* Filter tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.tab {
  padding: .5em 1.15em; border-radius: 999px; font-size: .88rem;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-3);
  transition: all .15s;
}
.tab:hover { border-color: var(--ink-3); color: var(--ink); }
.tab.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* ---------- Player cards ---------- */
.player-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  text-decoration: none !important; color: inherit; display: block;
  transition: transform .18s, box-shadow .18s;
}
.player-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
/* 棋士照片為正方形半身照，維持 1:1 才不會裁切放大成特寫 */
.player-card__photo {
  aspect-ratio: 1; background: var(--paper-2);
  display: grid; place-items: center; position: relative;
  background-image: radial-gradient(circle at 50% 35%, var(--paper-3), var(--paper-2));
}
/* 找老師：聯絡管道按鈕 —— 長網址不得撐破版面 */
.contact-btn { justify-content: flex-start; max-width: 100%; }
.contact-value {
  min-width: 0; font-size: .85rem; color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 找老師：老師自行提供的相關連結 */
.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-item {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  gap: 2px 12px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); text-decoration: none !important; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.link-item:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.link-item__label { font-weight: 500; color: var(--ink); }
.link-item__url {
  grid-column: 1; font-size: .8rem; color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-item__arrow { grid-row: 1 / span 2; color: var(--ink-4); }

/* 找老師：老師卡片 */
.teacher-card { display: flex; flex-direction: column; }
.teacher-card__head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.teacher-card__photo {
  width: 64px; height: 64px; flex: none; border-radius: 50%;
  object-fit: cover; background: var(--paper-2);
}
.teacher-card__photo--none {
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--line-2);
}
.teacher-card__meta { grid-template-columns: max-content 1fr; margin-bottom: 14px; }
.teacher-card__meta dt, .teacher-card__meta dd { padding: 7px 0; font-size: .88rem; }
.teacher-card__meta dt { padding-right: 16px; }
.teacher-card__intro {
  font-size: .9rem; margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* 名錄：依段位分組的純文字清單（照片只在個人頁顯示） */
.rank-group { margin-bottom: 36px; }
.rank-group__head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2);
}
.rank-group__rank { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.rank-group__count { font-size: .84rem; color: var(--ink-4); }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 8px; }
.name-item {
  display: block; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); text-decoration: none !important; color: inherit;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.name-item:hover { border-color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.name-item__name { font-family: var(--serif); font-size: 1.05rem; font-weight: 700; color: var(--ink); display: block; }
/* 保留高度，讓沒有冠軍數的項目與其他項目對齊 */
.name-item__meta { font-size: .75rem; color: var(--ink-4); display: block; margin-top: 1px; min-height: 1.15em; }
.player-card__initial {
  font-family: var(--serif); font-size: 3.2rem; color: var(--line-2); font-weight: 700;
}
.player-card__rank {
  position: absolute; top: 12px; right: 12px;
  background: var(--ink); color: var(--white);
  font-size: .74rem; padding: 3px 10px; border-radius: 999px; letter-spacing: .05em;
}
.player-card__body { padding: 12px 14px 14px; }
.player-card__name { font-family: var(--serif); font-size: 1.02rem; color: var(--ink); margin: 0 0 2px; font-weight: 700; }
.player-card__meta { font-size: .78rem; color: var(--ink-4); margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--white); }
.table { min-width: 560px; }
.table th, .table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th {
  background: var(--paper-2); font-family: var(--sans); font-weight: 700;
  color: var(--ink); white-space: nowrap; font-size: .86rem; letter-spacing: .03em;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--paper); }
.table td.num { font-variant-numeric: tabular-nums; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 28px; margin: 0; list-style: none; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line-2);
}
.timeline li { position: relative; margin-bottom: 30px; }
.timeline li::before {
  content: ""; position: absolute; left: -28px; top: 9px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--paper);
  box-shadow: 0 0 0 2px var(--line-2);
}
.timeline__year {
  font-family: var(--serif); font-weight: 700; color: var(--accent);
  font-size: 1.05rem; display: block; margin-bottom: 2px;
}

/* ---------- Gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.gallery-item {
  aspect-ratio: 1; border-radius: var(--radius); overflow: hidden;
  background: var(--paper-2); border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
  cursor: pointer; transition: transform .18s, box-shadow .18s;
}
.gallery-item:hover { transform: scale(1.02); box-shadow: var(--shadow); }
.gallery-item__label {
  position: absolute; inset: auto 0 0 0; padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff; font-size: .8rem;
}
.gallery-item__ph { color: var(--line-2); font-size: 2rem; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15,16,19,.92); display: none;
  align-items: center; justify-content: center; padding: 28px;
}
.lightbox.is-open { display: flex; }
.lightbox__inner { max-width: 900px; width: 100%; text-align: center; color: #ddd; }
.lightbox__frame {
  aspect-ratio: 3/2; background: var(--ink-2); border-radius: var(--radius);
  display: grid; place-items: center; color: #555; margin-bottom: 16px;
}
.lightbox__close {
  position: absolute; top: 20px; right: 24px; width: 42px; height: 42px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  background: transparent; color: #fff; font-size: 1.3rem; line-height: 1;
}

/* ---------- Notice / callout ---------- */
.callout {
  border-left: 3px solid var(--wood);
  background: var(--paper-2); padding: 18px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.callout--accent { border-left-color: var(--accent); background: var(--accent-wash); }
.callout--navy { border-left-color: var(--navy); background: var(--navy-tint); }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--ink); }

/* ---------- Definition list ---------- */
.deflist { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
.deflist dt {
  padding: 13px 22px 13px 0; font-weight: 700; color: var(--ink);
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: .92rem;
}
.deflist dd {
  padding: 13px 0; margin: 0; border-bottom: 1px solid var(--line);
  color: var(--ink-3); font-size: .94rem;
}

/* ---------- Steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.steps > li {
  counter-increment: step; position: relative; padding-left: 56px; margin: 0;
}
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ink); color: var(--white);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 1rem;
}
.steps h3 { font-size: 1.05rem; margin-bottom: .25em; }
.steps p { margin: 0; color: var(--ink-3); font-size: .94rem; }

/* ---------- Downloads ---------- */
.dl-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none !important; color: inherit; margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.dl-item:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.dl-item__ext {
  flex: none; width: 44px; height: 44px; border-radius: 9px;
  background: var(--accent-tint); color: var(--accent);
  display: grid; place-items: center; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
}
.dl-item__ext--doc { background: var(--navy-tint); color: var(--navy-3); }
.dl-item__ext--xls { background: var(--good-tint); color: var(--good); }
.dl-item__body { flex: 1 1 auto; min-width: 0; }
.dl-item__name { font-weight: 500; color: var(--ink); display: block; }
.dl-item__meta { font-size: .8rem; color: var(--ink-4); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .88rem; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: .72em .9em;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--white); font: inherit; font-size: .94rem; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(23,25,29,.07);
}
.field .hint { font-size: .8rem; color: var(--ink-4); margin-top: 5px; }
.form-note { font-size: .84rem; color: var(--ink-4); }

/* ---------- Member area ---------- */
body.member-area { background: var(--paper-2); }
.member-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 32px; align-items: start; }
.member-side {
  position: sticky; top: calc(var(--header-h) + 24px);
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm);
}
.member-side__user { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.member-side__avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--ink); color: var(--white);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 700;
}
.member-side__name { font-weight: 700; color: var(--ink); font-size: .95rem; line-height: 1.3; }
.member-side__rank { font-size: .78rem; color: var(--ink-4); }
.member-nav { list-style: none; padding: 0; margin: 0; }
.member-nav li { margin: 0; }
.member-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: .9rem; color: var(--ink-2); text-decoration: none !important;
}
.member-nav a:hover { background: var(--paper-2); }
.member-nav a.is-active { background: var(--ink); color: var(--white); font-weight: 500; }
.member-nav .ico { width: 16px; text-align: center; opacity: .75; }

.panel {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.panel__head h2, .panel__head h3 { margin: 0; }
.panel > :last-child { margin-bottom: 0; }

.stat-tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; }
.stat-tile__label { font-size: .8rem; color: var(--ink-4); letter-spacing: .05em; margin-bottom: 6px; }
.stat-tile__value { font-family: var(--serif); font-size: 1.8rem; color: var(--ink); font-weight: 700; line-height: 1.1; }
.stat-tile__sub { font-size: .82rem; color: var(--ink-3); margin-top: 4px; }

.progress { height: 8px; border-radius: 999px; background: var(--paper-3); overflow: hidden; margin: 10px 0 6px; }
.progress__bar { height: 100%; background: var(--good); border-radius: 999px; }

.badge-status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 500;
}
.badge-status--done    { background: var(--good-tint); color: var(--good); }
.badge-status--pending { background: var(--wood-wash); color: var(--wood-deep); }
.badge-status--soon    { background: var(--navy-tint); color: var(--navy-3); }

/* Calendar */
.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.cal__head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--paper-2); }
.cal__head div { padding: 10px 4px; text-align: center; font-size: .8rem; font-weight: 700; color: var(--ink-3); }
.cal__body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal__cell {
  min-height: 96px; border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 6px 7px; font-size: .8rem;
}
.cal__cell:nth-child(7n) { border-right: 0; }
.cal__cell.is-muted { background: var(--paper); color: var(--ink-4); }
.cal__date { font-variant-numeric: tabular-nums; color: var(--ink-4); margin-bottom: 4px; display: block; }
.cal__cell.is-today .cal__date {
  background: var(--accent); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: grid; place-items: center; font-weight: 700;
}
.cal__ev {
  display: block; padding: 3px 6px; border-radius: 5px; margin-bottom: 3px;
  font-size: .72rem; line-height: 1.35; background: var(--paper-3); color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal__ev--match { background: var(--navy-tint); color: var(--navy-3); }
.cal__ev--admin { background: var(--accent-tint); color: var(--accent); }
.cal__ev--event { background: var(--wood-tint); color: var(--wood-deep); }

/* 賽事系列配色：slot 由 schedule.json 的 series_slot 指定，同系列跨次執行固定不變 */
/* 賽事系列五色。實際資料目前是五個系列，超過會從頭循環；
   顏色只是輔助，系列名稱一直顯示在圓點旁邊。 */
.ev-s0 { background: var(--series-0-tint); color: var(--series-0); }
.ev-s1 { background: var(--series-1-tint); color: var(--series-1); }
.ev-s2 { background: var(--series-2-tint); color: var(--series-2); }
.ev-s3 { background: var(--series-3-tint); color: var(--series-3); }
.ev-s4 { background: var(--series-4-tint); color: var(--series-4); }

/* 月曆格內的賽事晶片：賽事名 + 輪次兩行 */
.cal__ev--rich { white-space: normal; line-height: 1.3; padding: 4px 6px; }
.cal__ev--rich b { display: block; font-weight: 700; }
.cal__ev--rich i { display: block; font-style: normal; opacity: .75; font-size: .92em; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; align-items: center; }
.legend__dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.src-note { font-size: .8rem; color: var(--ink-4); }
.src-note strong { color: var(--ink-3); font-weight: 500; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: var(--white); }
.seg button {
  border: 0; background: transparent; padding: .4em 1em;
  border-radius: 999px; font-size: .85rem; color: var(--ink-3);
}
.seg button.is-active { background: var(--ink); color: var(--white); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--on-dark-3); padding: 56px 0 28px; font-size: .9rem; }
.site-footer a { color: var(--on-dark-2); }
.site-footer a:hover { color: var(--wood); text-decoration: none; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 36px; }
/* logo 於深色底反相：黑字轉白、雙圈的內部明暗對比得以保留 */
.footer-logo { height: 30px; width: auto; filter: invert(1); }
.footer-brand p { font-size: .86rem; line-height: 1.75; margin: 18px 0 0; color: var(--on-dark-3); }
.footer-col h4 {
  color: var(--white); font-family: var(--sans); font-size: .82rem;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 14px; font-weight: 700;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; font-size: .88rem; }
.footer-bottom {
  margin-top: 44px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: .8rem; color: var(--on-dark-3);
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.muted { color: var(--ink-4); }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.lead { font-size: 1.08rem; color: var(--ink-3); }
.prose > h2 { margin-top: 2.2em; }
.prose > h3 { margin-top: 1.8em; }
.prose > h2:first-child, .prose > h3:first-child { margin-top: 0; }
.divider-dot { color: var(--line-2); margin: 0 .5em; }
.placeholder-note {
  font-size: .82rem; color: var(--wood-deep); background: var(--wood-wash);
  border: 1px dashed var(--wood); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 22px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav__link { padding: 10px 9px; font-size: .88rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  /* !important 用於覆寫各頁行內的桌機欄寬設定 */
  .grid-aside { grid-template-columns: minmax(0, 1fr) !important; gap: 36px !important; }
  .cal-scroll { overflow-x: auto; }
  .cal-scroll .cal { min-width: 520px; }
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .member-shell { grid-template-columns: minmax(0, 1fr); }
  .member-side { position: static; }
  .news-item { grid-template-columns: 1fr auto; gap: 6px 14px; }
  .news-item__date { grid-row: 1; }
  .news-item .tag { grid-row: 1; justify-self: start; }
  .news-item__title { grid-column: 1 / -1; }
  .news-item__arrow { display: none; }
}
/* 導覽列有 9 個項目，桌機版在 1000px 以下就會擠爆版面，
   因此收合成漢堡選單的斷點設在 1024px 而非 860px。 */
@media (max-width: 1024px) {
  .nav-toggle { display: flex; }
  /* backdrop-filter 會讓頁首成為 fixed 子元素的定位基準，行動版選單需以視窗為基準 */
  .site-header { backdrop-filter: none; background: var(--paper); }
  .nav {
    position: fixed; inset: var(--header-h) 0 0 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); padding: 16px 24px 48px;
    overflow-y: auto; display: none;
  }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; width: 100%; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav { display: flex; }
  .nav__item { border-bottom: 1px solid var(--line); }
  .nav__item--pill { border-bottom: 0; }
  .nav__link { padding: 15px 4px; font-size: 1rem; justify-content: space-between; }
  .nav__link--member {
    margin: 18px 0 0; justify-content: center; border-radius: var(--radius);
  }
  .dropdown {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; background: transparent;
    padding: 0 0 12px 12px; display: none;
  }
  .nav__item.is-open .dropdown { display: block; }
  .nav__item.is-open .caret { transform: rotate(180deg); }
}

@media (max-width: 860px) {
  .cal__cell { min-height: 70px; }
  .cal__ev { font-size: .64rem; padding: 2px 4px; }
}

@media (max-width: 640px) {
  .section { padding: 52px 0; }
  .hero { padding: 64px 0 72px; }
  .wrap { padding-inline: 18px; }
  .brand__logo { height: 26px; }
  .card { padding: 20px; }
  .panel { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero__stats { gap: 26px; }
  .deflist { grid-template-columns: 1fr; }
  .deflist dt { border-bottom: 0; padding-bottom: 0; }
  .deflist dd { padding-top: 4px; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .btn { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   長條文頁面的章節快捷列（賽制／競賽規則等）
   置於頁首下方隨捲動固定；z-index 低於 .site-header(100)，捲動時滑入其下方。
   ========================================================================== */
.page-toc {
  position: sticky; top: var(--header-h); z-index: 90;
  margin: 0 0 2.5rem;
  padding: 9px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.page-toc__inner {
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto;                 /* 窄螢幕改為單行橫向捲動，避免佔掉太多高度 */
  scrollbar-width: none;
}
.page-toc__inner::-webkit-scrollbar { display: none; }
.page-toc__label {
  flex: none; padding-right: 8px;
  font-size: .74rem; font-weight: 700; letter-spacing: .1em;
  color: var(--ink-4); text-transform: uppercase;
}
.page-toc a {
  flex: none; white-space: nowrap;
  padding: 6px 13px; border-radius: 999px;
  font-size: .86rem; text-decoration: none; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.page-toc a:hover { background: var(--paper-2); color: var(--ink); }
.page-toc a.is-active { background: var(--ink); color: var(--white); }

/* 錨點捲動時預留頁首與快捷列的高度，標題才不會被蓋住 */
.prose h2[id], .prose h3[id] { scroll-margin-top: calc(var(--header-h) + 62px); }

/* 回到頁首 */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 95;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--white);
  border: 0; cursor: pointer; font-size: 1rem; line-height: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.to-top.is-on { opacity: .9; visibility: visible; }
.to-top:hover { opacity: 1; }
@media (max-width: 860px) { .to-top { right: 14px; bottom: 14px; } }

/* ==========================================================================
   精銳隊名冊
   照片尺寸固定，不隨欄寬變動——教練團只有兩人，用會自動撐開的 .grid-4
   會把頭像放大到 400px 以上。
   ========================================================================== */
.elite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 30px 18px;
}
.elite-item { text-align: center; text-decoration: none !important; display: block; }

.elite-item__photo {
  /* 這是 <span>，沒有 display:block 的話 aspect-ratio 與 overflow 都不會生效 */
  display: block;
  width: 100%; max-width: 116px; aspect-ratio: 1;
  margin: 0 auto 12px; border-radius: 50%; overflow: hidden;
  background: var(--paper-2);
  box-shadow: 0 0 0 1px var(--line), 0 6px 16px rgba(0, 0, 0, .07);
  transition: box-shadow .18s ease, transform .18s ease;
}
.elite-item__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.elite-item:hover .elite-item__photo {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px var(--line-2), 0 12px 24px rgba(0, 0, 0, .12);
}

.elite-item__initial {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-family: var(--serif); font-size: 2rem; color: var(--ink-4);
}
.elite-item__name {
  display: block; font-family: var(--serif); font-size: 1.04rem;
  color: var(--ink); line-height: 1.35;
}
.elite-item__rank { display: block; font-size: .82rem; color: var(--ink-4); margin-top: 2px; }
.elite-item__role {
  display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: .74rem; letter-spacing: .04em;
  background: var(--paper-2); color: var(--ink-3);
}

.elite-group { margin-bottom: 52px; }
.elite-group__head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.elite-group__head h2 { font-size: 1.25rem; margin: 0; }
.elite-group__count { font-size: .82rem; color: var(--ink-4); }

@media (max-width: 520px) {
  .elite-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 24px 12px; }
  .elite-item__photo { max-width: 92px; }
}

/* ==========================================================================
   理事長介紹
   照片為人像直幅（原檔約 1:1.4），固定 3:4 顯示；林文伯的原圖僅 137px 寬，
   因此顯示尺寸刻意壓小，放大會糊。
   ========================================================================== */
.chair-hero {
  display: grid; grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px; align-items: start;
}
.chair-row {
  display: grid; grid-template-columns: 132px minmax(0, 1fr);
  gap: 28px; align-items: start;
  padding: 30px 0; border-top: 1px solid var(--line);
}
.chair-row:first-child { border-top: 0; padding-top: 4px; }

.chair-photo {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: center top;
  display: block; border-radius: var(--radius);
  background: var(--paper-2); border: 1px solid var(--line);
}
.chair-term {
  display: inline-block; margin-bottom: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .76rem; letter-spacing: .04em;
  background: var(--paper-2); color: var(--ink-3);
}
.chair-name { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); margin: 0 0 2px; }
.chair-years { font-size: .88rem; color: var(--ink-4); margin: 0 0 12px; }
.chair-deeds { margin: 0; padding-left: 1.15em; font-size: .93rem; color: var(--ink-3); }
.chair-deeds li { margin-bottom: 5px; }

@media (max-width: 720px) {
  .chair-hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .chair-hero .chair-photo { max-width: 190px; }
  .chair-row { grid-template-columns: 92px minmax(0, 1fr); gap: 18px; }
}

/* ---------- 深色底上的外框按鈕 ----------
   英雄區第三顆按鈕原本用 .btn-ghost 加行內樣式，邊框只有 rgba(255,255,255,.25)，
   在深色背景上幾乎看不見。 */
.btn-outline-light {
  background: transparent; color: var(--white);
  border-color: rgba(255, 255, 255, .55);
}
.btn-outline-light:hover {
  background: rgba(255, 255, 255, .14);
  border-color: #fff; color: var(--white);
}

/* ---------- 導覽列的膠囊項目 ----------
   棋士專區為實心紅底；找老師為玉綠外框，兩者以顏色與實心／外框區分。 */
.nav__link--pill {
  padding: 9px 16px; border-radius: 999px; margin-left: 6px;
  border: 1px solid transparent;
  /* 兩顆並排時字數不同（三字／四字），不對齊寬度會看起來一大一小。
     以較寬的四字為準，兩顆等寬並置中。 */
  min-width: 94px; justify-content: center;
}
/* 兩顆膠囊是一組，與左邊的文字選單拉開，才不會看起來黏在「下載專區」後面 */
/* 兩顆膠囊是一組，與左邊的文字選單拉開 */
.nav__link--teachers { margin-left: 14px; }
.nav__link--teachers {
  background: transparent; color: var(--navy); border-color: #a9bdd6;
}
.nav__link--teachers:hover { background: var(--navy-tint); color: var(--navy); border-color: var(--navy-2); }
/* 停在膠囊自己的頁面時，.nav__item.is-active 的紅字會落在深色底上讀不出來。
   選取器要比 .nav__item.is-active > .nav__link 更明確才蓋得過去。 */
.nav__item.is-active > .nav__link--member { color: var(--white); }
.nav__item.is-active > .nav__link--teachers { color: var(--navy); }

/* 1025–1080px 是桌機導覽最窄的區間（1024 以下換成漢堡選單）。
   兩顆維持等寬，但整體縮一號，否則「棋士專區」會被擠出頁首右緣。
   這段必須放在上面的 .nav__link--pill 之後——媒體查詢不會提高優先序。 */
@media (max-width: 1080px) {
  .nav__link--pill { min-width: 79px; padding: 9px 10px; }
  .nav__link--teachers { margin-left: 8px; }
}

@media (max-width: 1024px) {
  .nav__link--pill {
    margin: 10px 0 0; justify-content: center; border-radius: var(--radius);
  }
}

/* ==========================================================================
   登入頁與管理後台
   後台不套用官網的頁首頁尾，維持單純的工作介面。
   ========================================================================== */
.auth-body {
  min-height: 100vh; display: grid; place-items: center;
  padding: 32px 16px; background: var(--paper-2);
}
.auth-card {
  width: 100%; max-width: 410px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 38px 34px 30px;
}
.auth-brand { display: block; margin-bottom: 26px; }
.auth-brand img { height: 34px; width: auto; }
.auth-card h1 { font-size: 1.45rem; margin: 0 0 6px; }
.auth-card .field { margin-top: 16px; }

/* ---------- 後台外框 ---------- */
.admin-bar {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink); color: var(--on-dark);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.admin-bar__inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 16px;
}
.admin-bar__title {
  font-family: var(--serif); font-size: 1.02rem; color: var(--white);
  text-decoration: none !important; margin-right: auto;
}
.admin-bar__who { font-size: .86rem; color: var(--on-dark-2); }
.admin-bar a.admin-bar__link { color: var(--on-dark); font-size: .88rem; text-decoration: none; }
.admin-bar a.admin-bar__link:hover { color: var(--white); text-decoration: underline; }

.admin-wrap { max-width: 1120px; margin: 0 auto; padding: 36px 20px 64px; }

.admin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px;
}
.admin-tile {
  display: block; text-decoration: none !important;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.admin-tile:hover {
  border-color: var(--line-2); box-shadow: var(--shadow-sm); transform: translateY(-2px);
}
.admin-tile__kind {
  display: inline-block; margin-bottom: 8px; padding: 2px 9px; border-radius: 999px;
  font-size: .72rem; letter-spacing: .04em; background: var(--paper-2); color: var(--ink-3);
}
.admin-tile__name {
  display: block; font-family: var(--serif); font-size: 1.1rem; color: var(--ink); margin-bottom: 4px;
}
.admin-tile__meta { display: block; font-size: .82rem; color: var(--ink-4); }

@media (max-width: 620px) {
  .auth-card { padding: 30px 22px 24px; }
  .admin-bar__who { display: none; }
}

/* 後台的純文字／JSON 編輯區 */
.code-area {
  width: 100%; min-height: 60vh; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88rem; line-height: 1.6; tab-size: 2;
  white-space: pre; overflow-wrap: normal; overflow-x: auto;
}

/* ---------- 後台表單 ---------- */
.top-field { margin-bottom: 18px; }
.form-group { margin-bottom: 30px; }
.form-group__title {
  font-size: 1.1rem; margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.row-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.row-card {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.row-card__fields { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; }
.row-card__fields .row-field { flex: 1 1 200px; margin: 0 0 6px; }
.row-card__fields .field label { font-size: .78rem; }
.row-card__fields input, .row-card__fields textarea { font-size: .92rem; }

.row-card__tools { display: flex; gap: 4px; }
.row-card__tools button {
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-3); font-size: .9rem; line-height: 1;
}
.row-card__tools button:hover { border-color: var(--line-2); color: var(--ink); }
.row-card__tools button.is-danger:hover {
  border-color: var(--accent); color: var(--accent); background: #fff;
}

.row-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .86rem; color: var(--ink-3); margin: 0 0 10px; white-space: nowrap;
}
.row-check input { width: auto; margin: 0; }

@media (max-width: 620px) {
  .row-card { grid-template-columns: 1fr; }
  .row-card__tools { justify-content: flex-end; }
}

.admin-actions {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.admin-raw-toggle { margin-left: auto; font-size: .84rem; color: var(--ink-4); }
.admin-raw-toggle:hover { color: var(--ink-3); }

/* 後台的發布區塊 */
.publish-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-top: 34px; padding: 20px 22px;
  background: var(--white); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
}
.publish-bar > div { flex: 1 1 260px; }
.publish-bar .btn { flex: none; }

/* 公告編輯卡片 */
.ann-row {
  display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap;
  padding-top: 4px;
}
.ann-row .row-check { margin-bottom: 10px; }

/* 教學資訊的刊登開關 */
.listed-card { border-left: 4px solid var(--accent); }
.listed-toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 0; }
.listed-toggle input { width: auto; margin: 3px 0 0; flex: none; }
.chk-row { display: flex; gap: 18px; flex-wrap: wrap; }
.chk-row .row-check { margin: 0; }

/* 後台格子上的未處理數 */
.tile-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: var(--white);
  font-size: .76rem; font-family: var(--sans); vertical-align: middle;
}
