* {
  box-sizing: border-box;
}

:root {
  --pao-color-standard: #00e5ff;
  --pao-color-lighter: #6ef1ff;
  --pao-color-very-light: #d8fbff;
  --pbd-safe-top: 0px;
  --pbd-safe-bottom: 0px;
}

@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);
}

body {
  margin: 0;
  padding: calc(20px + var(--pbd-safe-top)) 20px calc(20px + var(--pbd-safe-bottom)) 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #1a1a1a;
  background-image: url('/images/runner-taipei.jpg');
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  color: #fff;
}

a {
  color: var(--pao-color-very-light);
}

.inline-map-link {
  color: var(--pao-color-very-light);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.inline-map-link:hover {
  color: #ffffff;
}

.status-link {
  color: #f0f0f0;
  font-weight: 700;
  text-decoration: none;
}

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

.status-link.muted-link {
  color: #c7d6db;
}

.detail-shell {
  max-width: 900px;
  margin: 0 auto;
  background-color: rgba(26, 26, 26, 0.9);
  border-radius: 12px;
  padding: 1px 20px 20px;
}

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

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

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

.logo-link:focus-visible,
.utility-link:focus-visible,
.crumb-link:focus-visible,
.site-footer a:focus-visible,
.related-list li a:focus-visible,
.button:focus-visible,
.feedback-trigger:focus-visible,
.feedback-reason:focus-visible,
.feedback-target-select:focus-visible {
  outline: 2px solid var(--pao-color-standard);
  outline-offset: 3px;
  border-radius: 6px;
}

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

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

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

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

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

.utility-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f5fbff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.utility-link:hover {
  background: rgba(0, 229, 255, 0.14);
  border-color: rgba(0, 229, 255, 0.36);
  color: var(--pao-color-standard);
}

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

.country-toggle {
  display: flex;
  justify-content: center;
  margin: 12px 0 12px;
}

.country-toggle-pill {
  display: inline-flex;
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.country-toggle-link,
.country-toggle-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.country-toggle-link {
  color: #aaa;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.country-toggle-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.country-toggle-current {
  color: var(--pao-color-standard);
  border: 1px solid rgba(0, 229, 255, 0.5);
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
  font-weight: 700;
}

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

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

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

.crumb-sep {
  color: #8fb0b9;
  margin: 0 8px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero,
section,
.info-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.hero {
  padding: 24px 20px;
}

section {
  padding: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
  background: transparent;
  border: 0;
}

.info-card {
  padding: 16px;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.2;
  color: #ffffff;
}

h2 {
  margin-top: 8px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  color: #cccccc;
  font-weight: 500;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
  color: #ffffff;
}

.info-card h3 {
  color: var(--pao-color-standard);
}

p {
  color: #f0f0f0;
  line-height: 1.6;
}

.muted,
.edition-date-en,
.edition-location-en,
.feedback-target-note {
  color: #c7d6db;
}

.hero-actions,
.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.button,
.feedback-trigger,
.feedback-reason {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:hover,
.feedback-trigger:hover,
.feedback-reason:hover {
  transform: translateY(-1px);
}

.button.primary,
.feedback-trigger:not(.neutral) {
  background: #00a6bd;
  color: #ffffff;
  padding: 12px 18px;
}

.button.primary:hover,
.feedback-trigger:not(.neutral):hover {
  background: #0094aa;
}

.button.secondary {
  background: rgba(0, 229, 255, 0.14);
  border-color: rgba(0, 229, 255, 0.22);
  color: #d8fbff;
  padding: 10px 16px;
}

.button.secondary:hover {
  background: rgba(0, 229, 255, 0.22);
}

.button.disabled {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #9fb0b6;
  cursor: default;
  padding: 10px 16px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.detail-feature-column h4 {
  margin: 0 0 10px;
  color: var(--pao-color-standard);
  font-size: 0.98rem;
}

.detail-feature-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-feature-list li {
  color: #f0f0f0;
  line-height: 1.55;
}

.venue-actions {
  margin-top: 14px;
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 20px;
  background-color: #e7f3ff;
  color: #007bff;
  padding: 5px 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.edition-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edition-item,
.related-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.edition-main,
.related-race-card .race-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edition-date,
.edition-date-en {
  font-weight: 600;
}

.feedback-panel {
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.feedback-target {
  margin-top: 14px;
}

.feedback-target-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #ffffff;
}

.feedback-target-select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  font: inherit;
  color: #ffffff;
}

.feedback-trigger.neutral,
.feedback-reason {
  background: rgba(255, 255, 255, 0.08);
  color: #d8fbff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  padding: 10px 14px;
}

.feedback-trigger.neutral:hover,
.feedback-reason:hover {
  background: rgba(0, 229, 255, 0.16);
  border-color: rgba(0, 229, 255, 0.3);
}

.feedback-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.feedback-reason {
  padding: 10px 14px;
}

.feedback-status {
  min-height: 1.5em;
  margin-top: 14px;
  color: #d8fbff;
  font-weight: 600;
}

.feedback-mode-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: #d8fbff;
  font-size: 0.92rem;
  line-height: 1.5;
}

.feedback-other {
  margin-top: 16px;
}

.feedback-other-label {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-weight: 600;
}

.feedback-other-text {
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: #ffffff;
  font: inherit;
  resize: vertical;
}

.feedback-other-text:focus-visible,
.feedback-other-submit:focus-visible,
.feedback-other-cancel:focus-visible {
  outline: 2px solid rgba(0, 229, 255, 0.55);
  outline-offset: 2px;
}

.feedback-other-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.feedback-other-submit,
.feedback-other-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  padding: 10px 14px;
}

.feedback-other-submit {
  border: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(0, 229, 255, 0.16);
  color: #d8fbff;
}

.feedback-other-cancel {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #d8fbff;
}

.feedback-other-submit:hover,
.feedback-other-cancel:hover {
  transform: translateY(-1px);
}

.en-block {
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
}

.site-footer {
  margin-top: 18px;
  padding: 8px 0 6px;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer a {
  color: #d8fbff;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.related-race-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.related-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.related-card-link:focus-visible {
  outline: none;
}

.related-card-link:focus-visible .race-card {
  outline: 2px solid #00e5ff;
  outline-offset: 3px;
}

.race-card {
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  gap: 15px;
  position: relative;
  cursor: pointer;
}

.race-date {
  flex-basis: 100px;
  text-align: center;
  border-right: 1px solid #e9ebee;
  padding-right: 15px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.race-date .month {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e74c3c;
  text-transform: uppercase;
}

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

.race-city {
  margin-top: auto;
  padding-top: 10px;
}

.race-city span {
  display: block;
  line-height: 1.3;
}

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

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

.city-filter-trigger {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: inherit;
  font: inherit;
}

.race-card .race-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.race-card .race-details h2 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
  text-align: left;
}

.race-card .race-details .name-zh {
  color: #1c1e21;
}

.race-card .race-details .name-en {
  font-size: 1.1rem;
  color: #606770;
  font-weight: 400;
}

.race-location {
  font-size: 1rem;
  color: #606770;
  margin-bottom: 15px;
  text-align: left;
}

.race-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.tag {
  background-color: #e7f3ff;
  color: #007bff;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  font-family: inherit;
}

.tag.trail {
  background-color: #e6f6e6;
  color: #34a853;
}

.tag.triathlon {
  background-color: #fff0e6;
  color: #fbbc05;
}

.tag.relay {
  background-color: #f4e8ff;
  color: #7b3fb6;
}

.race-deadline {
  margin-top: auto;
  padding: 6px 12px;
  background-color: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 6px;
  width: fit-content;
}

.deadline-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: #d46b08;
  line-height: 1.4;
}

.deadline-text span {
  display: block;
}

.mobile-city {
  display: none;
}

@media (max-width: 720px) {
  body {
    background-image: url('/images/runner-taipei-mobile.jpg');
    background-attachment: scroll;
    padding: 12px;
  }

  .detail-shell {
    padding: 1px 14px 18px;
    background-color: rgba(26, 26, 26, 0.92);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

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

  .edition-item,
  .site-footer {
    flex-direction: column;
  }

  .site-footer {
    align-items: center;
    gap: 10px;
  }

  .header-actions {
    top: 12px;
    right: 2px;
  }

  .race-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "date city"
      "details details";
    padding: 15px;
  }

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

  .race-city {
    display: none;
  }

  .mobile-city {
    grid-area: city;
    display: block;
    text-align: right;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ebee;
  }

  .race-card .race-details {
    grid-area: details;
  }

  .race-card .mobile-city span {
    display: block;
    line-height: 1.3;
  }

  .race-card .mobile-city .city-zh {
    font-size: 1rem;
  }

  .race-card .mobile-city .city-en {
    font-size: 0.85rem;
  }
}

@media (min-width: 721px) {
  .race-card .mobile-city {
    display: none;
  }
}
