:root {
  --ink: #18212f;
  --muted: #5d6878;
  --line: #d8dee8;
  --panel: #ffffff;
  --paper: #f5f7fa;
  --blue: #174ea6;
  --blue-strong: #103c7f;
  --teal: #0f766e;
  --amber: #b36b00;
  --red: #ad3434;
  --green: #23683b;
  --shadow: 0 12px 30px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.5;
  overflow-x: clip;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 18px clamp(18px, 4vw, 48px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

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

.brand-logo {
  width: clamp(132px, 16vw, 220px);
  height: auto;
  display: block;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.32rem, 2.3vw, 2.2rem);
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.header-meta {
  display: grid;
  gap: 2px;
  text-align: right;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.header-meta strong {
  color: var(--blue-strong);
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  padding: 18px clamp(14px, 3vw, 36px) 36px;
}

.overview-band,
.profile-band,
.control-band,
.workspace-band,
.detail-band,
.table-band {
  width: min(1280px, 100%);
  min-width: 0;
  margin: 0 auto;
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 18px;
  align-items: stretch;
  padding: clamp(18px, 3vw, 30px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overview-copy p:last-child {
  max-width: 820px;
  margin: 12px 0 0;
  color: var(--muted);
}

.overview-copy,
.metric-strip,
.profile-form,
.product-grid,
.detail-panel,
.table-shell {
  min-width: 0;
}

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

.metric {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfe;
}

.metric span {
  color: var(--muted);
  font-size: 0.84rem;
}

.metric strong {
  max-width: 100%;
  margin-top: 4px;
  color: var(--blue-strong);
  font-size: clamp(1.35rem, 2.5vw, 2.08rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
}

.metric:last-child strong {
  font-size: 1.55rem;
}

.profile-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr) minmax(230px, 0.55fr);
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile-copy p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}

.profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.profile-form select,
.profile-form input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.profile-form select:focus,
.profile-form input:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(23, 78, 166, 0.14);
}

.profile-result {
  display: grid;
  align-content: center;
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfe;
}

.profile-result span,
.profile-result small {
  color: var(--muted);
}

.profile-result strong {
  color: var(--blue-strong);
  font-size: 1.45rem;
  line-height: 1.2;
}

.control-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-control button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.segmented-control button:hover,
.segmented-control button:focus-visible {
  border-color: var(--blue);
  outline: none;
}

.segmented-control button.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot-primary {
  background: var(--blue);
}

.dot-secondary {
  background: var(--teal);
}

.dot-focus {
  background: var(--amber);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0 12px;
}

.section-title-group {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.table-actions button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue-strong);
  cursor: pointer;
  font-weight: 800;
}

.table-actions button:hover,
.table-actions button:focus-visible {
  background: var(--blue);
  color: #ffffff;
  outline: none;
}

.table-actions button:disabled {
  border-color: var(--line);
  background: #f1f4f8;
  color: var(--muted);
  cursor: wait;
}

.workspace-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 16px;
  align-items: start;
}

.product-grid-area,
.detail-band {
  min-width: 0;
}

.product-grid-area .section-heading,
.detail-band .section-heading {
  display: grid;
  justify-content: start;
  gap: 4px;
  margin-top: 0;
}

.detail-band {
  position: sticky;
  top: 14px;
}

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

.product-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 10px;
  min-height: 270px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(24, 33, 47, 0.06);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.product-card:hover,
.product-card:focus-visible,
.product-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 14px 28px rgba(23, 78, 166, 0.13);
  outline: none;
  transform: translateY(-2px);
}

.product-card.tier-secondary {
  border-top-color: var(--teal);
}

.product-card.tier-focus {
  border-top-color: var(--amber);
}

.product-card.is-unavailable {
  border-top-color: var(--red);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rank-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--blue-strong);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge {
  background: #f1f4f8;
  color: var(--muted);
  font-weight: 700;
}

