@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap");

:root {
  --bg0: #e4edf6;
  --bg1: #f8fbfd;
  --ink: #101820;
  --muted: #5a6b7c;
  --line: rgba(16, 24, 32, 0.12);
  --accent: #0a7a6f;
  --accent-bright: #14b8a6;
  --accent-deep: #055c54;
  --warm: #e15a3c;
  --warm-soft: #f4a28e;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --shadow: 6px 6px 0 rgba(16, 24, 32, 0.08);
  --shadow-hover: 9px 9px 0 rgba(16, 24, 32, 0.12);
  --radius: 2px;
  --radius-sm: 0;
  --px: 0.5;
  --py: 0.5;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg1);
  line-height: 1.55;
  overflow-x: hidden;
}

/* atmosphere — geometric themes */
body::before {
  content: "";
  position: fixed;
  inset: -12% -8%;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(148deg, var(--bg1) 0%, var(--bg0) 58%, color-mix(in srgb, var(--accent) 8%, var(--bg0)) 100%),
    linear-gradient(90deg, rgba(10, 122, 111, 0.09) 1px, transparent 1px),
    linear-gradient(0deg, rgba(10, 122, 111, 0.09) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  transform: translate3d(calc((var(--px) - 0.5) * -18px), calc((var(--py) - 0.5) * -14px), 0);
  transition: transform 0.35s var(--ease-out);
  animation: geo-drift 18s var(--ease) infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
  background-image:
    repeating-linear-gradient(
      -18deg,
      transparent 0 22px,
      rgba(16, 24, 32, 0.04) 22px 23px
    ),
    linear-gradient(115deg, transparent 38%, rgba(20, 184, 166, 0.1) 50%, transparent 62%),
    radial-gradient(ellipse 70% 50% at 12% 8%, rgba(225, 90, 60, 0.06), transparent 55%);
  background-size: auto, 220% 220%, auto;
  background-position: 0 0, calc(var(--px) * 100%) calc(var(--py) * 100%), 0 0;
  transition: background-position 0.4s var(--ease-out);
}

/* theme: grid (default) */
body[data-hub-theme="grid"] {
  --bg0: #d5e2ef;
  --bg1: #f2f7fb;
  --accent: #0a7a6f;
  --accent-bright: #14b8a6;
  --accent-deep: #055c54;
  --warm: #d4532f;
}
body[data-hub-theme="grid"]::before {
  background:
    linear-gradient(158deg, #f6fafc 0%, #d4e2ef 55%, #c8d8e8 100%),
    linear-gradient(90deg, rgba(10, 90, 110, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(10, 90, 110, 0.12) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}
body[data-hub-theme="grid"]::after {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(10, 122, 111, 0.14) 35px 36px),
    repeating-linear-gradient(90deg, transparent 0 35px, rgba(10, 122, 111, 0.14) 35px 36px),
    radial-gradient(ellipse 55% 40% at 88% 12%, rgba(20, 184, 166, 0.1), transparent 60%);
  opacity: 0.4;
}

/* theme: chevron */
body[data-hub-theme="chevron"] {
  --bg0: #e4d6c8;
  --bg1: #f6efe7;
  --accent: #b84a28;
  --accent-bright: #e36a3f;
  --accent-deep: #8a3218;
  --warm: #0f6e7a;
}
body[data-hub-theme="chevron"]::before {
  background:
    linear-gradient(152deg, #f9f3ec 0%, #e5d5c4 70%, #dcc9b4 100%),
    repeating-linear-gradient(
      135deg,
      rgba(184, 74, 40, 0.13) 0 14px,
      transparent 14px 28px
    ),
    repeating-linear-gradient(
      45deg,
      rgba(15, 110, 122, 0.09) 0 14px,
      transparent 14px 28px
    );
}
body[data-hub-theme="chevron"]::after {
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent 0 18px,
      rgba(184, 74, 40, 0.1) 18px 19px,
      transparent 19px 36px,
      rgba(15, 110, 122, 0.09) 36px 37px
    ),
    radial-gradient(ellipse 50% 45% at 10% 90%, rgba(15, 110, 122, 0.08), transparent 55%);
  opacity: 0.72;
}

/* theme: check */
body[data-hub-theme="check"] {
  --bg0: #c6d2be;
  --bg1: #ecf2e7;
  --accent: #2f6b3a;
  --accent-bright: #4ea35c;
  --accent-deep: #1e4a28;
  --warm: #c45c1a;
}
body[data-hub-theme="check"]::before {
  background:
    linear-gradient(162deg, #f2f7ee 0%, #d0dcc6 65%, #c2d0b6 100%),
    repeating-conic-gradient(
      from 0deg at 50% 50%,
      rgba(47, 107, 58, 0.12) 0 25%,
      transparent 0 50%
    );
  background-size: auto, 52px 52px;
}
body[data-hub-theme="check"]::after {
  background-image:
    linear-gradient(90deg, rgba(47, 107, 58, 0.16) 2px, transparent 2px),
    linear-gradient(0deg, rgba(47, 107, 58, 0.16) 2px, transparent 2px),
    radial-gradient(ellipse 45% 40% at 85% 80%, rgba(196, 92, 26, 0.07), transparent 55%);
  background-size: 28px 28px, 28px 28px, auto;
  opacity: 0.48;
}

/* theme: diagonal */
body[data-hub-theme="diagonal"] {
  --bg0: #161e2c;
  --bg1: #1f2a3c;
  --ink: #eef3f8;
  --muted: #9aadc0;
  --line: rgba(238, 243, 248, 0.16);
  --accent: #3ec4b5;
  --accent-bright: #6ee7d8;
  --accent-deep: #1f9a8c;
  --warm: #f0a060;
  --surface: rgba(28, 40, 56, 0.86);
  --surface-strong: rgba(34, 48, 66, 0.96);
  --shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
  --shadow-hover: 9px 9px 0 rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
body[data-hub-theme="diagonal"]::before {
  background:
    linear-gradient(142deg, #1e2a3c 0%, #121820 55%, #0e141c 100%),
    repeating-linear-gradient(
      32deg,
      rgba(62, 196, 181, 0.14) 0 10px,
      transparent 10px 28px
    );
}
body[data-hub-theme="diagonal"]::after {
  background-image:
    repeating-linear-gradient(
      -32deg,
      transparent 0 16px,
      rgba(240, 160, 96, 0.11) 16px 17px
    ),
    radial-gradient(ellipse 60% 45% at 80% 15%, rgba(62, 196, 181, 0.1), transparent 55%);
  opacity: 0.78;
}
body[data-hub-theme="diagonal"] .hub-tools,
body[data-hub-theme="diagonal"] .hub-quick,
body[data-hub-theme="diagonal"] .topbar,
body[data-hub-theme="diagonal"] .game-card,
body[data-hub-theme="diagonal"] .scores-panel {
  background: var(--surface-strong);
}
body[data-hub-theme="diagonal"] .hub-quick-link {
  background: rgba(20, 30, 42, 0.72);
  border-color: rgba(62, 196, 181, 0.28);
  color: var(--ink);
}
body[data-hub-theme="diagonal"] .hub-quick-link--accent {
  background: rgba(62, 196, 181, 0.16);
}
body[data-hub-theme="diagonal"] .hub-search input,
body[data-hub-theme="diagonal"] .hub-sort select,
body[data-hub-theme="diagonal"] .hub-select select,
body[data-hub-theme="diagonal"] .lang-select select,
body[data-hub-theme="diagonal"] .hub-dd-sum,
body[data-hub-theme="diagonal"] .hub-dd-panel {
  background: rgba(20, 30, 42, 0.9);
  color: var(--ink);
}
body[data-hub-theme="diagonal"] .hub-filter.is-on,
body[data-hub-theme="diagonal"] .cat-nav-btn.is-on {
  background: rgba(62, 196, 181, 0.18);
  color: var(--accent-bright);
}
body[data-hub-theme="diagonal"] .nav-link:hover {
  background: rgba(62, 196, 181, 0.12);
  color: var(--ink);
}
body[data-hub-theme="diagonal"] .fav-btn {
  background: rgba(20, 30, 42, 0.9);
}

/* theme: blocks */
body[data-hub-theme="blocks"] {
  --bg0: #d4d9e6;
  --bg1: #eceff6;
  --accent: #3557c8;
  --accent-bright: #5b7dff;
  --accent-deep: #243d96;
  --warm: #d6456a;
}
body[data-hub-theme="blocks"]::before {
  background:
    linear-gradient(168deg, #f3f5fb 0%, #d2d8e8 60%, #c6cee0 100%),
    linear-gradient(90deg, rgba(53, 87, 200, 0.11) 12px, transparent 12px),
    linear-gradient(0deg, rgba(214, 69, 106, 0.09) 12px, transparent 12px);
  background-size: auto, 60px 60px, 60px 60px;
}
body[data-hub-theme="blocks"]::after {
  background-image:
    linear-gradient(90deg, transparent 0 29px, rgba(53, 87, 200, 0.18) 29px 30px, transparent 30px 59px, rgba(214, 69, 106, 0.14) 59px 60px),
    linear-gradient(0deg, transparent 0 29px, rgba(53, 87, 200, 0.18) 29px 30px, transparent 30px 59px, rgba(214, 69, 106, 0.14) 59px 60px),
    radial-gradient(ellipse 40% 35% at 15% 20%, rgba(53, 87, 200, 0.08), transparent 55%);
  background-size: 60px 60px, 60px 60px, auto;
  opacity: 0.58;
}

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

button,
input,
select {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 5rem;
}

/* topbar — under hero; no clip-path (dropdowns must not be cut) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  overflow: visible;
  animation: rise 0.7s 0.05s var(--ease-out) both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
  padding-left: 0.25rem;
  line-height: 1.2;
  overflow: visible;
}

.brand-mark {
  display: block;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  border-radius: 0.45rem;
  background: none;
  box-shadow: none;
  animation: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
}

.nav-link {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  border-radius: 2px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

button.nav-link.btn-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(10, 122, 111, 0.08);
}

.hub-dd {
  position: relative;
}

.hub-dd-sum {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  border-radius: 2px;
  border: 1px solid transparent;
  user-select: none;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.hub-dd-sum::-webkit-details-marker {
  display: none;
}

.hub-dd-sum::after {
  content: " ▾";
  font-size: 0.72em;
  opacity: 0.7;
}

.hub-dd[open] > .hub-dd-sum,
.hub-dd-sum:hover {
  color: var(--ink);
  background: rgba(10, 122, 111, 0.08);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.hub-dd-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  min-width: 10.5rem;
  z-index: 50;
  display: grid;
  gap: 0.1rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.hub-dd-item {
  display: block;
  width: 100%;
  text-align: start;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.5rem 0.7rem;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
}

a.hub-dd-item {
  color: var(--ink);
}

.hub-dd-item:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-deep);
}

/* hero — first in shell */
.hero {
  position: relative;
  display: grid;
  gap: 0.65rem;
  padding: 0.35rem 0 1.15rem;
  overflow: visible;
  animation: rise 0.85s var(--ease-out) both;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 0;
  clip-path: polygon(0 18%, 78% 0, 100% 72%, 22% 100%);
  pointer-events: none;
  z-index: -1;
}

.hero::before {
  width: min(280px, 42vw);
  height: min(280px, 42vw);
  right: -2%;
  top: -8%;
  background: linear-gradient(145deg, rgba(20, 184, 166, 0.22), rgba(20, 184, 166, 0.02));
  animation: float-a 9s var(--ease) infinite alternate;
}

.hero::after {
  width: min(180px, 30vw);
  height: min(180px, 30vw);
  left: 8%;
  bottom: -12%;
  background: linear-gradient(145deg, rgba(225, 90, 60, 0.16), transparent);
  animation: float-b 11s var(--ease) infinite alternate;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  animation: rise 0.8s 0.05s var(--ease-out) both;
}

.hero-kicker .brand-mark {
  margin-right: 0.05rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 6.5vw, 3.75rem);
  letter-spacing: -0.045em;
  line-height: 1.12;
  padding: 0.05em 0.02em 0.1em 0;
  overflow: visible;
  animation: rise 0.85s 0.08s var(--ease-out) both;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
  display: inline-block;
}

.hero h1 em::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.08em;
  height: 0.18em;
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.45), rgba(225, 90, 60, 0.25));
  border-radius: 2px;
  transform-origin: left;
  animation: underline 1s 0.45s var(--ease-out) both;
}

.hero p {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
  animation: rise 0.85s 0.14s var(--ease-out) both;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Bot honeypot — visually hidden, not display:none (bots often skip those). */
.hp-trap {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.is-hidden {
  display: none !important;
}

.hub-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  align-items: center;
  margin: 0 0 0.45rem;
  padding: 0.5rem 0.65rem;
  position: sticky;
  top: 0.5rem;
  z-index: 25;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  overflow: visible;
  animation: rise 0.8s 0.16s var(--ease-out) both;
}

.hub-tools-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
}

.hub-search {
  flex: 0 1 11rem;
  width: 11rem;
  max-width: 12rem;
  min-width: 7.5rem;
}

.hub-search input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.hub-search input:focus {
  border-color: rgba(10, 122, 111, 0.45);
  box-shadow: 0 0 0 4px rgba(10, 122, 111, 0.12);
}

.hub-select {
  flex: 0 1 auto;
  min-width: 0;
}

.hub-select select,
.hub-sort select {
  max-width: 100%;
  padding: 0.55rem 0.9rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.hub-filter-select select {
  min-width: 6.5rem;
}

.hub-cat-select select {
  min-width: 7rem;
}

.hub-sort select {
  min-width: 5.5rem;
}

.hub-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0 0 0.85rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  animation: rise 0.7s 0.1s var(--ease-out) both;
}

.hub-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-left: auto;
  min-width: 0;
}

.hub-quick .hub-stats,
.hub-quick .continue-banner,
.hub-quick .recent-strip {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.hub-quick .hub-stats {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 28rem;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.hub-quick .hub-stats-bar {
  height: 4px;
  margin-bottom: 0;
}

.hub-quick .hub-stats p {
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-quick-link {
  display: inline-flex;
  align-items: center;
  max-width: 16rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.hub-quick-link:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.hub-quick-link--accent {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: color-mix(in srgb, var(--accent-bright) 14%, transparent);
}

.hub-quick-link strong {
  font-weight: 800;
}

.hub-recent-select select {
  min-width: 10.5rem;
  max-width: 14rem;
}

.hub-quick-clear {
  padding: 0.35rem 0.65rem !important;
  font-size: 0.76rem !important;
}

.back-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 40;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 24, 32, 0.12);
}

.back-top:hover {
  border-color: rgba(10, 122, 111, 0.45);
  color: #0a7a6f;
}

.mg-related {
  margin: 1.75rem 0 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.mg-related h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--ink);
}

.hub-stats {
  margin: 0;
  padding: 0;
}

.hub-stats-bar {
  height: 6px;
  border-radius: 2px;
  background: rgba(16, 24, 32, 0.08);
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.hub-stats-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: inherit;
}

.hub-stats p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.hub-stats strong {
  color: var(--ink);
}

.hub-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-best {
  background: rgba(224, 177, 90, 0.22) !important;
  color: #8a5a12 !important;
}

.chip-time {
  background: rgba(59, 130, 160, 0.16) !important;
  color: #1f5a6e !important;
}

.chip-new {
  background: rgba(11, 127, 116, 0.12) !important;
  color: #0b7f74 !important;
}

.chip-multi {
  background: rgba(59, 110, 180, 0.16) !important;
  color: #2a4f8a !important;
}

body.hub-compact .game-grid {
  gap: 0.65rem;
}

body.hub-compact .game-card {
  padding: 0.65rem;
}

body.hub-compact .game-card .preview {
  height: 72px;
}

body.hub-compact .game-card h2 {
  font-size: 1rem;
}

body.hub-compact .game-card p {
  display: none;
}

.save-dot {
  margin-left: 0.35rem;
  color: var(--accent);
  font-size: 0.65rem;
  vertical-align: middle;
}

.hub-empty {
  margin: 0 0 2rem;
  color: var(--muted);
  font-weight: 600;
}

.recent-strip {
  margin: 0;
  padding: 0;
}

.fav-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  color: #c5cdd6;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(16, 24, 32, 0.08);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.fav-btn:hover {
  transform: scale(1.08);
}

.fav-btn.is-on {
  color: #e15a3c;
}

/* category nav */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2.25rem;
  animation: rise 0.8s 0.18s var(--ease-out) both;
}

.cat-nav a,
.cat-nav-btn {
  padding: 0.5rem 0.95rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  backdrop-filter: none;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease),
    background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.cat-nav a:hover,
.cat-nav-btn:hover {
  color: var(--ink);
  border-color: rgba(10, 122, 111, 0.35);
  background: #fff;
  transform: translateY(-2px);
}

.cat-nav-btn.is-on {
  color: var(--accent-deep);
  border-color: rgba(10, 122, 111, 0.4);
  background: rgba(10, 122, 111, 0.12);
}

.cat-nav-count {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.85;
}

/* categories + cards */
.cat-block {
  margin-bottom: 3rem;
}

.cat-head {
  margin-bottom: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.55rem 1.1rem;
}

.cat-head-text {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.cat-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2rem);
  letter-spacing: -0.035em;
  line-height: 1.18;
  padding: 0.06em 0;
  overflow: visible;
}

