:root {
  color-scheme: light;
  --paper: #f5f0e6;
  --paper-light: #fffdf7;
  --paper-deep: #e9dfcc;
  --ink: #2b2b2b;
  --ink-soft: #625d54;
  --ink-line: rgba(43, 43, 43, 0.18);
  --cinnabar: #9d2f2f;
  --cinnabar-dark: #742323;
  --ok: #2e7d32;
  --down: #c62828;
  --checking: #9e9e9e;
  --shadow: 0 16px 40px rgba(55, 45, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px),
    radial-gradient(circle at 76% 68%, rgba(83, 72, 53, 0.08) 0 0.8px, transparent 1.4px),
    linear-gradient(103deg, rgba(255, 255, 255, 0.22), transparent 48%, rgba(121, 99, 70, 0.05));
  background-size: 17px 17px, 23px 23px, 100% 100%;
  font-family: "Noto Serif TC", "PingFang TC", "Microsoft JhengHei", serif;
  line-height: 1.65;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--cinnabar-dark);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(157, 47, 47, 0.42);
  outline-offset: 3px;
}

.ink-corner {
  position: fixed;
  z-index: -1;
  width: min(40vw, 520px);
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}

.ink-corner-top {
  top: -150px;
  right: -120px;
}

.ink-corner-bottom {
  bottom: -180px;
  left: -140px;
  transform: rotate(180deg);
}

