/* Playo — free educational game portal
   Original design tokens. Dark theme, purple + amber accents. */

:root {
  --bg: #0f1020;
  --bg-2: #14152a;
  --panel: #1b1d3a;
  --panel-2: #232759;
  --card: #22254a;
  --card-hi: #2c3169;
  --line: #2d3266;
  --text: #ecefff;
  --text-dim: #a3a8d6;
  --text-mute: #6b709c;
  --accent: #7c4dff;
  --accent-2: #9c7bff;
  --amber: #ffb400;
  --hot: #ff5a5f;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* Layout ----------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--bg-2) 0%, #12132a 100%);
  border-right: 1px solid var(--line);
  padding: 22px 14px 30px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2d3266; border-radius: 3px; }

.content {
  padding: 24px 28px 60px;
  max-width: 1400px;
}

/* Brand ------------------------------------------------------------ */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px 8px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent) 0%, #b78bff 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 6px 18px rgba(124, 77, 255, 0.4);
}
.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

/* Language switcher ----------------------------------------------- */

.lang-switch {
  display: flex;
  gap: 4px;
  background: var(--panel);
  padding: 4px;
  border-radius: 999px;
  margin: 4px 8px 14px;
  border: 1px solid var(--line);
}
.lang-switch button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: 0.15s;
}
.lang-switch button:hover { color: #fff; }
.lang-switch button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 77, 255, 0.35);
}

/* Search ----------------------------------------------------------- */

.search-box {
  position: relative;
  margin: 0 6px 16px;
}
.search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.7;
}
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px 10px 34px;
  border-radius: 999px;
  outline: none;
  font-size: 13px;
  transition: 0.15s;
}
.search-box input::placeholder { color: var(--text-mute); }
.search-box input:focus {
  border-color: var(--accent);
  background: var(--panel-2);
}

/* Categories ------------------------------------------------------- */

.cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  transition: 0.15s;
  width: 100%;
}
.cat-btn:hover {
  background: var(--panel);
  color: #fff;
}
.cat-btn.active {
  background: var(--accent);
  color: #fff;
}
.cat-btn .ico {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.cat-btn .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-mute);
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 8px;
}
.cat-btn.active .count { color: #fff; background: rgba(255,255,255,0.15); }

.back-link {
  display: inline-block;
  color: var(--text-dim);
  padding: 8px 10px;
  margin: 4px 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}
.back-link:hover { background: var(--panel); color: #fff; }

.geo-hint {
  margin: 14px 8px 0;
  padding: 10px 12px;
  background: rgba(124, 77, 255, 0.08);
  border: 1px solid rgba(124, 77, 255, 0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-dim);
}
.geo-hint b { color: var(--text); }

/* Content headings ------------------------------------------------- */

.section-title {
  margin: 6px 0 18px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.empty-hint {
  margin-top: 40px;
  color: var(--text-mute);
  text-align: center;
  font-size: 14px;
}

/* Game grid -------------------------------------------------------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.game-card {
  display: block;
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  color: var(--text);
}
.game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.game-cover {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.game-cover .cov-emoji {
  font-size: 54px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
  z-index: 1;
}
.game-cover .cov-title {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  z-index: 1;
  text-align: center;
}

.game-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  z-index: 2;
  color: #fff;
  text-transform: uppercase;
}
.badge.hot { background: var(--hot); }
.badge.new { background: var(--accent); }
.badge.playable { background: var(--amber); color: #2b1900; }

.game-card .foot {
  padding: 8px 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.game-card .foot .name {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-card .foot .cat {
  font-size: 11px;
  color: var(--text-mute);
}

/* Game page hero --------------------------------------------------- */

.game-page { max-width: 1100px; margin: 0 auto; }

.game-hero {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 28px;
}
.game-cover-slot {
  position: relative;
  width: 260px;
  height: 260px;
  border-radius: 16px;
  overflow: hidden;
}
.game-cover-slot .game-cover {
  width: 100%;
  height: 100%;
  border-radius: 16px;
}
.game-hero .game-cover .cov-emoji { font-size: 96px; }
.game-hero .game-cover .cov-title { font-size: 14px; bottom: 12px; }

.game-meta { min-width: 0; }
.game-title {
  margin: 4px 0 8px;
  font-size: 30px;
  font-weight: 800;
}
.game-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.game-tags .tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.game-tags .tag.hot { background: var(--hot); color: #fff; }
.game-tags .tag.playable { background: var(--amber); color: #2b1900; }

.game-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin: 10px 0 16px;
}

.game-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.btn {
  border: 0;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  transition: 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 77, 255, 0.35);
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.btn-ghost:hover { color: #fff; border-color: var(--accent); }

.how-to {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-2);
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-dim);
}
.how-to h4 { margin: 0 0 6px; color: var(--text); font-size: 13px; }
.how-to code {
  background: var(--panel-2);
  color: var(--amber);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}

/* Game stage ------------------------------------------------------- */

.game-stage {
  background: #06060f;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 28px;
}
.stage-inner {
  min-height: 480px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 30%, #1a1c3d 0%, #06060f 70%);
  padding: 16px;
  overflow: hidden;
}
.stage-inner canvas {
  display: block;
  background: #0a0b17;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(124,77,255,0.15);
  max-width: 100%;
  height: auto;
  touch-action: none;
}
.stage-controls {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  justify-content: flex-end;
}

.hud {
  color: var(--text);
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  justify-content: center;
  font-size: 14px;
}
.hud b { color: var(--amber); font-weight: 800; }
.hud .hud-btn {
  background: var(--panel-2);
  border: 0;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.hud .hud-btn:hover { background: var(--card-hi); }

.game-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 6, 15, 0.85);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  z-index: 5;
  color: #fff;
  text-align: center;
}
.game-over h3 { font-size: 28px; margin: 0 0 8px; }
.game-over p { color: var(--text-dim); margin: 0 0 16px; }

/* Footer ----------------------------------------------------------- */

.footer {
  margin-top: 40px;
  padding: 22px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-dim);
}
.footer h3 { margin: 0 0 8px; color: var(--text); font-size: 16px; }
.footer p { margin: 0 0 8px; font-size: 13px; }
.footer small { font-size: 12px; color: var(--text-mute); }

/* Mobile ----------------------------------------------------------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }
  .cats {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .cat-btn { flex: 0 0 auto; }
  .cat-btn .count { display: none; }
  .content { padding: 16px; }

  .game-hero { grid-template-columns: 1fr; }
  .game-cover-slot { width: 100%; height: auto; aspect-ratio: 1 / 1; }
}

@media (max-width: 500px) {
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .game-cover .cov-emoji { font-size: 40px; }
}