.score-lockup {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.score-lockup strong {
  color: var(--blue-strong);
  font-size: 2.28rem;
  line-height: 1;
}

.score-lockup span {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.product-card h3 {
  color: var(--ink);
}

.product-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.card-profile-premium {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfe;
}

.card-profile-premium span {
  color: var(--muted);
  font-size: 0.78rem;
}

.card-profile-premium strong {
  color: var(--blue-strong);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.card-profile-premium.is-warning strong {
  color: var(--red);
  font-size: 0.94rem;
}

.mini-score-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-self: end;
}

.mini-score {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.mini-score span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.mini-score strong {
  color: var(--ink);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.detail-panel {
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.detail-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-title-group {
  display: grid;
  gap: 6px;
}

.detail-title-group p {
  margin: 0;
  color: var(--muted);
}

.detail-score {
  display: grid;
  justify-items: start;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.detail-score strong {
  color: var(--blue-strong);
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 0.95;
}

.detail-score span {
  color: var(--muted);
  font-size: 0.9rem;
}

.score-bars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.score-bar {
  display: grid;
  gap: 8px;
}

.score-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e9eef5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--bar-width);
  min-width: 2px;
  border-radius: inherit;
  background: var(--blue);
}

.bar-fill.premium {
  background: var(--teal);
}

.bar-fill.extra {
  background: var(--amber);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.detail-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.detail-block h3 {
  margin-bottom: 8px;
  color: var(--blue-strong);
}

.detail-block p,
.detail-block li {
  color: var(--muted);
}

.detail-block p {
  margin: 0;
}

.detail-block ul {
  margin: 0;
  padding-left: 20px;
}

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

.premium-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.premium-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.premium-item strong {
  color: var(--ink);
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.premium-item.is-warning strong {
  color: var(--red);
  white-space: normal;
}

.table-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.source-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.download-link-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

.download-link:hover,
.download-link:focus-visible {
  background: var(--blue-strong);
  border-color: var(--blue-strong);
  color: #ffffff;
  outline: none;
  text-decoration: none;
}

.source-link-row a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
}

.table-shell {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  table-layout: fixed;
}

.comparison-table {
  min-width: 1750px;
}

.comparison-table .col-rank {
  width: 72px;
}

.comparison-table .col-product {
  width: 220px;
}

.comparison-table .col-period,
.comparison-table .col-ratio,
.comparison-table .col-score {
  width: 110px;
}

.comparison-table .col-critical {
  width: 260px;
}

.comparison-table .col-death,
.comparison-table .col-special {
  width: 220px;
}

.comparison-table .col-waiver,
.comparison-table .col-premium {
  width: 150px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  background: #0f4382;
  color: #ffffff;
  font-size: 0.8rem;
}

td {
  color: var(--muted);
}

td strong {
  color: var(--ink);
}

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

.numeric-cell {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ratio-cell {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.product-name-cell {
  display: grid;
  gap: 3px;
}

.product-name-cell span {
  color: var(--ink);
  font-weight: 800;
}

.product-name-cell small {
  color: var(--muted);
  font-size: 0.82rem;
}

.export-capture {
  position: fixed;
  top: 0;
  left: -100000px;
  z-index: -1;
  display: grid;
  gap: 16px;
  padding: 32px;
  background: #ffffff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

.export-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.export-title-row p,
.export-meta,
.export-note {
  margin: 0;
}

.export-title-row h2 {
  margin: 4px 0 0;
  font-size: 2rem;
}

.export-title-row p,
.export-meta {
  color: var(--blue-strong);
  font-weight: 800;
}

.export-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .workspace-band {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
  }
}

@media (max-width: 900px) {
  .site-header,
  .control-band,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .header-meta {
    text-align: left;
    white-space: normal;
  }

  .overview-band {
    grid-template-columns: 1fr;
  }

  .profile-band {
    grid-template-columns: 1fr;
  }

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

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

  .workspace-band {
    grid-template-columns: 1fr;
  }

  .detail-band {
    position: static;
  }

  .detail-panel {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  main {
    padding-inline: 12px;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-form,
  .product-grid,
  .download-link-row,
  .premium-row {
    grid-template-columns: 1fr;
  }

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

  .metric {
    min-height: 86px;
    padding: 11px 10px;
  }

  .metric strong {
    font-size: 1.35rem;
  }

  .metric:last-child strong {
    font-size: 1.15rem;
  }

  .product-card {
    min-height: 0;
  }

  .control-band {
    padding: 12px;
  }

  .segmented-control button {
    flex: 1 1 calc(50% - 8px);
  }
}