.cat-head p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1.15rem;
  perspective: 900px;
}

.game-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.8rem;
  padding: 1.15rem;
  border: 1px solid color-mix(in srgb, var(--line) 65%, var(--accent) 35%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-strong) 94%, var(--accent) 6%);
  backdrop-filter: none;
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out), border-color 0.3s var(--ease);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease-out);
  pointer-events: none;
  z-index: 2;
}

.game-card:hover {
  transform: translateY(-8px) rotateX(calc((var(--tilt-y, 0) * 1deg))) rotateY(calc((var(--tilt-x, 0) * 1deg))) scale(1.015);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.game-card.is-tilt {
  transform-style: preserve-3d;
  will-change: transform;
}
.game-card.is-press {
  transform: translateY(-2px) scale(0.985) !important;
  transition-duration: 0.12s !important;
}

.game-card:hover::before {
  transform: translateX(120%);
}

.game-card .preview {
  height: 132px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 2px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    4px 4px 0 color-mix(in srgb, var(--accent) 18%, transparent);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%),
    color-mix(in srgb, var(--bg0) 70%, #fff);
}

.game-card .preview .thumb-svg,
.scores-thumb .thumb-svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  transition: transform 0.45s var(--ease-out);
}

.game-card:hover .preview .thumb-svg {
  transform: scale(1.06) translateY(-1px);
}

