:root {
  --bg: #282823;
  --bg-soft: #32322e;
  --bg-deep: #22231f;
  --panel: #343530;
  --panel-2: #3a3b36;
  --text: #f5f6f2;
  --muted: #bfc3bb;
  --line: rgba(255,255,255,.09);
  --accent: #45e04b;
  --accent-dark: #1f9f2b;
  --danger: #ff5f67;
  --radius: 12px;
  --shadow: 0 16px 42px rgba(0,0,0,.28);
  --sidebar-w: 60px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 7px;
  background: #20221e;
  border-right: 1px solid var(--line);
}
.brand-mark {
  width: 42px;
  height: 42px;
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(69,224,75,.1);
}
.brand-mark img { width: 34px; height: 34px; }
.side-nav {
  width: 100%;
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.side-nav::-webkit-scrollbar { display: none; }
.side-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #d5d8d1;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: .2s ease;
}
.side-btn svg { width: 21px; fill: currentColor; }
.side-btn:hover,
.side-btn.active { background: #f2f3ef; color: #1f211e; transform: translateY(-1px); }
.nav-separator { width: 26px; height: 1px; margin: 2px 0; background: var(--line); }
.side-bottom { margin-top: auto; display: grid; gap: 7px; }

.main-column { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(280px, 510px) minmax(330px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: rgba(50,58,46,.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; }
.brand img { width: 34px; height: 34px; }
.brand span { font-size: 27px; font-weight: 900; letter-spacing: -1.5px; }
.search-box {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #62635f;
  transition: .2s ease;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(69,224,75,.12); }
.search-box svg { width: 21px; fill: none; stroke: #eef0eb; stroke-width: 2; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: white; background: transparent; }
.search-box input::placeholder { color: #e1e3de; }
.search-box kbd { padding: 3px 7px; border-radius: 6px; color: #d8dbd4; background: rgba(0,0,0,.18); font-size: 11px; }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.header-btn, .view-btn {
  border: 0;
  background: #5e5f5a;
  border-radius: 10px;
  cursor: pointer;
  transition: .2s ease;
}
.header-btn { width: 42px; height: 42px; position: relative; font-size: 20px; }
.header-btn:hover, .view-btn:hover { background: #71726d; transform: translateY(-1px); }
.header-btn.has-dot::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #5e5f5a;
}
.login-btn {
  height: 42px;
  min-width: 86px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #112013;
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
}
.login-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.content { padding: 16px 22px 40px; }
.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 190px;
  margin: 2px 0 26px;
  padding: 26px 30px;
  overflow: hidden;
  border: 1px solid rgba(69,224,75,.17);
  border-radius: 18px;
  background:
    radial-gradient(circle at 80% 20%, rgba(69,224,75,.25), transparent 28%),
    linear-gradient(120deg, #30342d, #262822 60%, #313b2d);
  box-shadow: var(--shadow);
}
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: 1.8px; }
.hero-strip h1 { margin: 8px 0 8px; font-size: clamp(30px, 4vw, 54px); line-height: .98; letter-spacing: -2.4px; }
.hero-strip p { max-width: 620px; margin: 0; color: var(--muted); line-height: 1.65; }
.hero-art { position: relative; width: 230px; height: 130px; flex: 0 0 auto; }
.hero-art span { position: absolute; display: block; border-radius: 24px; transform: rotate(-12deg); box-shadow: 0 20px 36px rgba(0,0,0,.3); }
.hero-art span:nth-child(1) { width: 160px; height: 95px; right: 30px; top: 16px; background: linear-gradient(145deg,#ffcf3e,#ff5b47); }
.hero-art span:nth-child(2) { width: 90px; height: 90px; right: 0; top: 0; background: linear-gradient(145deg,#36d7ff,#4455ff); }
.hero-art span:nth-child(3) { width: 78px; height: 78px; left: 0; bottom: 0; background: linear-gradient(145deg,#7eff5c,#23a96a); }

.games-section { scroll-margin-top: 95px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-title-wrap { display: flex; align-items: center; gap: 14px; }
.section-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: #f1f2ed; color: #1f211e; }
.section-heading h2 { margin: 0; font-size: 22px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.view-controls { display: flex; gap: 8px; }
.view-btn { width: 38px; height: 38px; }
.view-btn.active { background: var(--accent); color: #152216; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
}
.game-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.game-grid.compact .game-card { display: grid; grid-template-columns: 150px 1fr; }
.game-grid.compact .thumb-wrap { aspect-ratio: auto; min-height: 110px; }
.game-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 9px 24px rgba(0,0,0,.18);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.game-card:hover { transform: translateY(-4px); border-color: rgba(69,224,75,.5); box-shadow: 0 18px 34px rgba(0,0,0,.28); }
.thumb-wrap { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #1d1e1b; }
.game-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease, filter .35s ease; }
.game-card:hover .game-thumb { transform: scale(1.055); filter: saturate(1.12); }
.favorite-btn, .info-btn {
  position: absolute;
  z-index: 4;
  top: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #1d211d;
  background: rgba(255,255,255,.9);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: .2s ease;
}
.favorite-btn { left: 8px; font-size: 17px; }
.info-btn { right: 8px; font-weight: 900; }
.game-card:hover .favorite-btn, .game-card:hover .info-btn, .favorite-btn.is-favorite { opacity: 1; transform: translateY(0); }
.favorite-btn.is-favorite { color: white; background: var(--danger); }
.age-badge, .new-badge {
  position: absolute;
  z-index: 3;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
}
.age-badge { right: 8px; color: white; background: rgba(27,29,27,.82); }
.new-badge { left: 8px; color: #132115; background: var(--accent); }
.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.55));
  opacity: 0;
  transition: .24s ease;
}
.play-overlay span { width: 46px; height: 46px; display: grid; place-items: center; padding-left: 3px; border-radius: 50%; color: #172019; background: var(--accent); box-shadow: 0 12px 24px rgba(0,0,0,.3); }
.game-card:hover .play-overlay { opacity: 1; }
.game-meta { padding: 11px 12px 12px; }
.game-meta h3 { margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.game-meta p { margin: 5px 0 9px; color: var(--muted); font-size: 12px; }
.rating-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score { padding: 3px 7px; border-radius: 5px; color: #133015; background: var(--accent); font-size: 11px; font-weight: 900; }
.players { color: #aeb2aa; font-size: 11px; }
.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-illustration { font-size: 50px; }
.empty-state h3 { margin: 10px 0 5px; color: var(--text); }
.load-zone { min-height: 128px; display: grid; place-items: center; align-content: center; gap: 12px; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(69,224,75,.16); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
.load-more { border: 0; border-radius: 9px; padding: 10px 18px; color: #162218; background: var(--accent); font-weight: 800; cursor: pointer; }
@keyframes spin { to { transform: rotate(360deg); } }

.about-section {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 26px;
  padding: 30px 0 10px;
  border-top: 1px solid var(--line);
}
.about-copy h2 { margin: 8px 0 14px; }
.about-copy p { color: var(--muted); line-height: 1.75; }
.stats-card { display: grid; gap: 10px; align-content: start; }
.stats-card > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.stats-card strong { color: var(--accent); }
.stats-card span { color: var(--muted); font-size: 13px; }
.footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px; color: #aeb2aa; border-top: 1px solid var(--line); font-size: 13px; }
.footer div { display: flex; gap: 18px; }
.footer a:hover { color: var(--accent); }

.toast-region { position: fixed; z-index: 90; right: 18px; bottom: 18px; display: grid; gap: 10px; }
.toast { min-width: 240px; max-width: 360px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; color: white; background: #171916; box-shadow: var(--shadow); animation: toastIn .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.66); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.modal-card { position: relative; width: min(100%, 410px); padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: #2d302a; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); cursor: pointer; }
.modal-logo { width: 50px; height: 50px; padding: 8px; border-radius: 14px; background: rgba(69,224,75,.12); }
.modal-card h2 { margin-bottom: 6px; }
.modal-card > p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-card form { display: grid; gap: 13px; margin-top: 20px; }
.modal-card label { display: grid; gap: 7px; font-size: 13px; }
.modal-card input { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: 0; padding: 12px; color: white; background: #232520; }
.modal-card input:focus { border-color: var(--accent); }
.submit-btn { border: 0; border-radius: 9px; padding: 12px; color: #142115; background: var(--accent); font-weight: 900; cursor: pointer; }

body.light {
  --bg: #eef0ea;
  --bg-soft: #fff;
  --bg-deep: #e3e6df;
  --panel: #fff;
  --panel-2: #f6f7f3;
  --text: #1f241f;
  --muted: #646b63;
  --line: rgba(25,35,25,.11);
  --shadow: 0 16px 36px rgba(47,65,47,.12);
}
body.light .sidebar { background: #f7f8f5; }
body.light .topbar { background: rgba(238,240,234,.94); }
body.light .brand-mark { background: rgba(37,159,46,.1); }
body.light .search-box { background: white; border-color: rgba(30,50,30,.1); }
body.light .search-box input { color: #1f241f; }
body.light .search-box input::placeholder, body.light .search-box svg { color: #657064; stroke: #657064; }
body.light .header-btn { background: white; }
body.light .game-card { background: white; }
body.light .modal-card { background: white; }
body.light .modal-card input { color: #1f241f; background: #f1f3ee; }

@media (max-width: 1180px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topbar { grid-template-columns: 170px 1fr auto; }
  .search-box kbd { display: none; }
  .header-btn:nth-child(3), .header-btn:nth-child(4) { display: none; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    inset: auto 10px 10px 10px;
    width: auto;
    height: 58px;
    flex-direction: row;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(32,34,30,.94);
    backdrop-filter: blur(16px);
  }
  .brand-mark, .side-bottom, .nav-separator, .side-nav .side-btn:nth-of-type(n+6) { display: none; }
  .side-nav { margin: 0; flex-direction: row; justify-content: center; overflow: visible; }
  .side-btn { width: 44px; }
  .topbar { height: auto; min-height: 70px; grid-template-columns: 1fr auto; padding: 10px 14px; }
  .brand span { font-size: 22px; }
  .search-box { grid-column: 1 / -1; grid-row: 2; }
  .header-actions .header-btn { display: none; }
  .content { padding: 14px 14px 90px; }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .about-section { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .hero-strip { min-height: 160px; padding: 22px; }
  .hero-art { display: none; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .game-grid.compact { grid-template-columns: 1fr; }
  .game-grid.compact .game-card { grid-template-columns: 125px 1fr; }
  .game-meta { padding: 9px; }
  .game-meta h3 { font-size: 13px; }
  .section-heading { align-items: flex-end; }
  .section-title-wrap { align-items: flex-start; }
  .section-icon { width: 36px; height: 36px; }
  .section-heading h2 { font-size: 18px; }
  .footer { flex-direction: column; padding-bottom: 88px; }
}
@media (max-width: 430px) {
  .brand span { display: none; }
  .login-btn { min-width: 72px; }
  .hero-strip h1 { font-size: 34px; }
  .rating-row .players { display: none; }
}
