:root {
  --bg: #f1e4cf;
  --bg-top: #fbf4ea;
  --panel: rgba(255, 250, 243, 0.9);
  --panel-strong: rgba(255, 252, 247, 0.96);
  --ink: #1b1713;
  --muted: #7c7267;
  --line: rgba(27, 23, 19, 0.08);
  --accent: #e36d33;
  --accent-2: #f2b661;
  --green: #2a8e82;
  --shadow: 0 24px 56px rgba(71, 45, 19, 0.1);
  --glow-accent: rgba(227, 109, 51, 0.14);
  --glow-green: rgba(42, 142, 130, 0.12);
  --chip-bg: rgba(27, 23, 19, 0.05);
  --brand-bg: rgba(255, 255, 255, 0.72);
  --texture: url("/img/white.webp");
}

body[data-theme="dark"] {
  --bg: #161b22;
  --bg-top: #1f2730;
  --panel: rgba(31, 37, 46, 0.84);
  --panel-strong: rgba(35, 42, 52, 0.94);
  --ink: #f6f0e7;
  --muted: #b8b0a7;
  --line: rgba(246, 240, 231, 0.1);
  --accent: #ff8d54;
  --accent-2: #ffc56f;
  --green: #34a593;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.32);
  --glow-accent: rgba(255, 141, 84, 0.1);
  --glow-green: rgba(52, 165, 147, 0.1);
  --chip-bg: rgba(255, 255, 255, 0.06);
  --brand-bg: rgba(255, 255, 255, 0.05);
  --texture: url("/img/black.webp");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    var(--texture) 0 0 / 280px 280px repeat,
    radial-gradient(circle at top left, var(--glow-accent), transparent 26%),
    radial-gradient(circle at bottom right, var(--glow-green), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.home-shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 78px 0 28px;
}

.hero-card,
.game-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  padding: 22px 24px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.76), transparent 32%),
    radial-gradient(circle at 80% 30%, rgba(227, 109, 51, 0.05), transparent 22%),
    linear-gradient(180deg, rgba(255, 249, 241, 0.96), rgba(250, 241, 229, 0.94));
  border-color: rgba(27, 23, 19, 0.06);
}

body[data-theme="dark"] .hero-card {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 141, 84, 0.1), transparent 28%),
    radial-gradient(circle at 82% 28%, rgba(52, 165, 147, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(35, 42, 52, 0.96), rgba(30, 36, 45, 0.94));
  border-color: rgba(246, 240, 231, 0.08);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.18);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) 220px;
  gap: 14px;
  align-items: center;
}

.hero-main {
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 6px 8px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 10px 20px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--brand-bg);
}

.hero-card .site-brand {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(27, 23, 19, 0.08);
}

body[data-theme="dark"] .hero-card .site-brand {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(246, 240, 231, 0.1);
}

.site-brand__logo {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 12px;
  flex: 0 0 auto;
}

.site-brand__name {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1;
  color: #2a241e;
}

body[data-theme="dark"] .site-brand__name {
  color: #f6f0e7;
}

.eyebrow,
.game-card__top {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--green);
}