.game-card .preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 55%, rgba(16, 24, 32, 0.12) 100%),
    repeating-linear-gradient(
      -18deg,
      transparent 0 14px,
      rgba(255, 255, 255, 0.04) 14px 15px
    );
  z-index: 1;
}

.lang-select {
  display: inline-flex;
  align-items: center;
}

.lang-select select {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.card-wrap.is-in {
  opacity: 1;
  transform: translateY(0);
}

.card-wrap .howto-chip {
  align-self: stretch;
  text-align: center;
}

.howto-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 2px;
  cursor: pointer;
}

.howto-chip:hover {
  color: var(--accent-deep);
  border-color: rgba(10, 122, 111, 0.35);
}

.scores-panel {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.scores-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.scores-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.scores-actions {
  display: flex;
  gap: 0.4rem;
}

.scores-list {
  display: grid;
  gap: 0.55rem;
}

.scores-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.45rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
}

.scores-row:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.scores-thumb {
  width: 72px;
  height: 48px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 14%, transparent);
}

.scores-meta {
  display: grid;
  gap: 0.15rem;
}

.scores-meta strong {
  font-size: 0.98rem;
}

.scores-meta em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.scores-empty {
  margin: 0;
  color: var(--muted);
}

.howto-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(16, 24, 32, 0.45);
}

