:root {
  --paper: #f3eddf;
  --paper-deep: #e6dcc9;
  --ink: #171512;
  --muted: #766f64;
  --line: #d3c6af;
  --line-strong: #bcae98;
  --red: #9b2d1f;
  --green: #23463d;
  --green-soft: #dbe6dd;
  --blue: #263d55;
  --shadow: 0 18px 50px rgba(44, 35, 22, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif SC", serif;
}

button {
  font: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image: radial-gradient(rgba(23, 21, 18, 0.12) 0.65px, transparent 0.65px);
  background-size: 6px 6px;
  mix-blend-mode: multiply;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.masthead {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: end;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 26px;
}

.eyebrow,
.kicker {
  margin: 0 0 8px;
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 0.88;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.intro {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.system-card,
.panel,
.source-note,
.scoreboard {
  border: 1px solid var(--line);
  background: rgba(255, 251, 242, 0.52);
  box-shadow: var(--shadow);
}

.system-card {
  display: grid;
  grid-template-columns: minmax(112px, 0.72fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  align-self: end;
  padding: 14px;
  border-radius: 18px;
  font-size: 14px;
}

.system-card .dot {
  grid-column: 1;
  grid-row: 1;
}

.system-card #connectionText {
  grid-column: 1 / -1;
  grid-row: 1;
  padding-left: 28px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b68727;
  box-shadow: 0 0 0 5px rgba(182, 135, 39, 0.15);
}

.dot.online {
  background: #24764c;
  box-shadow: 0 0 0 5px rgba(36, 118, 76, 0.15);
}

.dot.error {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(155, 45, 31, 0.15);
}

.ghost-button,
.text-button,
.follow-button,
.small-button {
  cursor: pointer;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.ghost-button:hover,
.follow-button:hover,
.small-button:hover {
  transform: translateY(-1px);
  background: var(--ink);
  color: var(--paper);
}

.ghost-button {
  grid-column: auto;
  width: 100%;
  padding: 9px 12px;
  border-radius: 999px;
}

.mode-button.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.next-refresh {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.scoreboard {
  margin: 26px 0;
  border-radius: 28px;
  overflow: hidden;
}

.spotlight-card {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px) 1fr;
  gap: 24px;
  align-items: stretch;
  min-height: 230px;
  padding: 28px;
  background: linear-gradient(90deg, rgba(35, 70, 61, 0.08), rgba(155, 45, 31, 0.08));
}

.spotlight-empty {
  padding: 34px;
}

.team-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.team-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 252, 245, 0.85);
  object-fit: cover;
}

.team-logo.small {
  width: 28px;
  height: 28px;
}

.team-code {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.team-name {
  margin: 22px 0 0;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.score-center {
  display: grid;
  place-items: center;
  text-align: center;
  border-inline: 1px solid var(--line-strong);
  padding-inline: 20px;
}

.score-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(42px, 8vw, 76px);
  font-weight: 800;
  letter-spacing: -0.08em;
}

.score-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 64px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.live {
  background: var(--red);
  color: white;
}

.status-pill.finished {
  background: var(--green);
  color: white;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
}

.main-column,
.side-column {
  display: grid;
  gap: 24px;
  align-content: start;
}

.side-column {
  position: sticky;
  top: 18px;
  align-self: start;
}

.panel {
  border-radius: var(--radius);
  padding: 22px;
}

.subtle-panel {
  background: rgba(255, 251, 242, 0.36);
  box-shadow: 0 10px 28px rgba(44, 35, 22, 0.07);
}

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

.heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.section-heading.small h2 {
  font-size: 21px;
}

.muted,
.side-copy,
.empty-state,
.match-subline {
  color: var(--muted);
}

.match-stack {
  display: grid;
  gap: 12px;
}

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

.fixture-flow {
  display: grid;
  gap: 12px;
}

.fixture-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.68);
}

.fixture-card.next {
  border-color: rgba(35, 70, 61, 0.45);
  background: linear-gradient(90deg, rgba(219, 230, 221, 0.84), rgba(255, 252, 245, 0.72));
}

.fixture-time {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.fixture-time strong {
  color: var(--green);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif SC", serif;
  font-size: 18px;
}

.fixture-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.fixture-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fixture-team.right {
  justify-content: flex-end;
  text-align: right;
}

.fixture-team strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
}

.versus {
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.fixture-meta {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

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

.result-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(232, 226, 211, 0.36);
}

.result-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.result-score span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-score span:last-child {
  text-align: right;
}

.result-score strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.match-card {
  display: grid;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.66);
}

.match-card.live {
  border-color: rgba(155, 45, 31, 0.42);
}

.match-card.finished {
  background: rgba(232, 226, 211, 0.58);
}

.match-topline,
.match-actions,
.team-row,
.watch-item,
.notice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.match-topline {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.teams {
  display: grid;
  gap: 8px;
}

.team-row strong {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
}

.team-score {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 800;
}

.match-subline {
  margin: -4px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.follow-button {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 13px;
}

.follow-button.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.text-button {
  border: 0;
  padding: 0;
  color: var(--red);
  font-size: 13px;
}

.text-button:hover {
  text-decoration: underline;
}

.sticky-panel {
  position: static;
}

.push-card {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(219, 230, 221, 0.72);
}

.push-card label {
  color: var(--green);
  font-weight: 800;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.token-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.82);
  color: var(--ink);
  font: inherit;
  padding: 9px 12px;
}

.small-button {
  border-radius: 999px;
  padding: 8px 12px;
}

.push-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.push-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.push-status.ready {
  color: var(--green);
}

.watch-list,
.notice-list {
  display: grid;
  gap: 10px;
}

.watch-item,
.notice-item {
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 252, 245, 0.75);
  border: 1px solid var(--line);
}

.watch-item strong,
.notice-item strong {
  display: block;
  margin-bottom: 4px;
}

.watch-item span,
.notice-item span {
  color: var(--muted);
  font-size: 13px;
}

.source-note {
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.source-note p {
  margin: 0;
  color: var(--red);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.source-note strong {
  color: var(--ink);
  font-family: inherit;
}

.toast-zone {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 36px));
}

.toast {
  padding: 14px 16px;
  border: 1px solid var(--ink);
  border-radius: 16px;
  background: #fff8e8;
  box-shadow: var(--shadow);
  animation: rise 220ms ease both;
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

.toast span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  text-align: center;
  line-height: 1.7;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .shell {
    display: flex;
    flex-direction: column;
  }

  .masthead {
    display: contents;
  }

  .masthead > div:first-child {
    order: 1;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 18px;
  }

  .scoreboard {
    order: 2;
    margin: 18px 0 14px;
  }

  .system-card {
    order: 3;
    width: 100%;
    align-self: stretch;
    margin: 0 0 12px;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 251, 242, 0.36);
    border-color: rgba(211, 198, 175, 0.78);
    box-shadow: none;
  }

  .columns {
    order: 4;
  }

  .columns,
  .spotlight-card {
    grid-template-columns: 1fr;
  }

  .main-column {
    gap: 14px;
  }

  .live-panel {
    order: 1;
  }

  .upcoming-panel {
    order: 2;
  }

  .previous-panel {
    order: 3;
  }

  .score-center {
    border-inline: 0;
    border-block: 1px solid var(--line-strong);
    padding: 18px 0;
  }

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

  .result-strip {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }

  .side-column {
    position: static;
  }

  .source-note {
    box-shadow: none;
    opacity: 0.78;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 18px, 1180px);
    padding-top: 14px;
  }

  h1 {
    margin-bottom: 8px;
    font-size: clamp(34px, 13.2vw, 52px);
    line-height: 0.98;
    letter-spacing: -0.08em;
  }

  .eyebrow {
    font-size: 11px;
  }

  .intro {
    font-size: 15px;
    line-height: 1.55;
  }

  .system-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    font-size: 13px;
  }

  .system-card .dot {
    grid-column: 1;
    grid-row: 1;
  }

  .system-card #connectionText {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    padding-left: 26px;
    overflow: hidden;
    color: var(--green);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .system-card .ghost-button {
    width: 100%;
    padding: 8px 12px;
    border-color: var(--line-strong);
    background: rgba(255, 252, 245, 0.62);
    font-size: 13px;
  }

  .system-card #refreshButton {
    grid-column: 1 / 2;
    grid-row: 3;
  }

  .system-card #demoButton {
    grid-column: 2 / 3;
    grid-row: 3;
  }

  .system-card .next-refresh {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 11px;
    opacity: 0.72;
  }

  .scoreboard {
    border-radius: 20px;
  }

  .panel,
  .spotlight-card {
    padding: 16px;
  }

  .panel {
    border-radius: 18px;
  }

  .spotlight-card {
    min-height: auto;
    gap: 12px;
  }

  .team-name {
    margin-top: 12px;
    font-size: clamp(24px, 10vw, 36px);
  }

  .score-number {
    font-size: clamp(42px, 18vw, 60px);
  }

  .score-meta {
    font-size: 13px;
  }

  .columns,
  .main-column,
  .side-column {
    gap: 14px;
  }

  .section-heading {
    margin-bottom: 12px;
  }

  .section-heading h2 {
    font-size: 23px;
  }

  .match-card {
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
  }

  .fixture-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
  }

  .fixture-time {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .fixture-meta {
    grid-column: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .fixture-meta .follow-button {
    align-self: stretch;
  }

  .fixture-teams {
    grid-template-columns: 1fr auto 1fr;
  }

  .fixture-team {
    align-items: center;
    flex-direction: column;
    gap: 7px;
    text-align: center;
  }

  .fixture-team.right {
    flex-direction: column-reverse;
    text-align: center;
  }

  .fixture-team strong {
    font-size: 17px;
  }

  .result-card {
    padding: 12px;
  }

  .team-row strong {
    font-size: 16px;
  }

  .team-logo.small {
    width: 26px;
    height: 26px;
  }

  .team-score {
    font-size: 20px;
  }

  .side-copy {
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.55;
  }

  .match-topline,
  .match-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