.hero-card .eyebrow {
  color: var(--green);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero-title {
  display: grid;
  gap: 2px;
  max-width: 16ch;
  font-family: "Manrope", sans-serif;
  font-size: clamp(1.8rem, 4vw, 3.15rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.06em;
  color: var(--ink);
}

.hero-title__line {
  display: block;
}

.hero-title em {
  color: var(--accent);
  font-style: normal;
}

.hero-card .hero-title {
  color: #201a15;
}

body[data-theme="dark"] .hero-card .hero-title {
  color: #f6f0e7;
}

h2 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  line-height: 1;
}

h3 {
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  line-height: 1;
}

.hero-copy,
.section-head p,
.game-card p,
.game-card__hint {
  color: var(--muted);
  line-height: 1.55;
}

.hero-copy {
  font-size: 0.9rem;
}

.hero-card .hero-copy {
  color: #7f7368;
}

body[data-theme="dark"] .hero-card .hero-copy {
  color: #b8b0a7;
}

.hero-actions,
.game-card__actions,
.game-card__preview {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-side {
  display: grid;
  place-items: center;
  min-height: 100%;
}

.hero-visual {
  position: relative;
  width: 100%;
  min-height: 232px;
  transform: scale(0.84);
  transform-origin: center;
}

.bubble {
  position: absolute;
  border-radius: 22px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.1);
  transform: rotate(-12deg);
}

.bubble::before {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -10px;
  width: 22px;
  height: 22px;
  background: inherit;
  clip-path: polygon(0 0, 100% 0, 24% 100%);
}

.bubble span {
  position: absolute;
  left: 18px;
  right: 18px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.bubble span:nth-child(1) { top: 18px; }
.bubble span:nth-child(2) { top: 30px; }
.bubble span:nth-child(3) { top: 42px; width: 52%; }

.bubble--orange {
  background: linear-gradient(135deg, #ff941f, #f27a20);
}

.bubble--mint {
  background: linear-gradient(135deg, #39d4c2, #21a79e);
}

.bubble--large {
  top: 16px;
  left: 46px;
  width: 114px;
  height: 74px;
}

.bubble--medium {
  top: 24px;
  right: 28px;
  width: 86px;
  height: 58px;
  transform: rotate(10deg);
}

.bubble--wide {
  top: 134px;
  right: 48px;
  width: 110px;
  height: 74px;
  transform: rotate(18deg);
}

.token {
  position: absolute;
  border-radius: 18px;
}

.token--cube {
  top: 114px;
  left: 30px;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #ff9b1a, #f18024);
  transform: rotate(12deg);
  box-shadow: 0 14px 20px rgba(241, 128, 36, 0.18);
}

.token--cube::before,
.token--cube::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.88);
}

.token--cube::before { top: 8px; left: 8px; box-shadow: 12px 6px 0 rgba(255, 248, 240, 0.88), 6px 16px 0 rgba(255, 248, 240, 0.88); }
.token--cube::after { top: 20px; left: 18px; }

.token--coin {
  top: 166px;
  right: 10px;
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9f1d, #f18722);
  box-shadow: 0 16px 26px rgba(241, 128, 36, 0.2);
}

.token--coin::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  border: 3px solid rgba(255, 248, 240, 0.82);
}

.token--spark {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  transform: rotate(45deg);
}

.token--spark-a {
  top: 4px;
  right: 120px;
  background: #53dac6;
}

.token--spark-b {
  top: 112px;
  left: 4px;
  background: #ff9b1a;
}

.gamepad {
  position: absolute;
  right: 112px;
  bottom: 2px;
  width: 114px;
  height: 60px;
  border-radius: 28px;
  background: linear-gradient(135deg, #ff9d1b, #f07b1f);
  transform: rotate(18deg);
  box-shadow: 0 18px 26px rgba(240, 123, 31, 0.18);
}

.gamepad::before,
.gamepad::after {
  content: "";
  position: absolute;
  top: 20px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9d1b, #f07b1f);
}

.gamepad::before { left: -10px; }
.gamepad::after { right: -10px; }

.gamepad__top,
.gamepad__left,
.gamepad__right {
  position: absolute;
  background: rgba(71, 40, 12, 0.75);
}

.gamepad__top {
  left: 24px;
  top: 24px;
  width: 18px;
  height: 4px;
  box-shadow: 7px -7px 0 rgba(71, 40, 12, 0.75), 7px 7px 0 rgba(71, 40, 12, 0.75);
}

.gamepad__left {
  left: 74px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 16px 6px 0 rgba(71, 40, 12, 0.75), 2px 18px 0 rgba(71, 40, 12, 0.75);
}

.gamepad__right {
  left: 54px;
  top: 34px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.home-main {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.section-head p {
  font-size: 0.9rem;
}

.games-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 12px;
}

.game-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.game-card--featured {
  background:
    radial-gradient(circle at top right, rgba(242, 184, 97, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(255, 246, 236, 0.96));
  border-color: rgba(227, 109, 51, 0.08);
}

.game-card--tetris {
  background:
    radial-gradient(circle at top right, rgba(42, 142, 130, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(255, 246, 236, 0.96));
  border-color: rgba(42, 142, 130, 0.08);
}

.game-card--whoami {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at top right, rgba(227, 109, 51, 0.1), transparent 20%),
    radial-gradient(circle at bottom left, rgba(42, 142, 130, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(255, 246, 236, 0.96));
  border-color: rgba(27, 23, 19, 0.06);
}

body[data-theme="dark"] .game-card--featured {
  background:
    radial-gradient(circle at top right, rgba(242, 184, 97, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 250, 243, 0.98), rgba(255, 246, 236, 0.96));
  border-color: rgba(227, 109, 51, 0.08);
}

body[data-theme="dark"] .game-card--tetris {
  background:
    radial-gradient(circle at top right, rgba(52, 165, 147, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(36, 42, 52, 0.98), rgba(31, 37, 46, 0.96));
  border-color: rgba(246, 240, 231, 0.08);
}

body[data-theme="dark"] .game-card--whoami {
  background:
    radial-gradient(circle at top right, rgba(255, 141, 84, 0.1), transparent 20%),
    radial-gradient(circle at bottom left, rgba(52, 165, 147, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(36, 42, 52, 0.98), rgba(31, 37, 46, 0.96));
  border-color: rgba(246, 240, 231, 0.08);
}

.featured-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 18px;
  align-items: center;
}

.tetris-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  gap: 18px;
  align-items: center;
}

.whoami-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: center;
}

.featured-card__main {
  display: grid;
  gap: 12px;
}

.tetris-card__main {
  display: grid;
  gap: 12px;
}

.whoami-card__main {
  display: grid;
  gap: 12px;
}

.featured-card__visual {
  position: relative;
  min-height: 170px;
  display: grid;
  place-items: center;
}

.alias-tiles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 8px;
  transform: rotate(-18deg);
}

.alias-tiles span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff6ea, #ffd8a8);
  color: #5b4024;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(227, 109, 51, 0.12);
}

.alias-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffd6cd, #ffb4a0);
  color: var(--accent);
  font-weight: 900;
  font-size: 1.25rem;
}

.tetris-card__visual {
  position: relative;
  min-height: 168px;
  border: 1px solid rgba(27, 23, 19, 0.06);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(42, 142, 130, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 247, 235, 0.72));
  overflow: hidden;
}