.howto-modal.is-open {
  display: flex;
}

.howto-modal-card {
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.25rem;
  box-shadow: 8px 8px 0 rgba(16, 24, 32, 0.22);
}

.howto-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.howto-modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.howto-modal-body p {
  margin: 0 0 0.65rem;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.howto-modal-play {
  display: inline-flex;
  margin-top: 0.35rem;
}

.preview-orb {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  animation: orb 5s var(--ease) infinite alternate;
}

.preview-orb.a {
  width: 70px;
  height: 70px;
  left: 12%;
  top: 18%;
}

.preview-orb.b {
  width: 110px;
  height: 110px;
  right: -8%;
  bottom: -20%;
  animation-delay: -1.5s;
}

.preview-grid {
  position: absolute;
  inset: 18% 14%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  opacity: 0.55;
}

.preview-grid span {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  animation: tile-pop 2.4s var(--ease) infinite;
}

.preview-grid span:nth-child(2) { animation-delay: 0.15s; }
.preview-grid span:nth-child(3) { animation-delay: 0.3s; }
.preview-grid span:nth-child(5) { animation-delay: 0.2s; }
.preview-grid span:nth-child(8) { animation-delay: 0.4s; }

.game-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.35;
  padding: 0.12em 0 0.16em;
  overflow: visible;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.26rem 0.58rem;
  border-radius: 2px;
  background: rgba(10, 122, 111, 0.1);
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chip.cat-memory { background: rgba(100, 140, 200, 0.16); color: #335a8a; }
.chip.cat-puzzle { background: rgba(10, 122, 111, 0.12); color: var(--accent-deep); }
.chip.cat-arcade { background: rgba(225, 90, 60, 0.12); color: #a33a26; }
.chip.cat-reflex { background: rgba(224, 177, 90, 0.2); color: #8a5a12; }

.play {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.1rem;
  font-weight: 800;
  color: var(--accent-deep);
}

.play::after {
  content: "→";
  transition: transform 0.25s var(--ease);
}

.game-card:hover .play::after {
  transform: translateX(5px);
}

/* game pages */
.game-shell {
  width: min(780px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3.5rem;
  position: relative;
  z-index: 1;
}

.game-shell::before {
  content: "";
  position: absolute;
  left: -0.35rem;
  top: 0.4rem;
  bottom: 2.5rem;
  width: 3px;
  background: linear-gradient(
    180deg,
    var(--play-accent, var(--accent)),
    color-mix(in srgb, var(--play-accent2, var(--warm)) 70%, transparent)
  );
  opacity: 0.55;
  pointer-events: none;
}

.game-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.35rem;
  animation: rise 0.55s var(--ease-out) both;
}

.game-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex: 1 1 auto;
}

.game-nav-link {
  max-width: 9.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
}

.game-nav-link:hover {
  color: var(--ink);
  border-color: rgba(10, 122, 111, 0.35);
}

.game-nav-mute {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8rem !important;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  backdrop-filter: none;
  box-shadow: 2px 2px 0 rgba(16, 24, 32, 0.06);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}

.back:hover {
  color: var(--ink);
  border-color: rgba(10, 122, 111, 0.3);
  transform: translateX(-2px);
}

.game-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.5vw, 2.55rem);
  letter-spacing: -0.04em;
  line-height: 1.18;
  padding: 0.08em 0 0.1em;
  overflow: visible;
  animation: rise 0.6s 0.05s var(--ease-out) both;
}

.game-sub {
  margin: 0 0 1.2rem;
  color: var(--muted);
  animation: rise 0.6s 0.1s var(--ease-out) both;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  backdrop-filter: none;
  box-shadow: var(--shadow);
  padding: 1.15rem;
  animation: rise 0.65s 0.14s var(--ease-out) both;
}

.panel:fullscreen,
#stage:fullscreen,
.game-shell:fullscreen {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: clamp(0.75rem, 3vh, 1.75rem);
  /* Keep the same light play surface — no black fullscreen wash */
  --bg0: #e4edf6;
  --bg1: #f2f7fb;
  --ink: #101820;
  --muted: rgba(16, 24, 32, 0.62);
  --line: rgba(16, 24, 32, 0.12);
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  background: var(--bg1);
  color: var(--ink);
  overflow: auto;
}

.panel:fullscreen::backdrop,
#stage:fullscreen::backdrop,
.game-shell:fullscreen::backdrop {
  background: var(--bg1, #f2f7fb);
}

.game-shell:fullscreen .panel {
  background: #ffffff;
  color: #101820;
  border-color: rgba(16, 24, 32, 0.14);
}

.panel:fullscreen .hud,
.game-shell:fullscreen .hud,
#stage:fullscreen .hud {
  width: min(100%, 52rem);
  background: color-mix(in srgb, #ffffff 92%, #2a9d8f 8%);
  border-color: color-mix(in srgb, #2a9d8f 22%, rgba(16, 24, 32, 0.14));
  color: #101820;
}

.panel:fullscreen #stage,
.panel:fullscreen canvas,
#stage:fullscreen canvas,
.game-shell:fullscreen #stage,
.game-shell:fullscreen canvas {
  max-width: min(100vw - 2rem, 96vh);
  max-height: 82vh;
  width: auto;
  height: auto;
}

/* Force readable dark ink on light panels (overrides dark hub themes) */
.panel:fullscreen,
.game-shell:fullscreen,
#stage:fullscreen,
.panel:fullscreen .hud,
.game-shell:fullscreen .hud,
#stage:fullscreen .hud,
.panel:fullscreen .hint,
.game-shell:fullscreen .hint,
.panel:fullscreen .game-title,
.game-shell:fullscreen .game-title,
.panel:fullscreen .game-sub,
.game-shell:fullscreen .game-sub,
.panel:fullscreen .stat span,
.game-shell:fullscreen .stat span,
#stage:fullscreen .stat span {
  color: #101820;
}

.panel:fullscreen .stat b,
.game-shell:fullscreen .stat b,
#stage:fullscreen .stat b {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: #101820;
}

.panel:fullscreen .hint,
.game-shell:fullscreen .hint {
  color: rgba(16, 24, 32, 0.72);
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--accent) 8%);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--accent) 12%, transparent);
}

