:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #17202b;
  background: #eef2f5;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.site-header {
  align-items: center;
  background: rgba(248, 250, 252, 0.96);
  border-bottom: 1px solid #d4dce5;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 66px;
  padding: 10px clamp(18px, 4vw, 52px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand,
.site-nav,
.header-actions,
.section-head.row,
.section-actions,
.filters,
.result-meta,
.detail-actions,
.board-head,
.site-footer {
  align-items: center;
  display: flex;
}

.brand {
  font-weight: 800;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: #28566f;
  border-radius: 7px;
  color: #ffffff;
  display: inline-flex;
  font-size: 13px;
  height: 36px;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav {
  color: #536172;
  gap: 20px;
  justify-content: center;
}

.site-nav a:hover {
  color: #28566f;
}

.header-actions,
.section-actions {
  gap: 10px;
}

.theme-toggle {
  align-items: center;
  background: #ffffff;
  border: 1px solid #c5d0db;
  border-radius: 6px;
  color: #17202b;
  cursor: pointer;
  display: inline-flex;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
}

.theme-icon {
  align-items: center;
  background: #e5eff4;
  border-radius: 5px;
  color: #28566f;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.theme-toggle[aria-pressed="true"] .theme-icon {
  background: #f5d38a;
  color: #49340a;
}

.segmented {
  background: #e5ebf1;
  border: 1px solid #ccd6df;
  border-radius: 7px;
  display: inline-flex;
  padding: 3px;
}

.segmented button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #4d5d70;
  cursor: pointer;
  min-height: 30px;
  padding: 4px 10px;
}

.segmented button.active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 32, 43, 0.14);
  color: #17202b;
}

.admin-link {
  border: 1px solid #c5d0db;
  border-radius: 6px;
  color: #4b5a6b;
  padding: 7px 11px;
}

.admin-link:hover,
.button:hover,
.tool-link:hover,
.result-card:hover {
  background: #ffffff;
}

main {
  display: grid;
  gap: 28px;
}

.tool-hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  padding: 28px clamp(18px, 6vw, 80px) 4px;
}

.hero-dashboard {
  background:
    linear-gradient(135deg, rgba(21, 32, 40, 0.94), rgba(40, 86, 111, 0.72)),
    url("https://images.unsplash.com/photo-1462331940025-496dfbfc7564?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  border: 1px solid #cdd7e0;
  border-radius: 8px;
  color: #ffffff;
  display: grid;
  min-height: 360px;
  padding: clamp(26px, 5vw, 48px);
}

.hero-copy {
  max-width: 780px;
}

.eyebrow {
  color: #28566f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.tool-hero .eyebrow {
  color: #c7e9f3;
}

.hero-copy h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  margin: 0;
  max-width: 780px;
}

.hero-text {
  color: #e4f0f5;
  font-size: clamp(16px, 1.8vw, 20px);
  max-width: 720px;
}

.status-strip {
  align-self: end;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  color: #17202b;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 38px;
  padding: 10px;
}

.status-strip article,
.metric-grid article,
.detail-grid article {
  background: #f5f8fa;
  border: 1px solid #dbe4eb;
  border-radius: 7px;
  padding: 10px;
}

.status-strip span,
.detail-grid span,
.compact-list small,
.tool-link small {
  color: #657588;
  display: block;
  font-size: 12px;
}

.status-strip strong {
  display: block;
  font-size: 24px;
  margin-top: 2px;
}

.hero-tools {
  display: grid;
  gap: 12px;
}

.tool-link {
  background: #ffffff;
  border: 1px solid #d4dce5;
  border-radius: 8px;
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 16px;
}

.tool-link.primary {
  border-color: #28566f;
}

.tool-link span {
  color: #6d7d90;
  font-size: 12px;
  font-weight: 800;
}

.tool-link strong {
  font-size: 19px;
}

.quick-start,
.library,
.leaderboard,
.insights,
.contribute,
.faq,
.feedback-band {
  padding: 0 clamp(18px, 6vw, 80px);
}

.section-head {
  margin-bottom: 18px;
}

.section-head h2,
.contribute h2,
.leaderboard h2,
.insights h2,
.faq h2,
.feedback-band h2 {
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.1;
  margin: 0;
}

.section-head.row {
  justify-content: space-between;
  gap: 18px;
}

.button,
button.button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #c5d0db;
  border-radius: 6px;
  color: #17202b;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
}

.button.primary {
  background: #28566f;
  border-color: #28566f;
  color: #ffffff;
}

.button.subtle {
  background: #eef3f6;
}

.library {
  display: grid;
  gap: 14px;
}

.leaderboard {
  display: grid;
  gap: 14px;
}

