/* ==========================================================================
   EzSlotDesign Arena - broadcast-arena Ghost theme for SLOT設計王
   Dual dark/light via html[data-theme]. One spring-green signal accent.
   Signature motif: short skewed accent bars and angled chips (clip-path).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg: #0F1316;
  --bg-raise: #161C21;
  --panel: #1A2128;
  --line: #28313A;
  --line-strong: #3A454F;
  --text: #E8ECEF;
  --dim: #9AA6B0;
  --accent: #4CD681;
  --accent-strong: #6BE49A;
  --accent-ink: #0B2415;
  --accent-soft: rgba(76, 214, 129, 0.12);
  --cover-scrim: linear-gradient(to top, rgba(10, 13, 16, 0.94) 0%, rgba(10, 13, 16, 0.62) 45%, rgba(10, 13, 16, 0.18) 75%, rgba(10, 13, 16, 0.05) 100%);
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-label: "Rajdhani", "Noto Sans TC", sans-serif;
  --article-size: 1.125rem;
  --radius-sm: 3px;
  --radius-md: 4px;
  --shell-width: 1200px;
  --article-width: 800px;
  --chip-cut: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

html[data-theme="light"] {
  --bg: #F2F4F3;
  --bg-raise: #FFFFFF;
  --panel: #FFFFFF;
  --line: #D7DDDA;
  --line-strong: #B9C2BD;
  --text: #161B1E;
  --dim: #566059;
  --accent: #0C7C46;
  --accent-strong: #0A6539;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(12, 124, 70, 0.1);
}

html[data-fontsize="s"] { --article-size: 1.0625rem; }
html[data-fontsize="l"] { --article-size: 1.25rem; }

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

body.nav-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

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

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 90;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

.site-main {
  display: block;
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 0 24px 72px;
}

/* --------------------------------------------------------------------------
   Shared atoms: chips, flags, buttons, section headings
   -------------------------------------------------------------------------- */

.tag-flag {
  display: inline-block;
  padding: 3px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  clip-path: var(--chip-cut);
  font-family: var(--font-label);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

a.tag-flag:hover {
  background: var(--accent-strong);
}

.stat-chip {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.6;
  white-space: nowrap;
}

.button-primary {
  display: inline-block;
  padding: 11px 26px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  clip-path: var(--chip-cut);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  transition: background 0.15s ease, transform 0.15s ease;
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-primary:active {
  transform: translateY(1px);
}

.button-primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 24px;
}

.section-heading h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.3;
}

.section-heading h2::before {
  content: "";
  flex: none;
  width: 16px;
  height: 1.15em;
  background: var(--accent);
  transform: skewX(-14deg);
}

.content-section {
  margin-top: 64px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.header-shell {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--dim);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-raise);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-button,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--dim);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.search-button:hover,
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.search-icon {
  width: 17px;
  height: 17px;
}

.theme-icon {
  width: 18px;
  height: 18px;
}

.theme-icon--moon {
  display: none;
}

html[data-theme="light"] .theme-icon--brightness {
  display: none;
}

html[data-theme="light"] .theme-icon--moon {
  display: block;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 40px;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Homepage: cover story
   -------------------------------------------------------------------------- */

.stage-cover {
  margin-top: 28px;
}

.cover-story {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(380px, 44vw, 520px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel);
}

.cover-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-story::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cover-scrim);
  pointer-events: none;
}

.cover-story.no-media::after {
  background: none;
}

.cover-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: 48px 40px 40px;
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.cover-story h1 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 3.4vw, 2.7rem);
  font-weight: 900;
  line-height: 1.18;
}

.cover-story h1 a:hover {
  color: var(--accent);
}

.cover-story p {
  margin: 0 0 24px;
  max-width: 60ch;
  font-size: 1.02rem;
  line-height: 1.8;
}

/* Text always sits on the dark image scrim, in both themes. */
.cover-story:not(.no-media) .cover-copy {
  color: #F1F4F2;
}

.cover-story:not(.no-media) .stat-chip {
  border-color: rgba(241, 244, 242, 0.45);
  color: rgba(241, 244, 242, 0.85);
}

.cover-story:not(.no-media) h1 a:hover {
  color: var(--accent-strong);
}

html[data-theme="light"] .cover-story:not(.no-media) h1 a:hover {
  color: #7BE8A6;
}

html[data-theme="light"] .cover-story:not(.no-media) .tag-flag {
  background: #2FBF71;
  color: #0B2415;
}

