:root{
  --bg:#f3eee5;
  --bg-accent:#e2d5c4;
  --ink:#1e1712;
  --ink-soft:#5f5147;
  --line:#d7c6b4;
  --line-strong:#b79d82;
  --panel:#fbf7f1;
  --panel-2:#f5ede2;
  --shadow:0 22px 60px rgba(72, 48, 28, .14);
  --radius-xl:34px;
  --radius-lg:24px;
  --radius-md:18px;
  --radius-sm:14px;
  --mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans:Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  min-height:100vh;
  font-family:var(--sans);
  color:var(--ink);
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(164, 131, 98, .10), transparent 60%),
    radial-gradient(700px 460px at 100% 100%, rgba(117, 85, 55, .10), transparent 62%),
    linear-gradient(180deg, #efe7dc 0%, #f6f0e8 45%, #efe6da 100%);
}

.noise{
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.06;
  background-image:
    linear-gradient(rgba(30, 23, 18, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 23, 18, .10) 1px, transparent 1px);
  background-size:22px 22px;
  mask-image:linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,.12));
}

button, a{ font:inherit; }
.mono{ font-family:var(--mono); }

.topbar{
  width:min(1280px, calc(100% - 32px));
  margin:24px auto 0;
  padding:18px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(251, 247, 241, .82);
  backdrop-filter:blur(10px);
  box-shadow:0 8px 30px rgba(72, 48, 28, .08);
}

