:root {
  --page: #f4f6f9;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #dfe5ec;
  --soft: #eef2f7;
  --dark: #101827;
  --blue: #2563eb;
  --purple: #7c3aed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 246, 249, 0.96)),
    radial-gradient(circle at 50% 0%, #ffffff 0, transparent 42%);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

body.unlocking {
  overflow: hidden;
}

body.home-dark {
  --page: #10151f;
  --card: #171d29;
  --ink: #f8fafc;
  --muted: #b4bfce;
  --line: #2b3547;
  --soft: #202939;
  --dark: #e5edf7;
  --blue: #7dd3fc;
  --purple: #c4b5fd;
  background:
    radial-gradient(ellipse 92% 32% at 10% 18%, rgba(125, 211, 252, 0.18) 0 34%, transparent 70%),
    radial-gradient(ellipse 88% 28% at 92% 42%, rgba(196, 181, 253, 0.16) 0 36%, transparent 72%),
    radial-gradient(ellipse 96% 30% at 18% 78%, rgba(37, 99, 235, 0.13) 0 32%, transparent 72%),
    linear-gradient(180deg, rgba(16, 21, 31, 0.9), rgba(9, 13, 21, 0.98)),
    #10151f;
  background-size: 160% 120%, 150% 120%, 170% 130%, 100% 100%, auto;
  animation: homeDarkWaves 18s ease-in-out infinite alternate;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  user-select: none;
}

.home-page {
  width: min(100%, 720px);
  position: relative;
  z-index: 2;
  transition: filter 250ms ease;
}

.home-page.pull-away {
  animation: pullAway 1350ms cubic-bezier(0.77, 0, 0.18, 1) forwards;
  filter: drop-shadow(0 36px 44px rgba(17, 24, 39, 0.32));
}

.site-header {
  text-align: center;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.76rem;
  font-weight: 800;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: 0;
}

.site-header p {
  margin: 8px auto 0;
  color: var(--muted);
  max-width: 520px;
}

.calculator-shell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.12);
  transition: background 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.calc-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 4px 16px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.theme-switch {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  background: #ffffff;
  color: #374151;
  font-size: 0.76rem;
  font-weight: 850;
}

.theme-switch:hover,
.theme-switch:focus-visible {
  border-color: var(--blue);
  color: #1d4ed8;
  outline: none;
}

.theme-switch-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #111827 0 50%, #f8fafc 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.16);
}

.calc-topbar h2 {
  margin: 0;
  font-size: 1rem;
}

.calc-topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.solar-strip {
  width: 116px;
  height: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 4px;
  background: #141b2a;
  border-radius: 8px;
  flex: 0 0 auto;
}

.solar-strip span {
  background: #394151;
  border-radius: 2px;
}