.leaderboard-filter {
  color: #536174;
  display: grid;
  font-size: 13px;
  gap: 6px;
  min-width: min(300px, 100%);
}

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

.leaderboard-grid > article {
  background: #ffffff;
  border: 1px solid #d4dce5;
  border-radius: 8px;
  padding: 18px;
}

.board-head {
  border-bottom: 1px solid #e2e8ef;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.board-head h3 {
  font-size: 21px;
  margin: 0;
}

.board-head > strong {
  align-items: center;
  background: #eef3f6;
  border-radius: 7px;
  color: #28566f;
  display: inline-flex;
  font-size: 24px;
  min-height: 46px;
  min-width: 58px;
  justify-content: center;
  padding: 6px 10px;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dce4ec;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  min-height: 68px;
  padding: 10px;
}

.rank-number {
  align-items: center;
  background: #e7eef3;
  border-radius: 7px;
  color: #28566f;
  display: inline-flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.rank-1 .rank-number {
  background: #fff3d8;
  color: #775506;
}

.rank-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rank-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-main small,
.rank-score span,
.rank-verified span {
  color: #657588;
  font-size: 12px;
}

.rank-score,
.rank-verified {
  display: grid;
  justify-items: end;
  min-width: 58px;
}

.rank-score strong,
.rank-verified strong {
  font-size: 20px;
}

.filters {
  background: #ffffff;
  border: 1px solid #d4dce5;
  border-radius: 8px;
  gap: 12px;
  padding: 14px;
}

.filters label {
  color: #536174;
  display: grid;
  flex: 1;
  font-size: 13px;
  gap: 6px;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #c6d2dc;
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #28566f;
  outline: 2px solid rgba(40, 86, 111, 0.14);
}

.library-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
}

.result-list {
  display: grid;
  gap: 10px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.result-card {
  background: #ffffff;
  border: 1px solid #d4dce5;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.result-card.active {
  border-color: #28566f;
  box-shadow: inset 3px 0 0 #28566f;
}

.result-card h3 {
  font-size: 18px;
  margin: 0;
}

.result-meta {
  color: #637286;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.pill.verified,
.pill.Official_Group {
  background: #e3f4ea;
  color: #1f6a42;
}

.pill.Manual {
  background: #fff3d8;
  color: #775506;
}

.pill.AI_Auto {
  background: #e6f0f7;
  color: #28566f;
}

.detail-panel {
  align-self: start;
  background: #ffffff;
  border: 1px solid #d4dce5;
  border-radius: 8px;
  min-height: 360px;
  padding: 18px;
  position: sticky;
  top: 88px;
}

.detail-panel h3 {
  font-size: 24px;
  margin: 0 0 8px;
}

.detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 16px 0;
}

.detail-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  color: #637286;
  display: grid;
  gap: 8px;
  min-height: 280px;
  place-content: center;
  text-align: center;
}

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

.insights article,
.steps article,
.contribute-grid article,
.faq-grid details {
  background: #ffffff;
  border: 1px solid #d4dce5;
  border-radius: 8px;
  padding: 18px;
}

.compact-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.compact-list div {
  align-items: center;
  border-top: 1px solid #e4eaf0;
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
}

