:root {
  --page-bg: #ffffff;
  --surface: #f7f7f8;
  --surface-2: #efefef;

  --primary: #d4550a;
  --primary-deep: #992f05;
  --primary-shadow: rgba(212,85,10,0.5);

  --primary-accent: var(--primary);
  --on-primary: #fff0e8;

  --text: #111111;
  --muted: #666666;

  --radius: 10px;
  --control-gap: 12px;
  --focus-ring: 3px;
  --focus-color: rgba(212,85,10,0.18);

  --contrast-high: rgba(0,0,0,0.85);
  --contrast-low: rgba(0,0,0,0.5);

  --accent-gradient: linear-gradient(90deg, var(--primary-deep), var(--primary));
}


html {
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background: var(--page-bg);
  color: var(--text);
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

html.app-shell,
html.app-shell body {
  height: 100% !important;
}

html.app-shell body {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  position: relative !important;
}

.theme-midnight-amber {
  --page-bg: #0a0605;
  --surface: #1a100d;
  --surface-2: #1f1410;

  --primary: #d4550a;
  --primary-deep: #992f05;
  --primary-shadow: rgba(212,85,10,0.5);

  --primary-accent: var(--primary);
  --on-primary: #fff0e8;

  --text: #f8e7e0;
  --muted: #c9a08a;

  --contrast-high: rgba(255,255,255,0.94);
  --contrast-low: rgba(255,255,255,0.66);

  --focus-color: rgba(212,85,10,0.18);
  --accent-gradient: linear-gradient(90deg, rgba(255,77,0,1), rgba(255,106,0,1));
}

.theme-midnight-blueberry {
  --page-bg: #071026;
  --surface: #0d1b2a;
  --surface-2: #112534;

  --primary: #6ea8fe;
  --primary-deep: #3f78d1;
  --primary-shadow: rgba(110,168,254,0.35);

  --primary-accent: var(--primary);
  --on-primary: #dbe9ff;

  --text: #dbe9ff;
  --muted: #9fb7d6;

  --contrast-high: rgba(255,255,255,0.95);
  --contrast-low: rgba(255,255,255,0.7);

  --focus-color: rgba(110,168,254,0.16);
  --accent-gradient: linear-gradient(90deg, #3f78d1, #6ea8fe);
}

.theme-midnight-grape {
  --page-bg: #0a0812;
  --surface: #171024;
  --surface-2: #211428;

  --primary: #b388ff;
  --primary-deep: #7a4ed1;
  --primary-shadow: rgba(179,136,255,0.35);

  --primary-accent: var(--primary);
  --on-primary: #efe7ff;

  --text: #efe7ff;
  --muted: #cdb9e8;

  --contrast-high: rgba(255,255,255,0.95);
  --contrast-low: rgba(255,255,255,0.72);

  --focus-color: rgba(179,136,255,0.16);
  --accent-gradient: linear-gradient(90deg, #7a4ed1, #b388ff);
}

.light-scheme {
  --page-bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;

  --primary: #d4550a;
  --primary-deep: #a03e07;
  --primary-shadow: rgba(212,85,10,0.18);

  --primary-accent: var(--primary);
  --on-primary: #ffffff;

  --text: #1a1a1a;
  --muted: #5a5a5a;

  --contrast-high: rgba(0,0,0,0.92);
  --contrast-low: rgba(0,0,0,0.65);

  --focus-color: rgba(212,85,10,0.15);
  --accent-gradient: linear-gradient(135deg, #ff6b35, #ff9d6f);
}


.light-scheme.theme-midnight-blueberry {
  --primary: #2f6bd4;
  --primary-deep: #1f4a9a;
  --primary-shadow: rgba(47,107,212,0.18);
  --primary-accent: var(--primary);
  --focus-color: rgba(47,107,212,0.15);
  --accent-gradient: linear-gradient(135deg, #4a7fd9, #6ea8fe);
}


.light-scheme.theme-midnight-grape {
  --primary: #8f3fb1;
  --primary-deep: #6b2d85;
  --primary-shadow: rgba(143,63,177,0.18);
  --primary-accent: var(--primary);
  --focus-color: rgba(143,63,177,0.15);
  --accent-gradient: linear-gradient(135deg, #a855d9, #c084fc);
}


.light-scheme.theme-midnight-amber {
  --primary: #d4550a;
  --primary-deep: #a03e07;
  --primary-shadow: rgba(212,85,10,0.18);
  --primary-accent: var(--primary);
  --focus-color: rgba(212,85,10,0.15);
  --accent-gradient: linear-gradient(135deg, #ff6b35, #ff9d6f);
}

.bg-page { background: var(--page-bg); color: var(--text); }
.surface { background: var(--surface); color: var(--text); }
.surface-2 { background: var(--surface-2); color: var(--text); }

.btn-primary {
  background: var(--primary-accent);
  color: var(--on-primary);
  border: none;
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.06);
}

.text-muted { color: var(--muted); }
.text-primary { color: var(--primary-accent); }

.sep { border-color: rgba(0,0,0,0.04); }

:focus {
  outline: none;
  box-shadow: 0 0 0 var(--focus-ring) var(--focus-color);
  border-radius: calc(var(--radius) - 2px);
}

.hi-contrast { color: var(--contrast-high); }
.lo-contrast { color: var(--contrast-low); }

.u-gap { gap: var(--control-gap); }
.round { border-radius: var(--radius); }


button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:not([tabindex="-1"]):focus,
[role="button"]:focus,
[role="tab"]:focus {
  outline: none;
  box-shadow: 0 0 0 var(--focus-ring) var(--focus-color);
  border-radius: calc(var(--radius) - 2px);
}


.main-content:focus {
  box-shadow: none;
  outline: none;
}


/* Global performance modifiers */
html.performance-no-animations *,
html.performance-no-animations *::before,
html.performance-no-animations *::after,
html.performance-fast *,
html.performance-fast *::before,
html.performance-fast *::after {
  animation: none !important;
  transition-property: none !important;
  transition-duration: 0s !important;
}

html.performance-no-glow *,
html.performance-no-glow *::before,
html.performance-no-glow *::after {
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

html.performance-no-blur * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.performance-no-transforms *:hover,
html.performance-no-transforms *:focus,
html.performance-no-transforms *:active {
  transform: none !important;
}

html.performance-no-mouse-tracking * {
  --x: 50% !important;
  --y: 50% !important;
}

html.performance-fast {
  scroll-behavior: auto;
}


#preserved-game-loader {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