.wheel-wrap {
  overflow: hidden;
  padding: 0 15%;
  touch-action: pan-y;
  perspective: 1200px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.wheel-track {
  display: flex;
  align-items: stretch;
  will-change: transform;
  transform-style: preserve-3d;
}

.wheel-track.animate {
  transition: transform 680ms cubic-bezier(0.19, 1, 0.22, 1);
}

.wheel-panel {
  flex: 0 0 100%;
  padding: 4px;
  opacity: 0.32;
  transform: scale(0.83) rotateY(28deg);
  transform-origin: center;
  filter: blur(0.3px);
  pointer-events: none;
  transition: opacity 520ms ease, transform 680ms cubic-bezier(0.19, 1, 0.22, 1), filter 520ms ease;
}

.wheel-panel.is-active {
  opacity: 1;
  transform: scale(1) rotateY(0deg);
  filter: none;
  pointer-events: auto;
}

.wheel-panel.is-before {
  transform: scale(0.83) rotateY(-28deg);
}

.calculator-card {
  min-height: 590px;
  background: #f8fafc;
  border: 1px solid #e5eaf0;
  border-radius: 22px;
  padding: 16px;
  transition: transform 260ms ease, background 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.wheel-panel.is-active .calculator-card {
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
}

.display-stack {
  min-height: 116px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, #111827, #0b1220);
  border: 2px solid #1f2937;
  border-radius: 18px;
}

.history {
  min-height: 20px;
  text-align: right;
  color: #9ca3af;
  font-size: 0.78rem;
  word-break: break-all;
}

.display {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #ffffff;
  text-align: right;
  font-size: clamp(1.6rem, 7vw, 2.25rem);
  font-weight: 800;
}

.utility-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.calc-message {
  flex: 1;
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.calc-message.error {
  color: #b91c1c;
}

.calc-message.success {
  color: #15803d;
}

.small-pill,
.reel-btn {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  background: #ffffff;
  color: #374151;
  font-weight: 800;
  font-size: 0.78rem;
}

.expand-toggle {
  display: none;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.keypad button,
.primary-action {
  min-height: 44px;
  border-radius: 12px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  transition: transform 80ms ease, background 160ms ease;
}

.keypad button:active,
.primary-action:active,
.reel-btn:active,
.small-pill:active {
  transform: scale(0.97);
}

.keypad .num {
  background: #ffffff;
  box-shadow: inset 0 -1px 0 rgba(17, 24, 39, 0.08);
}

.keypad .op {
  background: #dbeafe;
  color: #1d4ed8;
}

.keypad .sci {
  background: #f1e8ff;
  color: #6d28d9;
  font-size: 0.74rem;
}

.keypad .memory {
  background: #e6fffb;
  color: #0f766e;
  font-size: 0.74rem;
}

.keypad .danger {
  background: #fee2e2;
  color: #b91c1c;
}

.keypad .equals {
  grid-row: span 2;
  background: var(--dark);
  color: #ffffff;
}

.keypad .wide {
  grid-column: span 2;
}

.converter-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-card .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.converter-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.converter-card p {
  margin: -6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid label {
  display: grid;
  gap: 6px;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 800;
}

.field-grid input,
.field-grid select {
  min-height: 50px;
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field-grid input:focus,
.field-grid select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
  transform: translateY(-1px);
}

.primary-action {
  width: 100%;
  margin-top: 2px;
  background: var(--dark);
  color: #ffffff;
}

.result-box {
  margin-top: auto;
  min-height: 110px;
  border-radius: 18px;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 6px;
  background: var(--dark);
  color: #ffffff;
}

.result-box span {
  color: #aeb8c7;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-box strong {
  font-size: clamp(1.35rem, 6vw, 2rem);
  word-break: break-word;
}

.stacked-result {
  align-content: start;
}

.result-detail {
  display: grid;
  gap: 6px;
  color: #dbe5f2;
  font-size: 0.82rem;
  line-height: 1.35;
}

.result-detail div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 7px;
}

.result-detail b {
  color: #ffffff;
  font-weight: 900;
  text-align: right;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex: 1;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: width 240ms ease, background 240ms ease, transform 240ms ease;
}

.dot.is-active {
  width: 26px;
  background: var(--dark);
  transform: translateY(-1px);
}

.version-note {
  margin: 14px 0 0;
  color: #9ca3af;
  text-align: center;
  font-size: 0.76rem;
}

.cookie-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  width: min(100% - 36px, 620px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 14px 14px 16px;
  border: 1px solid #dfe5ec;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.16);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.9rem;
}

.cookie-banner p {
  margin: 0;
  color: #6b7280;
  font-size: 0.82rem;
  line-height: 1.4;
}

.cookie-banner button {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
}

.unlock-reveal {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(56, 189, 248, 0.24), transparent 28%),
    radial-gradient(circle at 80% 30%, rgba(168, 85, 247, 0.35), transparent 32%),
    linear-gradient(135deg, #040817 0%, #0f1b3d 48%, #29145c 100%);
  color: #ffffff;
  transition: opacity 550ms ease;
}

.unlock-reveal.calculator-reveal {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #eef2f7 52%, #dfe5ec 100%);
  color: #111827;
}

.unlock-reveal.calculator-reveal::before {
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.72;
}

.unlock-reveal.calculator-reveal .eyebrow {
  color: #2563eb;
}

.unlock-reveal.calculator-reveal .loader-dots span {
  background: #111827;
}

.unlock-reveal.show {
  opacity: 1;
}

.unlock-reveal::before {
  content: "";
  position: absolute;
  inset: -80px;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.6) 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255, 255, 255, 0.22) 1px, transparent 1.4px);
  background-size: 78px 78px, 132px 132px;
  animation: starDrift 9s linear infinite;
  opacity: 0.56;
}

.unlock-glow {
  position: absolute;
  width: 330px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.38), transparent 67%);
  filter: blur(12px);
}

.unlock-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
}

.unlock-reveal.show .unlock-copy {
  animation: revealCopy 700ms ease 360ms forwards;
}

