:root {
  --bg: #070d16;
  --bg-soft: #101b2b;
  --card: rgba(16, 25, 39, 0.78);
  --line: rgba(120, 164, 204, 0.28);
  --line-strong: rgba(137, 190, 235, 0.52);
  --ink: #e8f2ff;
  --muted: #9cb6d3;
  --accent: #4ea8f5;
  --accent-2: #ffc072;
  --ok: #48d497;
  --danger: #ef7979;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.44);
  --shadow-lift: 0 20px 42px rgba(0, 0, 0, 0.54);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% -10%, rgba(78, 168, 245, 0.2), transparent 36%),
    radial-gradient(circle at 88% -16%, rgba(255, 192, 114, 0.14), transparent 34%),
    linear-gradient(180deg, #0e1725 0%, var(--bg) 60%, #050910 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 11px
    );
}

main.shell {
  max-width: 1220px;
  margin: 0 auto;
  padding: 1rem;
}

.glass {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 220ms ease;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(14px) scale(0.99);
  transition:
    opacity 320ms ease var(--reveal-delay, 0ms),
    transform 320ms ease var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand search account";
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem;
  position: sticky;
  top: 0.5rem;
  z-index: 40;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #081723;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
}

.brand-copy strong {
  display: block;
  font-size: 1.02rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: "Orbitron", "Cinzel", "Georgia", serif;
  font-weight: 700;
  background: linear-gradient(135deg, #d8ecff, #88d4ff 42%, #ffcb8d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-search {
  grid-area: search;
  display: flex;
  justify-content: center;
}

.header-search input {
  width: min(620px, 100%);
  border-radius: 999px;
  border: 1px solid rgba(137, 190, 235, 0.42);
  background: rgba(9, 18, 29, 0.88);
  color: #e8f2ff;
  padding: 0.6rem 0.95rem;
  font-size: 0.87rem;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.header-search input:focus {
  outline: none;
  border-color: rgba(141, 217, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(141, 217, 255, 0.14);
  background: rgba(12, 23, 35, 0.95);
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: #f7fbff;
  background: linear-gradient(125deg, #2b83cf, #43aef0);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.account-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(20, 40, 118, 0.45);
}

.account-actions {
  grid-area: account;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}

.menu-icon {
  width: 2.7rem;
  height: 2.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.78rem;
  border: 1px solid rgba(161, 214, 255, 0.62);
  background: linear-gradient(145deg, rgba(22, 45, 72, 0.9), rgba(12, 25, 42, 0.9));
  color: #d9ecff;
  text-decoration: none;
  font-size: 1.22rem;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 180ms ease;
}

.menu-icon:hover {
  transform: translateY(-1px);
  border-color: rgba(159, 216, 255, 0.74);
  background: rgba(17, 30, 47, 0.95);
  box-shadow: 0 10px 22px rgba(6, 15, 28, 0.36);
}

.menu-icon[aria-current="page"] {
  border-color: rgba(255, 201, 125, 0.76);
  background: rgba(44, 33, 20, 0.92);
}

.donate-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #261103;
  background: linear-gradient(130deg, #ffc56e, #ff9a63);
  border-radius: 999px;
  padding: 0.45rem 0.82rem;
  font-weight: 800;
  font-size: 0.77rem;
  border: 1px solid rgba(255, 224, 186, 0.6);
  transition: transform 150ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.donate-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(53, 26, 3, 0.35);
  filter: brightness(1.03);
}

.account-pill.logout {
  background: rgba(16, 25, 39, 0.9);
  color: #d1e2f9;
  border-color: rgba(120, 164, 204, 0.3);
}

.btn {
  cursor: pointer;
  text-decoration: none;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.66rem 0.92rem;
  color: #f5faff;
  font-weight: 700;
  font-size: 0.9rem;
  background: linear-gradient(130deg, #28466a, #1f3653);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 180ms ease,
    background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 22px rgba(2, 18, 30, 0.36);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn.primary {
  background: linear-gradient(130deg, #2c88d2, #44ace9);
  border-color: rgba(255, 255, 255, 0.28);
  color: #f3fcff;
}

.btn.warning {
  background: linear-gradient(130deg, #f1a846, #e9762f);
  color: #271404;
  border-color: rgba(255, 255, 255, 0.24);
}

.portal-main-layout {
  margin-top: 0.95rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 250px 1fr;
  align-items: start;
}

.category-sidebar {
  padding: 0.82rem;
}

.category-sidebar h2 {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 1rem;
}

.category-list {
  margin-top: 0.62rem;
  display: grid;
  gap: 0.42rem;
}

.category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: #d7ebff;
  border: 1px solid rgba(120, 164, 204, 0.3);
  border-radius: 0.64rem;
  padding: 0.42rem 0.55rem;
  background: rgba(8, 15, 24, 0.85);
  font-size: 0.82rem;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.category-link-main {
  display: inline-flex;
  align-items: center;
  gap: 0.44rem;
  min-width: 0;
}

.category-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9fd3ff;
  flex-shrink: 0;
}

.category-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-link:hover,
.category-link.is-active {
  border-color: rgba(141, 217, 255, 0.56);
  background: rgba(78, 168, 245, 0.18);
  transform: translateY(-1px);
}

.category-link:hover .category-icon,
.category-link.is-active .category-icon {
  color: #d2ecff;
}

.category-link-count {
  border-radius: 999px;
  border: 1px solid rgba(120, 164, 204, 0.34);
  padding: 0.1rem 0.42rem;
  font-size: 0.72rem;
  color: #b7d4f1;
}

.dashboard-grid {
  margin-top: 0.92rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.dashboard-card {
  padding: 0.72rem;
}

.dashboard-card h2 {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 1rem;
}

.mini-game-list {
  margin-top: 0.58rem;
  display: grid;
  gap: 0.44rem;
}

.mini-game-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(120, 164, 204, 0.3);
  border-radius: 0.7rem;
  background: rgba(8, 15, 24, 0.85);
  padding: 0.36rem;
  text-decoration: none;
  color: inherit;
}

.mini-game-item img {
  width: 44px;
  height: 44px;
  border-radius: 0.52rem;
  object-fit: cover;
  border: 1px solid rgba(120, 164, 204, 0.36);
}

.mini-game-item strong {
  display: block;
  font-size: 0.85rem;
}

.mini-game-item span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

.mini-icon-list {
  margin-top: 0.58rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.mini-icon-link {
  width: 50px;
  height: 50px;
  border-radius: 0.58rem;
  border: 1px solid rgba(120, 164, 204, 0.34);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 15, 24, 0.9);
}

.mini-icon-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.panel {
  padding: 0.9rem;
}

.panel h1,
.panel h2,
.panel h3 {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 1.18rem;
}

.panel-sub {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.catalog-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.8rem;
}

.game-card {
  position: relative;
  display: grid;
  grid-template-rows: 150px auto;
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(120, 164, 204, 0.26);
  background: rgba(8, 15, 24, 0.84);
  transform-origin: center;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 220ms ease;
}

.game-card:hover {
  border-color: rgba(141, 217, 255, 0.45);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.game-cover-link {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
}

.game-cover-media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.game-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 380ms ease,
    opacity 280ms ease,
    filter 280ms ease;
}

.game-cover-preview {
  opacity: 0;
  transform: scale(1.08);
  filter: saturate(1.08) contrast(1.03);
}

.game-card:hover .game-cover-base,
.game-card:focus-within .game-cover-base {
  opacity: 0.22;
  transform: scale(1.02);
  filter: blur(1px) saturate(0.9);
}

.game-card:hover .game-cover-preview,
.game-card:focus-within .game-cover-preview {
  opacity: 1;
  transform: scale(1.03);
}

.preview-badge {
  position: absolute;
  left: 0.5rem;
  bottom: 0.46rem;
  z-index: 2;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  border: 1px solid rgba(156, 212, 255, 0.5);
  background: rgba(4, 14, 23, 0.72);
  color: #d9efff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(2px);
  transition: transform 180ms ease, opacity 180ms ease, border-color 180ms ease;
}

.game-card:hover .preview-badge,
.game-card:focus-within .preview-badge {
  transform: translateY(-1px);
  opacity: 0.95;
  border-color: rgba(255, 196, 123, 0.72);
}

.game-cover-link::after {
  content: "";
  position: absolute;
  left: -45%;
  top: 0;
  width: 34%;
  height: 100%;
  background: linear-gradient(112deg, transparent 0%, rgba(255, 255, 255, 0.2) 45%, transparent 100%);
  transform: skewX(-15deg);
  transition: left 520ms ease;
}

.game-card:hover .game-cover-link::after,
.game-card:focus-within .game-cover-link::after {
  left: 118%;
}

.game-body {
  padding: 0.74rem;
}

.game-body h3 {
  margin: 0;
  font-size: 1rem;
}

.game-title-link {
  text-decoration: none;
  color: inherit;
}

.game-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.14rem 0.46rem;
  font-size: 0.74rem;
  border: 1px solid rgba(120, 164, 204, 0.3);
  color: #c8def5;
}

.favorite-toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(132, 189, 236, 0.5);
  background: rgba(7, 16, 25, 0.78);
  color: #b7d7f6;
  font-size: 1.05rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.favorite-toggle:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(255, 145, 173, 0.75);
}

.favorite-toggle.is-active {
  border-color: rgba(255, 120, 164, 0.78);
  background: rgba(66, 17, 40, 0.82);
  color: #ff8fb7;
}

.input-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.field {
  border: 1px solid rgba(120, 164, 204, 0.32);
  border-radius: 0.65rem;
  padding: 0.58rem 0.62rem;
  background: rgba(10, 18, 28, 0.92);
  color: #dcecff;
  width: 100%;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field:focus {
  outline: none;
  border-color: rgba(141, 217, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(141, 217, 255, 0.16);
  background: rgba(13, 23, 35, 0.96);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.7rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.45rem 0.38rem;
  border-bottom: 1px solid rgba(159, 192, 211, 0.2);
  font-size: 0.87rem;
}

.table tbody tr {
  transition: background 150ms ease;
}

.table tbody tr:hover {
  background: rgba(141, 217, 255, 0.08);
}

.score-groups {
  display: grid;
  gap: 0.64rem;
  margin-top: 0.65rem;
}

.score-group {
  border: 1px solid rgba(120, 164, 204, 0.28);
  border-radius: 0.8rem;
  background: rgba(8, 15, 24, 0.88);
  padding: 0.52rem;
}

.score-group h4 {
  margin: 0;
  font-size: 0.88rem;
  color: #d8e9fb;
}

.score-group .table {
  margin-top: 0.45rem;
}

.score-group .table th,
.score-group .table td {
  font-size: 0.76rem;
  padding: 0.34rem 0.26rem;
}

.footer {
  margin-top: 1rem;
  padding: 0.72rem 0.8rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.55rem 1rem;
}

.footer-copy {
  color: var(--muted);
}

.footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.footer-links a {
  color: #cfe7ff;
  text-decoration: none;
  border: 1px solid rgba(120, 164, 204, 0.36);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.footer-links a:hover {
  border-color: rgba(141, 217, 255, 0.58);
  background: rgba(78, 168, 245, 0.16);
  transform: translateY(-1px);
}

.legal-shell {
  margin-top: 0.95rem;
  padding: 1rem;
}

.legal-intro h1 {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.legal-intro p {
  margin: 0.62rem 0 0;
  color: #b7cde4;
  max-width: 72ch;
  font-size: 0.92rem;
}

.legal-meta {
  margin-top: 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.legal-meta span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.56rem;
  border: 1px solid rgba(120, 164, 204, 0.34);
  background: rgba(10, 18, 28, 0.84);
  font-size: 0.73rem;
  color: #cbe0f6;
}

.legal-content {
  padding: 0.85rem;
}

.legal-content-standalone {
  margin-top: 0.9rem;
}

.legal-content section + section {
  margin-top: 1rem;
}

.legal-content h2 {
  margin: 0 0 0.42rem;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 1.08rem;
}

.legal-content p,
.legal-content li {
  color: #c2d8ee;
  font-size: 0.87rem;
  line-height: 1.62;
}

.legal-content ul {
  margin: 0.42rem 0 0;
  padding-left: 1.1rem;
}

.legal-content a {
  color: #9bd2ff;
}

.legal-note {
  margin-top: 1rem;
  border: 1px solid rgba(120, 164, 204, 0.32);
  border-radius: 0.75rem;
  background: rgba(9, 16, 26, 0.86);
  padding: 0.72rem;
}

.account-panel {
  margin-top: 1rem;
  padding: 1rem;
}

.status-ok {
  color: var(--ok);
}

.status-danger {
  color: var(--danger);
}

.is-live-in {
  opacity: 0;
  animation: liveIn 280ms ease forwards;
}

@keyframes liveIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "search"
      "account";
    text-align: center;
    position: static;
  }

  .portal-main-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 700px) {
  main.shell {
    padding: 0.72rem;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .account-actions {
    justify-content: center;
  }
}

@media (hover: none) {
  .game-cover-preview {
    display: none;
  }

  .game-cover-link::after {
    display: none;
  }

  .preview-badge {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