.stat {
  display: grid;
  gap: 0.08rem;
  min-width: 4rem;
}

.stat b {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
}

.stat span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.05rem;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(16, 24, 32, 0.18);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:hover {
  transform: translateY(-2px) skewX(-0.5deg);
  background: #0a1218;
  box-shadow: 4px 4px 0 rgba(16, 24, 32, 0.22);
}

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

.btn.ghost {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 2px 2px 0 rgba(16, 24, 32, 0.08);
}

.btn.ghost:hover {
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn.accent {
  background: var(--accent);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--warm) 40%, transparent);
}

.btn.accent:hover {
  background: var(--accent-deep);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.hint {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.game-controls {
  margin-bottom: 1rem;
  animation: rise 0.6s 0.12s var(--ease-out) both;
}

.ctrl-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.ctrl-bar .btn {
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
}

.ctrl-more {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0 0 0.55rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.ctrl-more.is-hidden {
  display: none;
}

.ctrl-more-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
}

.ctrl-more-group:first-child {
  padding-top: 0;
  border-top: none;
}

.ctrl-more-note {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.78rem;
  color: var(--muted, #667);
  line-height: 1.35;
}
.ctrl-more-note.is-hidden {
  display: none;
}
.ctrl-more-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ctrl-more-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ctrl-more-actions .btn {
  padding: 0.5rem 0.8rem;
  font-size: 0.86rem;
}

.mg-toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  z-index: 80;
  transform: translateX(-50%) translateY(120%);
  max-width: min(92vw, 28rem);
  padding: 0.7rem 1.1rem;
  border-radius: 2px;
  background: rgba(16, 24, 32, 0.92);
  color: #f4f8fb;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 16px 40px rgba(16, 24, 32, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
}

.mg-toast.is-on {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.mg-pause {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(10, 18, 24, 0.62);
  backdrop-filter: none;
}

.mg-pause.is-hidden {
  display: none;
}

.mg-pause-card {
  width: min(90vw, 22rem);
  padding: 1.5rem 1.35rem;
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.28);
  animation: panel-in 0.3s var(--ease-out);
}

.mg-pause-card h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.mg-pause-card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.hub-help {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  animation: rise 0.6s var(--ease-out) both;
}

.hub-help h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.hub-help ul {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.hub-help li {
  margin: 0.25rem 0;
}

.hub-help kbd {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.8rem;
  text-align: center;
  box-shadow: 2px 2px 0 rgba(16, 24, 32, 0.08);
}

.chip-plays {
  background: rgba(16, 24, 32, 0.06) !important;
  color: var(--muted) !important;
}

.game-nav-mute.is-fav {
  color: #e15a3c;
}

.settings-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 1rem 1.05rem;
  margin-bottom: 0.4rem;
  box-shadow: var(--shadow);
  animation: panel-in 0.35s var(--ease-out);
}

.settings-panel.is-hidden {
  display: none;
}

.settings-panel h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.settings-fields {
  display: grid;
  gap: 0.75rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.55rem;
}

.settings-actions [data-act="apply"].is-dirty {
  box-shadow: 0 0 0 3px rgba(10, 122, 111, 0.28);
}

.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px);
  gap: 0.65rem;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.set-row.check {
  grid-template-columns: 1fr auto;
}

.set-row span b {
  font-family: var(--font-display);
  color: var(--accent-deep);
  margin-left: 0.25rem;
}

.set-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.set-row select,
.set-row input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.55rem;
  background: #fff;
}