.unlock-copy h2 {
  margin: 0;
  font-size: clamp(2.3rem, 9vw, 5rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.loader-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  animation: dotPulse 900ms ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
  animation-delay: 140ms;
}

.loader-dots span:nth-child(3) {
  animation-delay: 280ms;
}

body.home-dark .calculator-shell {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

body.home-dark .calculator-card {
  background: #111827;
  border-color: #2b3547;
}

body.home-dark .display-stack,
body.home-dark .result-box {
  background: linear-gradient(180deg, #030712, #0b1120);
  border-color: #334155;
}

body.home-dark .history,
body.home-dark .result-box span {
  color: #94a3b8;
}

body.home-dark .result-detail {
  color: #cbd5e1;
}

body.home-dark .small-pill,
body.home-dark .reel-btn,
body.home-dark .theme-switch,
body.home-dark .field-grid input,
body.home-dark .field-grid select,
body.home-dark .keypad .num {
  border-color: #334155;
  background: #1f2937;
  color: #f8fafc;
}

body.home-dark .theme-switch:hover,
body.home-dark .theme-switch:focus-visible {
  color: #7dd3fc;
}

body.home-dark .field-grid label {
  color: #cbd5e1;
}

body.home-dark .keypad button,
body.home-dark .primary-action {
  background: #202939;
  color: #f8fafc;
}

body.home-dark .keypad .op {
  background: #173154;
  color: #93c5fd;
}

body.home-dark .keypad .sci {
  background: #33244a;
  color: #d8b4fe;
}

body.home-dark .keypad .memory {
  background: #123733;
  color: #99f6e4;
}

body.home-dark .keypad .danger {
  background: #471c1c;
  color: #fecaca;
}

body.home-dark .keypad .equals,
body.home-dark .primary-action {
  background: #e5edf7;
  color: #101827;
}

body.home-dark .solar-strip {
  background: #050816;
  border: 1px solid #334155;
}

body.home-dark .solar-strip span {
  background: #1e293b;
}

body.home-dark .dot {
  background: #475569;
}

body.home-dark .dot.is-active {
  background: #7dd3fc;
}

body.home-dark .version-note {
  color: #94a3b8;
}

body.home-dark .cookie-banner {
  border-color: #334155;
  background: rgba(23, 29, 41, 0.96);
  color: #f8fafc;
}

body.home-dark .cookie-banner p {
  color: #b4bfce;
}

body.home-dark .cookie-banner button {
  background: #e5edf7;
  color: #101827;
}

.code-page,
.open-page,
.play-page {
  min-height: 100vh;
  display: block;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(244, 246, 249, 0.98)),
    radial-gradient(circle at 50% 0%, #ffffff 0, transparent 42%),
    #f4f6f9;
}

.code-sheet {
  width: min(100%, 520px);
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #dfe5ec;
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.12);
  padding: 24px;
}

.code-header {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5eaf0;
}

.code-header h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  letter-spacing: 0;
}

.code-back {
  width: max-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  color: #374151;
  background: #f8fafc;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.code-list {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
}

.code-list li {
  min-height: 68px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #e5eaf0;
}

.code-list li:last-child {
  border-bottom: 0;
}

.code-number {
  color: #111827;
  font-size: 1.28rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.code-name {
  color: #374151;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 800;
}

a.code-name:hover,
a.code-name:focus-visible,
.code-back:hover,
.code-back:focus-visible {
  color: #1d4ed8;
  outline: none;
}

.open-page {
  place-items: initial;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(244, 246, 249, 0.98)),
    linear-gradient(120deg, rgba(37, 99, 235, 0.09), transparent 34%),
    linear-gradient(240deg, rgba(20, 184, 166, 0.08), transparent 32%),
    #f4f6f9;
}

.open-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.play-shell {
  width: min(100%, 1400px);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr);
  gap: 16px;
}

.open-header,
.play-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.play-bar {
  margin-bottom: 0;
}

.open-header h1,
.play-bar h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(2rem, 7vw, 4rem);
  letter-spacing: 0;
}

.play-bar h1 {
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.open-header p {
  max-width: 620px;
  margin: 8px 0 0;
  color: #6b7280;
  line-height: 1.5;
}

.open-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.open-actions .code-back {
  cursor: pointer;
}

.launcher-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.recent-panel {
  margin: 0 0 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  color: #111827;
  font-size: 1rem;
  letter-spacing: 0;
}

.text-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #374151;
  font-size: 0.74rem;
  font-weight: 850;
}

.text-button:hover,
.text-button:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
  outline: none;
}

.game-search {
  width: 100%;
  min-height: 52px;
  margin-bottom: 0;
  border: 1px solid #cfd8e3;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  padding: 0 16px;
  outline: none;
  box-shadow: 0 14px 32px rgba(17, 24, 39, 0.08);
}

.game-search:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tab {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #374151;
  font-size: 0.78rem;
  font-weight: 850;
}

.category-tab:hover,
.category-tab:focus-visible,
.category-tab.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  grid-auto-rows: 112px;
  gap: 12px;
}

.game-card {
  --accent: #2563eb;
  --accent-soft: #edf4ff;
  min-height: 112px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
  border: 1px solid #dfe5ec;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--accent-soft), #ffffff 38%),
    #ffffff;
  color: #111827;
  padding: 0;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.07);
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.game-card[data-category="Arcade"] {
  --accent: #2563eb;
  --accent-soft: #edf4ff;
}

.game-card[data-category="Action"] {
  --accent: #dc2626;
  --accent-soft: #fff0f0;
}

.game-card[data-category="Classic"] {
  --accent: #7c3aed;
  --accent-soft: #f4efff;
}

.game-card[data-category="Platform"] {
  --accent: #0891b2;
  --accent-soft: #e8f8fc;
}

.game-card[data-category="Puzzle"] {
  --accent: #047857;
  --accent-soft: #ecfdf3;
}

.game-card[data-category="Racing"] {
  --accent: #ea580c;
  --accent-soft: #fff2e9;
}

.game-card[data-category="Sports"] {
  --accent: #ca8a04;
  --accent-soft: #fff9db;
}

.game-card[data-category="Casino"] {
  --accent: #6d5dfc;
  --accent-soft: #f1efff;
}

.game-card:hover,
.game-card:focus-within {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.11);
}

.game-card.is-unavailable {
  opacity: 0.74;
}

.game-card.is-unavailable .game-link {
  cursor: help;
}

.game-card.is-compact {
  min-height: 92px;
}

.game-card.is-compact .game-link {
  min-height: 92px;
}

.game-link {
  min-height: 112px;
  flex: 1;
  display: grid;
  align-content: center;
  gap: 5px;
  color: #111827;
  text-decoration: none;
  padding: 14px 8px 14px 14px;
}

.game-link:hover,
.game-link:focus-visible {
  color: var(--accent);
  outline: none;
}

