/* Chess Flash design tokens: surfaces, ink, accent, spacing, radii and motion. */
:root {
  color-scheme: dark;
  --canvas:#101315; --rail:#0b0e10; --surface:#191e20; --surface-high:#202629;
  --ink:#f3f5ee; --muted:#abb4b0; --subtle:#86928d; --line:#343d3c;
  --accent:#d4ef68; --accent-ink:#12180b; --cyan:#75dbd2; --lavender:#b9adff;
  --space-1:.5rem; --space-2:1rem; --space-3:1.5rem; --space-4:2rem;
  --radius-sm:6px; --radius:12px; --radius-lg:20px;
  --ease:cubic-bezier(.2,.7,.2,1); --duration:220ms;
  font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--ink); background:var(--canvas); font-synthesis:none;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; }
button,input,select { font:inherit; }
button,a,summary { cursor:pointer; }
a { color:inherit; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.app { min-height:100vh; display:flex; }
.sidebar { position:sticky; top:0; height:100vh; width:218px; flex:none; padding:32px 20px 24px; background:var(--rail); border-right:1px solid #252b2b; display:flex; flex-direction:column; }
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; font-size:13px; font-weight:750; letter-spacing:.1em; white-space:nowrap; }
.brand strong { color:var(--accent); }
.brand-mark { display:grid; place-items:center; width:38px; height:38px; background:var(--accent); color:var(--accent-ink); border-radius:8px; font-size:25px; line-height:1; }
.side-label,.eyebrow { margin:0 0 12px; color:var(--accent); font-size:14px; font-weight:750; letter-spacing:.12em; line-height:1.3; }
.side-label { color:var(--subtle); margin:74px 10px 15px; font-size:13px; }
.side-link { position:relative; display:flex; gap:12px; align-items:center; padding:13px 12px; border-radius:var(--radius-sm); text-decoration:none; color:#e1e8df; font-size:14px; transition:background var(--duration) var(--ease),transform var(--duration) var(--ease); }
.side-link:hover { background:#202727; transform:translateX(3px); }
.side-link.active { background:#242e24; color:var(--accent); }
.nav-icon { font-size:20px; line-height:1; }
.side-bottom { margin-top:auto; padding:24px 10px 0; color:var(--muted); }
.side-line { display:block; width:34px; height:3px; background:var(--accent); }
.side-bottom p { margin:18px 0 6px; font-size:16px; color:var(--ink); }
.side-bottom small { font-size:14px; line-height:1.5; }
.main { min-width:0; flex:1; }
.topbar { height:72px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; padding:0 clamp(24px,4.5vw,72px); font-size:14px; color:var(--muted); }
.top-note { font-size:13px; font-weight:700; letter-spacing:.12em; color:var(--subtle); }
.content { max-width:1600px; margin:auto; padding:32px clamp(24px,4.5vw,72px) 0; }
h1,h2,h3,p { margin-top:0; }
h1,h2,h3 { color:var(--ink); letter-spacing:-.045em; }
h1 { font-size:clamp(40px,5.5vw,76px); line-height:1.01; margin:0 0 20px; font-weight:750; }
h1 em { font-style:normal; color:var(--accent); }
h2 { font-size:clamp(24px,2.2vw,32px); line-height:1.15; margin:0; }
h3 { font-size:20px; line-height:1.2; margin:0 0 6px; }
.home-intro { position:relative; overflow:hidden; min-height:270px; display:flex; align-items:center; justify-content:space-between; padding:32px 0 34px; }
.intro-copy { position:relative; z-index:1; }
.home-intro .intro-copy>p:last-child { max-width:530px; margin-bottom:0; font-size:17px; color:var(--muted); }
.intro-board { position:absolute; right:3%; top:-15%; width:300px; aspect-ratio:1; display:grid; place-items:center; transform:rotate(-9deg); border:1px solid #66715a; border-radius:15px; background-color:#202722; background-image:conic-gradient(#d4ef6812 25%,transparent 0 50%,#d4ef6812 0 75%,transparent 0); background-size:25% 25%; box-shadow:0 30px 70px #0005; }
.intro-board span { font-family:Georgia,serif; color:var(--accent); font-size:190px; line-height:1; transform:rotate(9deg); text-shadow:0 12px 25px #0008; }
.search-card { position:relative; padding:24px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); }
.search-card label,.table-tools label { display:block; margin-bottom:10px; color:var(--ink); font-weight:650; font-size:14px; }
.search-row { display:flex; align-items:center; border:1px solid #53605a; border-radius:var(--radius-sm); background:#111718; overflow:hidden; transition:border-color var(--duration); }
.search-row:focus-within { border-color:var(--accent); }
.search-row>span { font-size:28px; color:var(--accent); padding-left:16px; }
.search-row input { width:100%; min-width:0; flex:1; padding:16px; outline:none; background:transparent; border:0; color:var(--ink); }
input::placeholder { color:#9ba8a1; opacity:1; }
.search-row button { align-self:stretch; padding:0 25px; border:0; background:var(--accent); color:var(--accent-ink); font-weight:750; transition:background var(--duration),color var(--duration); }
.search-row button:hover { background:#edff9a; }
.hint,.caption,.subtle { color:var(--muted); font-size:14px; line-height:1.5; }
.hint { margin:10px 0 0; }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:20px; margin:56px 0 20px; }
.section-heading .subtle { margin:0; }
.overview-grid,.stats-grid,.rating-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px; overflow:hidden; background:var(--line); border:1px solid var(--line); border-radius:var(--radius); }
.stat,.rating { min-width:0; padding:24px; background:var(--surface); }
.stat-label,.rating-label { display:block; color:var(--muted); font-weight:600; font-size:14px; }
.stat-value,.rating-value { display:block; margin:14px 0 3px; font-size:clamp(25px,2.5vw,38px); line-height:1.05; letter-spacing:-.045em; font-weight:750; color:var(--ink); font-variant-numeric:tabular-nums; }
.stat-note,.rating-note { display:block; font-size:14px; color:var(--muted); line-height:1.5; }
.overview-grid .stat:first-child,.stats-grid .stat:first-child { background:#273025; }
.overview-grid .stat:first-child .stat-value,.stats-grid .stat:first-child .stat-value { color:var(--accent); }
.featured-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.featured-item { position:relative; overflow:hidden; display:flex; align-items:center; justify-content:space-between; min-height:125px; padding:24px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); text-decoration:none; transition:border-color var(--duration),background var(--duration),transform var(--duration); }
.featured-item:after { content:'♞'; position:absolute; right:22px; bottom:-44px; font-family:Georgia,serif; font-size:120px; line-height:1; color:#d4ef6812; pointer-events:none; }
.featured-item:hover { background:#252e27; border-color:var(--accent); transform:translateY(-3px); }
.featured-item strong { display:block; font-size:19px; letter-spacing:-.02em; }
.featured-item small,.search-result small { display:block; margin-top:6px; color:var(--muted); font-size:14px; }
.featured-item>span { display:none; }
.search-results:not(:empty) { margin-top:14px; padding-top:8px; border-top:1px solid var(--line); }
.search-result { display:block; padding:13px 10px; border-bottom:1px solid var(--line); border-radius:4px; text-decoration:none; transition:background var(--duration); }
.search-result:hover { background:#2a352d; }
.search-result strong { display:block; color:var(--ink); }
.search-pagination,.pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 0 0; color:var(--muted); font-size:14px; }
.search-pagination { justify-content:flex-end; }
.search-pagination button,.pagination button { border:1px solid #56645c; background:#252d2b; border-radius:var(--radius-sm); color:var(--ink); padding:8px 14px; transition:background var(--duration),border-color var(--duration); }
.search-pagination button:hover:not(:disabled),.pagination button:hover:not(:disabled) { background:#344237; border-color:var(--accent); }
.search-pagination button:disabled,.pagination button:disabled { opacity:.45; cursor:default; }
.player-top { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.back { display:inline-flex; align-items:center; gap:8px; color:var(--muted); text-decoration:none; font-size:14px; transition:color var(--duration),transform var(--duration); }
.back:before { content:'‹'; font-size:24px; line-height:1; }
.back:hover { color:var(--accent); transform:translateX(-3px); }
.compact-search { width:270px; position:relative; }
.compact-search input,.table-tools input { width:100%; padding:11px 13px; border:1px solid #526059; border-radius:var(--radius-sm); background:#141a1a; color:var(--ink); }
.compact-search .search-results:not(:empty) { position:absolute; z-index:8; top:100%; left:0; right:0; max-height:60vh; overflow:auto; margin-top:6px; padding:8px 12px; border:1px solid var(--line); border-radius:var(--radius); background:#222a27; box-shadow:0 16px 36px #0008; }
.profile { position:relative; overflow:hidden; display:flex; justify-content:space-between; gap:28px; margin-top:28px; padding:40px; background:linear-gradient(110deg,#222c25 0%,#1a2220 60%,#202a24 100%); border:1px solid #445244; border-radius:var(--radius-lg); }
.profile:after { content:''; position:absolute; top:-65px; right:20%; width:220px; height:220px; transform:rotate(14deg); opacity:.25; border-radius:10px; background-image:conic-gradient(#d4ef6835 25%,transparent 0 50%,#d4ef6835 0 75%,transparent 0); background-size:25% 25%; pointer-events:none; }
.profile-copy,.profile-side { position:relative; z-index:1; }
.profile h1 { font-size:clamp(36px,4.2vw,60px); overflow-wrap:anywhere; }
.profile-meta { color:#c2cec3; margin-bottom:18px; }
.identifiers { display:flex; flex-wrap:wrap; gap:8px; font-size:14px; }
.identifiers span { padding:5px 10px; border:1px solid #59685c; border-radius:999px; color:#e3ebe0; }
.profile-side { align-self:center; min-width:160px; padding-left:24px; border-left:1px solid #607063; }
.profile-side span,.profile-side small { display:block; color:#c1ccc2; font-size:14px; line-height:1.5; }
.profile-side strong { display:block; margin:7px 0; color:var(--accent); font-size:28px; letter-spacing:-.04em; }
.rating-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.rating { position:relative; }
.rating:before { content:''; position:absolute; top:0; left:0; width:100%; height:3px; background:var(--cyan); }
.rating:nth-child(2):before { background:var(--lavender); }
.rating:nth-child(3):before { background:var(--accent); }
.rating-value { font-size:32px; }
.filters { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin-bottom:18px; }
.filters label { display:grid; gap:7px; min-width:145px; color:var(--muted); font-weight:650; font-size:14px; }
.filters select { appearance:none; min-height:45px; width:100%; padding:10px 40px 10px 13px; border:1px solid #59675f; border-radius:var(--radius-sm); background-color:#202825; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23d4ef68' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; color:var(--ink); cursor:pointer; transition:border-color var(--duration),background-color var(--duration); }
.filters select:hover { border-color:var(--accent); background-color:#29342b; }
.text-button { padding:11px; border:0; background:none; color:var(--accent); font-size:14px; font-weight:650; }
.text-button:hover { text-decoration:underline; }
.stats-grid { margin-bottom:18px; }
.chart-grid { display:grid; grid-template-columns:2fr 1fr; gap:14px; }
.card { min-width:0; padding:25px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.elo-card { background:linear-gradient(145deg,#1d2925,#191e20 70%); }
.results-card { background:linear-gradient(155deg,#242a25,#191e20 72%); }
.card-heading { display:flex; justify-content:space-between; gap:16px; }
.caption { margin:5px 0 0; }
.tabs { display:flex; align-items:start; gap:3px; }
.tabs button { padding:8px 10px; border:0; border-bottom:2px solid transparent; background:none; color:var(--muted); font-size:14px; transition:color var(--duration),border-color var(--duration); }
.tabs button:hover { color:var(--ink); }
.tabs button.selected { color:var(--accent); border-color:var(--accent); }
.chart-wrap { position:relative; height:260px; margin-top:22px; }
.activity-wrap { height:190px; }
.donut-wrap { position:relative; height:190px; margin-top:18px; }
.chart-wrap canvas,.donut-wrap canvas { animation:chart-enter 450ms var(--ease) both; }
@keyframes chart-enter { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.empty { color:var(--muted); font-size:14px; text-align:center; padding:30px 10px; }
.chart-wrap .empty,.donut-wrap .empty { position:absolute; inset:25% 0 auto; }
.legend { display:flex; justify-content:center; flex-wrap:wrap; gap:14px; margin-top:16px; color:var(--muted); font-size:14px; }
.legend span:before { content:''; display:inline-block; width:8px; height:8px; margin-right:6px; border-radius:50%; background:var(--dot); }
.breakdown-row,.event-row { display:flex; justify-content:space-between; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); color:var(--muted); font-size:14px; }
.breakdown-row strong,.event-row strong { color:var(--ink); white-space:nowrap; }
.breakdown-group { margin-top:16px; color:var(--accent); font-size:14px; font-weight:700; letter-spacing:.1em; }
.table-card { padding:0; overflow:hidden; }
.table-tools { max-width:390px; padding:22px 24px; }
.table-scroll { overflow-x:auto; }
table { width:100%; min-width:830px; border-collapse:collapse; font-size:14px; }
th { background:#242c29; color:#c1cbc2; text-align:left; font-weight:650; }
th,td { padding:15px 18px; border-bottom:1px solid var(--line); }
th button { padding:0; border:0; background:none; color:inherit; font:inherit; }
th button:hover { color:var(--accent); }
td { color:var(--muted); }
td:first-child,td:nth-child(2),td:nth-child(3) { color:#e3eae2; }
td a { color:var(--accent); }
tbody tr { transition:background var(--duration); }
tbody tr:hover { background:#29322c; }
.pagination { padding:18px 24px; }
.pagination button { margin-left:5px; }
.lower-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:18px; }
.lower-grid .card { min-height:150px; }
.coverage-copy { margin:14px 0; color:var(--muted); font-size:14px; line-height:1.7; }
#events { max-height:360px; overflow:auto; }
.event-row span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
details { margin-top:18px; padding-top:14px; border-top:1px solid var(--line); }
summary { color:var(--ink); font-size:14px; font-weight:650; }
#administrative p { color:var(--muted); font-size:14px; line-height:1.5; }
footer { display:flex; justify-content:space-between; gap:20px; margin-top:70px; padding:25px 0 35px; border-top:1px solid var(--line); color:var(--muted); font-size:14px; font-weight:700; letter-spacing:.1em; }
footer span { font-weight:400; letter-spacing:0; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
#notice:not(:empty) { margin-bottom:20px; padding:14px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); color:var(--muted); }
#home:not([hidden]),#player:not([hidden]) { animation:page-enter 350ms var(--ease) both; }
@keyframes page-enter { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@media(max-width:1050px) {
  .sidebar { width:68px; padding:26px 14px; }
  .brand span:last-child,.side-label,.side-link span:last-child,.side-bottom { display:none; }
  .side-link { margin-top:65px; justify-content:center; padding:12px 0; }
  .side-link + .side-link { margin-top:8px; }
  .overview-grid,.stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .chart-grid { grid-template-columns:minmax(0,1fr); }
  .elo-card,.activity-card { grid-column:auto; }
}
@media(max-width:650px) {
  .app { display:block; }
  .sidebar { position:relative; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; width:100%; height:auto; min-height:0; padding:10px 20px; border-right:0; border-bottom:1px solid var(--line); }
  .brand { grid-column:1/-1; margin-bottom:2px; }
  .brand span:last-child { display:inline; }
  .brand-mark { width:35px; height:35px; }
  .side-link,.side-link + .side-link { justify-content:flex-start; min-width:0; min-height:44px; margin:0; padding:6px 9px; }
  .side-link span:last-child { display:inline; line-height:1.2; }
  .topbar { height:49px; padding:0 20px; }
  .top-note { display:none; }
  .content { padding:24px 20px 0; }
  .home-intro { min-height:245px; align-items:flex-start; padding:24px 0; }
  .home-intro h1 { font-size:43px; }
  .home-intro .intro-copy>p:last-child { max-width:260px; font-size:16px; }
  .intro-board { width:170px; right:-75px; top:20px; opacity:.48; }
  .intro-board span { font-size:110px; }
  .search-card,.card { padding:18px; }
  .search-row { flex-wrap:wrap; }
  .search-row input { width:calc(100% - 50px); flex:auto; padding:13px; }
  .search-row button { min-height:46px; width:100%; }
  .section-heading { margin:42px 0 16px; align-items:start; flex-direction:column; gap:8px; }
  .stat,.rating { padding:18px; }
  .featured-grid,.lower-grid { grid-template-columns:1fr; }
  .featured-item { min-height:100px; }
  .player-top { align-items:stretch; flex-direction:column; gap:14px; }
  .compact-search { width:100%; }
  .profile { padding:25px 20px; flex-direction:column; }
  .profile h1 { font-size:38px; }
  .profile:after { right:-80px; }
  .profile-side { align-self:stretch; padding:16px 0 0; border-left:0; border-top:1px solid #607063; }
  .rating-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .rating { padding:17px 12px; }
  .rating-value { font-size:24px; }
  .filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .filters label { min-width:0; }
  .text-button { justify-self:start; padding-left:0; }
  .chart-grid { grid-template-columns:1fr; }
  .elo-card,.activity-card { grid-column:auto; }
  .card-heading { flex-direction:column; }
  .tabs { flex-wrap:wrap; }
  .chart-wrap { height:220px; }
  .activity-wrap { height:180px; }
  .table-card { padding:0; }
  .table-tools { padding:18px; }
  .pagination { align-items:flex-start; flex-direction:column; padding:16px 18px; }
  .pagination button { margin:0 5px 0 0; }
  footer { flex-direction:column; gap:6px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
}

/* Accessible custom select: the native control remains the source of truth. */
.filters .cf-select-native { display:none; }
.cf-select { display:block; position:relative; min-width:0; }
.cf-select-trigger { position:relative; display:flex; align-items:center; width:100%; min-height:45px; padding:10px 39px 10px 13px; border:1px solid #59675f; border-radius:var(--radius-sm); background:#202825; color:var(--ink); text-align:left; font-size:14px; font-weight:650; transition:border-color var(--duration),background var(--duration); }
.cf-select-trigger:after { content:''; position:absolute; right:15px; top:16px; width:7px; height:7px; border-right:2px solid var(--accent); border-bottom:2px solid var(--accent); transform:rotate(45deg); transition:transform var(--duration),top var(--duration); }
.cf-select-trigger:hover,.cf-select-trigger[aria-expanded='true'] { border-color:var(--accent); background:#29342b; }
.cf-select-trigger[aria-expanded='true']:after { top:20px; transform:rotate(225deg); }
.cf-select-menu { position:absolute; z-index:10; top:calc(100% + 7px); left:0; right:0; max-height:240px; overflow:auto; margin:0; padding:5px; list-style:none; border:1px solid #59675f; border-radius:var(--radius-sm); background:#222b27; box-shadow:0 12px 28px #0009; animation:menu-enter 180ms var(--ease) both; }
.cf-select-option { min-height:44px; padding:11px 10px; border-radius:4px; color:var(--ink); font-size:14px; font-weight:500; cursor:pointer; }
.cf-select-option:hover,.cf-select-option.is-active { background:#354337; }
.cf-select-option[aria-selected='true'] { color:var(--accent); font-weight:700; }
@keyframes menu-enter { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

/* A compact profile puts statistics and graphs closer to the player identity. */
.profile { padding:28px 32px; margin-top:20px; }
.profile h1 { font-size:clamp(34px,3.5vw,48px); margin-bottom:12px; }
.profile-meta { margin-bottom:12px; }
#player .section-heading { margin-top:32px; margin-bottom:14px; }
#player .rating { padding:16px 22px; }
#player .rating-value { margin-top:8px; font-size:28px; }
#player .stats-grid .stat { padding:15px 20px; }
#player .stats-grid .stat-value { margin-top:8px; font-size:30px; }
@media(max-width:650px) {
  .profile { padding:22px 20px; }
  .profile h1 { font-size:35px; }
  #player .rating { padding:14px 12px; }
  #player .rating-value { font-size:24px; }
  #player .stats-grid .stat { padding:14px; }
  #player .stats-grid .stat-value { font-size:25px; }
}