.site-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 104px;
  padding: 18px clamp(22px, 4vw, 64px);
  border-bottom: 1px solid var(--ink-line);
  background: rgba(245, 240, 230, 0.88);
  backdrop-filter: blur(8px);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.seal {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 4px;
  color: #fff8ec;
  background: var(--cinnabar);
  box-shadow: inset 0 0 0 2px rgba(255, 248, 236, 0.35);
  font-size: 1.55rem;
  font-weight: 800;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-subtitle {
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.09em;
}

.trust {
  margin: 0;
  padding: 7px 16px;
  border: 1px solid rgba(157, 47, 47, 0.35);
  border-radius: 999px;
  color: var(--cinnabar-dark);
  background: rgba(255, 253, 247, 0.76);
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.to-map {
  justify-self: end;
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.mobile-directory-bar {
  display: none;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: calc(100vh - 105px);
}

#sidebar {
  padding: 24px 18px 48px;
  border-right: 1px solid rgba(43, 43, 43, 0.25);
  background: linear-gradient(90deg, rgba(239, 231, 215, 0.88), rgba(249, 245, 235, 0.75));
  box-shadow: 10px 0 24px rgba(50, 41, 29, 0.07);
}

.overview-button {
  width: 100%;
  margin-bottom: 18px;
  padding: 11px 14px;
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  background: rgba(255, 253, 247, 0.72);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.overview-button:hover,
.overview-button.is-active {
  color: #fff;
  background: var(--ink);
}

.folder {
  margin: 0 0 10px;
  border-bottom: 1px solid rgba(43, 43, 43, 0.12);
}

.folder-heading {
  width: 100%;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: left;
}

.folder-caret {
  display: inline-block;
  width: 1.2em;
  color: var(--cinnabar);
}

.folder.is-collapsed .folder-sites {
  display: none;
}

.folder-sites {
  padding: 0 0 10px 10px;
}

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
  margin: 3px 0;
  border-radius: 4px;
}

.site-row:hover,
.site-row.is-active {
  background: rgba(157, 47, 47, 0.09);
}

.site-select {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 9px 4px 9px 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.site-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.last-used {
  display: block;
  margin-top: 1px;
  color: var(--cinnabar-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.external-link {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  text-decoration: none;
}

.external-link:hover {
  color: var(--cinnabar);
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  background: var(--checking);
  box-shadow: 0 0 0 3px rgba(158, 158, 158, 0.12);
}

.status-dot[data-state="ok"] {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.status-dot[data-state="down"] {
  background: var(--down);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.panel {
  width: 100%;
  max-width: 1180px;
  padding: clamp(28px, 5vw, 68px);
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--cinnabar-dark);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.page-title,
.detail-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.lead {
  max-width: 760px;
  margin: 12px 0 32px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0 44px;
}

.countdown-card,
.exam-card,
.detail-copy,
.media-card,
.table-wrap {
  border: 1px solid var(--ink-line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.8);
  box-shadow: var(--shadow);
}

.countdown-card {
  padding: 20px;
  border-top: 4px solid var(--cinnabar);
}

.countdown-card h3,
.exam-card h3 {
  margin: 0 0 8px;
}

.countdown-number {
  margin: 4px 0;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 900;
}

.date-note,
.exam-card p {
  margin: 6px 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.overview-section {
  margin-top: 42px;
}

.overview-section h2 {
  margin-bottom: 14px;
  font-size: 1.45rem;
}

.table-wrap {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.comparison-table th,
.comparison-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(43, 43, 43, 0.11);
  text-align: left;
  vertical-align: top;
}

.comparison-table th {
  background: rgba(233, 223, 204, 0.75);
  white-space: nowrap;
}

.comparison-table tr:last-child td {
  border-bottom: 0;
}

.table-site-button {
  padding: 0;
  border: 0;
  color: var(--cinnabar-dark);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.status-cell {
  white-space: nowrap;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.exam-card {
  padding: 20px;
}

.official-link {
  display: inline-block;
  margin-top: 8px;
  font-weight: 800;
  text-underline-offset: 4px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.media-card {
  overflow: hidden;
}

.site-screenshot {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  background: var(--paper-deep);
}

.detail-copy {
  padding: clamp(22px, 4vw, 36px);
}

.grade-badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  color: #fff;
  background: var(--cinnabar);
  font-size: 0.84rem;
  font-weight: 800;
}

.tagline {
  margin: 14px 0 6px;
  color: var(--cinnabar-dark);
  font-size: 1.05rem;
  font-weight: 800;
}

.stats {
  margin: 0;
  color: var(--ink-soft);
}

.scenario-box {
  margin: 22px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--cinnabar);
  background: rgba(233, 223, 204, 0.45);
}

.scenario-box strong,
.scenario-box span {
  display: block;
}

.enter-btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border-radius: 5px;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}

.enter-btn:hover {
  background: var(--cinnabar);
  transform: translateY(-1px);
}

.share-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 24px;
}

.qr-image {
  display: block;
  width: 116px;
  height: 116px;
  padding: 6px;
  border: 1px solid var(--ink-line);
  background: #fff;
  object-fit: contain;
}

.share-copy p {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.copy-button {
  padding: 8px 13px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.copy-button:hover {
  color: #fff;
  background: var(--ink);
}

.noscript {
  margin: 20px;
  padding: 14px;
  border: 1px solid var(--down);
  background: #fff;
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .trust {
    display: none;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    min-height: 76px;
    padding: 12px 16px;
  }

  .seal {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }

  .brand-title {
    font-size: 1.18rem;
  }

  .brand-subtitle {
    font-size: 0.72rem;
  }

  .to-map {
    font-size: 0.82rem;
  }

  .mobile-directory-bar {
    position: sticky;
    top: 76px;
    z-index: 3;
    display: block;
    border-bottom: 1px solid var(--ink-line);
    background: rgba(245, 240, 230, 0.96);
  }

  .sidebar-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 900;
  }

  .layout {
    display: block;
    min-height: auto;
  }

  #sidebar {
    display: none;
    padding: 14px 16px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--ink-line);
    box-shadow: 0 12px 22px rgba(50, 41, 29, 0.08);
  }

  #sidebar.is-open {
    display: block;
  }

  .panel {
    padding: 28px 18px 110px;
  }

  .countdown-grid,
  .exam-grid {
    grid-template-columns: 1fr;
  }

  .comparison-table th:nth-child(3),
  .comparison-table td:nth-child(3) {
    min-width: 250px;
  }

  .enter-btn {
    position: sticky;
    bottom: 14px;
    z-index: 2;
    box-shadow: 0 8px 24px rgba(43, 43, 43, 0.28);
  }
}

@media (max-width: 440px) {
  .to-map {
    max-width: 76px;
    text-align: right;
  }

  .share-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .qr-image {
    width: 96px;
    height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .enter-btn {
    transition: none;
  }
}
