:root {
  color-scheme: light;
  --ink: #152337;
  --muted: #5f6d7e;
  --line: #d8e0e8;
  --paper: #f7f9fb;
  --white: #ffffff;
  --red: #c8172c;
  --red-dark: #941022;
  --gold: #d9a928;
  --silver: #8795a6;
  --bronze: #a96b3f;
  --shadow: 0 18px 48px rgba(21, 35, 55, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 88% -5%, rgba(200, 23, 44, 0.12), transparent 30rem),
    repeating-radial-gradient(
      ellipse at 4% 95%,
      rgba(21, 35, 55, 0.035) 0,
      rgba(21, 35, 55, 0.035) 1px,
      transparent 1px,
      transparent 24px
    ),
    var(--paper);
}

button {
  font: inherit;
}

.page-shell {
  width: min(100% - 32px, 1040px);
  margin-inline: auto;
  padding: 40px 0 24px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 18px;
  background: var(--red);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(200, 23, 44, 0.22);
}

.brand-mark svg {
  width: 38px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.15rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.live-panel {
  min-width: 190px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: right;
}

.live-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 750;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #159455;
  box-shadow: 0 0 0 4px rgba(21, 148, 85, 0.13);
}

.live-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 42px 0 26px;
}

.standings-kicker {
  margin-bottom: 0;
}

.refresh-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: border-color 160ms ease, transform 160ms ease;
}

.refresh-button:hover {
  border-color: var(--red);
  transform: translateY(-1px);
}

.refresh-button:focus-visible {
  outline: 3px solid rgba(200, 23, 44, 0.24);
  outline-offset: 2px;
}

.refresh-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.refresh-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.podium-card {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.podium-card::after {
  position: absolute;
  right: -36px;
  bottom: -48px;
  width: 140px;
  height: 140px;
  border: 24px solid color-mix(in srgb, var(--medal) 16%, transparent);
  border-radius: 50%;
  content: "";
}

.podium-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 5px solid var(--house, var(--line));
}

.podium-card::after {
  display: none;
}

.podium-text {
  align-self: flex-start;
  min-width: 0;
}

.podium-crest {
  position: relative;
  z-index: 1;
  flex: none;
  width: 104px;
  height: auto;
  filter: drop-shadow(0 8px 14px rgba(21, 35, 55, 0.18));
}

.house-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.row-crest {
  flex: none;
  width: 40px;
  height: auto;
}

