:root {
  --bg: #f5efe4;
  --bg-deep: #dcc8a0;
  --paper: rgba(255, 251, 244, 0.9);
  --paper-strong: #fff8ec;
  --ink: #1d1a16;
  --muted: #5f5549;
  --line: rgba(29, 26, 22, 0.12);
  --accent: #b64023;
  --accent-dark: #7e2614;
  --gold: #c5942f;
  --shadow: 0 20px 50px rgba(95, 62, 15, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(198, 148, 47, 0.25), transparent 30%),
    radial-gradient(circle at right 20%, rgba(182, 64, 35, 0.18), transparent 30%),
    linear-gradient(135deg, #f9f1e3 0%, #f2e6cf 45%, #eadbc0 100%);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 44px;
}

.hero-copy::after,
.panel::after,
.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(198, 148, 47, 0.24), transparent 70%);
  pointer-events: none;
}

.hero-panel {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 10ch;
  font-size: clamp(2.8rem, 5vw, 4.8rem);
  line-height: 0.95;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 0;
}

.hero-text,
.section-note,
#auth-status {
  color: var(--muted);
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.stat-card {
  min-width: 150px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 248, 236, 0.78);
  border: 1px solid rgba(198, 148, 47, 0.18);
}

.stat-value {
  display: block;
  font-size: 2rem;
  color: var(--accent-dark);
}

.stat-label {
  color: var(--muted);
}

.auth-card,
.panel {
  padding: 24px;
}

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

.search-heading {
  align-items: end;
}

.stack-form,
.agent-form {
  display: grid;
  gap: 12px;
}

.stack-form + .stack-form {
  margin-top: 18px;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(29, 26, 22, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(182, 64, 35, 0.22);
  border-color: rgba(182, 64, 35, 0.35);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  color: #fff7eb;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  transition: transform 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 12px 22px rgba(126, 38, 20, 0.18);
}

button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  width: 100%;
  background: linear-gradient(135deg, #3c3024 0%, #1f1a14 100%);
  box-shadow: 0 12px 22px rgba(31, 26, 20, 0.18);
}

.main-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-top: 24px;
}

.panel-wide {
  grid-column: span 1;
}

.search-controls {
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
}

.leaderboard-list,
.agent-list {
  display: grid;
  gap: 14px;
}

.leaderboard-item,
.agent-card {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(29, 26, 22, 0.09);
  background: rgba(255, 253, 248, 0.88);
}

.leaderboard-rank {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  color: white;
  background: linear-gradient(135deg, var(--gold) 0%, #9b6a13 100%);
}

.agent-card-top,
.leaderboard-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.agent-meta,
.leaderboard-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(198, 148, 47, 0.14);
  color: var(--accent-dark);
  font-size: 0.88rem;
}

.agent-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.score-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.score-button {
  min-width: 42px;
  padding-inline: 0;
}

.score-badge {
  color: var(--accent-dark);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.empty-state {
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed rgba(29, 26, 22, 0.18);
  color: var(--muted);
  background: rgba(255, 251, 244, 0.58);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 14px 18px;
  border-radius: 16px;
  color: #fff7eb;
  background: rgba(29, 26, 22, 0.92);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
}

a {
  color: var(--accent-dark);
}

@media (max-width: 960px) {
  .hero,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 30px;
  }

  h1 {
    max-width: none;
    font-size: 2.8rem;
  }
}