.game-title {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.game-category {
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 12px;
}

.favorite-button,
.info-button,
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid #dfe5ec;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #9ca3af;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.favorite-button:hover,
.favorite-button:focus-visible,
.favorite-button.is-favorite {
  border-color: #f59e0b;
  color: #b45309;
  background: #fffbeb;
  outline: none;
}

.info-button:hover,
.info-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
  outline: none;
}

.game-empty {
  margin: 18px 0 0;
  color: #6b7280;
  font-weight: 800;
}

.game-missing {
  width: min(100%, 760px);
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  padding: 14px 16px;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
}

.module-frame {
  width: 100%;
  min-height: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.12);
}

.module-missing {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  padding: 24px;
  text-align: center;
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.12);
}

.module-missing[hidden] {
  display: none;
}

.module-missing h2,
.module-missing p {
  margin: 0;
}

.module-missing p {
  max-width: 520px;
  color: #6b7280;
  line-height: 1.45;
}

.game-dialog {
  width: min(92vw, 460px);
  border: 1px solid #dfe5ec;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
}

.game-dialog::backdrop {
  background: rgba(17, 24, 39, 0.35);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid #e5eaf0;
  padding-bottom: 10px;
}

.detail-list dt {
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 850;
}

.detail-list dd {
  margin: 0;
  color: #111827;
  font-weight: 850;
  word-break: break-word;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

:root {
  --games-bg-base: #f4f6f9;
  --games-bg-layer-a: rgba(37, 99, 235, 0.09);
  --games-bg-layer-b: rgba(20, 184, 166, 0.08);
  --games-bg-wash: rgba(255, 255, 255, 0.78);
  --games-panel: rgba(255, 255, 255, 0.94);
  --games-panel-strong: #ffffff;
  --games-border: #dfe5ec;
  --games-border-strong: #cfd8e3;
  --games-text: #111827;
  --games-muted: #6b7280;
  --games-accent: #2563eb;
  --games-accent-strong: #1d4ed8;
  --games-accent-soft: #eff6ff;
  --games-shadow: rgba(17, 24, 39, 0.11);
  --games-frame-shadow: rgba(17, 24, 39, 0.12);
  --games-grid-lines: rgba(37, 99, 235, 0.045);
}

:root[data-game-theme="arcade"] {
  --games-bg-base: #171426;
  --games-bg-layer-a: rgba(236, 72, 153, 0.22);
  --games-bg-layer-b: rgba(34, 211, 238, 0.2);
  --games-bg-wash: rgba(18, 18, 33, 0.76);
  --games-panel: rgba(31, 28, 48, 0.84);
  --games-panel-strong: #211e35;
  --games-border: rgba(164, 177, 255, 0.26);
  --games-border-strong: rgba(125, 211, 252, 0.42);
  --games-text: #f8fafc;
  --games-muted: #cbd5e1;
  --games-accent: #22d3ee;
  --games-accent-strong: #f472b6;
  --games-accent-soft: rgba(34, 211, 238, 0.14);
  --games-shadow: rgba(0, 0, 0, 0.34);
  --games-frame-shadow: rgba(0, 0, 0, 0.42);
  --games-grid-lines: rgba(34, 211, 238, 0.08);
}

:root[data-game-theme="forest"] {
  --games-bg-base: #eef8f0;
  --games-bg-layer-a: rgba(21, 128, 61, 0.14);
  --games-bg-layer-b: rgba(20, 184, 166, 0.13);
  --games-panel: rgba(255, 255, 255, 0.9);
  --games-border: #cfe6d6;
  --games-border-strong: #a9d8b7;
  --games-text: #10251b;
  --games-muted: #52645a;
  --games-accent: #15803d;
  --games-accent-strong: #166534;
  --games-accent-soft: #e9f8ee;
  --games-grid-lines: rgba(21, 128, 61, 0.05);
}

:root[data-game-theme="sunset"] {
  --games-bg-base: #fff3ec;
  --games-bg-layer-a: rgba(244, 114, 182, 0.16);
  --games-bg-layer-b: rgba(251, 146, 60, 0.18);
  --games-panel: rgba(255, 255, 255, 0.91);
  --games-border: #f4d6cb;
  --games-border-strong: #f3b79d;
  --games-text: #2b1511;
  --games-muted: #795b51;
  --games-accent: #c2410c;
  --games-accent-strong: #be185d;
  --games-accent-soft: #fff1eb;
  --games-grid-lines: rgba(194, 65, 12, 0.052);
}

:root[data-game-theme="noir"] {
  --games-bg-base: #111318;
  --games-bg-layer-a: rgba(148, 163, 184, 0.12);
  --games-bg-layer-b: rgba(59, 130, 246, 0.1);
  --games-bg-wash: rgba(14, 16, 21, 0.88);
  --games-panel: rgba(24, 27, 34, 0.9);
  --games-panel-strong: #181b22;
  --games-border: rgba(226, 232, 240, 0.16);
  --games-border-strong: rgba(226, 232, 240, 0.28);
  --games-text: #f8fafc;
  --games-muted: #cbd5e1;
  --games-accent: #94a3b8;
  --games-accent-strong: #e2e8f0;
  --games-accent-soft: rgba(148, 163, 184, 0.14);
  --games-shadow: rgba(0, 0, 0, 0.44);
  --games-frame-shadow: rgba(0, 0, 0, 0.48);
  --games-grid-lines: rgba(226, 232, 240, 0.04);
}

:root[data-game-theme="ocean"] {
  --games-bg-base: #edf8fb;
  --games-bg-layer-a: rgba(14, 116, 144, 0.14);
  --games-bg-layer-b: rgba(59, 130, 246, 0.12);
  --games-panel: rgba(255, 255, 255, 0.9);
  --games-border: #c9e6ee;
  --games-border-strong: #9bd3e3;
  --games-text: #102333;
  --games-muted: #536a78;
  --games-accent: #0e7490;
  --games-accent-strong: #0369a1;
  --games-accent-soft: #e6f7fb;
  --games-grid-lines: rgba(14, 116, 144, 0.052);
}

:root[data-game-theme="paper"] {
  --games-bg-base: #fbfaf7;
  --games-bg-layer-a: rgba(100, 116, 139, 0.07);
  --games-bg-layer-b: rgba(15, 118, 110, 0.06);
  --games-panel: rgba(255, 255, 255, 0.96);
  --games-border: #dedbd2;
  --games-border-strong: #cbc6ba;
  --games-text: #24211d;
  --games-muted: #6c665d;
  --games-accent: #0f766e;
  --games-accent-strong: #334155;
  --games-accent-soft: #eef7f5;
  --games-grid-lines: rgba(51, 65, 85, 0.04);
}

body.open-page,
body.play-page {
  color: var(--games-text);
  background:
    linear-gradient(180deg, var(--games-bg-wash), var(--games-bg-base)),
    radial-gradient(circle at 18% 12%, var(--games-bg-layer-a), transparent 32%),
    radial-gradient(circle at 82% 2%, var(--games-bg-layer-b), transparent 34%),
    linear-gradient(90deg, var(--games-grid-lines) 1px, transparent 1px),
    linear-gradient(0deg, var(--games-grid-lines) 1px, transparent 1px),
    var(--games-bg-base);
  background-size: auto, auto, auto, 34px 34px, 34px 34px, auto;
}

:root[data-game-scenery="minimal"] body.open-page,
:root[data-game-scenery="minimal"] body.play-page {
  background:
    linear-gradient(180deg, var(--games-bg-wash), var(--games-bg-base)),
    var(--games-bg-base);
}

.open-header h1,
.play-bar h1,
.section-heading h2,
.dialog-header h2,
.games-theme-panel h2,
.games-theme-panel h3,
.games-theme-storage h3,
.game-link,
.detail-list dd {
  color: var(--games-text);
}

.open-header p,
.game-empty,
.game-category,
.detail-list dt,
.games-theme-option small,
.games-theme-storage p,
.games-storage-banner span {
  color: var(--games-muted);
}

.game-search,
.category-tab,
.text-button,
.code-back,
.favorite-button,
.info-button,
.icon-button,
.game-dialog {
  border-color: var(--games-border-strong);
  background: var(--games-panel);
  color: var(--games-text);
}

.game-card {
  border-color: var(--games-border);
  background:
    linear-gradient(90deg, var(--accent-soft), var(--games-panel-strong) 38%),
    var(--games-panel-strong);
  color: var(--games-text);
  box-shadow: 0 10px 24px var(--games-shadow);
}

.game-card:hover,
.game-card:focus-within {
  box-shadow: 0 14px 30px var(--games-shadow);
}

.category-tab:hover,
.category-tab:focus-visible,
.category-tab.is-active,
.info-button:hover,
.info-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.game-search:focus,
.code-back:hover,
.code-back:focus-visible,
.text-button:hover,
.text-button:focus-visible {
  border-color: var(--games-accent);
  background: var(--games-accent-soft);
  color: var(--games-accent-strong);
}

.module-frame {
  border-color: var(--games-border-strong);
  box-shadow: 0 18px 44px var(--games-frame-shadow);
}

.detail-list div {
  border-bottom-color: var(--games-border);
}

:root[data-game-theme="arcade"] .game-card[data-category="Classic"],
:root[data-game-theme="noir"] .game-card[data-category="Classic"] {
  --accent: #a78bfa;
  --accent-soft: rgba(167, 139, 250, 0.16);
}

:root[data-game-theme="arcade"] .game-card[data-category="Action"] {
  --accent: #f472b6;
  --accent-soft: rgba(244, 114, 182, 0.15);
}

:root[data-game-theme="noir"] .game-card {
  --accent-soft: rgba(148, 163, 184, 0.11);
}

:root[data-game-density="compact"] .game-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 92px;
  gap: 8px;
}