.house-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.house-gap {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.standings-row {
  box-shadow: inset 5px 0 0 var(--house, transparent);
}

.podium-card[data-place="1"] {
  --medal: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  background: linear-gradient(145deg, #fffdf4, #ffffff 68%);
}

.podium-card[data-place="2"] {
  --medal: var(--silver);
}

.podium-card[data-place="3"] {
  --medal: var(--bronze);
}

.place-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.medal-dot {
  width: 13px;
  height: 13px;
  border: 3px solid color-mix(in srgb, var(--medal) 28%, white);
  border-radius: 50%;
  background: var(--medal);
  box-shadow: 0 0 0 1px var(--medal);
}

.podium-card h3 {
  position: relative;
  z-index: 1;
  max-width: 13ch;
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.18;
}

.podium-score {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  color: var(--red-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
}

.podium-score span {
  margin-left: 4px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.standings-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.table-heading,
.standings-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 16px;
}

.table-heading {
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.table-heading span:last-child {
  text-align: right;
}

.standings-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.standings-row {
  min-height: 74px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
}

.standings-row:last-child {
  border-bottom: 0;
}

.rank-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  font-weight: 800;
}

.house-name {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.015em;
}

.score {
  text-align: right;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
}

.score span {
  margin-left: 3px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
}

.error-panel {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #e2b8bd;
  border-radius: 12px;
  background: #fff1f3;
  color: #6f1723;
  font-size: 0.9rem;
}

.error-panel span {
  margin-left: 4px;
}

footer {
  padding: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 1040px);
    padding-top: 24px;
  }

  .site-header {
    align-items: flex-start;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }

  .brand-mark svg {
    width: 31px;
  }

  .live-panel {
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 5px 0 0;
  }

  .live-panel p {
    max-width: 18ch;
  }

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

  .podium-card {
    min-height: 142px;
  }

  .podium-crest {
    width: 84px;
  }

  .place-label {
    margin-bottom: 16px;
  }
}

@media (max-width: 500px) {
  .site-header {
    display: grid;
  }

  .live-panel {
    text-align: left;
  }

  .live-line {
    justify-content: flex-start;
  }

  .live-panel p {
    max-width: none;
  }

  .intro {
    align-items: center;
    padding-top: 32px;
  }

  .refresh-button {
    padding-inline: 12px;
  }

  .table-heading,
  .standings-row {
    grid-template-columns: 48px minmax(0, 1fr) 76px;
    gap: 10px;
  }

  .table-heading,
  .standings-row {
    padding-inline: 14px;
  }

  .house-cell {
    gap: 10px;
  }

  .row-crest {
    width: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Projector / desktop fit: whole board visible without scrolling */
@media (min-width: 900px) and (min-height: 480px) and (orientation: landscape) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .page-shell {
    display: flex;
    flex-direction: column;
    width: min(100% - 64px, 1500px);
    height: 100vh;
    height: 100dvh;
    padding: 2.6vh 0 1.4vh;
  }

  .site-header {
    flex: none;
    padding-bottom: 1.8vh;
  }

  .brand-mark {
    width: clamp(48px, 7vh, 76px);
    height: clamp(48px, 7vh, 76px);
  }

  .brand-mark svg {
    width: 60%;
  }

  .eyebrow {
    font-size: clamp(0.75rem, 1.5vh, 1rem);
  }

  h1 {
    font-size: clamp(2rem, 5.6vh, 3.8rem);
  }

  .live-panel {
    padding: 1vh 15px;
  }

  .live-line {
    font-size: clamp(0.9rem, 1.8vh, 1.2rem);
  }

  .live-panel p {
    font-size: clamp(0.75rem, 1.4vh, 0.95rem);
  }

  main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  .intro {
    flex: none;
    align-items: center;
    padding: 1.8vh 0 1.4vh;
  }

  .section-kicker {
    font-size: clamp(0.75rem, 1.5vh, 1rem);
  }

  .refresh-button {
    min-height: 0;
    padding: 0.8vh 14px;
  }

  .podium {
    flex: 0 0 25vh;
    gap: 1.6vw;
    margin-bottom: 1.8vh;
  }

  .podium-card {
    min-height: 0;
    padding: 2vh 1.8vw;
  }

  .place-label {
    margin-bottom: 1.4vh;
    font-size: clamp(0.72rem, 1.45vh, 1rem);
  }

  .podium-card h3 {
    font-size: clamp(1rem, 2.7vh, 1.75rem);
  }

  .podium-score {
    margin-top: 1vh;
    font-size: clamp(1.6rem, 4.6vh, 3.2rem);
  }

  .podium-crest {
    width: auto;
    height: min(18vh, 100%);
    max-width: 40%;
    object-fit: contain;
  }

  .standings-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  .table-heading {
    flex: none;
    padding: 1.1vh 24px;
    font-size: clamp(0.68rem, 1.3vh, 0.9rem);
  }

  .standings-list {
    display: grid;
    flex: 1;
    grid-auto-rows: minmax(0, 1fr);
    min-height: 0;
  }

  .standings-row {
    min-height: 0;
    padding: 0 24px;
  }

  .rank-number {
    width: clamp(30px, 4.4vh, 46px);
    height: clamp(30px, 4.4vh, 46px);
    font-size: clamp(0.9rem, 2vh, 1.3rem);
  }

  .row-crest {
    width: auto;
    height: clamp(28px, 5.2vh, 56px);
  }

  .house-name {
    font-size: clamp(0.95rem, 2.2vh, 1.45rem);
  }

  .house-gap {
    font-size: clamp(0.72rem, 1.5vh, 1rem);
  }

  .score {
    font-size: clamp(1.25rem, 3.2vh, 2.2rem);
  }

  .error-panel {
    flex: none;
    margin-top: 1vh;
    padding: 0.8vh 14px;
  }

  footer {
    flex: none;
    padding-top: 1vh;
    font-size: clamp(0.7rem, 1.3vh, 0.9rem);
  }
}