.whoami-card__visual {
  position: relative;
  min-height: 170px;
  display: grid;
  place-items: center;
}

.whoami-bubble {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(27, 23, 19, 0.08);
  color: #34281f;
  font-weight: 800;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.08);
}

.whoami-bubble::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -10px;
  width: 18px;
  height: 18px;
  background: inherit;
  border-right: inherit;
  border-bottom: inherit;
  transform: rotate(45deg);
}

.whoami-bubble--you {
  left: 18px;
  top: 20px;
  width: 104px;
  min-height: 104px;
  border-radius: 28px;
  background: linear-gradient(135deg, #f27d3a, #ffac67);
  color: #fff7ef;
  font-size: 2.4rem;
}

.whoami-bubble--other {
  top: 30px;
  right: 18px;
}

.whoami-bubble--alt {
  top: auto;
  bottom: 20px;
  right: 42px;
  background: linear-gradient(135deg, rgba(42, 142, 130, 0.18), rgba(42, 142, 130, 0.08));
}

.whoami-line {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 35% 38%, rgba(227, 109, 51, 0.12) 0 6px, transparent 7px),
    radial-gradient(circle at 66% 72%, rgba(42, 142, 130, 0.14) 0 6px, transparent 7px);
}

.tetris-card__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(27, 23, 19, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 23, 19, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.55;
}

.tetris-card__piece {
  position: absolute;
  display: block;
  border-radius: 12px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.12);
}