:root[data-game-density="compact"] .game-card,
:root[data-game-density="compact"] .game-link {
  min-height: 92px;
}

:root[data-game-density="compact"] .game-link {
  padding: 10px 6px 10px 12px;
}

:root[data-game-density="compact"] .game-controls {
  gap: 4px;
  padding-right: 7px;
}

:root[data-game-density="compact"] .favorite-button,
:root[data-game-density="compact"] .info-button,
:root[data-game-density="compact"] .icon-button {
  width: 32px;
  height: 32px;
}

:root[data-game-density="relaxed"] .open-shell {
  width: min(100%, 1260px);
}

:root[data-game-density="relaxed"] .game-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 132px;
  gap: 14px;
}

:root[data-game-density="relaxed"] .game-card,
:root[data-game-density="relaxed"] .game-link {
  min-height: 132px;
}

:root[data-game-density="relaxed"] .game-link {
  padding: 18px 10px 18px 18px;
}

:root[data-game-contrast="boosted"] body.open-page,
:root[data-game-contrast="boosted"] body.play-page {
  --games-border: color-mix(in srgb, var(--games-border-strong), var(--games-text) 18%);
  --games-muted: color-mix(in srgb, var(--games-text), var(--games-bg-base) 34%);
}

:root[data-game-contrast="boosted"] .game-card,
:root[data-game-contrast="boosted"] .game-dialog,
:root[data-game-contrast="boosted"] .games-theme-panel {
  border-width: 2px;
}