.steps,
.contribute-grid,
.faq-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.steps span {
  align-items: center;
  background: #e5eff4;
  border-radius: 50%;
  color: #28566f;
  display: inline-flex;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.steps h3,
.contribute-grid strong {
  display: block;
  font-size: 18px;
  margin: 12px 0 6px;
}

.steps p,
.contribute p,
.contribute-grid span,
.faq p,
.feedback-band p {
  color: #5e6d7f;
  margin: 0;
}

.feedback-band {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d4dce5;
  border-top: 1px solid #d4dce5;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 10px;
  padding-bottom: 28px;
  padding-top: 28px;
}

.contribute {
  align-items: center;
  background: #22303a;
  color: #ffffff;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  margin-top: 8px;
  padding-bottom: 38px;
  padding-top: 38px;
}

.contribute-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.contribute .eyebrow {
  color: #b8d7e5;
}

.contribute p,
.contribute-grid span {
  color: #c9d4dc;
}

.contribute-grid article {
  background: #2e3d48;
  border-color: #41515d;
}

.faq {
  padding-bottom: 38px;
}

.faq-grid summary {
  cursor: pointer;
  font-weight: 800;
}

.site-footer {
  border-top: 1px solid #d4dce5;
  color: #617083;
  justify-content: space-between;
  padding: 20px clamp(18px, 6vw, 80px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  color: #e1edf4;
  background: #070a0e;
}

:root[data-theme="dark"] body {
  background: #070a0e;
}

:root[data-theme="dark"] .site-header {
  background: rgba(8, 12, 17, 0.96);
  border-bottom-color: #1d2a36;
}

:root[data-theme="dark"] .site-nav,
:root[data-theme="dark"] .admin-link,
:root[data-theme="dark"] .result-meta,
:root[data-theme="dark"] .leaderboard-filter,
:root[data-theme="dark"] .filters label,
:root[data-theme="dark"] .steps p,
:root[data-theme="dark"] .faq p,
:root[data-theme="dark"] .feedback-band p,
:root[data-theme="dark"] .compact-list small,
:root[data-theme="dark"] .rank-main small,
:root[data-theme="dark"] .rank-score span,
:root[data-theme="dark"] .rank-verified span,
:root[data-theme="dark"] .status-strip span,
:root[data-theme="dark"] .detail-grid span,
:root[data-theme="dark"] .tool-link small,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .site-footer {
  color: #9fafbd;
}

:root[data-theme="dark"] .site-nav a:hover,
:root[data-theme="dark"] .eyebrow {
  color: #7fb7d4;
}

:root[data-theme="dark"] .segmented,
:root[data-theme="dark"] .theme-icon {
  background: #111923;
  border-color: #223140;
}

:root[data-theme="dark"] .segmented button {
  color: #9fafbd;
}

:root[data-theme="dark"] .segmented button.active,
:root[data-theme="dark"] .button,
:root[data-theme="dark"] button.button,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .admin-link,
:root[data-theme="dark"] .tool-link,
:root[data-theme="dark"] .filters,
:root[data-theme="dark"] .leaderboard-grid > article,
:root[data-theme="dark"] .result-card,
:root[data-theme="dark"] .detail-panel,
:root[data-theme="dark"] .insights article,
:root[data-theme="dark"] .steps article,
:root[data-theme="dark"] .faq-grid details,
:root[data-theme="dark"] .feedback-band {
  background: #0f171f;
  border-color: #223140;
  color: #e1edf4;
}

:root[data-theme="dark"] .admin-link:hover,
:root[data-theme="dark"] .button:hover,
:root[data-theme="dark"] .tool-link:hover,
:root[data-theme="dark"] .result-card:hover {
  background: #14202b;
}

:root[data-theme="dark"] .button.primary {
  background: #5b9ab9;
  border-color: #5b9ab9;
  color: #071118;
}

:root[data-theme="dark"] .button.subtle,
:root[data-theme="dark"] .status-strip article,
:root[data-theme="dark"] .metric-grid article,
:root[data-theme="dark"] .detail-grid article,
:root[data-theme="dark"] .board-head > strong,
:root[data-theme="dark"] .ranking-row,
:root[data-theme="dark"] .rank-number,
:root[data-theme="dark"] .steps span {
  background: #0b1118;
  border-color: #1d2a36;
  color: #e1edf4;
}

:root[data-theme="dark"] .status-strip {
  background: rgba(8, 12, 17, 0.94);
  border-color: rgba(128, 161, 181, 0.28);
  color: #e1edf4;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #090f15;
  border-color: #223140;
  color: #e1edf4;
}

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
  border-color: #7fb7d4;
  outline-color: rgba(127, 183, 212, 0.22);
}

:root[data-theme="dark"] .board-head,
:root[data-theme="dark"] .compact-list div {
  border-color: #1d2a36;
}

:root[data-theme="dark"] .pill.verified,
:root[data-theme="dark"] .pill.Official_Group {
  background: #173627;
  color: #93e0b5;
}

:root[data-theme="dark"] .pill.Manual {
  background: #392d13;
  color: #f0cf7f;
}

:root[data-theme="dark"] .pill.AI_Auto {
  background: #132e3d;
  color: #91c8e4;
}

:root[data-theme="dark"] .contribute {
  background: #0b1118;
}

:root[data-theme="dark"] .contribute-grid article {
  background: #0f171f;
  border-color: #223140;
}

:root[data-theme="dark"] .contribute p,
:root[data-theme="dark"] .contribute-grid span {
  color: #adbac7;
}

:root[data-theme="dark"] .site-footer {
  border-top-color: #1d2a36;
}

@media (max-width: 1050px) {
  .site-header,
  .tool-hero,
  .library-layout,
  .leaderboard-grid,
  .insights,
  .contribute {
    grid-template-columns: 1fr;
  }

  .site-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters,
  .section-head.row,
  .section-actions,
  .feedback-band {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .steps,
  .contribute-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .site-header {
    gap: 10px;
  }

  .brand span:last-child {
    max-width: 180px;
  }

  .header-actions {
    justify-content: space-between;
  }

  .hero-dashboard {
    min-height: 0;
    padding: 22px;
  }

  .hero-copy h1 {
    font-size: 34px;
  }

  .status-strip,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .rank-score,
  .rank-verified {
    justify-items: start;
    margin-left: 48px;
  }
}