.ctrl-msg {
  min-height: 1.2em;
  margin-top: 0.35rem;
}

.howto-panel {
  position: fixed;
  inset: 0;
  z-index: 76;
  display: grid;
  place-items: center;
  padding: 1rem;
  margin: 0;
  border: none;
  border-radius: 0;
  background: rgba(10, 18, 24, 0.62);
  box-shadow: none;
  animation: none;
}

.howto-panel.is-hidden {
  display: none;
}

.howto-card {
  width: min(92vw, 28rem);
  max-height: min(82vh, 36rem);
  overflow: auto;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.28);
  animation: panel-in 0.3s var(--ease-out);
}

.howto-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.howto-card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

body.howto-open {
  overflow: hidden;
}

.howto-panel p,
.howto-body p {
  margin: 0 0 0.65rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 500;
}

.howto-body p:last-child {
  margin-bottom: 0;
}

.howto-keys {
  margin-top: 0.85rem;
}

.howto-keys h4 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-family: var(--font-display);
}

.howto-key-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.howto-key-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.howto-key-list kbd,
.keybind-btn {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.82rem;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  min-width: 4.5rem;
  text-align: center;
  box-shadow: 2px 2px 0 rgba(16, 24, 32, 0.08);
}

.keybind-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.keybind-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.keybind-row.is-listening .keybind-btn {
  border-color: var(--accent);
  color: var(--accent-deep);
  box-shadow: 0 0 0 2px rgba(10, 122, 111, 0.15);
}

