:root {
  --bg: #11152c;
  --bg-soft: #191e3d;
  --card: rgba(31, 38, 76, .88);
  --card-strong: #252d59;
  --text: #f7f7ff;
  --muted: #a9afd0;
  --line: rgba(255,255,255,.12);
  --purple: #9d7bff;
  --pink: #ff78bd;
  --yellow: #ffd166;
  --mint: #58e6bd;
  --blue: #69b7ff;
  --shadow: 0 22px 50px rgba(0,0,0,.24);
  font-family: "Trebuchet MS", Inter, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 12% 10%, rgba(157,123,255,.20), transparent 32rem),
    radial-gradient(circle at 88% 16%, rgba(255,120,189,.16), transparent 28rem),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
}
body.light {
  --bg: #f3f2ff; --bg-soft: #ffffff; --card: rgba(255,255,255,.90); --card-strong: #f0efff;
  --text: #171a35; --muted: #616784; --line: rgba(22,25,54,.12); --shadow: 0 18px 45px rgba(71,56,143,.14);
}
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.site-header { height: 82px; display: flex; align-items: center; gap: 34px; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(255,209,102,.08); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; font-size: 1.12rem; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: #16142c; background: var(--yellow); border-radius: 12px; transform: rotate(-8deg); box-shadow: 0 5px 0 #ba8e32; }
.main-nav { display: flex; gap: 20px; margin-right: auto; color: var(--muted); font-size: .92rem; }
.main-nav a:hover, .main-nav a.active { color: var(--text); }
.icon-button, .ghost-button { color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 12px; }
.icon-button { width: 40px; height: 40px; font-size: 1.25rem; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); padding: 35px 0 24px; font-size: .78rem; }
main { flex: 1; padding: 48px 0; }
.hero { display: grid; grid-template-columns: 1.4fr .9fr; align-items: center; gap: 42px; margin-bottom: 48px; }
.eyebrow { color: var(--pink); font-size: .77rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 700px; margin-bottom: 18px; font-size: clamp(2.5rem, 6vw, 5.2rem); line-height: .98; letter-spacing: -.07em; }
h1 em { color: var(--yellow); font-style: normal; }
.hero-copy p { max-width: 600px; color: var(--muted); font-size: 1.04rem; line-height: 1.7; }
.hero-art { min-height: 250px; position: relative; display: grid; place-items: center; }
.orb { width: 210px; height: 210px; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--purple)); box-shadow: 0 0 0 18px rgba(157,123,255,.08), 0 25px 60px rgba(157,123,255,.35); animation: float 5s ease-in-out infinite; }
.orb::before, .orb::after { content: ""; position: absolute; border-radius: 50%; background: var(--yellow); }
.orb::before { width: 36px; height: 36px; margin: 52px 0 0 58px; box-shadow: 60px 30px 0 var(--mint); }
.orb::after { width: 15px; height: 15px; margin: 118px 0 0 123px; background: var(--text); }
.spark { position: absolute; color: var(--yellow); font-size: 2rem; animation: twinkle 2.5s infinite; }
.spark.one { top: 28px; left: 14%; }.spark.two { right: 12%; bottom: 28px; color: var(--mint); animation-delay: .8s; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; font-size: 1.3rem; letter-spacing: -.03em; }
.section-heading span { color: var(--muted); font-size: .86rem; }
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.game-card { position: relative; overflow: hidden; min-height: 205px; display: flex; flex-direction: column; justify-content: space-between; padding: 21px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; }
.game-card:hover { transform: translateY(-5px); border-color: var(--accent); }
.game-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #1a1730; background: var(--accent); font-size: 1.5rem; }
.game-card h3 { margin: 16px 0 5px; font-size: 1.05rem; }.game-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.play-link, .primary-button { align-self: flex-start; border: 0; border-radius: 11px; color: #17142e; background: var(--accent, var(--yellow)); padding: 10px 14px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.22); transition: transform .15s, filter .15s; }
.play-link:hover, .primary-button:hover { filter: brightness(1.08); transform: translateY(-2px); }
.play-link { margin-top: 15px; font-size: .78rem; }
.panel { border: 1px solid var(--line); border-radius: 24px; padding: clamp(20px, 4vw, 38px); background: var(--card); box-shadow: var(--shadow); }
.game-top { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 24px; }
.game-top h1 { font-size: clamp(2rem, 4vw, 3.3rem); margin-bottom: 8px; }.game-top p { color: var(--muted); margin-bottom: 0; }
.game-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary-button { background: var(--yellow); }.ghost-button { padding: 10px 14px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }.stat-pill { background: var(--card-strong); border: 1px solid var(--line); border-radius: 13px; padding: 10px 14px; font-size: .82rem; color: var(--muted); }.stat-pill b { color: var(--text); margin-left: 5px; }
.game-stage { min-height: 250px; display: grid; place-items: center; background: rgba(10,12,30,.25); border: 1px dashed var(--line); border-radius: 18px; padding: 20px; }
.message { color: var(--muted); text-align: center; line-height: 1.6; }.message strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 5px; }
.choice-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }.choice { min-width: 105px; padding: 20px 15px; border: 1px solid var(--line); border-radius: 17px; color: var(--text); background: var(--card-strong); transition: transform .15s, border-color .15s; }.choice:hover { transform: translateY(-3px); border-color: var(--yellow); }.choice span { display: block; font-size: 2rem; margin-bottom: 7px; }
.memory-grid { display: grid; grid-template-columns: repeat(4, minmax(52px, 88px)); gap: 10px; }.memory-card { aspect-ratio: 1; border: 0; border-radius: 13px; background: var(--purple); color: transparent; font-size: 1.7rem; transform-style: preserve-3d; transition: transform .3s, background .3s; }.memory-card.flipped, .memory-card.matched { background: var(--yellow); color: #201936; transform: rotateY(180deg); }.memory-card.matched { background: var(--mint); }
.snake-wrap { display: grid; gap: 12px; justify-items: center; }.snake-canvas { width: min(100%, 360px); aspect-ratio: 1; border-radius: 12px; background: #10152e; border: 3px solid var(--purple); image-rendering: pixelated; }.key-hint { color: var(--muted); font-size: .8rem; text-align: center; }
.snake-controls { display: grid; gap: 6px; justify-items: center; touch-action: manipulation; }.snake-controls div { display: flex; gap: 6px; }.snake-controls button { width: 48px; height: 42px; border: 1px solid var(--purple); border-radius: 10px; color: var(--text); background: var(--card-strong); box-shadow: 0 4px 0 rgba(0,0,0,.25); font-weight: 900; }.snake-controls button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.guess-form, .word-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }.text-input { width: 200px; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; color: var(--text); background: var(--card-strong); outline: none; }.text-input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255,209,102,.18); }
.reflex-target { width: min(220px, 70vw); aspect-ratio: 1; border: 0; border-radius: 50%; color: #19152e; background: var(--pink); font-weight: 900; box-shadow: 0 10px 0 #ae4c84; }.reflex-target.waiting { background: var(--yellow); }.reflex-target.ready { background: var(--mint); animation: pulse 1s infinite; }
.word-display { display: flex; gap: 8px; margin-bottom: 22px; font-size: clamp(1.5rem, 5vw, 2.5rem); letter-spacing: .18em; font-weight: 900; }.letter-slot { min-width: 30px; border-bottom: 3px solid var(--purple); text-align: center; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 30px; }.big-stat { padding: 18px; border-radius: 17px; background: var(--card-strong); }.big-stat strong { display: block; font-size: 2rem; color: var(--yellow); }.big-stat span { color: var(--muted); font-size: .8rem; }
.score-list { display: grid; gap: 8px; }.score-item { display: flex; justify-content: space-between; padding: 13px 15px; border-radius: 12px; background: var(--card-strong); color: var(--muted); }.score-item b { color: var(--text); }
.empty-state { padding: 34px 10px; text-align: center; color: var(--muted); }.error-state { color: var(--pink); text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(340px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-strong); box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .25s; font-size: .86rem; }.toast.show { transform: translateY(0); opacity: 1; }
@keyframes float { 50% { transform: translateY(-12px) rotate(5deg); } } @keyframes twinkle { 50% { transform: scale(1.3) rotate(15deg); opacity: .65; } } @keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(88,230,189,.15); } }
@media (max-width: 760px) { .app-shell { width: min(100% - 24px, 580px); }.site-header { height: 70px; gap: 18px; }.main-nav { gap: 12px; }.hero { grid-template-columns: 1fr; gap: 10px; margin-bottom: 30px; }.hero-art { min-height: 180px; order: -1; }.orb { width: 145px; height: 145px; }.orb::before { width: 25px; height: 25px; margin: 35px 0 0 40px; box-shadow: 42px 22px 0 var(--mint); }.orb::after { width: 11px; height: 11px; margin: 82px 0 0 85px; } h1 { font-size: clamp(2.5rem, 14vw, 4rem); }.game-grid, .stats-grid { grid-template-columns: 1fr; }.game-top { flex-direction: column; }.game-actions { width: 100%; }.game-actions > * { flex: 1; text-align: center; }.site-footer { flex-direction: column; gap: 7px; } main { padding: 30px 0; }.panel { padding: 20px 14px; } }
@media (max-width: 420px) { .memory-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }.memory-card { font-size: 1.2rem; }.choice { min-width: 86px; padding: 14px 8px; }.choice span { font-size: 1.6rem; } }