.brand{
  color:var(--ink);
  text-decoration:none;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  font-size:18px;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.topbar-btn,
.btn{
  appearance:none;
  border:none;
  cursor:pointer;
  transition:transform .14s ease, background .14s ease, border-color .14s ease, opacity .14s ease, color .14s ease;
}

.topbar-btn{
  padding:11px 16px;
  border-radius:999px;
  border:1px solid var(--line);
  background:transparent;
  color:var(--ink);
}
.topbar-btn:hover,
.btn:hover{ transform:translateY(-1px); }

.topbar-btn-solid{
  background:var(--ink);
  color:#f8f3ec;
  border-color:var(--ink);
}

.layout{
  width:min(1280px, calc(100% - 32px));
  margin:26px auto 0;
  padding:0 0 40px;
}

.leaderboard-shell{
  display:grid;
  grid-template-columns:300px minmax(0, 1fr);
  gap:18px;
  align-items:stretch;
}

.leaderboard-side,
.board-panel{
  background:linear-gradient(180deg, rgba(251,247,241,.96), rgba(244,234,221,.96));
  border:1px solid var(--line);
  box-shadow:var(--shadow);
}

.leaderboard-side{
  border-radius:var(--radius-xl);
  padding:28px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  min-height:720px;
}

.side-kicker,
.modal-eyebrow{
  display:inline-flex;
  width:max-content;
  padding:8px 12px;
  border-radius:999px;
  background:#efe4d7;
  border:1px solid var(--line);
  color:var(--ink-soft);
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.leaderboard-side h1{
  margin:18px 0 10px;
  font-size:48px;
  line-height:.96;
  letter-spacing:-.05em;
}

.side-text{
  margin:0;
  color:var(--ink-soft);
  font-size:15px;
  line-height:1.7;
}

.stats-grid{
  display:grid;
  gap:12px;
  margin-top:24px;
}

.stat-card{
  padding:16px 18px;
  border-radius:20px;
  background:rgba(255,255,255,.42);
  border:1px solid var(--line);
}

.stat-label{
  display:block;
  margin-bottom:6px;
  font-size:11px;
  color:var(--ink-soft);
  letter-spacing:.12em;
  text-transform:uppercase;
}

.stat-card strong{
  display:block;
  font-size:20px;
  font-weight:900;
}

.service-note{
  margin-top:24px;
  padding:18px 20px;
  border-radius:24px;
  background:#241b15;
  color:#f5ece3;
  line-height:1.6;
  font-size:14px;
}

.board-panel{
  border-radius:40px;
  overflow:hidden;
}

.board-head{
  padding:26px 26px 20px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  border-bottom:1px solid var(--line);
}

.board-title{
  font-size:32px;
  font-weight:900;
  letter-spacing:-.04em;
}

.board-subtitle{
  margin-top:8px;
  color:var(--ink-soft);
  font-size:14px;
}

.controls{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.btn{
  padding:11px 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fffaf4;
  color:var(--ink);
}

.btn-ghost{ background:rgba(255,255,255,.55); }
.btn[disabled]{ opacity:.42; cursor:not-allowed; transform:none; }

.page-indicator{
  min-width:150px;
  padding:11px 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#f0e5d8;
  text-align:center;
  color:var(--ink-soft);
  font-size:13px;
  font-family:var(--mono);
}

.table-wrap{ overflow:auto; }

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

thead th{
  padding:16px 22px;
  text-align:left;
  font-size:12px;
  font-weight:800;
  letter-spacing:.10em;
  text-transform:uppercase;
  color:var(--ink-soft);
  background:#f0e4d6;
  border-bottom:1px solid var(--line);
}

tbody td{
  padding:18px 22px;
  font-size:14px;
  vertical-align:middle;
  border-bottom:1px solid rgba(183, 157, 130, .30);
}

tbody tr:nth-child(even){ background:rgba(255,255,255,.34); }
tbody tr:hover{ background:rgba(182, 145, 106, .08); }

.col-rank{ width:110px; }
.col-user{ width:48%; }
.col-score{ width:20%; }
.col-date{ width:22%; }

.state-cell{
  padding:28px 22px;
  text-align:center;
  color:var(--ink-soft);
}

.rank{
  display:flex;
  align-items:center;
}

.rank-badge{
  min-width:62px;
  height:42px;
  padding:0 14px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:#ede0d0;
  border:1px solid var(--line);
  font-family:var(--mono);
  font-weight:800;
}

.rank-1 .rank-badge{
  background:#1f1712;
  border-color:#1f1712;
  color:#f6ebdd;
}
.rank-2 .rank-badge{
  background:#d8c3aa;
}
.rank-3 .rank-badge{
  background:#e8d8c8;
}

.rank-star{
  font-size:11px;
  transform:translateY(-1px);
}

.user{
  display:flex;
  align-items:center;
  gap:12px;
}

.avatar{
  width:42px;
  height:42px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#f6eee6;
  flex:0 0 auto;
}

.uname{
  font-weight:800;
  font-size:15px;
}

.utag{
  margin-left:8px;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#f1e5d8;
  color:var(--ink-soft);
  font-size:11px;
  font-family:var(--mono);
}

.uid{
  margin-top:4px;
  color:var(--ink-soft);
  font-size:12px;
}

.score{
  font-weight:900;
  font-size:15px;
}

.board-foot{
  padding:16px 22px 20px;
  color:var(--ink-soft);
  font-size:13px;
}

.error-line{ word-break:break-word; }

.modal-overlay{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(31, 23, 18, .38);
  backdrop-filter:blur(8px);
  z-index:1000;
}

.modal{
  width:min(620px, 100%);
  padding:28px;
  border-radius:28px;
  background:#fbf6ef;
  border:1px solid var(--line);
  box-shadow:0 28px 80px rgba(31, 23, 18, .24);
  position:relative;
}

.modal h2{
  margin:16px 0 12px;
  font-size:34px;
  line-height:1;
  letter-spacing:-.04em;
}

.modal p{
  margin:10px 0;
  color:var(--ink-soft);
  line-height:1.7;
  font-size:15px;
}

.contact-box{
  margin-top:18px;
  padding:16px 18px;
  border-radius:20px;
  background:#f0e3d5;
  border:1px solid var(--line);
  line-height:1.7;
}

.close-btn{
  position:absolute;
  top:14px;
  right:14px;
  width:40px;
  height:40px;
  border:none;
  border-radius:999px;
  background:#efe2d3;
  color:var(--ink);
  font-size:22px;
  cursor:pointer;
}

@media (max-width: 1080px){
  .leaderboard-shell{
    grid-template-columns:1fr;
  }

  .leaderboard-side{
    min-height:auto;
    gap:24px;
  }
}

@media (max-width: 760px){
  .topbar{
    border-radius:28px;
    padding:16px;
    align-items:flex-start;
    flex-direction:column;
  }

  .board-head{
    padding:20px 18px 16px;
  }

  thead th,
  tbody td{
    padding-left:16px;
    padding-right:16px;
  }

  .col-date{ display:none; }
  .col-user{ width:auto; }
  .col-score{ width:30%; }
  .col-rank{ width:96px; }

  .leaderboard-side h1{
    font-size:38px;
  }

  .board-title{
    font-size:28px;
  }

  .board-panel{
    border-radius:28px;
  }
}