.keybind-actions {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

/* shared play surfaces */
#stage,
.panel #board,
.panel canvas,
#canvas,
canvas#c {
  border-radius: var(--radius);
}

.panel canvas,
#canvas,
canvas#c {
  display: block;
  margin-left: auto;
  margin-right: auto;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    5px 5px 0 rgba(16, 24, 32, 0.16);
  transition: transform 0.35s var(--ease);
}

.panel:hover canvas,
.panel:hover #canvas,
.panel:hover canvas#c {
  transform: translateY(-1px);
}

#stage .cell,
#board .cell,
.board .card .face,
.hole,
.block,
.chip,
.item,
.pad[data-i],
.tile {
  transition: transform 0.18s var(--ease), background 0.18s var(--ease),
    border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

#stage .cell:hover:not(:disabled),
#board .cell:hover:not(:disabled),
.item:hover,
.block:hover,
.tile:hover,
.hole:hover {
  transform: translateY(-1px) scale(1.02);
  filter: none;
}

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

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes geo-drift {
  from {
    transform: translate3d(calc((var(--px) - 0.5) * -18px), calc((var(--py) - 0.5) * -14px), 0) scale(1);
  }
  to {
    transform: translate3d(calc((var(--px) - 0.5) * -18px - 1.5%), calc((var(--py) - 0.5) * -14px + 1%), 0) scale(1.03);
  }
}

@keyframes pager-in {
  from {
    opacity: 0;
    transform: translateY(10px) skewX(-2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) skewX(0);
  }
}

@keyframes card-snap {
  0% { transform: translateY(22px) scale(0.96); opacity: 0; }
  60% { transform: translateY(-4px) scale(1.01); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-2%, 1.5%, 0) scale(1.04);
  }
}

