:root {
  --pbd-safe-top: 0px;
  --pbd-safe-bottom: 0px;
  --pao: #00e5ff;
  --pao-soft: #d8fbff;
  --ink: #ffffff;
  --muted: #c9d3d8;
  --panel: rgba(16, 20, 22, 0.92);
  --panel-solid: #15191c;
  --line: rgba(255, 255, 255, 0.14);
  --warm: #f2d06b;
  --green: #7ed7a3;
  --red: #f09191;
}

@media (display-mode: standalone) {
  :root {
    --pbd-safe-top: env(safe-area-inset-top, 0px);
    --pbd-safe-bottom: env(safe-area-inset-bottom, 0px);
  }
}

html.standalone-mode {
  --pbd-safe-top: env(safe-area-inset-top, 0px);
  --pbd-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: calc(20px + var(--pbd-safe-top)) 20px calc(20px + var(--pbd-safe-bottom)) 20px;
  background-color: #1a1a1a;
  background-image: linear-gradient(rgba(0, 0, 0, 0.48), rgba(0, 0, 0, 0.72)), url("/images/runner-taipei.jpg");
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

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

a:hover {
  text-decoration: underline;
}

.page-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 1px 20px 20px 20px;
  border-radius: 12px;
  background-color: rgba(26, 26, 26, 0.9);
}

.rankings-page .page-shell {
  width: min(940px, 100%);
}

.site-header {
  position: relative;
  margin-bottom: 10px;
  padding-top: 15px;
  text-align: center;
}

.logo-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

.logo-link:hover {
  text-decoration: none;
}

.logo-link:focus-visible,
.button:focus-visible,
.utility-link:focus-visible,
.source-link:focus-visible {
  outline: 2px solid var(--pao);
  outline-offset: 3px;
  border-radius: 6px;
}

