:root {
  --bg: #040611;
  --panel: rgba(10, 15, 28, 0.9);
  --line: rgba(114, 215, 255, 0.32);
  --blue: #72d7ff;
  --blue-2: #46bfff;
  --pink: #ff67c7;
  --yellow: #ffe66d;
  --orange: #ff9f43;
  --text: #f7f9ff;
  --muted: #9aa8c7;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 22% 16%, rgba(114, 215, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 76%, rgba(255, 103, 199, 0.14), transparent 26rem),
    linear-gradient(135deg, #040611, #090f22 58%, #02040b);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  opacity: 0.16;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(290px, 320px);
  gap: 1.25rem;
  align-items: stretch;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0;
}

.game-shell,
.side {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(17, 22, 43, 0.94), rgba(5, 8, 18, 0.97)),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 22px 60px rgba(0, 0, 0, 0.5),
    0 0 42px rgba(114, 215, 255, 0.16);
}

.game-shell {
  overflow: hidden;
  aspect-ratio: 9 / 10;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #02030a;
}

body.mouse-locked canvas {
  cursor: none;
}

.side {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lang-switch {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.lang-btn {
  width: 2.45rem;
  height: 2.05rem;
  border: 1px solid rgba(114, 215, 255, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.lang-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(114, 215, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(114, 215, 255, 0.2);
}

.lang-btn.active {
  border-color: rgba(255, 230, 109, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 230, 109, 0.25);
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  color: var(--yellow);
  font-size: 2rem;
  line-height: 1;
  text-transform: uppercase;
}

.intro {
  margin: 0.85rem 0 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.score-box {
  padding: 1rem;
  border: 1px solid rgba(114, 215, 255, 0.2);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
}

.score-box h2 {
  margin: 0 0 0.7rem;
  color: var(--blue);
  font-size: 1rem;
  text-transform: uppercase;
}

.score-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.score-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 0.92rem;
}

.score-item:last-child { border-bottom: 0; }

.score-item .name {
  color: var(--yellow);
  font-weight: 800;
}

.score-item .meta {
  color: var(--blue-2);
  font-weight: 800;
}

.score-empty {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.35rem 0;
}

.stats {
  margin: 1rem 0 0;
  display: grid;
  gap: 0.55rem;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  color: var(--blue);
  font-weight: 800;
  text-align: right;
}

.legend {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  color: var(--muted);
  font-size: 0.82rem;
}

.legend b { color: var(--text); }

html.embedded body { background: transparent; }

html.embedded .app {
  width: 100%;
  padding: 0;
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .legend { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

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