:root[data-game-glass="clear"] body.open-page,
:root[data-game-glass="clear"] body.play-page {
  --games-panel: rgba(255, 255, 255, 0.72);
}

:root[data-game-glass="solid"] body.open-page,
:root[data-game-glass="solid"] body.play-page {
  --games-panel: var(--games-panel-strong);
  --games-bg-wash: var(--games-bg-base);
}

.games-theme-launcher {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 40;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--games-border-strong);
  border-radius: 999px;
  background: var(--games-panel);
  color: var(--games-text);
  font-weight: 900;
  box-shadow: 0 16px 34px var(--games-shadow);
  backdrop-filter: blur(18px);
}

.games-theme-launcher:hover,
.games-theme-launcher:focus-visible {
  border-color: var(--games-accent);
  color: var(--games-accent-strong);
  outline: none;
}

.games-theme-panel {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 45;
  width: min(92vw, 390px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--games-border-strong);
  border-radius: 12px;
  background: var(--games-panel);
  color: var(--games-text);
  box-shadow: 0 24px 70px var(--games-frame-shadow);
  backdrop-filter: blur(22px);
}

.games-theme-panel[hidden] {
  display: none;
}

.games-theme-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.games-theme-head h2,
.games-theme-group h3,
.games-theme-storage h3 {
  margin: 0;
  letter-spacing: 0;
}

.games-theme-head h2 {
  font-size: 1.3rem;
}

.games-theme-group,
.games-theme-storage {
  display: grid;
  gap: 9px;
}

.games-theme-group h3,
.games-theme-storage h3 {
  font-size: 0.86rem;
}

.games-theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.games-theme-option,
.games-theme-tool,
.games-theme-reset {
  border: 1px solid var(--games-border-strong);
  background: var(--games-panel);
  color: var(--games-text);
}

.games-theme-option {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
}

.games-theme-option span {
  font-weight: 900;
}

.games-theme-option small {
  line-height: 1.25;
  font-size: 0.72rem;
  font-weight: 750;
}

.games-theme-option:hover,
.games-theme-option:focus-visible,
.games-theme-option.is-active,
.games-theme-tool:hover,
.games-theme-tool:focus-visible,
.games-theme-tool.is-active,
.games-theme-reset:hover,
.games-theme-reset:focus-visible {
  border-color: var(--games-accent);
  background: var(--games-accent-soft);
  color: var(--games-accent-strong);
  outline: none;
}

.games-theme-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.games-theme-tool,
.games-theme-reset {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 900;
}

.games-theme-storage {
  border-top: 1px solid var(--games-border);
  padding-top: 14px;
}

.games-theme-storage p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.games-theme-reset {
  width: max-content;
}

.games-storage-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 39;
  width: min(760px, calc(100vw - 36px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--games-border-strong);
  border-radius: 12px;
  background: var(--games-panel);
  color: var(--games-text);
  box-shadow: 0 18px 48px var(--games-frame-shadow);
  backdrop-filter: blur(18px);
}

.games-storage-banner strong,
.games-storage-banner span {
  display: block;
}

.games-storage-banner strong {
  margin-bottom: 3px;
}

:root[data-game-consent="accepted"] .games-storage-banner,
:root[data-game-consent="declined"] .games-storage-banner {
  display: none;
}

:root[data-game-motion="full"] .games-theme-launcher,
:root[data-game-motion="full"] .games-theme-panel,
:root[data-game-motion="full"] .games-storage-banner {
  animation: gamesPanelIn 220ms ease both;
}

:root[data-game-motion="full"] body.open-page,
:root[data-game-motion="full"] body.play-page {
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  animation: gamesBackdropDrift 18s ease-in-out infinite alternate;
}

:root[data-game-motion="reduced"] body.open-page,
:root[data-game-motion="reduced"] body.play-page,
:root[data-game-motion="reduced"] .game-card,
:root[data-game-motion="reduced"] .games-theme-launcher,
:root[data-game-motion="reduced"] .games-theme-panel,
:root[data-game-motion="reduced"] .games-storage-banner {
  animation: none;
  transition: none;
}

