:root {
  --radius: 14px;
  --bg: #0e0f12;
  --card: #16181d;
  --muted: #9aa0a6;
  --text: #e8eaed;
  --accent: #6ea8fe;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif; }
html, body, .container { overflow-x: hidden; }

.container { max-width: 1120px; margin: 24px auto; padding: 0 16px; }
.footer { max-width: 1120px; margin: 32px auto; padding: 12px 16px;
  color: var(--muted); border-top: 1px solid #24262b; }

/* ---------- Top bar (aligned to content width) ---------- */
.topbar{
  position: sticky; top: 0; z-index: 60;
  background: #0b0f14;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-inner{
  max-width: 1120px;            /* same width as .container */
  margin: 0 auto;
  padding: 10px 16px;           /* same side padding as .container */
  display: flex; align-items: center; gap: 12px;
}
.nav-left, .nav-right{ display:flex; align-items:center; gap:10px; }
.nav-center{ flex:1; display:flex; justify-content:center; min-width: 0; }
.brand{ color:#fff; text-decoration:none; font-weight:700; font-size:18px; }
.nav-link{ color:#cbd5e1; text-decoration:none; padding:6px 4px; }
.nav-link:hover{ color:#fff; }
.board-title{ font-weight:800; color:#fff; font-size:16px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }

/* Buttons in the topbar */
.btn { display:inline-block; background:var(--accent); color:#0a0c10; border:none;
  padding:8px 12px; border-radius:10px; font-weight:700; text-decoration:none; cursor:pointer; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid #2b2e35; }
.btn.small { padding: 0 12px; height: 32px; display:inline-flex; align-items:center; justify-content:center; }

/* Force readable colors for buttons in the topbar */
.topbar a.btn,
.topbar a.btn:link,
.topbar a.btn:visited,
.topbar a.btn:hover,
.topbar a.btn:active { color:#0a0c10 !important; }
.topbar a.btn.ghost,
.topbar a.btn.ghost:link,
.topbar a.btn.ghost:visited,
.topbar a.btn.ghost:hover,
.topbar a.btn.ghost:active { color:var(--text) !important; }

/* ---------- Flash ---------- */
.flash { background:#152a12; border:1px solid #1f4b18; color:#b7f397; padding:10px 12px; border-radius:10px; margin-bottom:16px; }
.flash.warn { background:#2a1512; border:1px solid #4b1f18; color:#f3b797; }

/* ---------- Layout with left sidebar ---------- */
.layout { display:grid; grid-template-columns: minmax(0,240px) minmax(0,1fr); gap:16px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* Sidebar */
.sidebar { background: var(--card); border: 1px solid #24262b; border-radius: var(--radius); padding: 12px; }
.sidebar-title { margin: 4px 0 8px; font-size: 18px; }
.sidebar .list { list-style: none; padding: 0; margin: 0; }
.sidebar .list li { border-bottom: 1px solid #22252b; }
.sidebar .list li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.sidebar .list li a:hover, .sidebar .list li a.active { background: #1a1d24; }

/* ---------- Cards & tables ---------- */
.cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap:16px; }
.cards.cards-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.cards.cards-2 .card.wide { grid-column: 1 / -1; }
@media (max-width:900px){ .cards.cards-2{ grid-template-columns:1fr; } .cards.cards-2 .card.wide{ grid-column:auto; } }

.card { background: var(--card); border: 1px solid #24262b; border-radius: var(--radius); padding: 12px; }
.card h2 { margin-top: 4px; }

.table { width:100%; border-collapse:collapse; background:transparent; border-radius:var(--radius); overflow:hidden; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid #22252b; }
.table th { text-align:left; color:var(--muted); font-weight:600; background:#171a20; }
.table td.num, .table th.num { text-align:right; }
.table tbody tr:hover { background:#1a1d24; }
.table .muted { text-align:center; color:var(--muted); padding:18px; }

/* Compact table variant (Today + History) */
.table.compact th, .table.compact td { padding:6px 8px; white-space:nowrap; }
.table.compact td { font-variant-numeric: tabular-nums; }
.table.compact th abbr { text-decoration:none; border-bottom:0; }

/* ---------- Links (dark theme) ---------- */
a:not(.btn){ color:#cbd5ff; text-decoration:none; transition:color .15s ease, border-color .15s ease; }
a:not(.btn):visited{ color:#cbd5ff; }
a:not(.btn):hover, a:not(.btn):focus{ color:#ffffff; text-decoration:underline; }
.table a:not(.btn){ border-bottom:1px dashed rgba(203,213,255,.35); }
.table a:not(.btn):hover{ border-bottom-color: rgba(255,255,255,.7); }
.sidebar a:not(.btn){ color:#e5e7eb; }
.sidebar a:not(.btn):hover{ color:#fff; }

/* ---------- Share actions + toast ---------- */
.share-actions{ margin-left:8px; display:inline-flex; gap:8px; }
#today-card .share-actions .btn.small{ padding:4px 8px; }

.toast{
  position:fixed; bottom:16px; right:16px;
  background:#1f2937; color:#e5e7eb; border:1px solid rgba(255,255,255,.1);
  padding:10px 14px; border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,.3);
  opacity:0; transform:translateY(10px); pointer-events:none; z-index:9999;
  transition:opacity .15s ease, transform .15s ease; font-size:14px;
}
.toast.show{ opacity:1; transform:translateY(0); }

/* ---------- Copy highlight (Today share) ---------- */
.table tr.copy-highlight{ background: rgba(99,102,241,.18); box-shadow: inset 0 0 0 2px rgba(99,102,241,.6); }
.table tr.copy-highlight td{ color:#fff; }
.table tr.copy-dim{ opacity:.55; }

/* ---------- Paste boxes (submit form) ---------- */
.paste-wrap { margin-top: 12px; }
.paste-box{
  height: 180px; border:1px dashed rgba(255,255,255,.25);
  display:flex; align-items:center; justify-content:center;
  border-radius: 10px; background: rgba(255,255,255,.02);
  cursor: pointer; position: relative; overflow: hidden; outline:none;
}
.paste-box .hint{ color:#a1a1aa; text-align:center; font-size: 13px; }
.paste-box.has-image .hint{ display:none; }
.paste-box img{ max-height:100%; max-width:100%; display:block; }
.paste-grid { margin-top: 12px; }
.paste-grid .paste-wrap { min-width: 0; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Today's round posts ---------- */

/* Stack posts vertically with a bit more space */
.posts{
  display:flex;
  flex-direction:column;
  gap:24px;
}

/* Make the “Today’s round” posts borderless so screenshots can use all the space */
.post.card{
  padding:0;
  overflow:visible;
  max-height:none;
  background:none;
  border:none;
}

/* Header stays the same */
.post-header{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:12px;
  gap:12px;
}
.post-title .player{
  font-weight:600;
  font-size:18px;
  margin-right:10px;
}
.post-title .meta{
  color:#a9b1c3;
  font-size:14px;
}
.post-header .time{
  color:#8c94a6;
  font-size:12px;
}

/* One block per row – screenshot is as wide as the content */
.rounds{
  display:grid;
  grid-template-columns:1fr;         /* was: repeat(3, 1fr) */
  gap:16px;
  align-items:stretch;
}

/* Remove inner “card” look around each round */
.round{
  background:transparent;
  border:none;
  border-radius:0;
  padding:0;
  display:flex;
  flex-direction:column;
}

.round-head{
  color:#a9b1c3;
  font-size:12px;
  margin-bottom:6px;
}

/* Let the screenshot fill the row with no rounded corners */
.shot,
.shot-empty{
  width:100%;
  height:auto;
  aspect-ratio:16 / 9;
  border-radius:0;                   /* no rounded border on the image */
  overflow:hidden;
}

/* Keep the “no screenshot” placeholder styling */
.shot-empty{
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed #2a3140;
  background:#0e1218;
  color:#8c94a6;
  font-size:13px;
}

/* Boards page header: right-align the button and make it not bold */
.page-title{
  display:flex;
  align-items:center;
  gap:10px;
}
.page-title .btn{
  margin-left:auto;     /* push button to the right */
  font-weight:500;      /* override the bold .btn rule above */
}

@media (max-width: 900px){ .rounds{ grid-template-columns:1fr; } }

/* ---------- Forms ---------- */
.form { display:grid; gap:12px; background:var(--card); padding:16px; border-radius:var(--radius); border:1px solid #24262b; }
.form label { display:grid; gap:6px; }
.form input, .form select { background:#0f1116; color:var(--text); border:1px solid #2b2e35; border-radius:8px; padding:10px 12px; }
.form .hint { color:var(--muted); font-size:12px; margin-top:-4px; }
.actions { display:flex; gap:8px; margin-top:4px; }

/* ---------- Make leaderboard header disappear (only on the leaderboard page) ---------- */
/* Works because that page has the cards grid; other pages (e.g., Today's round) keep their H1 */
.content:has(.cards.cards-2) > h1 { display: none; }

.page-title{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin:0 0 12px;
}
.page-title h1{ margin:0; font-size:32px; font-weight:700; }
.page-title .btn{ font-weight:500; }  /* no !important needed now */

/* ---------- Today’s round: fullscreen, borderless posts ---------- */
.rounds{ display:grid; grid-template-columns:repeat(3, 1fr); gap:12px; align-items:stretch; }


/* Make the main content full width only on the page that has .posts (Today’s round) */
main.container:has(.posts){
  max-width: none;       /* no 1120px limit */
  margin: 24px 0;        /* keep top/bottom margin, no left/right gaps */
  padding: 0;            /* remove side padding */
}

/* Remove card frame only for Today’s round posts */
main.container:has(.posts) .post.card{
  background: none;
  border: none;
  padding: 16px 0;       /* keep vertical spacing between players */
}

/* Remove inner “card” look around each round */
main.container:has(.posts) .round{
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
}

/* Screenshots should go edge-to-edge inside their column */
main.container:has(.posts) .shot,
main.container:has(.posts) .shot-empty{
  border-radius: 0;
}

/* ---------- Screenshot lightbox ---------- */

.image-lightbox{
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.image-lightbox.open{
  display: flex;
}

.image-lightbox img{
  max-width: min(96vw, 1200px);
  max-height: 96vh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
}

.image-lightbox-close{
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #f5f5f5;
  line-height: 1;
}

.image-lightbox-caption{
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #ccc;
  font-size: 13px;
  text-align: center;
}

/* Show pointer on clickable screenshots */
.shot{
  cursor: zoom-in;
}