.logo {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.logo-char {
  display: inline-block;
  text-align: center;
}

.char-zh {
  display: block;
  color: #fff;
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.char-en {
  display: block;
  color: #cccccc;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: normal;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.accent-color {
  color: var(--pao);
}

.header-note {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: absolute;
  right: 0;
  top: 18px;
}

.utility-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #555;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: #e6e6e6;
  background: rgba(0, 0, 0, 0.32);
  line-height: 1;
}

.utility-link.language-link {
  width: auto;
  min-width: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.detail-header {
  margin-bottom: 18px;
  font-size: 0.95rem;
  text-align: center;
}

.crumb-link,
.crumb-current {
  color: var(--text);
  font-weight: 600;
}

.crumb-link {
  text-decoration: none;
}

.crumb-link:hover {
  text-decoration: underline;
}

.crumb-sep {
  color: var(--muted);
  margin: 0 8px;
}

.hero {
  display: grid;
  align-items: start;
  min-height: 0;
  padding: 16px 0 18px;
  margin-bottom: 14px;
}

.hero-kicker {
  color: var(--pao);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 12px;
}

h1 {
  max-width: 1120px;
  margin: 0 auto;
  font-size: clamp(1.75rem, 3.3vw, 2.45rem);
  line-height: 1.12;
  letter-spacing: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

.heading-line {
  display: block;
}

.heading-accent {
  color: var(--pao);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.18;
}

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

.hero-copy p {
  max-width: 780px;
  margin: 12px 0 0;
  color: #edf7fa;
  font-size: clamp(0.96rem, 1.2vw, 1.02rem);
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hub-hero-actions {
  justify-content: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(0, 229, 255, 0.42);
  border-radius: 7px;
  background: rgba(0, 229, 255, 0.14);
  color: #fff;
  font-weight: 800;
}

.button:disabled,
.ranking-controls input:disabled,
.ranking-controls select:disabled,
.claim-form select:disabled,
.claim-form input:disabled,
.claim-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.button.secondary {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.notice,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.notice {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 8px;
}

.notice p {
  margin: 0;
}

.urgent-status-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(0, 229, 255, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 72, 55, 0.78), rgba(0, 0, 0, 0.62));
  color: #f6fbfb;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.urgent-status-kicker {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 139, 52, 0.42);
  border-radius: 999px;
  background: rgba(255, 139, 52, 0.18);
  color: #ffd7bf;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.urgent-status-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.urgent-status-copy h2 {
  margin: 0;
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.28;
}

.urgent-status-copy span {
  color: rgba(246, 251, 251, 0.82);
  font-size: 0.9rem;
  line-height: 1.45;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #f4fbfd;
  font-size: 0.84rem;
  font-weight: 800;
}

.tag.good {
  border-color: rgba(126, 215, 163, 0.55);
  background: rgba(126, 215, 163, 0.12);
}

.tag.watch {
  border-color: rgba(242, 208, 107, 0.62);
  background: rgba(242, 208, 107, 0.12);
}

.tag.closed {
  border-color: rgba(240, 145, 145, 0.62);
  background: rgba(240, 145, 145, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.layout > *,
.content-stack,
.panel {
  min-width: 0;
}

.content-stack {
  display: grid;
  gap: 18px;
}

.panel {
  padding: clamp(18px, 3vw, 28px);
  border-radius: 8px;
}

.panel h2,
.major-glance-section h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.2;
}

.major-glance-section {
  min-width: 0;
}

.panel-centered-heading > h2 {
  text-align: center;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 1.12rem;
}

.race-card-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.race-card-heading h3 {
  margin: 0;
}

.race-card-subtitle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  margin: 0;
  padding: 3px 9px;
  border: 1px solid rgba(0, 229, 255, 0.24);
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.08);
  color: var(--pao);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.panel p {
  margin: 0 0 12px;
}

.article-panel {
  display: grid;
  gap: 12px;
}

.article-panel h2 {
  max-width: 780px;
}

.article-panel p {
  max-width: 840px;
  color: #eef7fa;
  font-size: clamp(0.98rem, 1.25vw, 1.05rem);
  line-height: 1.75;
}

.article-panel p:last-child {
  margin-bottom: 0;
}

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

.fine-print {
  color: #aebcc1;
  font-size: 0.88rem;
}

.major-glance-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.major-glance-card {
  display: flex;
  gap: 15px;
  align-items: stretch;
  min-width: 0;
  padding: 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: #1c1e21;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.major-glance-card:hover,
.major-glance-card:focus-visible {
  border-color: rgba(0, 123, 255, 0.18);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1), 0 10px 24px rgba(0, 123, 255, 0.14);
  text-decoration: none;
  transform: translateY(-1px);
}

.major-glance-card:focus-visible {
  outline: 2px solid var(--pao);
  outline-offset: 3px;
}

.major-glance-date {
  display: flex;
  flex: 0 0 100px;
  flex-direction: column;
  align-items: center;
  padding-right: 15px;
  border-right: 1px solid #e9ebee;
  text-align: center;
  line-height: 1.1;
}

.major-glance-month {
  color: #e74c3c;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
}

.major-glance-day {
  color: #1c1e21;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
}

.major-glance-city {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 10px;
  text-align: center;
}

.major-glance-city span,
.major-glance-mobile-city span {
  display: block;
  line-height: 1.3;
}

.city-zh {
  color: #333;
  font-size: 1rem;
  font-weight: 600;
}

.city-en {
  color: #606770;
  font-size: 0.85rem;
}

.major-glance-mobile-city {
  display: none;
}

.major-glance-details,
.major-glance-title {
  min-width: 0;
}

.major-glance-details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
}

.major-glance-title strong,
.major-glance-title span {
  display: block;
}

.major-glance-title strong {
  color: #1c1e21;
  font-size: 1.38rem;
  line-height: 1.2;
}

.major-glance-title span {
  margin-top: 4px;
  color: #606770;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.major-glance-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.major-glance-tag {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 20px;
  background: #e7f3ff;
  color: #007bff;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}

.major-glance-deadline {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: auto;
  padding: 6px 12px;
  border: 1px solid #ffe58f;
  border-radius: 6px;
  background: #fffbe6;
}

.major-glance-deadline .deadline-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: #d46b08;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

.major-glance-bullets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 12px 0 0;
  padding: 0;
  color: #606770;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  list-style: none;
}

.major-glance-bullets li {
  position: relative;
  padding-left: 12px;
  white-space: nowrap;
}

.major-glance-bullets li::before {
  content: "";
  position: absolute;
  top: 0.58em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e74c3c;
}

.race-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.race-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.race-table th,
.race-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.race-table th {
  color: var(--pao);
  font-size: 0.84rem;
  text-transform: uppercase;
}

.entry-grid,
.decision-grid,
.race-card-grid,
.club-grid {
  display: grid;
  gap: 14px;
}

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

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

.mini-card,
.race-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.mini-card strong,
.race-card strong {
  display: block;
  margin-bottom: 6px;
}

.race-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.race-card .tag-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.race-card .tag {
  justify-content: center;
  width: 100%;
  border-color: rgba(0, 229, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf8fb;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.race-card ul {
  margin: 0;
  padding-left: 20px;
}

.race-card li + li,
.check-list li + li,
.source-list li + li {
  margin-top: 7px;
}

.source-list {
  margin: 0;
  padding-left: 20px;
}

.source-link {
  align-self: flex-start;
  font-weight: 800;
}

.rankings-hero {
  min-height: 0;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.stat-card strong {
  display: block;
  color: #fff;
  font-size: 1.9rem;
  line-height: 1.05;
}

.stat-card span {
  display: block;
  margin-top: 6px;
  color: var(--pao);
  font-weight: 800;
}

.stat-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.ranking-controls,
.claim-form {
  display: grid;
  gap: 12px;
}

.ranking-controls {
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(130px, 1fr));
  align-items: end;
  margin-bottom: 12px;
}

.ranking-controls label,
.claim-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.ranking-controls input,
.ranking-controls select,
.claim-form select,
.claim-form input,
.claim-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font: inherit;
}

.ranking-controls input,
.ranking-controls select,
.claim-form select,
.claim-form input {
  padding: 8px 10px;
}

.claim-form textarea {
  padding: 10px;
  resize: vertical;
}

.ranking-count {
  margin: 0 0 10px;
}

.loading-row td {
  padding: 24px 12px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.ranking-table th button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pao);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.ranking-table {
  min-width: 560px;
  table-layout: fixed;
  font-size: 0.93rem;
}

.ranking-table th,
.ranking-table td {
  padding: 9px 7px;
}

.ranking-table th:nth-child(1),
.ranking-table td:nth-child(1) {
  width: 52px;
  white-space: nowrap;
}

.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3) {
  width: 64px;
  text-align: center;
}

.ranking-table th:nth-child(4),
.ranking-table td:nth-child(4) {
  width: 74px;
}

.ranking-table th:nth-child(5),
.ranking-table td:nth-child(5) {
  width: 112px;
}

.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2) {
  width: 230px;
}

.ranking-table td {
  overflow-wrap: anywhere;
}

.runner-name-cell .muted {
  font-size: 0.84rem;
}

.claim-inline-link {
  color: var(--pao);
  font-weight: 800;
  text-decoration: none;
}

.claim-inline-link:hover {
  text-decoration: underline;
}

.star-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(242, 208, 107, 0.68);
  border-radius: 50%;
  color: #fff;
  background: rgba(242, 208, 107, 0.14);
  font-weight: 900;
}