body.open-page {
  --games-bg-base: #ffffff;
  --games-bg-layer-a: rgba(8, 145, 178, 0.08);
  --games-bg-layer-b: rgba(124, 58, 237, 0.07);
  --games-bg-wash: rgba(255, 255, 255, 0.9);
  --games-panel: rgba(255, 255, 255, 0.86);
  --games-panel-strong: #ffffff;
  --games-border: #e4e7ec;
  --games-border-strong: #111111;
  --games-text: #09090b;
  --games-muted: #626a73;
  --games-accent: #111111;
  --games-accent-strong: #000000;
  --games-accent-soft: #f5f7fa;
  --games-shadow: rgba(17, 24, 39, 0.08);
  --games-frame-shadow: rgba(17, 24, 39, 0.14);
  --games-grid-lines: rgba(17, 24, 39, 0.045);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.98)),
    linear-gradient(90deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 24px 24px, rgba(17, 24, 39, 0.08) 0 1px, transparent 1.5px),
    #ffffff;
  background-size: auto, 34px 34px, 34px 34px, 68px 68px, auto;
}

body.open-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(135deg, transparent 0 47%, rgba(17, 24, 39, 0.08) 47% 53%, transparent 53% 100%),
    linear-gradient(45deg, transparent 0 47%, rgba(125, 211, 252, 0.14) 47% 53%, transparent 53% 100%);
  background-position: right 8vw top 8vh, left 4vw bottom 12vh;
  background-repeat: no-repeat;
  background-size: 170px 170px, 120px 120px;
}

body.open-page .open-shell {
  position: relative;
  z-index: 1;
}

.open-hero {
  min-height: 188px;
  align-items: center;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.88) 54%, rgba(255, 255, 255, 0.98)),
    #ffffff;
  box-shadow: 0 22px 54px rgba(17, 24, 39, 0.09);
  padding: 22px;
}

.open-brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.open-logo-mark {
  width: clamp(84px, 13vw, 132px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #111111;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.85)),
    #ffffff;
  box-shadow:
    inset 0 0 0 8px rgba(17, 24, 39, 0.035),
    0 20px 36px rgba(17, 24, 39, 0.13);
}

.open-logo-mark img {
  width: 72%;
  height: 72%;
  display: block;
  filter: drop-shadow(0 8px 12px rgba(17, 24, 39, 0.16));
}

body.open-page .eyebrow {
  color: #111111;
}

body.open-page .open-header h1 {
  color: #050505;
  font-size: clamp(2.25rem, 7vw, 5.25rem);
}

body.open-page .open-header p {
  color: #525b66;
}

.open-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.open-stat-row span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 999px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.92), rgba(125, 211, 252, 0.14), rgba(196, 181, 253, 0.16), rgba(255, 255, 255, 0.94));
  color: #111111;
  padding: 0 11px;
  font-size: 0.72rem;
  font-weight: 900;
}

body.open-page .open-actions .code-back,
body.open-page .text-button,
body.open-page .category-tab,
body.open-page .favorite-button,
body.open-page .icon-button,
body.open-page .game-dialog {
  border-color: rgba(17, 24, 39, 0.2);
  background: rgba(255, 255, 255, 0.94);
  color: #111111;
}

body.open-page .open-actions .code-back:hover,
body.open-page .open-actions .code-back:focus-visible,
body.open-page .text-button:hover,
body.open-page .text-button:focus-visible,
body.open-page .category-tab:hover,
body.open-page .category-tab:focus-visible,
body.open-page .category-tab.is-active,
body.open-page .favorite-button:hover,
body.open-page .favorite-button:focus-visible,
body.open-page .favorite-button.is-favorite,
body.open-page .icon-button:hover,
body.open-page .icon-button:focus-visible {
  border-color: #111111;
  background:
    linear-gradient(110deg, #ffffff, rgba(125, 211, 252, 0.16), rgba(196, 181, 253, 0.16), #ffffff);
  color: #000000;
  outline: none;
}

body.open-page .launcher-tools {
  margin-top: 16px;
}

.search-shell {
  position: relative;
}

.search-star {
  position: absolute;
  left: 17px;
  top: 50%;
  z-index: 1;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background: #111111;
  clip-path: polygon(50% 0, 61% 36%, 99% 36%, 68% 58%, 80% 96%, 50% 73%, 20% 96%, 32% 58%, 1% 36%, 39% 36%);
}

body.open-page .game-search {
  min-height: 58px;
  border-color: rgba(17, 24, 39, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94)),
    #ffffff;
  color: #09090b;
  padding-left: 48px;
  box-shadow: 0 18px 36px rgba(17, 24, 39, 0.08);
}

body.open-page .game-search:focus {
  border-color: #111111;
  box-shadow:
    0 0 0 3px rgba(17, 24, 39, 0.08),
    0 18px 36px rgba(17, 24, 39, 0.1);
}

body.open-page .game-grid {
  gap: 10px;
}

body.open-page .game-card {
  --accent: #111111;
  --accent-soft: rgba(17, 24, 39, 0.035);
  border-color: rgba(17, 24, 39, 0.14);
  border-left-color: #111111;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.045), rgba(255, 255, 255, 0.98) 40%),
    linear-gradient(135deg, rgba(125, 211, 252, 0.08), rgba(196, 181, 253, 0.07)),
    #ffffff;
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.07);
}