.tetris-card__piece--i {
  top: 18px;
  right: 18px;
  width: 88px;
  height: 24px;
  background: linear-gradient(135deg, #39d4c2, #21a79e);
}

.tetris-card__piece--o {
  top: 54px;
  left: 18px;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ffd35a, #f1ad1f);
}

.tetris-card__piece--t {
  right: 16px;
  bottom: 18px;
  width: 78px;
  height: 56px;
  background: linear-gradient(135deg, #ff9a31, #f2791f);
  clip-path: polygon(0 0, 100% 0, 100% 44%, 66% 44%, 66% 100%, 34% 100%, 34% 44%, 0 44%);
}

.tetris-card__piece--s {
  left: 58px;
  bottom: 48px;
  width: 66px;
  height: 44px;
  background: linear-gradient(135deg, #7d63f3, #5d3ee0);
  clip-path: polygon(0 28%, 50% 28%, 50% 0, 100% 0, 100% 72%, 50% 72%, 50% 100%, 0 100%);
}

.game-card__body {
  display: grid;
  gap: 12px;
}

.game-card--featured h3 {
  color: #171411;
}

.game-card--featured p,
.game-card--featured .game-card__hint {
  color: #7f7368;
}

.pill,
.game-card__preview span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  font-size: 0.88rem;
  font-weight: 800;
}

.game-card--featured .pill {
  background: rgba(227, 109, 51, 0.1);
  color: var(--accent);
}

.game-card--featured .game-card__preview span {
  background: rgba(27, 23, 19, 0.05);
  color: #2d261f;
}

body[data-theme="dark"] .game-card--featured {
  background:
    radial-gradient(circle at top right, rgba(242, 184, 97, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(36, 42, 52, 0.98), rgba(31, 37, 46, 0.96));
  border-color: rgba(246, 240, 231, 0.08);
}

body[data-theme="dark"] .game-card--featured h3 {
  color: #f6f0e7;
}

body[data-theme="dark"] .game-card--featured p,
body[data-theme="dark"] .game-card--featured .game-card__hint {
  color: #b8b0a7;
}

body[data-theme="dark"] .game-card--featured .pill {
  background: rgba(227, 109, 51, 0.14);
  color: var(--accent);
}

body[data-theme="dark"] .game-card--featured .game-card__preview span {
  background: rgba(255, 255, 255, 0.06);
  color: #f6f0e7;
}

body[data-theme="dark"] .alias-tiles span {
  background: linear-gradient(180deg, #fff0d8, #ffc984);
  color: #5b4024;
}

body[data-theme="dark"] .tetris-card__piece {
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.24);
}

body[data-theme="dark"] .tetris-card__visual {
  border-color: rgba(246, 240, 231, 0.08);
  background:
    radial-gradient(circle at top right, rgba(52, 165, 147, 0.1), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.03));
}

body[data-theme="dark"] .whoami-bubble {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(246, 240, 231, 0.1);
  color: #f6f0e7;
}

body[data-theme="dark"] .whoami-bubble--you {
  background: linear-gradient(135deg, #f27d3a, #ffac67);
  color: #fff8f0;
}

body[data-theme="dark"] .whoami-bubble--alt {
  background: linear-gradient(135deg, rgba(52, 165, 147, 0.24), rgba(52, 165, 147, 0.12));
}

body[data-theme="dark"] .tetris-card__grid {
  background-image:
    linear-gradient(rgba(246, 240, 231, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 240, 231, 0.06) 1px, transparent 1px);
}

.pill--muted {
  color: var(--muted);
}

.primary-link,
.ghost-link,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 800;
  text-decoration: none;
}

.primary-link {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px rgba(227, 109, 51, 0.18);
}

.ghost-link,
.ghost-button {
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--ink);
}

.ghost-button {
  font: inherit;
}

@media (max-width: 940px) {
  .hero-layout,
  .games-grid,
  .section-head {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  .hero-side {
    display: none;
  }

  .hero-title {
    max-width: none;
  }

  .featured-card {
    grid-template-columns: 1fr;
  }

  .tetris-card {
    grid-template-columns: 1fr;
  }

  .whoami-card {
    grid-template-columns: 1fr;
  }

  .featured-card__visual {
    min-height: 130px;
  }

  .tetris-card__visual {
    min-height: 124px;
    max-width: 220px;
    margin-left: auto;
  }

  .whoami-card__visual {
    min-height: 132px;
    max-width: 240px;
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .theme-toggle {
    top: 12px;
    right: 12px;
    padding: 10px 14px;
  }

  .home-shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 72px;
  }

  .hero-card,
  .game-card {
    border-radius: 22px;
    padding: 14px;
  }

  .hero-main {
    padding: 4px;
  }

  .site-brand {
    width: 100%;
    justify-content: center;
  }

  .hero-actions,
  .game-card__actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .hero-actions > *,
  .game-card__actions > * {
    width: 100%;
  }
}