.claim-form {
  max-width: 760px;
}

.runner-claim-form {
  max-width: none;
}

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

.claim-match-status {
  min-height: 22px;
  margin: -2px 0 0;
}

.feedback-status {
  min-height: 24px;
  margin: 0;
  color: var(--pao-soft);
  font-weight: 800;
}

.feedback-status[data-mode="ok"] {
  color: var(--green);
}

.feedback-status[data-mode="error"] {
  color: var(--red);
}

.site-footer {
  margin-top: 18px;
  padding: 18px 0 0;
  color: #aebcc1;
  font-size: 0.88rem;
}

.site-footer a {
  font-weight: 700;
}

.footer-topics {
  margin-top: 10px;
  line-height: 1.55;
}

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

  .stat-grid,
  .ranking-controls {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    display: grid;
  }

}

@media (max-width: 720px) {
  body {
    padding: calc(10px + var(--pbd-safe-top)) 10px calc(10px + var(--pbd-safe-bottom)) 10px;
    background-attachment: scroll;
  }

  .page-shell {
    padding: 1px 10px 10px 10px;
    border-radius: 0;
    background-color: transparent;
  }

  .header-actions {
    top: 14px;
    right: 0;
  }

  .header-actions.has-language-switch {
    left: 0;
    right: 0;
    justify-content: space-between;
  }

  .utility-link {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
  }

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

  .urgent-status-panel {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }

  .urgent-status-kicker {
    align-self: flex-start;
    padding: 5px 9px;
  }

  .header-note {
    text-align: left;
  }

  .hero {
    padding: 12px 0 16px;
  }

  .entry-grid,
  .decision-grid,
  .major-glance-grid,
  .race-card-grid,
  .club-grid,
  .stat-grid,
  .ranking-controls,
  .claim-form-grid {
    grid-template-columns: 1fr;
  }

  .major-glance-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "date city"
      "details details";
    gap: 12px 14px;
    padding: 15px;
  }

  .major-glance-date {
    grid-area: date;
    flex-basis: auto;
    align-items: flex-start;
    width: auto;
    min-width: 0;
    padding-right: 0;
    padding-bottom: 10px;
    border-right: none;
    border-bottom: 1px solid #e9ebee;
  }

  .major-glance-month {
    font-size: 1.6rem;
    line-height: 1.05;
    text-align: left;
  }

  .major-glance-day {
    font-size: 2.2rem;
    text-align: left;
  }

  .major-glance-city-desktop {
    display: none;
  }

  .major-glance-mobile-city {
    display: block;
    grid-area: city;
    justify-self: end;
    align-self: start;
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ebee;
    text-align: right;
  }

  .major-glance-details {
    grid-area: details;
  }

  .major-glance-title strong {
    font-size: 1.2rem;
  }

  .major-glance-tags {
    margin: 10px 0 12px;
  }

  .major-glance-deadline {
    width: 100%;
  }

  .major-glance-bullets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

}