body.open-page .game-card:hover,
body.open-page .game-card:focus-within {
  border-color: #111111;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(17, 24, 39, 0.12);
}

body.open-page .game-link,
body.open-page .dialog-header h2,
body.open-page .detail-list dd {
  color: #09090b;
}

body.open-page .game-category,
body.open-page .detail-list dt,
body.open-page .game-empty {
  color: #626a73;
}

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

@keyframes gamesBackdropDrift {
  to {
    background-position: 0 0, 4% 3%, -4% 2%, 12px 16px, 12px 16px, 0 0;
  }
}

@keyframes pullAway {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  34% {
    transform: translateY(-9vh) scale(0.99);
    opacity: 1;
  }
  100% {
    transform: translateY(-125vh) scale(0.96);
    opacity: 0.96;
  }
}

@keyframes revealCopy {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes starDrift {
  to {
    transform: translateY(-78px);
  }
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-7px);
  }
}

@keyframes homeDarkWaves {
  0% {
    background-position: 0% 6%, 100% 34%, 10% 92%, 0 0, 0 0;
  }
  50% {
    background-position: 42% 14%, 58% 48%, 38% 82%, 0 0, 0 0;
  }
  100% {
    background-position: 82% 10%, 14% 38%, 92% 88%, 0 0, 0 0;
  }
}

@media (max-width: 700px) {
  body {
    padding: 12px;
    place-items: start center;
  }

  .site-header {
    margin-top: 8px;
  }

  .calculator-shell {
    padding: 12px;
    border-radius: 24px;
  }

  .calc-topbar {
    align-items: flex-start;
  }

  .open-hero {
    min-height: 0;
    padding: 16px;
  }

  .open-brand-lockup {
    align-items: flex-start;
  }

  .open-logo-mark {
    width: 74px;
  }

  .open-stat-row {
    gap: 6px;
  }

  .open-stat-row span {
    min-height: 28px;
    font-size: 0.68rem;
    padding: 0 9px;
  }

  .solar-strip {
    width: 82px;
  }

  .wheel-wrap {
    padding: 0 9%;
  }

  .calculator-card {
    min-height: 0;
    padding: 12px;
  }

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

  .scientific-card {
    min-height: 0;
  }

  .display-stack {
    min-height: 94px;
    padding: 12px;
  }

  .utility-row {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 7px;
  }

  .calc-message {
    align-self: center;
    min-width: 0;
    font-size: 0.75rem;
  }

  .expand-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .keypad {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .scientific-card:not(.is-expanded) .advanced-key {
    display: none;
  }

  .scientific-card:not(.is-expanded) [data-action="clear"] {
    order: 1;
  }

  .scientific-card:not(.is-expanded) [data-action="backspace"] {
    order: 2;
  }

  .scientific-card:not(.is-expanded) [data-token="/"] {
    order: 3;
  }

  .scientific-card:not(.is-expanded) [data-token="*"] {
    order: 4;
  }

  .scientific-card:not(.is-expanded) [data-token="7"] {
    order: 5;
  }

  .scientific-card:not(.is-expanded) [data-token="8"] {
    order: 6;
  }

  .scientific-card:not(.is-expanded) [data-token="9"] {
    order: 7;
  }

  .scientific-card:not(.is-expanded) [data-token="-"] {
    order: 8;
  }

  .scientific-card:not(.is-expanded) [data-token="4"] {
    order: 9;
  }

  .scientific-card:not(.is-expanded) [data-token="5"] {
    order: 10;
  }

  .scientific-card:not(.is-expanded) [data-token="6"] {
    order: 11;
  }

  .scientific-card:not(.is-expanded) [data-token="+"] {
    order: 12;
  }

  .scientific-card:not(.is-expanded) [data-token="1"] {
    order: 13;
  }

  .scientific-card:not(.is-expanded) [data-token="2"] {
    order: 14;
  }

  .scientific-card:not(.is-expanded) [data-token="3"] {
    order: 15;
  }

  .scientific-card:not(.is-expanded) [data-action="equals"] {
    order: 16;
  }

  .scientific-card:not(.is-expanded) [data-token="0"] {
    order: 17;
  }

  .scientific-card:not(.is-expanded) [data-token="."] {
    order: 18;
  }

  .scientific-card.is-expanded .keypad {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .keypad button {
    min-height: 38px;
    border-radius: 10px;
    font-size: 0.74rem;
  }

  .keypad .sci,
  .keypad .memory {
    font-size: 0.64rem;
  }

  .keypad .equals {
    grid-row: span 2;
  }
}

@media (max-width: 430px) {
  .wheel-wrap {
    padding: 0 5%;
  }

  .carousel-controls {
    gap: 8px;
  }

  .reel-btn {
    padding: 0 10px;
  }

  .cookie-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .cookie-banner button {
    width: 100%;
  }

  .calc-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-tools {
    justify-content: space-between;
    width: 100%;
  }

  .open-brand-lockup {
    flex-direction: column;
  }

  .open-logo-mark {
    width: 88px;
  }

  .open-header,
  .play-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .open-actions {
    justify-content: flex-start;
  }

  .play-shell {
    min-height: calc(100vh - 24px);
    grid-template-rows: auto minmax(360px, 1fr);
  }

  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.home-dark {
    animation: none;
  }
}
