:root {
  --bg:#07111f;
  --panel:#0d1b2f;
  --panel2:#132641;
  --card:rgba(255,255,255,.075);
  --line:rgba(255,255,255,.13);
  --text:#f8fafc;
  --muted:rgba(248,250,252,.7);
  --accent:#41d17d;
  --accent2:#38bdf8;
  --warn:#f59e0b;
  --bad:#ef4444;
  --good:#22c55e;
  --white:#f0d9b5;
  --black:#b58863;
}
* { box-sizing:border-box; }
body {
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(circle at 0 0, rgba(65,209,125,.20), transparent 34%),
    radial-gradient(circle at 100% 0, rgba(56,189,248,.18), transparent 35%),
    linear-gradient(135deg,#050b14,#07111f 55%,#0d1b2f);
  color:var(--text);
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
button,input,select,textarea { font:inherit; }
button {
  cursor:pointer;
  border:0;
  border-radius:14px;
  padding:11px 14px;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:#04111f;
  font-weight:900;
}
button.ghost {
  background:rgba(255,255,255,.08);
  color:var(--text);
  border:1px solid var(--line);
}
button.danger { background:linear-gradient(135deg,#ef4444,#f97316); color:#fff; }
button:disabled { opacity:.45; cursor:not-allowed; }
input,select,textarea {
  width:100%;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px 13px;
  background:rgba(255,255,255,.08);
  color:var(--text);
}
select option { color:#0f172a; }
textarea { min-height:90px; resize:vertical; }
label { display:block; margin:0 0 7px; color:var(--muted); font-weight:800; font-size:13px; }
a { color:#93c5fd; text-decoration:none; }
.top {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  gap:18px;
  align-items:center;
  min-height:92px;
  padding:18px 22px;
  border-bottom:1px solid var(--line);
  background:rgba(3,9,20,.68);
  backdrop-filter:blur(14px);
  position:sticky;
  top:0;
  z-index:10;
}
.brand { display:flex; align-items:center; gap:14px; }
.logo {
  width:58px;height:58px;border-radius:18px;
  display:grid;place-items:center;
  font-size:36px;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:#03101c;
  box-shadow:0 18px 40px rgba(65,209,125,.18);
}
h1,h2,h3,p { margin-top:0; }
.brand h1 { margin:0 0 3px; font-size:25px; }
.brand p { margin:0; color:var(--muted); font-weight:700; }
nav { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
.nav {
  background:transparent;
  color:var(--text);
  border:1px solid transparent;
}
.nav.active {
  border-color:rgba(65,209,125,.42);
  background:rgba(65,209,125,.12);
}
.right { display:flex; gap:8px; align-items:center; }
main { padding:24px; max-width:1440px; margin:0 auto; }
footer {
  padding:24px;
  border-top:1px solid var(--line);
  color:var(--muted);
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  justify-content:center;
}
.grid { display:grid; gap:16px; }
.grid.two { grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid.three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.card {
  border:1px solid var(--line);
  background:linear-gradient(135deg,rgba(19,38,65,.92),rgba(12,26,46,.86));
  border-radius:28px;
  padding:20px;
  box-shadow:0 24px 70px rgba(0,0,0,.24);
}
.hero {
  min-height:330px;
  display:grid;
  grid-template-columns:minmax(0,1fr) 390px;
  gap:20px;
  align-items:center;
}
.hero h2 {
  font-size:58px;
  line-height:.96;
  letter-spacing:-1.5px;
  margin:12px 0 16px;
}
.hero p { color:var(--muted); font-size:18px; max-width:820px; }
.heroBoard {
  aspect-ratio:1;
  border-radius:30px;
  padding:14px;
  background:rgba(255,255,255,.08);
  border:1px solid var(--line);
  display:grid;
  grid-template-columns:repeat(8,1fr);
  overflow:hidden;
}
.heroBoard div:nth-child(odd) { background:var(--white); }
.heroBoard div:nth-child(even) { background:var(--black); }
.badge {
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 11px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.08);
  color:var(--muted);
  font-weight:900;
  font-size:12px;
}
.actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }
.notice {
  border-left:4px solid var(--accent);
  background:rgba(65,209,125,.10);
  padding:14px;
  border-radius:14px;
  color:#d1fae5;
  font-weight:750;
}
.warn {
  border-left-color:var(--warn);
  background:rgba(245,158,11,.12);
  color:#fde68a;
}
.formGrid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.tournamentCard { display:grid; gap:12px; }
.meta { display:flex; gap:8px; flex-wrap:wrap; color:var(--muted); }
.table { width:100%; border-collapse:collapse; overflow:hidden; border-radius:18px; }
.table th,.table td { padding:12px; border-bottom:1px solid var(--line); text-align:left; }
.table th { color:#bfdbfe; font-size:13px; text-transform:uppercase; letter-spacing:.04em; }
.table tr:last-child td { border-bottom:0; }
.gameRow {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:12px;
  border:1px solid var(--line);
  border-radius:16px;
  margin:8px 0;
  background:rgba(255,255,255,.055);
}
.profileBox { display:flex; gap:10px; align-items:end; flex-wrap:wrap; }
.profileBox > div { min-width:260px; }
.boardWrap {
  display:grid;
  grid-template-columns:minmax(320px,600px) minmax(260px,1fr);
  gap:18px;
  align-items:start;
}
.chessboard {
  width:min(72vw,600px);
  max-width:100%;
  aspect-ratio:1;
  display:grid;
  grid-template-columns:repeat(8,1fr);
  border:12px solid rgba(255,255,255,.08);
  border-radius:24px;
  overflow:hidden;
  box-shadow:0 30px 80px rgba(0,0,0,.32);
}
.square {
  position:relative;
  display:grid;
  place-items:center;
  font-size:clamp(28px,6vw,54px);
  user-select:none;
}
.square.light { background:#f0d9b5; color:#1f2937; }
.square.dark { background:#b58863; color:#111827; }
.square.selected { outline:4px solid #38bdf8; outline-offset:-4px; }
.square.last { box-shadow:inset 0 0 0 999px rgba(34,197,94,.18); }
.coord {
  position:absolute; left:4px; bottom:2px;
  font-size:11px; font-weight:900; opacity:.55;
}
.clock {
  font-variant-numeric:tabular-nums;
  font-size:28px;
  font-weight:1000;
  padding:10px 12px;
  border-radius:16px;
  background:rgba(255,255,255,.09);
  border:1px solid var(--line);
}
.moves {
  max-height:260px;
  overflow:auto;
  padding:12px;
  border-radius:16px;
  background:rgba(0,0,0,.18);
  line-height:1.8;
}
.small { color:var(--muted); font-size:13px; }
.error { color:#fecaca; font-weight:800; }
.success { color:#bbf7d0; font-weight:800; }
@media(max-width:1000px){
  .top { grid-template-columns:1fr; }
  .hero,.grid.two,.grid.three,.boardWrap,.formGrid { grid-template-columns:1fr; }
  .hero h2 { font-size:42px; }
  main { padding:16px; }
}

/* v1.1.0 Professional PWA chessboard */
.chessboard {
  background: #0b1220;
  border: 14px solid rgba(255,255,255,.10);
  box-shadow:
    0 34px 90px rgba(0,0,0,.38),
    inset 0 0 0 1px rgba(255,255,255,.08);
}
.square {
  overflow: hidden;
}
.square.light {
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.22), transparent 34%),
    linear-gradient(135deg, #f3ddb6, #d9b782);
}
.square.dark {
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,.10), transparent 34%),
    linear-gradient(135deg, #9b6b43, #6f472f);
}
.square:hover {
  box-shadow: inset 0 0 0 999px rgba(56,189,248,.12);
}
.square.selected {
  outline: 0;
  box-shadow:
    inset 0 0 0 5px rgba(56,189,248,.90),
    inset 0 0 0 999px rgba(56,189,248,.18);
}
.pieceSvg {
  width: 72%;
  height: 72%;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 9px 8px rgba(0,0,0,.34));
  z-index: 2;
}
.pieceSvg svg {
  width: 100%;
  height: 100%;
}
.whitePiece svg {
  fill: #f8fafc;
  stroke: #334155;
  stroke-width: 2.2;
  paint-order: stroke fill;
}
.blackPiece svg {
  fill: #111827;
  stroke: #e2e8f0;
  stroke-width: 1.4;
  paint-order: stroke fill;
}
.coord {
  font-size: 10px;
  font-weight: 1000;
  opacity: .62;
  z-index: 1;
}
.square.light .coord { color:#6f472f; }
.square.dark .coord { color:#f3ddb6; }
.installBanner {
  display:none;
  margin-bottom:16px;
  border:1px solid rgba(65,209,125,.32);
  background:rgba(65,209,125,.10);
  border-radius:22px;
  padding:14px;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.installBanner.show { display:flex; }
@media(max-width:720px){
  .pieceSvg{width:78%;height:78%}
  .chessboard{border-width:8px;border-radius:18px}
}
