:root {
  --bg: #f3ebde;
  --bg-deep: #e8dbc8;
  --paper: rgba(255, 250, 244, 0.9);
  --paper-strong: #fcf5ea;
  --paper-clay: rgba(248, 239, 229, 0.94);
  --paper-pine: rgba(241, 237, 228, 0.95);
  --ink: #1e1710;
  --muted: #645749;
  --line: rgba(60, 44, 31, 0.16);
  --line-strong: rgba(60, 44, 31, 0.28);
  --clay: #9b492c;
  --clay-soft: rgba(155, 73, 44, 0.1);
  --pine: #2f5849;
  --gold: #8c6a28;
  --shadow: 0 18px 36px rgba(38, 26, 17, 0.08);
  --radius: 14px;
  --max-width: 1240px;
  --section-gap: 34px;
  --nav-offset: calc(env(safe-area-inset-top, 0px) + 10px);
  --nav-height: 58px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(155, 73, 44, 0.1), transparent 26rem),
    linear-gradient(180deg, rgba(140, 106, 40, 0.08), transparent 12rem),
    repeating-linear-gradient(
      0deg,
      rgba(104, 84, 63, 0.03) 0,
      rgba(104, 84, 63, 0.03) 1px,
      transparent 1px,
      transparent 28px
    ),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(155, 73, 44, 0.18);
}

.page {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 84px 14px 68px;
}

.site-head,
.section-shell,
.table-shell,
.site-foot {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.site-head,
.section-shell,
.site-foot,
.table-shell {
  border-radius: var(--radius);
}

.site-head {
  overflow: hidden;
}

.meta-bar {
  display: grid;
  gap: 12px;
  padding: 14px 14px 0;
}

.brand-line,
.meta-stack,
.hero-actions,
.legend,
.detail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  font-weight: 700;
}

.meta-copy,
.section-head p,
.bullet-list,
.source-list,
.story-card p,
.side-card p,
.bout-card p,
.board-card p,
.site-foot p,
.hero-summary,
.hero-notes p,
.race-meta,
.pulse-card span {
  color: var(--muted);
}

.chip,
.legend-item,
.hero-link,
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.chip {
  min-height: 34px;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.8);
  color: var(--muted);
  font-size: 0.9rem;
}

.chip strong {
  color: var(--ink);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Shippori Mincho B1", serif;
  letter-spacing: -0.02em;
}

.hero {
  display: grid;
  gap: 18px;
  padding: 18px 14px 20px;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at right 18%, rgba(155, 73, 44, 0.11), transparent 11rem),
    linear-gradient(90deg, rgba(155, 73, 44, 0.07), transparent 40%);
  pointer-events: none;
}

.hero-copy,
.hero-ledger {
  position: relative;
}

.hero-copy,
.hero-ledger,
.pulse-card,
.bout-card,
.story-card,
.side-card,
.board-card,
.table-shell,
.site-foot {
  animation: settle 680ms ease both;
}

.hero-copy {
  display: grid;
  gap: 14px;
}

h1 {
  font-size: clamp(2.45rem, 10vw, 5rem);
  line-height: 0.95;
  max-width: 12ch;
}

.hero-summary {
  margin: 0;
  max-width: 45rem;
  font-size: 1.07rem;
  line-height: 1.7;
}

.hero-link,
.nav-link {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-weight: 700;
}

.hero-link.primary {
  background: var(--clay);
  border-color: var(--clay);
  color: #fff8f1;
}

.nav-link {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  background: rgba(255, 252, 247, 0.84);
  color: var(--muted);
  white-space: nowrap;
}

.nav-link.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff8f1;
}

.hero-notes {
  display: grid;
  gap: 10px;
  max-width: 44rem;
}

.hero-notes p {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--clay);
  line-height: 1.58;
}

.hero-ledger {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(60, 44, 31, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.97), rgba(247, 239, 228, 0.95));
  animation-delay: 80ms;
}

.race-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.race-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.race-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.race-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--clay);
  color: #fff8f1;
  font-weight: 700;
}

.race-name {
  display: block;
  font-weight: 700;
  font-size: 1.02rem;
}

.race-meta {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.pulse-grid {
  display: grid;
  gap: 12px;
  padding: 0 14px 18px;
}

.pulse-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 1px);
  background: rgba(255, 252, 247, 0.78);
}

.pulse-card strong {
  font-size: 1.8rem;
  line-height: 1;
}

.pulse-grid .pulse-card:nth-child(1) {
  animation-delay: 120ms;
}

.pulse-grid .pulse-card:nth-child(2) {
  animation-delay: 180ms;
}

.pulse-grid .pulse-card:nth-child(3) {
  animation-delay: 240ms;
}