@keyframes float-a {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(-12px, 18px) rotate(8deg);
  }
}

@keyframes float-b {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(14px, -10px) rotate(-6deg);
  }
}

@keyframes pulse-mark {
  0%,
  100% {
    box-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 28%, transparent);
  }
  50% {
    box-shadow: 5px 5px 0 color-mix(in srgb, var(--accent) 16%, transparent);
  }
}

@keyframes underline {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes orb {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(10px, -8px) scale(1.08);
  }
}

@keyframes tile-pop {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.8;
    transform: scale(1);
  }
}

@media (max-width: 560px) {
  .set-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    border-radius: var(--radius);
  }
}

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

  .game-card {
    opacity: 1;
    transform: none;
  }
}


/* hub pager */
.hub-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.7rem;
  margin: 1.25rem 0 0.35rem;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.hub-pager-inline {
  margin: 0;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: min(100%, 18rem);
}

.hub-pager-inline .hub-pager-range {
  display: none;
}

.hub-pager-meta {
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  min-width: 0;
  text-align: center;
}

.hub-pager-inline .hub-pager-meta {
  text-align: end;
}

.hub-pager-range {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.84rem;
}

.hub-pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hub-pager-input {
  width: 3.6rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.2;
}

.hub-pager-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
}

.hub-pager-go {
  min-width: 3.2rem !important;
  padding-inline: 0.65rem;
}

.hub-pager .btn {
  min-width: 5.5rem;
  border-radius: var(--radius);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}

.hub-pager-inline .btn {
  min-width: 3.6rem;
  padding-inline: 0.7rem;
}

.hub-pager .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

.hub-pager .btn:not(:disabled):hover {
  transform: translateY(-2px) skewX(-1deg);
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--accent) 25%, transparent);
}

.game-card.is-in {
  animation: card-snap 0.55s var(--ease-out) both;
}

.theme-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  vertical-align: -0.05rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, var(--accent) 50%, transparent 50%),
    linear-gradient(0deg, var(--warm) 50%, transparent 50%);
  background-size: 4px 4px;
}


/* hub interactive polish */
.hub-filter,
.cat-nav-btn,
.nav-link.btn-link {
  transition: transform 0.18s var(--ease-out), background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.hub-filter:hover,
.cat-nav-btn:hover,
.nav-link.btn-link:hover {
  transform: translateY(-2px) skewX(-1deg);
}

.hub-filter:active,
.cat-nav-btn:active,
.nav-link.btn-link:active,
.btn:active {
  transform: translateY(1px) scale(0.98) !important;
}

.hub-filter.is-on,
.cat-nav-btn.is-on {
  box-shadow: inset 3px 0 0 var(--accent);
}

.cat-nav-btn.is-on,
.cat-nav a:hover,
.cat-nav-btn:hover {
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 16%, transparent);
}

.hero::before {
  animation: geo-drift 14s var(--ease) infinite alternate;
  clip-path: polygon(0 18%, 78% 0, 100% 72%, 22% 100%);
}

.hero::after {
  animation: geo-drift 18s var(--ease) infinite alternate-reverse;
  clip-path: polygon(12% 0, 100% 8%, 88% 100%, 0 86%);
}

.game-card {
  border-radius: var(--radius);
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}

.game-card .preview {
  overflow: hidden;
}

.game-card.is-tilt:hover .preview {
  transform: translateZ(18px) scale(1.03);
  transition: transform 0.25s var(--ease-out);
}

.hub-pager .btn:not(:disabled):active {
  transform: translateY(1px) skewX(0) !important;
}

@media (prefers-reduced-motion: reduce) {
  .hub-filter:hover,
  .cat-nav-btn:hover,
  .nav-link.btn-link:hover,
  .game-card:hover,
  .game-card.is-tilt:hover .preview,
  .btn:hover,
  .hub-pager .btn:not(:disabled):hover {
    transform: none !important;
  }
}

/* Hub footer site links */
.site-links {
  margin: 2.75rem 0 0;
  padding: 1.05rem 0 0.15rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.35rem;
}

.site-links a {
  display: inline-flex;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.site-links a:hover {
  color: var(--ink);
  background: rgba(10, 122, 111, 0.08);
  border-color: rgba(10, 122, 111, 0.18);
}

.site-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* POL network strip */
.pol-net {
  margin: 1.35rem 0 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
}
.pol-net-dir {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--accent);
}
.pol-net-dir:hover { text-decoration: underline; }
.pol-net-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
}
.pol-net-list a,
.pol-net-list .is-current {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}
.pol-net-list a:hover { color: var(--accent); }
.pol-net-list .is-current {
  color: var(--ink);
  font-weight: 600;
}
