:root {
  --bg: #e9eaed;
  --ink: #17191d;
  --muted: #6c727c;
  --panel: rgba(255, 255, 255, .62);
  --panel-strong: rgba(255, 255, 255, .82);
  --line: rgba(130, 139, 151, .28);
  --accent: #2f6fed;
  --accent-dark: #17479e;
  --road: #282f34;
  --good: #17834d;
  --warn: #a65f00;
  --shadow: 0 24px 70px rgba(28, 31, 38, .18);
  --glass-blur: blur(22px) saturate(150%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, #f7f8fa 0%, #e7e9ee 44%, #d5d9e1 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.topbar {
  align-items: center;
  backdrop-filter: var(--glass-blur);
  background: rgba(246, 247, 250, .72);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 54px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  font-size: 18px;
  font-weight: 850;
  text-decoration: none;
}

.brand-logo {
  border-radius: 6px;
  height: 38px;
  object-fit: contain;
  width: auto;
}

nav {
  align-items: center;
  display: flex;
  gap: 18px;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

nav a:hover {
  color: var(--ink);
}

main {
  margin: 0 auto;
  max-width: 1440px;
  padding: 42px clamp(18px, 4vw, 54px) 72px;
}

.hero {
  align-items: center;
  display: grid;
  gap: 34px;
  grid-template-columns: 1.05fr .95fr;
  min-height: 68vh;
}

h1 {
  font-size: clamp(40px, 7vw, 88px);
  letter-spacing: 0;
  line-height: .92;
  margin: 0 0 22px;
  max-width: 780px;
}

h2 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  margin: 0 0 18px;
}

p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

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

.button,
button {
  background: linear-gradient(180deg, #252932, #121419);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(23, 25, 29, .18), inset 0 1px 0 rgba(255, 255, 255, .18);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  padding: 15px 20px;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button.secondary {
  backdrop-filter: var(--glass-blur);
  background: rgba(255, 255, 255, .58);
  color: var(--ink);
  outline: 1px solid var(--line);
}

.button.small {
  padding: 10px 13px;
}

.panel {
  backdrop-filter: var(--glass-blur);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.garage-art {
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .95) 0%, rgba(221, 226, 235, .68) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: grid;
  overflow: hidden;
  place-items: center;
  position: relative;
}

.garage-art::before {
  background: var(--road);
  bottom: -30%;
  content: "";
  height: 58%;
  left: 11%;
  position: absolute;
  transform: perspective(260px) rotateX(42deg);
  width: 78%;
}

.car {
  background: linear-gradient(180deg, #7d8796, #2c323b);
  border-radius: 20px 20px 10px 10px;
  box-shadow: 0 24px 0 -16px #1a1d20;
  height: 82px;
  position: relative;
  width: 176px;
  z-index: 1;
}

.car::before {
  background: #ffd44d;
  border-radius: 12px;
  content: "";
  height: 28px;
  left: 42px;
  position: absolute;
  top: -24px;
  width: 92px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, 1fr);
}

.stat {
  backdrop-filter: var(--glass-blur);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 26px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  font-weight: 750;
  gap: 7px;
}

input,
textarea,
select {
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  padding: 13px 14px;
  width: 100%;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

.check {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 18px 1fr;
}

.check input {
  margin-top: 3px;
  width: auto;
}

.notice {
  backdrop-filter: var(--glass-blur);
  background: rgba(255, 248, 231, .76);
  border: 1px solid rgba(193, 143, 38, .32);
  border-radius: 14px;
  color: #6f4a00;
  padding: 14px 16px;
}

.error {
  background: #ffeceb;
  border-color: #ffc4bf;
  color: var(--accent-dark);
}

.success {
  background: #eaf8f0;
  border-color: #afe0c2;
  color: var(--good);
}

table {
  backdrop-filter: var(--glass-blur);
  background: var(--panel-strong);
  border-collapse: collapse;
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.game-layout {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 300px;
  max-width: 1500px;
  margin: 0 auto;
}

.game-wrap {
  background: linear-gradient(180deg, #172026, #0f1519);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.game-wrap::after {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

canvas {
  display: block;
  height: auto;
  max-width: 100%;
  width: 100%;
}

.three-game {
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #0b1119, #182229);
  display: none;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.three-game canvas {
  display: block;
  height: 100% !important;
  width: 100% !important;
}

.three-placeholder {
  align-items: center;
  color: rgba(255, 255, 255, .86);
  display: flex;
  font-size: clamp(26px, 5vw, 54px);
  font-weight: 900;
  height: 100%;
  justify-content: center;
  text-align: center;
}

.hud {
  display: grid;
  gap: 10px;
}

.game-tabs {
  background: rgba(232, 235, 240, .82);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  padding: 4px;
}

.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.leaderboard-tabs a {
  backdrop-filter: var(--glass-blur);
  background: rgba(255, 255, 255, .54);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  padding: 10px 14px;
  text-decoration: none;
}

.leaderboard-tabs a.active {
  background: linear-gradient(180deg, #2e333d, #171a20);
  color: #fff;
}

.game-tab {
  background: transparent;
  border-radius: 9px;
  color: var(--muted);
  padding: 11px 10px;
}

.game-tab.active {
  background: linear-gradient(180deg, #2e333d, #171a20);
  color: #fff;
}

.install-db-fields {
  border-left: 3px solid var(--accent);
  display: grid;
  gap: 14px;
  padding-left: 14px;
}

.footer {
  color: var(--muted);
  font-size: 13px;
  padding: 0 clamp(18px, 4vw, 54px) 34px;
  text-align: center;
}

.logo-preview {
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 14px;
  max-height: 90px;
  max-width: 240px;
  object-fit: contain;
  padding: 10px;
}

.legal-page {
  max-width: 920px;
  margin: 0 auto;
}

.legal-page h1 {
  font-size: clamp(34px, 5vw, 62px);
}

.legal-page h2 {
  font-size: clamp(20px, 3vw, 30px);
  margin-top: 30px;
}

.inline-form {
  display: inline;
}

.inline-form button {
  white-space: nowrap;
}

.inline-role-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-check {
  align-items: center;
  display: inline-flex;
  gap: 5px;
  white-space: nowrap;
}

.mini-check input {
  width: auto;
}

@media (max-width: 850px) {
  .hero,
  .game-layout,
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }

  nav {
    flex-wrap: wrap;
  }
}
