:root {
  --bg: #f7f5f1;
  --surface: #fffdfa;
  --ink: #15171c;
  --muted: #6c6f78;
  --line: #e4dfd6;
  --accent: #ff4655;
  --accent-soft: #ffe9eb;
  --green: #1f8a5b;
  --red: #d3455a;
  --max: 1040px;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 245, 241, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  font-size: 1.02rem;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.95rem;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
  border-color: var(--ink);
}

/* Hero */
.hero {
  padding: 84px 0 68px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 680;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .lead {
  margin: 22px 0 0;
  max-width: 56ch;
  font-size: 1.09rem;
  color: #3d4048;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.riot-line {
  margin: 30px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.riot-line code,
code.riot {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  border-color: #cfc8bd;
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #000;
  border-color: #000;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

/* Sections */
.section {
  padding: 64px 0;
  border-bottom: 1px solid var(--line);
}

.section:last-of-type {
  border-bottom: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  font-weight: 640;
}

.section-head a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.section-head a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* Posts */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: #cfc8bd;
  transform: translateY(-2px);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag {
  color: var(--accent);
}

.post-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  font-weight: 620;
}

.post-card p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted);
}

.read-more {
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.88rem;
  font-weight: 550;
  color: var(--ink);
}

/* Post list page */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.post-row:last-child {
  border-bottom: 1px solid var(--line);
}

.post-row:hover h3 {
  color: var(--accent);
}

.post-row time {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-row h3 {
  margin: 0 0 4px;
  font-size: 1.12rem;
  letter-spacing: -0.015em;
  transition: color 0.15s ease;
}

.post-row p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

/* Article */
.article {
  padding: 60px 0 20px;
}

.article-head {
  max-width: 68ch;
}

.article-head h1 {
  margin: 10px 0 0;
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 660;
}

.article-body {
  max-width: 68ch;
  margin-top: 34px;
  font-size: 1.05rem;
  color: #2a2d34;
}

.article-body p {
  margin: 0 0 20px;
}

.article-body h2 {
  margin: 36px 0 12px;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}

.article-foot {
  max-width: 68ch;
  margin: 36px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: start;
}

.about-grid p {
  margin: 0 0 16px;
  color: #3d4048;
}

.facts {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 6px 20px;
}

.fact {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.fact:last-child {
  border-bottom: 0;
}

.fact span {
  color: var(--muted);
}

.fact strong {
  font-weight: 560;
  text-align: right;
}

/* Stats page */
.page-head {
  padding: 56px 0 32px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.9rem);
  letter-spacing: -0.03em;
  line-height: 1.06;
  font-weight: 660;
}

.page-head p {
  margin: 14px 0 0;
  max-width: 62ch;
  color: #3d4048;
}

.lookup {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.97rem;
  width: 100%;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.lookup .btn {
  align-self: end;
  height: 44px;
}

.hint {
  margin: 12px 0 0;
  font-size: 0.87rem;
  color: var(--muted);
}

.result {
  margin-top: 28px;
}

.notice {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
}

.notice h2 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.notice p {
  margin: 0 0 8px;
  font-size: 0.93rem;
  color: var(--muted);
}

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

.notice ol {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 0.93rem;
  color: #3d4048;
}

.notice li {
  margin-bottom: 4px;
}

.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.88em;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--line);
}

.profile-card h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.profile-card .sub {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.stat-box .label {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-box .value {
  margin: 6px 0 0;
  font-size: 1.5rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-box .value small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.stat-box .note {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.matches {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.match {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}

.match:last-child {
  border-bottom: 0;
}

.match img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.match .map {
  font-weight: 550;
}

.match .rank {
  color: var(--muted);
  font-size: 0.85rem;
}

.match .rr {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.match .rr.up {
  color: var(--green);
}

.match .rr.down {
  color: var(--red);
}

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

.sub-head {
  margin: 32px 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Footer */
.site-footer {
  padding: 34px 0 48px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.site-footer a:hover {
  border-color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lookup {
    grid-template-columns: 1fr 1fr;
  }
  .lookup .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  .hero {
    padding: 56px 0 48px;
  }
  .section {
    padding: 48px 0;
  }
  .post-grid {
    grid-template-columns: 1fr;
  }
  .post-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .nav {
    gap: 16px;
    font-size: 0.88rem;
  }
  .profile-card {
    flex-wrap: wrap;
  }
  .profile-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  .lookup {
    grid-template-columns: 1fr;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}