.cover-story.no-media .cover-copy {
  padding-top: 64px;
}

.cover-story.no-media p {
  color: var(--dim);
}

/* --------------------------------------------------------------------------
   Homepage: stage grid (lead + standard cards)
   -------------------------------------------------------------------------- */

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.post-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.post-card.is-lead {
  grid-column: span 2;
  grid-row: span 2;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.post-card-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-raise);
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  padding: 18px 20px 20px;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.post-card h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.45;
}

.post-card.is-lead h3 {
  font-size: 1.5rem;
  line-height: 1.35;
}

.post-card:hover h3 {
  color: var(--accent);
}

.post-card p {
  margin: 0;
  color: var(--dim);
  font-size: 0.92rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card.is-lead p {
  -webkit-line-clamp: 3;
  font-size: 0.98rem;
}

.post-card-text footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Homepage: channel tabs
   -------------------------------------------------------------------------- */

.channel-tabs {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.tab-rail {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  position: relative;
  padding: 14px 24px 12px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 3px;
  background: transparent;
  transform: skewX(-14deg);
}

.tab-button[aria-selected="true"] {
  color: var(--text);
}

.tab-button[aria-selected="true"]::after {
  background: var(--accent);
}

.tab-panel {
  padding: 8px 24px 20px;
}

.channel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.channel-list li + li {
  border-top: 1px solid var(--line);
}

.channel-list a {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.channel-list img {
  width: 96px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-raise);
  display: block;
}

.channel-list a.no-media {
  grid-template-columns: minmax(0, 1fr) auto;
}

.channel-title {
  font-weight: 500;
  line-height: 1.5;
  transition: color 0.15s ease;
}

.channel-list a:hover .channel-title {
  color: var(--accent);
}

.channel-list time {
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.channel-all {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

.channel-all:hover {
  color: var(--accent-strong);
}

/* --------------------------------------------------------------------------
   Homepage: bonus spin strip
   -------------------------------------------------------------------------- */

.bonus-section {
  margin-top: 20px;
}

.bonus-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 22px 28px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.bonus-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bonus-label {
  color: var(--accent);
  font-family: var(--font-label);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.bonus-copy h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.3;
}

.bonus-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bonus-result strong {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bonus-result[href]:hover strong {
  color: var(--accent);
}

.bonus-result[aria-disabled="true"] {
  cursor: default;
}

.bonus-result span {
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bonus-strip.is-spinning .bonus-result {
  animation: bonus-flicker 0.35s linear infinite;
}

@keyframes bonus-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* --------------------------------------------------------------------------
   Archive pages (tag / author / error)
   -------------------------------------------------------------------------- */

.archive-hero {
  max-width: 760px;
  margin: 56px auto 0;
  text-align: center;
}

.archive-label {
  display: inline-block;
  padding: 3px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  clip-path: var(--chip-cut);
  font-family: var(--font-label);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.archive-hero h1 {
  margin: 16px 0 10px;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 900;
  line-height: 1.2;
}

.archive-hero p {
  margin: 0 auto;
  max-width: 56ch;
  color: var(--dim);
}

.error-hero {
  margin-top: 96px;
}

.error-hero .button-primary {
  margin-top: 24px;
}

.archive-section {
  margin-top: 40px;
}

.archive-grid .post-card.is-lead {
  grid-column: auto;
  grid-row: auto;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.pagination.is-empty {
  display: none;
}

.pagination .page-number {
  display: none;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-page,
.pagination-edge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.92rem;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pagination-page:hover,
.pagination-edge:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.pagination-page.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.pagination-ellipsis {
  color: var(--dim);
}

/* Order: newer < pages > older */
.pagination.has-numbers {
  flex-direction: row;
}

.pagination.has-numbers .newer-posts {
  order: 1;
}

.pagination.has-numbers .pagination-pages {
  order: 2;
}

.pagination.has-numbers .older-posts {
  order: 3;
}

/* --------------------------------------------------------------------------
   Article: hero, feature image, toolbar
   -------------------------------------------------------------------------- */

.article-shell {
  margin-top: 48px;
}

.article-hero {
  max-width: var(--article-width);
  margin: 0 auto;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.article-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  font-weight: 900;
  line-height: 1.22;
}

.article-hero > p {
  margin: 0 0 16px;
  color: var(--dim);
  font-size: 1.08rem;
  line-height: 1.8;
}

.article-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.88rem;
}

.article-feature {
  max-width: var(--article-width);
  margin: 32px auto 0;
}

.article-feature img {
  display: block;
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--panel);
}

.article-feature figcaption {
  margin-top: 8px;
  color: var(--dim);
  font-size: 0.85rem;
  text-align: center;
}

.article-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--article-width);
  margin: 28px auto 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  color: var(--dim);
  font-size: 0.85rem;
  font-weight: 500;
}

.toolbar-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--dim);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.toolbar-button:hover {
  color: var(--text);
  border-color: var(--accent);
}

.toolbar-button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.toolbar-copy.is-copied {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.toolbar-copy.is-copied::after {
  content: " ✓";
}

/* --------------------------------------------------------------------------
   Article: layout + rundown TOC
   -------------------------------------------------------------------------- */

.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, var(--article-width));
  justify-content: center;
  gap: 48px;
  margin-top: 40px;
}

.article-layout.toc-empty,
.article-layout.single {
  grid-template-columns: minmax(0, var(--article-width));
}

.article-toc.is-empty {
  display: none;
}

.article-toc {
  position: relative;
}

.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-label);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.toc-caret {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--dim);
  border-bottom: 2px solid var(--dim);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.article-toc.is-open .toc-caret {
  transform: rotate(225deg);
}

.article-toc nav {
  display: none;
  position: sticky;
  top: 24px;
  margin-top: 12px;
  padding-left: 2px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.article-toc.is-open nav {
  display: block;
}

.toc-link {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid var(--line);
  color: var(--dim);
  font-size: 0.88rem;
  line-height: 1.5;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-link.child {
  padding-left: 26px;
  font-size: 0.84rem;
}

.toc-link:hover {
  color: var(--text);
}

.toc-link.is-active {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Article content typography
   -------------------------------------------------------------------------- */

.article-content {
  font-size: var(--article-size);
  line-height: 1.9;
}

.article-content > * {
  margin-top: 0;
  margin-bottom: 1.5em;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  position: relative;
  margin: 2em 0 0.8em;
  scroll-margin-top: 28px;
  font-weight: 900;
  line-height: 1.35;
}

.article-content h2 {
  font-size: 1.5em;
  padding-left: 18px;
}

.article-content h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  width: 7px;
  height: 1em;
  background: var(--accent);
  transform: skewX(-14deg);
}

.article-content h3 {
  font-size: 1.22em;
}

.article-content h4 {
  font-size: 1.05em;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
}

.article-content a:hover {
  text-decoration-color: var(--accent);
}

.article-content ul,
.article-content ol {
  padding-left: 1.4em;
}

.article-content li {
  margin-bottom: 0.4em;
}

.article-content li::marker {
  color: var(--accent);
}

.article-content blockquote {
  margin: 1.5em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--dim);
}

.article-content blockquote p {
  margin: 0.4em 0;
}

.article-content code {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-raise);
  font-size: 0.88em;
}

.article-content pre {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-raise);
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.7;
}

.article-content pre code {
  padding: 0;
  background: none;
}

.article-content hr {
  margin: 2.5em auto;
  width: 120px;
  border: 0;
  height: 3px;
  background: var(--line-strong);
  transform: skewX(-14deg);
}

.article-content img {
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
}

.article-content figcaption {
  margin-top: 8px;
  color: var(--dim);
  font-size: 0.82em;
  text-align: center;
}

.heading-anchor {
  margin-left: 10px;
  color: var(--accent);
  font-size: 0.8em;
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.article-content h2:hover .heading-anchor,
.article-content h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.heading-anchor.is-copied::after {
  content: " 已複製";
  font-size: 0.75em;
}

@media (hover: none) {
  .heading-anchor {
    opacity: 0.55;
  }
}

/* Tables */
.table-scroll {
  margin: 1.5em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  line-height: 1.6;
}

.table-scroll table {
  min-width: 560px;
}

.article-content th,
.article-content td {
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-content th {
  background: var(--bg-raise);
  font-weight: 700;
  white-space: nowrap;
}

.article-content tbody tr:nth-child(even) {
  background: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Ghost kg cards
   -------------------------------------------------------------------------- */

.kg-card {
  margin: 1.8em 0;
}

.kg-image-card img {
  margin: 0 auto;
}

.kg-width-wide,
.kg-width-full {
  max-width: 100%;
}

.article-content .kg-embed-card iframe,
.article-content .kg-video-card video {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: var(--radius-md);
}

.article-content .kg-embed-card iframe[src*="youtube"],
.article-content .kg-embed-card iframe[src*="youtu.be"] {
  min-height: 450px;
}

.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kg-gallery-row {
  display: flex;
  gap: 8px;
}

.kg-gallery-image {
  flex: 1;
  min-width: 0;
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Callout */
.kg-callout-card {
  display: flex;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
}

.kg-callout-emoji {
  flex: none;
  font-size: 1.2em;
  line-height: 1.5;
}

.kg-callout-text {
  font-size: 0.95em;
  line-height: 1.8;
}

.kg-callout-card-grey { border-left: 4px solid var(--line-strong); }
.kg-callout-card-white { border-left: 4px solid var(--line-strong); }
.kg-callout-card-blue { border-left: 4px solid #4A90D9; }
.kg-callout-card-green { border-left: 4px solid var(--accent); }
.kg-callout-card-yellow { border-left: 4px solid #D9B44A; }
.kg-callout-card-red { border-left: 4px solid #D95C4A; }
.kg-callout-card-pink { border-left: 4px solid #D94A8C; }
.kg-callout-card-purple { border-left: 4px solid #9A6BD9; }
.kg-callout-card-accent { border-left: 4px solid var(--accent); }

/* Toggle */
.kg-toggle-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  padding: 0 20px;
}

.kg-toggle-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  cursor: pointer;
}

.kg-toggle-heading h4 {
  margin: 0;
  font-size: 1.02em;
  font-weight: 700;
}

.kg-toggle-card-icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--dim);
  transition: transform 0.15s ease;
}

.kg-toggle-card[data-kg-toggle-state="close"] .kg-toggle-content {
  display: none;
}

.kg-toggle-card[data-kg-toggle-state="open"] .kg-toggle-card-icon {
  transform: rotate(180deg);
}

.kg-toggle-content {
  padding-bottom: 16px;
  font-size: 0.95em;
}

/* Bookmark */
.kg-bookmark-card a {
  text-decoration: none;
}

.kg-bookmark-container {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  overflow: hidden;
  color: var(--text);
  transition: border-color 0.15s ease;
}

.kg-bookmark-container:hover {
  border-color: var(--accent);
}

.kg-bookmark-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
}

.kg-bookmark-title {
  font-size: 0.95em;
  font-weight: 700;
  line-height: 1.5;
}

.kg-bookmark-description {
  margin-top: 4px;
  color: var(--dim);
  font-size: 0.85em;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--dim);
  font-size: 0.8em;
}

.kg-bookmark-icon {
  width: 16px;
  height: 16px;
}

.kg-bookmark-thumbnail {
  flex: none;
  width: 200px;
}

.kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Button card */
.kg-button-card {
  display: flex;
}

.kg-button-card.kg-align-center {
  justify-content: center;
}

.kg-button-card .kg-btn {
  display: inline-block;
  padding: 11px 26px;
  background: var(--accent);
  color: var(--accent-ink);
  clip-path: var(--chip-cut);
  font-weight: 700;
  text-decoration: none;
}

.kg-button-card .kg-btn:hover {
  background: var(--accent-strong);
}

/* Alt blockquote */
.article-content blockquote.kg-blockquote-alt {
  border-left: 0;
  padding: 0 24px;
  text-align: center;
  font-size: 1.15em;
  font-weight: 700;
  color: var(--text);
}

/* File card */
.kg-file-card a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  text-decoration: none;
}

.kg-file-card-title {
  font-weight: 700;
  font-size: 0.95em;
}

.kg-file-card-caption,
.kg-file-card-metadata {
  color: var(--dim);
  font-size: 0.82em;
}

/* --------------------------------------------------------------------------
   Post nav + related
   -------------------------------------------------------------------------- */

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: var(--article-width);
  margin: 56px auto 0;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  transition: border-color 0.15s ease;
}

.post-nav-card:hover {
  border-color: var(--accent);
}

.post-nav-card.next {
  text-align: right;
  grid-column: 2;
}

.post-nav-card.prev {
  grid-column: 1;
}

.post-nav-label {
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.post-nav-card strong {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
}

.post-nav-card:hover strong {
  color: var(--accent);
}

.related-grid .post-card.is-lead {
  grid-column: auto;
  grid-row: auto;
}

/* --------------------------------------------------------------------------
   Contact page
   -------------------------------------------------------------------------- */

.contact-hero p {
  max-width: 62ch;
}

.contact-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  max-width: var(--article-width);
  margin: 36px auto 0;
}

.contact-main {
  padding: 28px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.contact-main h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
  font-weight: 900;
}

.contact-main p {
  margin: 0 0 18px;
  color: var(--dim);
}

.contact-handle {
  display: block;
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raise);
  color: var(--text);
  font-family: var(--font-label);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.contact-handle.is-copied::after {
  content: " ✓ 已複製";
  color: var(--accent);
  font-size: 0.85em;
}

.contact-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-readout {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.contact-readout span {
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.contact-readout strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.contact-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: var(--article-width);
  margin: 20px auto 0;
}

.contact-notes article {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.contact-notes h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
}

.contact-notes p,
.contact-notes ul {
  margin: 0;
  color: var(--dim);
  font-size: 0.92rem;
  line-height: 1.8;
}

.contact-notes ul {
  padding-left: 1.3em;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-raise);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.footer-brand {
  font-size: 1.15rem;
  font-weight: 900;
}

.footer-grid p {
  margin: 12px 0 0;
  max-width: 44ch;
  color: var(--dim);
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-grid h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.footer-grid section a:not(.footer-brand) {
  display: block;
  margin-bottom: 8px;
  color: var(--dim);
  font-size: 0.9rem;
  transition: color 0.15s ease;
}

.footer-grid section a:not(.footer-brand):hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  text-align: center;
  color: var(--dim);
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Back to top
   -------------------------------------------------------------------------- */

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1040px) {
  .stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-card.is-lead {
    grid-column: span 2;
    grid-row: auto;
  }

  .article-layout {
    grid-template-columns: minmax(0, var(--article-width));
  }

  .article-toc {
    max-width: var(--article-width);
    width: 100%;
    margin: 0 auto;
  }

  .article-toc nav {
    position: static;
    max-height: none;
  }
}

@media (max-width: 980px) {
  .site-nav {
    position: fixed;
    inset: 68px 0 0 0;
    z-index: 60;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 16px 24px;
    background: var(--bg);
    overflow-y: auto;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 1.05rem;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  :root {
    --article-size: 1.0625rem;
  }

  html[data-fontsize="s"] {
    --article-size: 1rem;
  }

  html[data-fontsize="l"] {
    --article-size: 1.1875rem;
  }

  .site-main {
    padding: 0 16px 56px;
  }

  .content-section {
    margin-top: 44px;
  }

  .bonus-section {
    margin-top: 14px;
  }

  .stage-cover {
    margin-top: 16px;
  }

  .cover-story {
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .cover-media {
    position: static;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .cover-story::after {
    display: none;
  }

  .cover-copy {
    padding: 20px 18px 24px;
  }

  .cover-story.no-media .cover-copy {
    padding-top: 28px;
  }

  /* On mobile the copy sits below the image on panel background again. */
  .cover-story:not(.no-media) .cover-copy {
    color: var(--text);
  }

  .cover-story:not(.no-media) .stat-chip {
    border-color: var(--line-strong);
    color: var(--dim);
  }

  .cover-story p {
    color: var(--dim);
    font-size: 0.95rem;
  }

  html[data-theme="light"] .cover-story:not(.no-media) .tag-flag {
    background: var(--accent);
    color: var(--accent-ink);
  }

  .stage-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .post-card.is-lead {
    grid-column: auto;
  }

  .tab-rail {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .tab-button {
    padding: 12px 16px 10px;
    white-space: nowrap;
    font-size: 0.95rem;
  }

  .tab-panel {
    padding: 4px 16px 16px;
  }

  .channel-list a {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .channel-list a.no-media {
    grid-template-columns: minmax(0, 1fr);
  }

  .channel-list img {
    width: 72px;
    height: 44px;
  }

  .channel-list time {
    display: none;
  }

  .bonus-strip {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
  }

  .bonus-result strong,
  .bonus-result span {
    white-space: normal;
  }

  .article-shell {
    margin-top: 28px;
  }

  .article-toolbar {
    justify-content: flex-start;
  }

  .article-content .kg-embed-card iframe[src*="youtube"],
  .article-content .kg-embed-card iframe[src*="youtu.be"] {
    min-height: 204px;
  }

  .kg-bookmark-thumbnail {
    display: none;
  }

  .post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav-card.prev,
  .post-nav-card.next {
    grid-column: auto;
  }

  .post-nav-card.next {
    text-align: left;
  }

  .contact-panel,
  .contact-notes {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 36px 16px 24px;
  }

  .header-shell {
    padding: 0 16px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .bonus-strip.is-spinning .bonus-result {
    animation: none;
  }
}
