@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,500;6..72,600&display=swap");

:root {
  --bg: #f6f3ec;
  --text: #171713;
  --muted: #666357;
  --line: #d7d1c5;
  --soft-line: rgba(23, 23, 19, 0.08);
  --panel: rgba(255, 255, 255, 0.45);
  --panel-strong: rgba(255, 255, 255, 0.7);
  --player: #1f5eff;
  --policy: #0f8a5f;
  --oracle: #a68a5a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Manrope", sans-serif;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
}

.hero {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.text-section {
  max-width: 100%;
}

h1 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero-subtitle {
  margin: 0.7rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  max-width: 42rem;
}

.lead {
  max-width: 42rem;
  margin: 1.15rem 0 0;
  color: var(--muted);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.35rem;
  width: fit-content;
  margin-top: 1rem;
  padding-bottom: 0.1rem;
}

.links a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.links a:hover {
  border-color: var(--line);
}

.hero-bandit {
  margin-top: 1.75rem;
}

.hero-bandit-copy {
  max-width: 42rem;
  margin-bottom: 1rem;
}

.bandit-heading {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-bandit-copy p {
  color: var(--muted);
}

.bandit-invite {
  color: var(--text);
}

.adnote-label {
  margin: 0 0 0.2rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bandit-stage {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.bandit-margin {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 22rem;
}

.bandit-margin-left {
  order: 2;
  text-align: left;
  padding-top: 0;
}

.bandit-margin-right {
  order: 3;
  display: grid;
  gap: 1rem;
  padding-top: 0;
}

.bandit-adnote {
  margin: 0;
}

.adnote-ref {
  margin-top: 0.28rem;
  font-size: 0.82rem;
}

.adnote-ref a {
  color: var(--muted);
}

section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

.body-copy p,
.hero-bandit-copy p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.body-copy .bandit-kicker,
.body-copy .adnote-label,
.body-copy .adnote-ref,
.body-copy .bandit-history,
.body-copy .plot-note,
.body-copy .metric-label,
.bandit-kicker,
.adnote-label,
.adnote-ref,
.bandit-history,
.plot-note,
.metric-label {
  text-align: left;
  text-justify: auto;
  hyphens: manual;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

strong {
  font-weight: 700;
}

.focus-list,
.publication-list,
.compact-list {
  margin: 0;
  padding: 0;
}

.focus-item,
.publication {
  padding: 0 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--soft-line);
}

.focus-item:last-child,
.publication:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.bandit-panel {
  max-width: 100%;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.bandit-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.bandit-kicker,
.control-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.bandit-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.bandit-subtitle {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.bandit-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.9rem 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.bandit-meta strong {
  color: var(--text);
}

.bandit-stats-inline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  padding: 0.75rem 0 0.95rem;
  border-bottom: 1px solid var(--soft-line);
}

.stat-inline strong,
.arm-name,
.arm-button,
.secondary-button,
.bandit-history {
  font-family: "Manrope", sans-serif;
}

.metric-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-inline strong {
  font-size: 1.05rem;
  font-weight: 700;
}

.bandit-plot-card {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--soft-line);
}

.plot-header,
.plot-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.plot-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.plot-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.bandit-plot {
  display: block;
  width: 100%;
  height: 160px;
  margin-top: 0.4rem;
  overflow: visible;
}

.plot-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.player-line {
  stroke: var(--player);
}

.policy-line {
  stroke: var(--policy);
}

.oracle-line {
  stroke: var(--oracle);
  stroke-dasharray: 7 7;
}

.plot-legend {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.plot-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.player-swatch {
  background: var(--player);
}

.policy-swatch {
  background: var(--policy);
}

.oracle-swatch {
  background: linear-gradient(to right, var(--oracle) 60%, transparent 60%);
  background-size: 9px 3px;
}

.bandit-toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 0.95rem 0 0;
}

.toolbar-group {
  min-width: 0;
}

.toolbar-group-policy {
  min-width: 260px;
}

.toolbar-group-utility {
  justify-self: end;
}

.arm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.arm-button,
.secondary-button {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.arm-button {
  padding: 0.56rem 0.72rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.secondary-button {
  padding: 0.56rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.arm-button:hover,
.secondary-button:hover {
  border-color: #b9af9f;
  background: rgba(255, 255, 255, 0.3);
}

.policy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.policy-select {
  min-width: 220px;
  padding: 0.56rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.policy-run-buttons,
.bandit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.bandit-history {
  min-height: 0;
  margin: 0.9rem 0 0.65rem;
  padding: 0;
  color: var(--muted);
}

.bandit-footer {
  display: flex;
}

.arm-stat-list {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.arm-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--soft-line);
}

.arm-stat:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.arm-name {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
}

.compact-list {
  list-style: none;
}

.compact-list li {
  margin-bottom: 1rem;
}

.compact-list li:last-child {
  margin-bottom: 0;
}

.section-note,
.publication-meta,
.muted,
footer {
  color: var(--muted);
}

footer {
  padding-top: 1.5rem;
  font-size: 0.95rem;
}

@media (max-width: 700px) {
  main {
    padding-top: 3rem;
  }

  .hero-bandit {
    margin-top: 1.8rem;
  }

  .links {
    width: auto;
  }

  .bandit-stage,
  .bandit-toolbar,
  .meta-grid {
    grid-template-columns: 1fr;
  }

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

  .bandit-panel-header,
  .bandit-footer,
  .policy-controls {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .toolbar-group-utility {
    justify-self: start;
  }

  .arm-stat {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }
}

@media (min-width: 1180px) {
  .bandit-stage {
    position: relative;
    display: block;
  }

  .bandit-panel {
    width: 100%;
  }

  .bandit-margin {
    position: absolute;
    max-width: 150px;
  }

  .bandit-margin-left {
    top: 5.6rem;
    left: -170px;
    text-align: right;
  }

  .bandit-margin-right {
    top: 8.8rem;
    right: -170px;
  }
}