.section-nav {
  position: fixed;
  top: var(--nav-offset);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 8px;
  width: min(calc(100% - 20px), var(--max-width));
  padding: 8px;
  overflow-x: auto;
  background: rgba(255, 249, 241, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

main {
  display: grid;
  gap: var(--section-gap);
  margin-top: 30px;
}

main > section {
  position: relative;
}

main section[id] {
  scroll-margin-top: calc(var(--nav-offset) + var(--nav-height) + 16px);
}

.section-shell {
  padding: 22px 15px;
}

.section-head {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.section-head p {
  margin: 0;
  max-width: 48rem;
  line-height: 1.6;
}

#standings {
  display: grid;
  gap: 18px;
}

.table-head {
  display: grid;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(60, 44, 31, 0.2);
}

.legend {
  align-items: flex-start;
}

.legend-item {
  min-height: 28px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  line-height: 1.2;
}

.legend-item.is-returned,
tr.is-returned {
  background: rgba(47, 88, 73, 0.15);
}

.legend-item.is-absent,
tr.is-absent {
  background: rgba(140, 106, 40, 0.17);
}

.legend-item.is-returned {
  border-color: rgba(47, 88, 73, 0.26);
  color: #214d41;
}

.legend-item.is-absent {
  border-color: rgba(140, 106, 40, 0.28);
  color: #735914;
}

.table-shell {
  overflow: clip;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  display: none;
}

tbody {
  display: grid;
}

tbody tr {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 5px 10px;
  align-items: start;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
}

tbody tr:first-child {
  border-top: 0;
}

td {
  min-width: 0;
  font-size: 0.95rem;
}

.cell-position {
  grid-column: 1;
  grid-row: 1 / span 2;
  color: var(--muted);
  font-weight: 700;
}

.cell-rikishi {
  grid-column: 2;
  grid-row: 1;
}

.cell-rikishi strong {
  font-size: 1rem;
}

.cell-record {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  font-weight: 700;
  color: var(--clay);
  white-space: nowrap;
}

.cell-next,
.cell-rank {
  grid-column: 2 / 4;
}

.cell-next {
  grid-row: 2;
}

.cell-rank {
  grid-row: 3;
  color: var(--muted);
  font-size: 0.92rem;
}

.cell-record::before,
.cell-next::before,
.cell-rank::before {
  content: attr(data-label) " ";
  margin-right: 4px;
  color: var(--ink);
  font-weight: 500;
}

.bout-grid,
.board-grid,
.side-stack,
.name-list {
  display: grid;
  gap: 12px;
}

.bout-card,
.board-card,
.side-card,
.story-card {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 1px);
  background: rgba(255, 252, 247, 0.78);
}

.bout-card {
  border-left: 5px solid var(--clay);
}

.story-card {
  gap: 14px;
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.97), rgba(246, 237, 225, 0.94));
}

.story-card p,
.side-card p,
.bout-card p,
.board-card p,
.site-foot p {
  margin: 0;
  line-height: 1.62;
}

.story-card p + p {
  margin-top: 12px;
}

.small-note,
.record {
  color: var(--clay);
  font-weight: 700;
}

.small-note {
  font-size: 0.92rem;
}

.split-layout {
  display: grid;
  gap: 16px;
}

.bullet-list,
.source-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.58;
}

.bullet-list li + li,
.source-list li + li {
  margin-top: 10px;
}

.name-list div {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.name-list div:first-child {
  padding-top: 0;
  border-top: 0;
}

.name-list strong,
.board-card strong {
  font-size: 1.05rem;
}

.board-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.record {
  white-space: nowrap;
}

.detail-row {
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-row span {
  display: inline-flex;
  gap: 6px;
}

.detail-row .is-rank {
  color: rgba(100, 87, 73, 0.86);
}

#pivot.section-shell {
  border-top: 3px solid rgba(155, 73, 44, 0.32);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.97), var(--paper-clay));
}

#story .story-card {
  border-top: 3px solid rgba(140, 106, 40, 0.32);
}

#story .side-card {
  background: linear-gradient(180deg, rgba(252, 247, 239, 0.94), rgba(244, 238, 228, 0.96));
}

#leverage.section-shell {
  border-top: 3px solid rgba(47, 88, 73, 0.3);
  background: linear-gradient(180deg, rgba(251, 246, 238, 0.97), var(--paper-pine));
}

.site-foot {
  display: grid;
  gap: 12px;
  margin-top: 34px;
  padding: 16px 14px;
}

.site-foot strong {
  font-size: 1rem;
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-copy,
  .hero-ledger,
  .pulse-card,
  .bout-card,
  .story-card,
  .side-card,
  .board-card,
  .table-shell,
  .site-foot {
    animation: none;
  }
}

@media (min-width: 760px) {
  .page {
    padding: 96px 22px 72px;
  }

  .meta-bar,
  .hero,
  .pulse-grid,
  .section-shell,
  .site-foot {
    padding-left: 22px;
    padding-right: 22px;
  }

  .section-nav {
    justify-content: center;
  }

  .hero {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
    align-items: start;
    padding-top: 24px;
    padding-bottom: 24px;
  }

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

  .section-shell {
    padding: 24px 22px;
  }

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

  .split-layout {
    grid-template-columns: minmax(0, 1.28fr) minmax(300px, 0.92fr);
    align-items: start;
    gap: 20px;
  }

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

  thead {
    display: table-header-group;
  }

  tbody {
    display: table-row-group;
  }

  tbody tr {
    display: table-row;
    padding: 0;
  }

  th,
  td {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
  }

  thead th {
    position: sticky;
    top: calc(var(--nav-offset) + var(--nav-height));
    z-index: 1;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 237, 225, 0.98);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
  }

  .cell-position,
  .cell-rikishi,
  .cell-record,
  .cell-next,
  .cell-rank {
    display: table-cell;
    grid-column: auto;
    grid-row: auto;
  }

  .cell-position {
    width: 54px;
  }

  .cell-rikishi {
    width: 28%;
  }

  .cell-record {
    white-space: nowrap;
  }

  .cell-rank {
    font-size: 0.9rem;
  }

  .cell-record::before,
  .cell-next::before,
  .cell-rank::before {
    content: none;
  }
}

@media (min-width: 1120px) {
  .page {
    padding-top: 92px;
  }

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

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