/* --- 1. CORE VARIABLES --- */
:root {
  --bg: #050505;
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.2);
  --accent-glow: rgba(255, 255, 255, 0.6);
  --scanline-opacity: 0.5;
  --common: #b0b0b0;
  --rare: #00ccff;
  --epic: #d000ff;
  --leg: #ffd700;
  --font-main: "Press Start 2P", monospace;
  --font-type: "Roboto Mono", monospace;
  --topbar-clearance: 50px;
}

/* RAINBOW MODE */
@keyframes rgbLoop {
  0% {
    --accent: #ff0000;
  }
  20% {
    --accent: #ffff00;
  }
  40% {
    --accent: #00ff00;
  }
  60% {
    --accent: #00ffff;
  }
  80% {
    --accent: #0000ff;
  }
  100% {
    --accent: #ff00ff;
  }
}
body.rainbow-mode {
  animation: rgbLoop 5s linear infinite;
  --accent-dim: rgba(255, 255, 255, 0.2);
  --accent-glow: rgba(255, 255, 255, 0.5);
  will-change: color, text-shadow;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
  user-select: none;
}
button,
input,
.bj-card,
.ttt-cell,
.chat-input {
  cursor: pointer;
}

html,
body {
  height: 100%;
  margin: 0;
  background-color: var(--bg);
  font-family: var(--font-main);
  overflow-x: hidden;
  color: var(--accent);
  touch-action: auto;
  text-shadow: 0 0 10px var(--accent-glow);
  transition:
    color 0.5s,
    text-shadow 0.5s;
}

body.overlay-open {
  overflow: hidden;
}

/* --- 2. VISUAL EFFECTS --- */
/* Matrix rain canvas sits beneath the UI and toggles via .active. */
#matrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0.8;
  pointer-events: none;
  display: none;
  border: none;
  box-shadow: none;
  margin: 0;
  max-width: none;
  max-height: none;
}
#matrixCanvas.active {
  display: block;
}

/* Boot/hack overlay used during "root access" animation. */
#hackOverlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  font-family: var(--font-type);
  color: #0f0;
  font-size: 12px;
  pointer-events: none;
}
#hackOverlay.active {
  display: flex;
}

/* CRT scanline overlay (global). */
body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    );
  z-index: 99999;
  background-size:
    100% 2px,
    3px 100%;
  pointer-events: none;
  opacity: var(--scanline-opacity);
  will-change: opacity, transform;
  transform: translateZ(0);
}
/* Subtle flicker vignette when flicker mode is enabled. */
.flicker-on::after {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: radial-gradient(
    circle,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  z-index: 99999;
  pointer-events: none;
  animation: flicker 0.15s infinite;
}
@keyframes flicker {
  0% {
    opacity: 0.95;
  }
  50% {
    opacity: 0.85;
  }
  100% {
    opacity: 0.98;
  }
}

/* --- 3. LAYOUT & UI --- */
/* Central landing layout. */
.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 10;
  padding: 90px 20px 260px;
  width: 100%;
  gap: 12px;
}

/* Sticky top navigation bar with system status. */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid var(--accent);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.menu-btn {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 10px;
  border: 1px solid var(--accent);
  text-transform: uppercase;
  transition: 0.2s;
}
.menu-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.menu-btn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 10px var(--accent);
}

.menu-btn[data-exit-mode="1"] {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 10px var(--accent);
}
.sys-info {
  display: flex;
  gap: 15px;
  font-size: 8px;
  color: var(--accent);
  opacity: 0.8;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.top-bar-actions::-webkit-scrollbar {
  display: none;
}

.april-fools-active .top-bar {
  animation: aprilGlow 1.4s ease-in-out infinite;
}

.april-fools-banner {
  position: fixed;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  z-index: 3000;
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.88);
  color: var(--accent);
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.april-fools-banner strong {
  color: #ffd700;
}

.april-fools-speech {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3000;
  max-width: min(360px, 90vw);
  border: 1px solid #ffd700;
  background: rgba(0, 0, 0, 0.92);
  color: #ffd700;
  padding: 10px 12px;
  font-size: 10px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.april-fools-speech.show {
  opacity: 1;
  transform: translateY(0);
}

.menu-btn.april-fools-pulse {
  animation: aprilBtnPulse 0.7s ease-out;
}

.april-fools-home-card {
  margin: 14px auto 8px;
  max-width: min(540px, 94vw);
  border: 1px dashed #ffd700;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.08), rgba(0, 0, 0, 0.5));
  padding: 10px 12px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.april-fools-home-title {
  color: #ffd700;
  font-size: 10px;
  margin-bottom: 6px;
}

.april-fools-home-card p {
  margin: 0 0 8px;
  line-height: 1.35;
}

.april-fools-home-card .april-fools-trigger {
  margin-bottom: 8px;
}

.april-fools-loading {
  border: 1px solid rgba(255, 215, 0, 0.45);
  height: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.april-fools-loading span {
  display: block;
  width: 35%;
  height: 100%;
  background: #ffd700;
  animation: aprilLoad 1.8s linear infinite;
}

.april-fools-shake .wrap {
  animation: aprilShake 0.32s linear 2;
}

.april-fools-overlay {
  position: fixed;
  inset: 0;
  z-index: 3600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
}

.april-fools-overlay.show {
  display: flex;
}

.april-fools-overlay-card {
  width: min(560px, 92vw);
  border: 1px solid #ffd700;
  background: radial-gradient(circle at top, rgba(255, 215, 0, 0.22), rgba(0, 0, 0, 0.95) 55%);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.35);
  padding: 16px 14px 14px;
  position: relative;
  color: #ffe58f;
  text-align: center;
  animation: aprilOverlayPop 0.3s ease-out;
}

.april-fools-overlay-head {
  font-size: 13px;
  letter-spacing: 1px;
  color: #ffd700;
  margin-bottom: 10px;
}

.april-fools-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 229, 143, 0.75);
  background: rgba(0, 0, 0, 0.6);
  color: #ffe58f;
  cursor: pointer;
}

.april-fools-slot {
  margin: 10px 0;
  border: 1px solid rgba(255, 215, 0, 0.45);
  padding: 10px 6px;
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: clamp(24px, 5vw, 34px);
  background: rgba(0, 0, 0, 0.58);
}

.april-fools-slot span {
  display: inline-block;
  animation: aprilSlotBounce 0.9s ease-in-out infinite alternate;
}

.april-fools-slot span:nth-child(2) {
  animation-delay: 0.16s;
}

.april-fools-slot span:nth-child(3) {
  animation-delay: 0.32s;
}

.april-fools-overlay-result {
  margin: 8px 0 12px;
  line-height: 1.4;
}

@keyframes aprilGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 215, 0, 0);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
  }
}

@keyframes aprilBtnPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.08) rotate(-1.5deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes aprilLoad {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(340%);
  }
}

@keyframes aprilShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes aprilOverlayPop {
  from {
    transform: scale(0.93);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes aprilSlotBounce {
  from {
    transform: translateY(0) rotate(-6deg);
    filter: saturate(0.9);
  }
  to {
    transform: translateY(-6px) rotate(5deg);
    filter: saturate(1.4);
  }
}

.top-overlay-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* Games dropdown menu anchored to the top bar. */
.dropdown-content {
  display: none !important;
  position: absolute;
  right: 20px;
  top: 50px;
  background-color: #000;
  min-width: 200px;
  border: 1px solid var(--accent);
  border-top: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.8);
  z-index: 2001;
}
.dropdown-content.show {
  display: block;
}
.dropdown-content button {
  background: transparent;
  color: var(--accent);
  padding: 15px;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--accent-dim);
  font-family: inherit;
  font-size: 10px;
  transition: 0.2s;
}
.dropdown-content button:hover {
  background-color: var(--accent-dim);
  padding-left: 20px;
}

/* --- 4. CHAT --- */
/* Global chat dock + Voice Lounge. Now a primary overlay. */
#globalChat {
  z-index: 1500 !important;
}

.chat-box {
  width: min(560px, 92vw);
  display: flex;
  flex-direction: column;
  padding: 14px;
  max-height: calc(100vh - var(--topbar-clearance) - 40px);
}

.chat-header {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--accent-dim);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-minimize-btn {
  border: 1px solid var(--accent-dim);
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 10px;
  width: 18px;
  height: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.chat-minimize-btn:hover {
  border-color: var(--accent);
  color: #fff;
}
.chat-moderation-btn {
  font-size: 11px;
}
.chat-moderation-btn.off {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.chat-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--accent-dim);
  margin-bottom: 10px;
}
.chat-tab {
  background: transparent;
  border: none;
  border-right: 1px solid var(--accent-dim);
  color: #9ee;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0.8px;
  padding: 10px 4px;
  cursor: pointer;
}
.chat-tab:last-child {
  border-right: none;
}
.chat-tab.active {
  color: #000;
  background: var(--accent);
  text-shadow: none;
}
.chat-meta {
  padding: 6px 8px;
  border-bottom: 1px solid var(--accent-dim);
  color: #9aa;
  font-size: 8px;
  letter-spacing: 0.6px;
}
#chatHistory {
  height: 320px;
  overflow-y: auto;
  padding: 8px;
  color: var(--accent);
  text-shadow: none;
  user-select: text;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
  margin-bottom: 10px;
}
.chat-msg {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  word-wrap: break-word;
}
.chat-msg-replyable {
  cursor: pointer;
}
.chat-msg-replyable:hover .chat-msg-text {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.chat-msg-text {
  flex: 1;
  min-width: 0;
}
.chat-msg.chat-msg-continuation {
  margin-top: -2px;
}
.chat-msg.chat-msg-continuation .chat-msg-text {
  padding-left: 18px;
}
.chat-crew-tag {
  color: #8fb6ff;
  font-size: 9px;
  margin-right: 4px;
  opacity: 0.9;
}
.chat-muted-placeholder {
  color: #7f8c9a;
  font-style: italic;
}
.chat-mute-btn {
  border: none;
  background: transparent;
  color: #7ec8ff;
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.chat-mute-btn:hover {
  color: #fff;
}
.chat-global-mute-btn {
  color: #ffd36a;
}
.chat-remove-btn {
  border: none;
  background: transparent;
  color: #ff7e7e;
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.chat-remove-btn:hover {
  color: #fff;
}
.chat-user {
  color: var(--accent);
  font-weight: bold;
}
#chatInput {
  background: #000;
  border: none;
  border-top: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px;
  font-family: inherit;
  outline: none;
  cursor: text;
  user-select: text;
  touch-action: auto;
}
.chat-box {
  max-width: 760px;
  width: min(90vw, 760px);
}

/* --- 5. MAIN LOGO --- */
.gooner-btn {
  font-size: clamp(30px, 10vw, 80px);
  color: var(--accent);
  cursor: pointer;
  padding: 40px 60px;
  border: 4px solid var(--accent);
  background: rgba(0, 0, 0, 0.8);
  box-shadow:
    0 0 20px var(--accent-dim),
    inset 0 0 30px var(--accent-dim);
  text-shadow: 0 0 15px var(--accent);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
  text-transform: uppercase;
  z-index: 20;
  letter-spacing: 5px;
}
.gooner-btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 50px var(--accent-glow),
    inset 0 0 50px var(--accent-glow);
  background: var(--accent);
  color: #000;
  text-shadow: none;
}

.site-search {
  width: min(92vw, 680px);
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 0;
}

.site-search #siteSearchInput {
  flex: 1;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
  caret-color: var(--accent);
  background: rgba(0, 0, 0, 0.72);
  text-align: left;
  font-size: 14px;
  margin-bottom: 0;
}

.site-search #siteSearchBtn {
  width: auto;
  flex: 0 0 auto;
  padding: 15px 18px;
}

.site-search #siteSearchInput::placeholder {
  color: #9fd8be;
  opacity: 0.85;
}


.site-search-dropdown {
  display: none;
  width: min(92vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.93);
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.16);
  overflow: hidden;
}

.site-search-dropdown.active {
  display: block;
}

.site-search-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(0, 255, 136, 0.2);
  background: transparent;
  color: #d8ffe9;
  font: inherit;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.site-search-option:last-child {
  border-bottom: 0;
}

.site-search-option small {
  color: #88c9aa;
  font-size: 8px;
  letter-spacing: 0.8px;
}

.site-search-option:hover,
.site-search-option.active {
  background: rgba(0, 255, 136, 0.16);
}

.site-search-meta {
  width: min(92vw, 680px);
  margin: -2px 0 4px;
  color: #9fd8be;
  font-size: 9px;
  letter-spacing: 1.2px;
  text-align: left;
  opacity: 0.85;
}

.subtitle {
  color: var(--accent);
  font-size: 10px;
  opacity: 0.7;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
}


.random-game-cta {
  margin-top: 24px;
  width: min(90vw, 680px);
}

.random-game-btn {
  text-align: left;
}

.random-game-cta h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
}

.random-game-cta h2 .panel-title-btn {
  text-align: center;
}

.trending-games {
  margin-top: 24px;
  width: min(90vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.75);
  padding: 14px 16px;
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.12);
  text-align: left;
}

.trending-games h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
}

.panel-title-btn {
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.55);
  color: var(--accent);
  font: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
}

.panel-title-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.trending-meta {
  font-size: 8px;
  color: var(--accent);
  opacity: 0.9;
  margin-bottom: 10px;
}

.trending-games-list {
  display: grid;
  gap: 8px;
}

.trending-game-btn {
  width: 100%;
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.55);
  color: var(--accent);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 1px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  transition: 0.18s ease;
}

.trending-game-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

.trending-rank {
  color: var(--accent);
}

.trending-count {
  opacity: 0.86;
}

.trending-empty {
  border: 1px dashed var(--accent-dim);
  padding: 10px;
  font-size: 9px;
  opacity: 0.75;
}

.update-log {
  margin-top: 24px;
  width: min(90vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.75);
  padding: 14px 16px;
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.12);
  text-align: left;
}

.update-log h2 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
}

.update-log ul {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 8px;
  font-size: 9px;
  line-height: 1.5;
}

.update-log li span {
  color: var(--accent);
}

.panel-overlay-box {
  width: min(980px, 95vw);
}

.panel-overlay-meta {
  text-align: center;
  font-size: 9px;
  margin-bottom: 10px;
  color: var(--accent);
}

.trending-month-chart {
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.45);
  padding: 10px;
  min-height: 260px;
  max-height: min(52vh, 430px);
}

.trend-line-chart {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px;
  align-items: stretch;
  height: min(46vh, 360px);
}

.trend-chart-legend {
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  min-height: 0;
}

.trend-chart-legend-head {
  font-size: 8px;
  letter-spacing: 0.8px;
  color: rgba(220, 255, 235, 0.75);
}

.trend-chart-legend-list {
  display: grid;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.trend-legend-item {
  border: 1px solid rgba(0, 255, 136, 0.16);
  padding: 4px 6px;
  font-size: 9px;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  color: rgba(220, 255, 235, 0.8);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.trend-legend-item:hover {
  border-color: rgba(0, 255, 136, 0.45);
  color: #fff;
}

.trend-legend-item.active {
  color: #fff;
  border-color: rgba(0, 255, 136, 0.7);
  background: rgba(0, 255, 136, 0.12);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.45);
}

.trend-legend-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
}

.trend-legend-count {
  color: rgba(220, 255, 235, 0.7);
}

.trend-chart-stage {
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
}

.trend-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trend-chart-hover-readout {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  color: rgba(220, 255, 235, 0.95);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 255, 136, 0.3);
  padding: 4px 6px;
}

.trend-line {
  fill: none;
  stroke-width: 2;
  opacity: 0.35;
  transition: opacity 0.12s ease, stroke-width 0.12s ease;
}

.trend-line.active {
  opacity: 1;
  stroke-width: 3.2;
  filter: drop-shadow(0 0 4px currentColor);
}

.trend-line-hit {
  fill: none;
  stroke-width: 14;
  stroke: transparent;
  cursor: crosshair;
}

.trend-point {
  opacity: 0.65;
  transition: opacity 0.12s ease, r 0.12s ease;
}

.trend-point.active {
  opacity: 1;
}

.trend-point-hit {
  fill: transparent;
  cursor: pointer;
}

.trend-x-day {
  cursor: pointer;
}


@media (max-width: 760px) {
  .trend-line-chart {
    grid-template-columns: 1fr;
  }
}

.update-log-scroll {
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.45);
  max-height: min(68vh, 680px);
  overflow-y: auto;
  padding: 10px 14px;
}

.update-log-search {
  margin: 0 0 10px;
}

.update-log-scroll ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 9px;
}

.update-log-scroll li span {
  color: var(--accent);
}

.update-log-scroll li.update-log-day-title {
  list-style: none;
  text-align: center;
  color: rgba(220, 255, 235, 0.65);
  letter-spacing: 0.8px;
  margin: 4px 0;
}

.panel-overlay-exit {
  display: block !important;
  margin-top: 12px;
}

.live-ops {
  margin-top: 14px;
  width: min(90vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.75);
  padding: 14px 16px;
  text-align: left;
}

.live-ops h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
}

.live-ops-line {
  font-size: 9px;
  margin-bottom: 10px;
  color: var(--accent);
}

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

.crew-dashboard {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 10px;
}

.crew-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: flex-start;
}

.crew-finder {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 10px;
}

.crew-directory-section {
  display: flex;
  flex-direction: column;
  max-height: 50vh;
}

@media (max-width: 600px) {
  .crew-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

.crew-dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: 100%;
}

.crew-section {
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.4);
  padding: 15px;
  position: relative;
  transition: box-shadow 0.3s ease;
}

.crew-section:hover {
  box-shadow: 0 0 15px var(--accent-glow) !important;
}

.crew-section-title {
  text-align: left;
  font-size: 11px;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 5px;
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.crew-roster-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.crew-roster-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 5px;
  flex: 1;
  min-height: 120px;
  max-height: 250px;
  overflow-y: auto;
  border: 1px dashed var(--accent-dim);
  padding: 5px;
}

.crew-roster-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(var(--accent-rgb), 0.05);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-bottom: 2px;
}

.crew-roster-item:hover {
  border-color: var(--accent);
  background: rgba(0, 255, 0, 0.1);
  box-shadow: inset 0 0 5px var(--accent-dim);
}

.crew-roster-name {
  color: #fff;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  margin-left: 6px;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 4px currentColor;
}

.status-dot.online {
  background: #62ff62;
  color: #62ff62;
}

.status-dot.offline {
  background: #ff6a6a;
  color: #ff6a6a;
}

.status-dot.hidden {
  background: #a1a1a1;
  color: #a1a1a1;
}

.crew-roster-item .status-dot {
  margin-left: auto;
}

.chat-msg .status-dot {
  margin-left: 0;
}

.chat-msg .chat-user {
  vertical-align: middle;
}

/* Legacy badge selector retained for compatibility with older cached markup. */
.online-status {
  border: 1px solid;
  padding: 0;
  border-radius: 50%;
  width: 8px;
  height: 8px;
}

.crew-roster-you {
  color: var(--accent);
}

.crew-roster-empty {
  text-align: center;
  font-size: 10px;
  color: #aaa;
  margin: auto;
  opacity: 0.5;
}

.live-ops-grid div {
  border: 1px solid var(--accent-dim);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.live-ops-grid span {
  font-size: 8px;
  opacity: 0.8;
}

.live-ops-grid strong {
  font-size: 9px;
  color: var(--accent);
}

.season-mission-done {
  color: #0f0;
}

.season-tab-block {
  width: 100%;
  margin: 10px 0;
}

.season-subtabs {
  margin-top: 8px;
}

.season-board-title {
  margin: 10px 0 6px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 1px;
}

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

/* --- 6. OVERLAYS & MODALS --- */
/* Overlay container for modals and game screens. */

.overlay {
  position: fixed;
  inset: var(--topbar-clearance) 0 0 0;
  background: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.overlay.active {
  display: flex !important;
  opacity: 1;
  transform: translateY(0);
}


/* Menu-style overlays sit above the home scene so chat/glow stay visible. */
.menu-overlay {
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(1px);
}

#overlayBank,
#overlayShop,
#overlayProfile,
#overlayScores,
#overlaySeason,
#overlayCrew,
#overlayCrewLogoEditor,
#overlayAdmin,
#overlayGamebox {
  z-index: 1250;
}

#overlayCrewLogoEditor {
  z-index: 1350;
}




.menu-overlay .score-box,
.menu-overlay .menu-box,
.menu-overlay .job-card,
.menu-overlay .settings-grid,
.menu-overlay h1,
.menu-overlay p {
  position: relative;
  z-index: 1;
}
.menu-box {
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid var(--accent);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 0 15px var(--accent-dim);
}

/* LOGIN */
#overlayLogin {
  background: rgba(0, 0, 0, 0.98);
  z-index: 9000;
}
.login-box {
  border: 2px solid var(--accent);
  padding: 40px;
  text-align: center;
  box-shadow: 0 0 30px var(--accent-dim);
  background: #050505;
  width: 400px;
}

/* INPUTS */
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
}

.term-input {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 15px;
  font-family: inherit;
  text-align: center;
  font-size: 20px;
  outline: none;
  margin-bottom: 20px;
  width: 100%;
}

select.term-input {
  background: #050505;
}

select.term-input option {
  background: #050505;
  color: var(--accent);
}

select.term-input:focus {
  background: #050505;
}
.term-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 15px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}
.term-btn:hover {
  opacity: 0.8;
}


.admin-actions {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.admin-actions-overhaul {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

.admin-section {
  border: 1px solid var(--accent-dim);
  padding: 12px;
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.admin-section-hero {
  grid-column: 1 / -1;
  border-color: rgba(255, 215, 0, 0.6);
  background: rgba(255, 215, 0, 0.08);
}

.admin-section-danger {
  border-color: rgba(255, 0, 0, 0.5);
}

.admin-section-title {
  margin: 0;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--accent);
  text-align: left;
}

.admin-section-subtitle {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #ddd;
}

/* MINES */
.mines-cell {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 1 / 1;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}
.mines-cell:hover:not(.revealed) {
  background: var(--accent-dim);
  transform: scale(1.05);
}
.mines-cell.revealed {
  cursor: default;
  transform: scale(0.95);
}

/* --- 7. GAMES --- */
canvas {
  border: 4px solid var(--accent);
  background: #000;
  box-shadow: 0 0 20px var(--accent-dim);
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: calc(100vh - 230px);
  image-rendering: pixelated;
  margin-bottom: 10px;
}

.embedded-game-frame {
  width: min(95vw, calc((100vh - 210px) * 1.7143), 1200px);
  aspect-ratio: 1200 / 700;
  height: auto;
  max-height: calc(100vh - 210px);
  border: 3px solid var(--accent);
  background: #000;
  box-shadow: 0 0 20px var(--accent-dim);
}

.game-overlay {
  gap: 12px;
  padding-top: 10px;
}

.game-content-shell {
  width: min(95vw, 1200px);
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.86);
  box-shadow: 0 0 20px var(--accent-dim);
  min-height: unset;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gamebox-shell {
  width: min(96vw, 1300px);
  --gamebox-panel-min-height: clamp(420px, calc(100vh - var(--topbar-clearance) - 210px), 760px);
}

.gamebox-heading-row {
  width: 100%;
  margin-bottom: 8px;
}

.gamebox-heading-row h2 {
  margin: 0;
  font-size: 12px;
}

.gamebox-search-input {
  margin-bottom: 8px;
}

.gamebox-game-strip {
  width: 100%;
  min-height: var(--gamebox-panel-min-height);
  margin-bottom: 10px;
  padding: 2px 2px 8px;
}

.leaderboard-game-strip.gamebox-game-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: min-content;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
}

.leaderboard-game-strip.gamebox-game-strip .leaderboard-game-card {
  max-width: none;
  min-width: 0;
  width: 100%;
}


.gamebox-leaderboard-panel {
  width: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 6px;
  min-height: var(--gamebox-panel-min-height);
}

.gamebox-leaderboard-panel .score-list {
  max-height: none;
  height: 100%;
}

.gamebox-leaderboard-mode-store {
  display: none;
}

.gamebox-frame {
  width: 100%;
  min-height: var(--gamebox-panel-min-height);
  flex: 1;
  position: relative;
  padding-top: 0;
  border: 1px solid var(--accent-dim);
  padding: 8px;
}

.gamebox-header-actions .menu-btn {
  width: auto;
  min-width: 220px;
}

.gamebox-header-actions {
  position: absolute;
  top: 10px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gamebox-content {
  width: 100%;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.gamebox-mounted {
  position: static;
  inset: auto;
  display: flex;
  width: 100%;
  height: auto;
  min-height: 0;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  padding: 0;
  border: 0;
}

.gamebox-mounted canvas,
.gamebox-mounted .embedded-game-frame {
  max-width: 100%;
  height: auto;
}

.game-content-shell > h1 {
  margin: 0 0 4px;
  font-size: clamp(24px, 4.2vw, 40px);
}

.game-content-shell > .high-score-display {
  margin-bottom: 2px;
}

.game-content-shell > [style*="margin-bottom"] {
  margin-bottom: 4px !important;
}

.game-content-shell > .mobile-hint.active {
  margin-top: 6px !important;
}

.game-content-shell canvas,
.game-content-shell .embedded-game-frame {
  margin-bottom: 4px;
}

.overlay-controls-fixed {
  display: none;
}

.fullscreen-btn-fixed {
  position: static;
  margin: 0;
  width: 200px;
  border: 2px solid var(--accent);
  background: #000;
  color: var(--accent);
  padding: 12px;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  z-index: 1001;
}

.fullscreen-btn-fixed:hover {
  background: var(--accent);
  color: #000;
}

.exit-btn-fixed {
  display: none;
}

.game-leaderboard-jump-btn {
  position: fixed;
  left: 14px;
  top: calc(var(--topbar-clearance) + 14px);
  z-index: 1200;
  min-width: 180px;
  max-width: 240px;
  padding: 8px 10px;
  font-size: 10px;
}

.game-leaderboard-jump-btn.active {
  display: block;
}


.leaderboard-game-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.leaderboard-heading-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.leaderboard-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-search-toggle {
  justify-self: end;
  min-width: 92px;
  font-size: 10px;
}

.leaderboard-search-input {
  margin-bottom: 10px;
}

.leaderboard-game-card {
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  text-align: left;
  min-width: clamp(168px, 18vw, 210px);
  max-width: clamp(190px, 22vw, 240px);
  padding: clamp(8px, 1vw, 10px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  cursor: pointer;
  scroll-snap-align: center;
}

.leaderboard-game-card.is-favorite {
  border-color: #ffd447;
  box-shadow: inset 0 0 0 1px rgba(255, 212, 71, 0.35);
}

.game-strip-icon-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gamebox-heading-row .leaderboard-search-toggle {
  min-width: 84px;
}

#gameboxFilterToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  height: 36px;
  padding: 0 8px;
  font-size: 11px;
  line-height: 1;
}

.leaderboard-game-strip.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.leaderboard-game-card strong {
  font-size: 12px;
  line-height: 1.3;
}

.leaderboard-game-card small {
  font-size: 9px;
  color: #ddd;
}


.game-picker-hint {
  font-size: 8px;
  letter-spacing: 0.35px;
  color: #8fffd0;
  opacity: 0.9;
  text-transform: uppercase;
}

.leaderboard-game-card.active,
.leaderboard-game-card:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 10px var(--accent-dim);
}

.leaderboard-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 14px;
  align-items: start;
}

.leaderboard-side-modes {
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.55);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: min(58vh, 500px);
}

.leaderboard-side-modes h3 {
  margin: 0;
  font-size: 11px;
}

.leaderboard-mode-meta {
  margin: 0;
  font-size: 9px;
  color: #ddd;
}

.leaderboard-mode-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-mode-btn {
  width: 100%;
  text-align: left;
  font-size: 10px;
  padding: 8px 9px;
}

.leaderboard-mode-btn.active {
  background: var(--accent);
  color: #000;
}


@media (max-width: 900px) {
  .leaderboard-layout {
    grid-template-columns: 1fr;
  }

  .leaderboard-side-modes {
    min-height: auto;
  }

  .game-leaderboard-jump-btn {
    left: 10px;
    top: calc(var(--topbar-clearance) + 10px);
    min-width: 160px;
  }
}


.game-card.is-favorite {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.game-card::after {
  content: attr(data-badge);
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 8px;
  color: #ffd700;
}

.game-card span {
  font-size: 18px;
}

.game-card strong {
  font-size: 14px;
  line-height: 1.25;
}

.game-card small {
  font-size: 9px;
  color: #ddd;
  line-height: 1.4;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 32px;
  overflow: visible;
}

.game-tag {
  border: 1px solid var(--accent);
  background: rgba(0, 255, 0, 0.08);
  color: var(--accent);
  font-size: 10px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  position: relative;
  cursor: default;
}

.game-tag::after {
  content: attr(data-tag-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 6px;
  border: 1px solid var(--accent);
  background: #030;
  color: var(--accent);
  font-size: 7px;
  letter-spacing: 0.25px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 6;
}

.game-tag::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  width: 6px;
  height: 6px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  background: #030;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 5;
}

.game-tag:hover::after,
.game-tag:hover::before,
.game-tag:focus-visible::after,
.game-tag:focus-visible::before {
  opacity: 1;
}

.game-card:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 10px var(--accent-dim);
}


.overlay.has-game-side-shop {
  --game-side-shop-width: 260px;
  --game-side-shop-height: 520px;
  padding-left: calc(var(--game-side-shop-width) + 24px);
}

.game-side-shop {
  position: absolute;
  left: 14px;
  top: 74px;
  width: var(--game-side-shop-width, 260px);
  height: var(--game-side-shop-height, 520px);
  max-height: var(--game-side-shop-height, 520px);
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.9);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  z-index: 8;
}


#overlayGamebox.has-game-side-shop {
  padding-left: 20px;
}

#overlayGamebox.has-game-side-shop .gamebox-frame {
  padding-right: calc(var(--game-side-shop-width, 260px) + 18px);
}

#overlayGamebox .game-side-shop {
  left: auto;
  right: 14px;
  top: 186px;
  height: calc(var(--gamebox-panel-min-height) - 18px);
  max-height: calc(var(--gamebox-panel-min-height) - 18px);
}

.game-side-shop h3 {
  margin: 0;
  font-size: 11px;
  color: var(--accent);
}

.game-side-shop-meta {
  margin: 0;
  font-size: 8px;
  opacity: 0.8;
}

.game-side-shop-row {
  border-top: 1px dashed var(--accent-dim);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-side-shop-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-side-shop-details strong {
  font-size: 9px;
}

.game-side-shop-details small {
  font-size: 8px;
  color: #ddd;
}

.game-side-shop-action {
  width: 100%;
  font-size: 8px;
  padding: 5px 6px;
}

.game-side-shop-empty {
  margin-top: 8px;
  border-top: 1px dashed var(--accent-dim);
  padding-top: 8px;
  font-size: 8px;
  color: #ddd;
  letter-spacing: 0.25px;
}

@media (max-width: 1100px) {
  .overlay.has-game-side-shop {
    --game-side-shop-width: 220px;
    --game-side-shop-height: 460px;
  }

  #overlayGamebox.has-game-side-shop .gamebox-frame {
    padding-right: calc(var(--game-side-shop-width, 220px) + 14px);
  }

  #overlayGamebox .game-side-shop {
    top: 178px;
  }

  .gamebox-header-actions {
    position: static;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin: 0 0 8px auto;
  }

  .gamebox-frame {
    padding-top: 0;
  }
}

@media (max-width: 760px) {
  .overlay.has-game-side-shop {
    padding-left: 20px;
  }

  #overlayGamebox.has-game-side-shop .gamebox-frame {
    padding-right: 8px;
  }

  .game-side-shop {
    position: static;
    width: min(92vw, 420px);
    height: auto;
    max-height: none;
    margin: 8px auto 0;
  }
}

.exit-btn-fixed:hover {
  background: var(--accent);
  color: #000;
}


/* Hide all legacy per-overlay close buttons; top bar controls replace them. */
.overlay button[onclick*="closeOverlays"] {
  display: none !important;
}

.touch-controls {
  display: none;
  margin-top: 10px;
  gap: 12px;
}
.touch-controls.active {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.touch-btn {
  width: 50px;
  height: 50px;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 0, 0, 0.1);
}
.touch-btn:active {
  background: var(--accent);
  color: #000;
}
@media (pointer: coarse) {
  .touch-controls.active {
    display: grid;
  }
}

/* --- TYPE RUNNER --- */
#typeGameArea {
  width: 90%;
  max-width: 900px;
  text-align: left;
  margin-bottom: 50px;
  position: relative;
}
#typeTextBox {
  font-family: var(--font-type);
  font-size: 24px;
  line-height: 1.6;
  color: #555;
  user-select: none;
  position: relative;
  word-break: break-all;
  min-height: 150px;
  max-height: 300px;
  overflow: hidden;
}
.letter {
  position: relative;
  transition: color 0.1s;
}
.letter.correct {
  color: var(--accent);
  text-shadow: 0 0 5px var(--accent-dim);
}
.letter.incorrect {
  color: #ff0000;
  text-decoration: underline;
}
.letter.active::before {
  content: "|";
  position: absolute;
  left: -2px;
  color: var(--accent);
  animation: blink 1s infinite;
  opacity: 0.8;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
#typeHiddenInput {
  position: absolute;
  opacity: 0;
  top: 0;
  left: 0;
  pointer-events: none;
}
.type-stats {
  display: flex;
  gap: 20px;
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--accent);
  font-family: var(--font-type);
}

/* --- BLACKJACK --- */
.bj-table {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.bj-pot-display {
  font-size: 24px;
  color: #ffd700;
  text-shadow: 0 0 10px #b8860b;
  padding: 10px;
  margin-bottom: 15px;
  border-bottom: 2px solid #ffd700;
  width: 100%;
  text-align: center;
  display: none;
}
.bj-area {
  width: 100%;
  border: 1px dashed var(--accent-dim);
  padding: 10px;
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bj-label {
  position: absolute;
  top: -8px;
  background: #000;
  padding: 0 5px;
  font-size: 8px;
  color: var(--accent);
  left: 10px;
}
.bj-hand {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.bj-card {
  width: 50px;
  height: 70px;
  border: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  font-size: 12px;
  background: #000;
  box-shadow: 2px 2px 0px var(--accent-dim);
  user-select: none;
  position: relative;
  color: var(--accent);
}

.bj-card.deal-anim {
  animation: dealCard 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
}

@keyframes dealCard {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.bj-card.mini {
  width: 30px;
  height: 42px;
  font-size: 8px;
  border: 1px solid var(--accent);
}
.bj-card.hidden {
  background: repeating-linear-gradient(
    45deg,
    #000,
    #000 5px,
    var(--accent-dim) 5px,
    var(--accent-dim) 10px
  );
  color: transparent;
}
.bj-card.hidden > div {
  display: none;
}

.bj-deck-container {
  width: 60px;
  height: 84px;
  border: 2px dashed var(--accent-dim);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin: 5px;
  position: relative;
  transition: transform 0.1s;
}
.bj-deck-container:active {
  transform: scale(0.95);
}
.bj-deck-card {
  position: absolute;
  width: 45px;
  height: 63px;
  background: repeating-linear-gradient(
    45deg,
    #000,
    #000 5px,
    var(--accent) 5px,
    var(--accent) 6px
  );
  border: 2px solid var(--accent);
  box-shadow: -2px 2px 0px var(--accent-dim);
  top: 8px;
  left: 6px;
}

.bj-side-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  width: 100%;
  margin-top: 10px;
}
.bj-small-seat {
  border: 1px dotted var(--accent-dim);
  padding: 5px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bj-small-hand {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
}
.active-seat {
  box-shadow: 0 0 15px var(--accent);
  border-color: var(--accent);
  animation: pulseSeat 1.5s infinite alternate;
}

@keyframes pulseSeat {
  from {
    box-shadow: 0 0 5px var(--accent);
  }
  to {
    box-shadow: 0 0 15px var(--accent);
  }
}

.bj-chip-rack {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.bj-chip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #000;
  color: var(--accent);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 9px;
  cursor: pointer;
  box-shadow:
    0 0 10px var(--accent-dim),
    inset 0 0 5px rgba(0, 0, 0, 0.5);
  font-weight: bold;
  transition: transform 0.1s;
}
.bj-chip:hover {
  background: var(--accent);
  color: #000;
  transform: translateY(-5px);
}
.bj-chip:active {
  transform: scale(0.9);
  box-shadow: 0 0 5px var(--accent);
}

@keyframes resultPulse {
  0% { transform: scale(1); text-shadow: 0 0 5px currentColor; }
  50% { transform: scale(1.1); text-shadow: 0 0 15px currentColor; }
  100% { transform: scale(1); text-shadow: 0 0 5px currentColor; }
}

.bj-message-highlight {
  animation: resultPulse 0.5s ease-out;
  color: #0f0; /* Default highlight to green, can be changed via JS */
}

.bj-message-bust {
  animation: resultPulse 0.5s ease-out;
  color: #f00;
}

.bj-all-in {
  border-color: #ffcc00;
  color: #ffcc00;
  width: auto;
  padding: 0 10px;
}

/* --- WAR --- */
.war-topline {
  display: block;
}

.war-scoreline {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  border: 1px dashed var(--accent-dim);
  padding: 8px 10px;
}

.war-result {
  min-height: 18px;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Leaderboard */
.score-box {
  width: min(96vw, 1300px);
  border: 2px solid var(--accent);
  background: #000;
  padding: clamp(12px, 2.5vw, 24px);
}
.score-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  max-height: 220px;
  overflow-y: auto;
}
.score-tab {
  padding: 10px 8px;
  border: 1px solid var(--accent);
  cursor: pointer;
  font-size: clamp(9px, 1.8vw, 12px);
  text-align: center;
  line-height: 1.3;
}
.score-tab.active {
  background: var(--accent);
  color: #000;
}
.score-list {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  text-align: left;
}
#overlayScores .score-list {
  max-height: min(58vh, 500px);
  overflow-y: auto;
}
.score-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px dashed var(--accent-dim);
  font-size: clamp(10px, 2vw, 13px);
  word-break: break-word;
  align-items: center;
}
.score-actions {
  margin-left: auto;
}
.admin-remove-btn {
  padding: 6px 10px;
  font-size: 10px;
  min-width: 64px;
}


.jobs-note {
  text-align: center;
  font-size: 10px;
  margin-bottom: 12px;
  opacity: 0.9;
}
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.job-card {
  border: 1px solid var(--accent-dim);
  padding: 12px;
  background: rgba(0, 0, 0, 0.45);
}
.job-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 8px;
}
.job-desc {
  font-family: var(--font-type);
  font-size: 11px;
  margin-bottom: 10px;
  opacity: 0.85;
}
.job-prompt {
  min-height: 18px;
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 8px;
}
.job-input {
  margin: 0 0 8px;
  width: 100%;
}
.job-actions {
  display: flex;
  gap: 8px;
}
.job-actions .term-btn {
  flex: 1;
}
.jobs-msg {
  text-align: center;
  min-height: 16px;
  margin-top: 12px;
  font-size: 10px;
}


.job-board {
  position: relative;
  width: 100%;
  height: 230px;
  border: 1px dashed var(--accent-dim);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.job-board-cashier { background: linear-gradient(160deg, rgba(34,34,34,0.9), rgba(0,0,0,0.8)); }
.job-board-frontdesk { background: linear-gradient(160deg, rgba(15,30,55,0.8), rgba(0,0,0,0.85)); }
.job-board-delivery { background: linear-gradient(160deg, rgba(35,35,35,0.9), rgba(10,10,10,0.9)); }
.job-board-stocker { background: linear-gradient(160deg, rgba(32,24,8,0.8), rgba(0,0,0,0.9)); }
.job-board-janitor { background: linear-gradient(160deg, rgba(14,26,20,0.85), rgba(0,0,0,0.9)); }
.job-board-barista { background: linear-gradient(160deg, rgba(42,20,10,0.85), rgba(0,0,0,0.9)); }
.job-board-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0.75;
}
.job-target {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  background: rgba(10, 10, 10, 0.88);
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
}
.job-target.good { box-shadow: 0 0 10px rgba(46, 204, 113, 0.3); }
.job-target.bad { box-shadow: 0 0 10px rgba(255, 107, 107, 0.22); }
.job-target:hover { transform: translate(-50%, -50%) scale(1.08); }
.job-target.delivery { border-radius: 50%; }
.job-target.frontdesk, .job-target.stocker, .job-target.cashier { font-size: 10px; letter-spacing: 0.4px; }


.job-meter {
  width: 100%;
  height: 16px;
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.05);
  margin: 0 0 6px 0;
  min-height: 42px;
}
.job-meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #45b6fe, #ffd93d);
  transition: width 0.2s ease;
}
.job-meter-fill.ok {
  background: linear-gradient(90deg, #2ecc71, #9be15d);
}
.job-meter-fill.bad {
  background: linear-gradient(90deg, #ff6b6b, #ffb347);
}
.job-temp {
  text-align: center;
  font-size: 16px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: var(--accent);
}

.profile-summary {
  margin-top: 14px;
  border: 1px solid var(--accent-dim);
  padding: 10px;
  background: rgba(0, 0, 0, 0.35);
}
.profile-summary-rank {
  text-align: center;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 11px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 4px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.rank-badge.inline {
  margin-right: 6px;
}

.rank-iron { color: #9aa0a6; }
.rank-bronze { color: #cd7f32; }
.rank-silver { color: #d4d7dd; }
.rank-gold { color: #ffd447; }
.rank-platinum { color: #6ce4df; }
.rank-diamond { color: #7aa6ff; }
.rank-ascendant { color: #7b5cff; }
.rank-immortal { color: #ff5d89; }
.rank-radiant { color: #ffe682; }
.rank-god { color: #ff3d3d; }
.profile-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-progress-label {
  font-size: 9px;
  text-align: center;
  opacity: 0.85;
}
.profile-progress-track {
  width: 100%;
  height: 10px;
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.05);
}
.profile-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0f0, #afffaf);
  transition: width 0.35s ease;
}

.profile-stats {
  text-align: left;
  width: 100%;
  margin-top: 20px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 5px;
}

/* Maintenance */
#overlayMaintenance {
  z-index: 9999 !important;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
}

.maintenance-box {
  border: 2px solid #f66;
  background: rgba(20, 0, 0, 0.9);
  padding: 40px;
  box-shadow: 0 0 30px rgba(255, 102, 102, 0.3);
  max-width: 600px;
  width: 90vw;
}

/* Config */
.config-box {
  width: min(260px, 92vw);
  padding: 14px;
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.92);
  font-size: 10px;
  box-shadow: 0 0 10px var(--accent-dim);
}

#overlayConfig {
  align-items: flex-start;
  justify-content: flex-start;
  padding: 8px 14px 14px;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(1.5px);
}

#overlayConfig .config-box {
  margin-top: 0;
  margin-left: 0;
}
.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}

.config-row span {
  white-space: nowrap;
}

.config-row input[type="range"] {
  width: 120px;
}

body.high-contrast {
  filter: contrast(1.18) saturate(1.06);
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* TTT */
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 10px;
}
.ttt-cell {
  width: 70px;
  height: 70px;
  background: #111;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 35px;
}

/* Wordle */
.wordle-room {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 500px;
}
.wordle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}
.wordle-status {
  font-size: 14px;
  letter-spacing: 2px;
}
.wordle-grid-container {
  display: flex;
  justify-content: center;
  width: 100%;
}
.wordle-grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
}
.wordle-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.wordle-cell {
  width: 50px;
  height: 50px;
  border: 2px solid #333;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  transition: transform 0.5s;
}
.wordle-cell.filled {
  border-color: #555;
}
.wordle-cell.correct {
  background-color: #538d4e;
  border-color: #538d4e;
  color: white;
}
.wordle-cell.present {
  background-color: #b59f3b;
  border-color: #b59f3b;
  color: white;
}
.wordle-cell.absent {
  background-color: #3a3a3c;
  border-color: #3a3a3c;
  color: white;
}
.wordle-cell.flip {
  animation: flipIn 0.5s ease forwards;
}
@keyframes flipIn {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0);
  }
}
.wordle-keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}
.wordle-kbd-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.wordle-key {
  background-color: #818384;
  color: white;
  border: none;
  border-radius: 4px;
  height: 48px;
  font-weight: bold;
  font-size: 14px;
  flex: 1;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  font-family: inherit;
  transition: background-color 0.2s;
  padding: 0;
  max-width: 40px;
}
.wordle-key-large {
  flex: 1.5;
  font-size: 12px;
  max-width: 65px;
}
.wordle-key:hover {
  opacity: 0.8;
}
.wordle-spacer {
  flex: 0.5;
}
.wordle-key.correct {
  background-color: #538d4e;
}
.wordle-key.present {
  background-color: #b59f3b;
}
.wordle-key.absent {
  background-color: #3a3a3c;
}
.wordle-stats-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.wordle-stats-content {
  background: #111;
  border: 1px solid var(--accent);
  padding: 20px;
  width: 90%;
  max-width: 400px;
  text-align: center;
}
.wordle-stats-row {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
}
.wordle-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wordle-stat-val {
  font-size: 24px;
  font-weight: bold;
}
.wordle-stat-label {
  font-size: 10px;
  opacity: 0.8;
}
.wordle-guess-dist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  text-align: left;
}
.wordle-dist-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wordle-dist-num {
  font-size: 12px;
  width: 15px;
}
.wordle-dist-bar-container {
  flex: 1;
  background: #222;
  height: 20px;
}
.wordle-dist-bar {
  height: 100%;
  background: #3a3a3c;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 5px;
  font-size: 10px;
  color: white;
}
.wordle-dist-bar.active {
  background: #538d4e;
}

/* Hangman */
.hangman-room {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 1100px;
}
.hangman-sidebar,
.hangman-chat {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.hangman-panel {
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.8);
  padding: 12px;
  font-size: 10px;
  box-shadow: 0 0 10px var(--accent-dim);
}
.hangman-section-title {
  font-size: 9px;
  letter-spacing: 2px;
  margin-bottom: 8px;
  opacity: 0.8;
  text-transform: uppercase;
}
.hangman-turn {
  margin-top: 10px;
  font-size: 10px;
}
.hangman-chat-log {
  height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hangman-chat-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hangman-chat-name {
  color: var(--accent);
  font-weight: bold;
  font-size: 9px;
}
.hangman-chat-text {
  color: var(--accent);
  font-family: var(--font-type);
  font-size: 11px;
  text-shadow: none;
}
.hangman-chat-text.good {
  color: #0f0;
}
.hangman-chat-text.bad {
  color: #f00;
}
.hangman-chat-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hangman-hint {
  font-size: 8px;
  opacity: 0.7;
  text-align: center;
}
.hangman-status {
  margin-bottom: 12px;
  font-size: 10px;
  text-align: center;
}
.hangman-word {
  font-size: 24px;
  letter-spacing: 8px;
  margin: 10px 0 20px;
  text-align: center;
}
.hangman-row {
  font-size: 10px;
  margin-bottom: 10px;
  text-align: center;
}
.hangman-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  font-size: 12px;
  margin-bottom: 10px;
}
.hangman-letters span {
  border: 1px solid var(--accent);
  padding: 4px 6px;
}
.hangman-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hangman-figure {
  position: relative;
  width: 200px;
  height: 220px;
  margin-bottom: 15px;
}
.hangman-gallows {
  position: absolute;
  inset: 0;
}
.hangman-base {
  position: absolute;
  bottom: 0;
  left: 20px;
  width: 140px;
  height: 6px;
  background: var(--accent);
}
.hangman-post {
  position: absolute;
  bottom: 6px;
  left: 40px;
  width: 6px;
  height: 170px;
  background: var(--accent);
}
.hangman-beam {
  position: absolute;
  top: 20px;
  left: 40px;
  width: 100px;
  height: 6px;
  background: var(--accent);
}
.hangman-rope {
  position: absolute;
  top: 26px;
  left: 132px;
  width: 4px;
  height: 30px;
  background: var(--accent);
}
.hangman-man div {
  position: absolute;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s;
}
.hangman-head {
  width: 28px;
  height: 28px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  top: 56px;
  left: 118px;
  background: transparent;
}
.hangman-body {
  width: 6px;
  height: 50px;
  top: 86px;
  left: 131px;
}
.hangman-arm.left {
  width: 30px;
  height: 4px;
  top: 100px;
  left: 102px;
  transform: rotate(-25deg);
  transform-origin: right center;
}
.hangman-arm.right {
  width: 30px;
  height: 4px;
  top: 100px;
  left: 134px;
  transform: rotate(25deg);
  transform-origin: left center;
}
.hangman-leg.left {
  width: 32px;
  height: 4px;
  top: 132px;
  left: 102px;
  transform: rotate(-30deg);
  transform-origin: right center;
}
.hangman-leg.right {
  width: 32px;
  height: 4px;
  top: 132px;
  left: 132px;
  transform: rotate(30deg);
  transform-origin: left center;
}
.hangman-figure[data-stage="1"] .hangman-head {
  opacity: 1;
}
.hangman-figure[data-stage="2"] .hangman-body {
  opacity: 1;
}
.hangman-figure[data-stage="3"] .hangman-arm.left {
  opacity: 1;
}
.hangman-figure[data-stage="4"] .hangman-arm.right {
  opacity: 1;
}
.hangman-figure[data-stage="5"] .hangman-leg.left {
  opacity: 1;
}
.hangman-figure[data-stage="6"] .hangman-leg.right {
  opacity: 1;
}
.hangman-figure[data-stage="2"] .hangman-head,
.hangman-figure[data-stage="3"] .hangman-head,
.hangman-figure[data-stage="4"] .hangman-head,
.hangman-figure[data-stage="5"] .hangman-head,
.hangman-figure[data-stage="6"] .hangman-head,
.hangman-figure[data-stage="3"] .hangman-body,
.hangman-figure[data-stage="4"] .hangman-body,
.hangman-figure[data-stage="5"] .hangman-body,
.hangman-figure[data-stage="6"] .hangman-body,
.hangman-figure[data-stage="4"] .hangman-arm.left,
.hangman-figure[data-stage="5"] .hangman-arm.left,
.hangman-figure[data-stage="6"] .hangman-arm.left,
.hangman-figure[data-stage="5"] .hangman-arm.right,
.hangman-figure[data-stage="6"] .hangman-arm.right,
.hangman-figure[data-stage="6"] .hangman-leg.left {
  opacity: 1;
}
@media (max-width: 900px) {
  :root {
    --topbar-clearance: 96px;
  }

  .hangman-room {
    grid-template-columns: 1fr;
  }
  .hangman-stage {
    order: 1;
  }
  .hangman-sidebar {
    order: 2;
  }
  .hangman-chat {
    order: 3;
  }
  .hangman-figure {
    transform: scale(0.9);
  }

  .wrap {
    padding: 76px 12px 24px;
    gap: 12px;
  }

  #globalChat {
    position: static;
    width: min(92vw, 420px);
    height: 220px;
    margin: 10px auto 16px;
  }

  #globalChat.minimized {
    width: min(92vw, 260px);
    margin: 10px auto;
  }

  .top-bar {
    height: auto;
    min-height: 50px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .sys-info {
    width: 100%;
    order: 3;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
}
/* Game Over Modal */
#modalGameOver {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, 0.95);
  z-index: 30;
  padding: 20px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

#modalGameOver.active {
  display: flex;
}

#goRestart {
  width: 200px;
}

#goExit {
  margin-top: 20px;
}

#gameOverText {
  margin-bottom: 30px;
  font-size: 14px;
}

.game-over-host {
  position: relative;
}

.game-surface-host {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
}

#modalGameOver h1 {
  color: var(--accent);
  text-shadow: 2px 2px red;
  font-size: 24px;
  margin-bottom: 10px;
}

.restart-hint {
  font-size: 10px;
  margin-top: 20px;
  animation: blink 1s infinite;
  color: var(--accent);
}

/* --- ACHIEVEMENTS & SHOP --- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 15px;
  max-height: 200px;
  overflow-y: auto;
}
.badge-item {
  border: 1px solid #333;
  padding: 8px;
  color: #555;
  font-size: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: 0.2s;
  cursor: help;
  height: 70px;
}
.badge-item:hover {
  transform: scale(1.05);
  border-color: var(--accent-glow);
}
.badge-item.unlocked {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
  box-shadow: 0 0 5px var(--accent-dim);
  background: rgba(255, 255, 255, 0.05);
}
.badge-item.common {
  border-color: var(--common);
  color: var(--common);
}
.badge-item.rare {
  border-color: var(--rare);
  color: var(--rare);
}
.badge-item.epic {
  border-color: var(--epic);
  color: var(--epic);
}
.badge-item.legendary {
  border-color: var(--leg);
  color: var(--leg);
  box-shadow: 0 0 10px var(--leg);
}
.badge-icon {
  font-size: 20px;
  margin-bottom: 5px;
}

#modalBadgeDetail {
  background: rgba(5, 5, 5, 0.98);
  z-index: 9600;
  text-align: center;
}
#bdIcon {
  font-size: 50px;
  margin-bottom: 20px;
  display: block;
}
#bdTitle {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--accent);
}
#bdRarity {
  font-size: 10px;
  margin-bottom: 15px;
  text-transform: uppercase;
  font-weight: bold;
}
#bdDesc {
  font-size: 10px;
  line-height: 1.5;
  color: var(--accent);
  max-width: 80%;
  margin: 0 auto;
}
#bdReward {
  margin-top: 20px;
  color: #0f0;
  font-size: 12px;
}

#toastBox {
  position: fixed;
  top: calc(var(--topbar-clearance) + 14px);
  right: 18px;
  bottom: auto;
  left: auto;
  transform: none;
  max-width: 340px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.toast {
  position: relative;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid var(--accent);
  color: var(--accent);
  min-width: 220px;
  max-width: 340px;
  padding: 10px 36px 10px 14px;
  text-align: center;
  box-shadow: 0 0 10px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: 15px;
  pointer-events: auto;
  animation:
    slideUp 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28),
    fadeOut 0.5s ease-in 3.5s forwards;
}
.toast-close-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.toast-close-btn:hover {
  color: #fff;
}
.toast-icon {
  font-size: 30px;
}
.toast-content {
  text-align: left;
}
.toast-title {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 5px;
}
.toast-desc {
  font-size: 8px;
  opacity: 0.8;
}

#toastBox.in-game {
  top: calc(var(--topbar-clearance) + 14px);
}

#toastBox.in-game .toast-icon {
  font-size: 20px;
}

#toastBox.in-game .toast-title {
  font-size: 10px;
}

#toastBox.in-game .toast-desc {
  font-size: 8px;
}
@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

#overlayShop {
  overflow: hidden;
}

#overlayShop .score-box {
  width: min(96vw, 1300px);
  height: calc(100vh - var(--topbar-clearance) - 40px);
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shop-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 10px;
}
.shop-item {
  border: 1px solid var(--accent);
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 10px;
}
.shop-item > div {
  min-width: 0;
  flex: 1 1 320px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.shop-item-icon {
  display: inline-block;
  margin-right: 8px;
}
.shop-buy-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 5px 10px;
  font-weight: bold;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.shop-buy-btn:active:not(:disabled) {
  transform: scale(0.95);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
.shop-buy-btn:disabled {
  background: #333;
  color: #555;
  cursor: not-allowed;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  margin-top: 10px;
}

.inventory-item {
  border: 1px solid var(--accent);
  padding: 12px;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.inventory-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.inventory-item-desc {
  font-size: 8px;
  color: #aaa;
  line-height: 1.4;
}

.inventory-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  font-size: 10px;
  opacity: 0.7;
}

.shop-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}
.shop-toggle-btn {
  background: #111;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 5px 8px;
  font-weight: bold;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.shop-toggle-btn:active {
  transform: scale(0.95);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

/* Terminal Bank Styling */
.term-nav {
  display: flex;
  justify-content: space-around;
  border-bottom: 1px dashed #333;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.term-nav-btn {
  background: none;
  border: none;
  color: #555;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
}

.term-nav-btn:hover {
  color: #fff;
}

.term-nav-btn.active {
  color: #0f0;
  font-weight: bold;
}

.bank-tab-pane {
  display: none;
}

.bank-tab-pane.active {
  display: block;
}

.bank-balance-card {
  text-align: center;
  margin-bottom: 20px;
  padding: 15px;
  border: 1px dashed #333;
}

.bank-balance-label {
  font-size: 10px;
  color: #aaa;
  margin-bottom: 5px;
}

.bank-balance-value {
  font-size: 24px;
  margin-bottom: 10px;
}

.bank-balance-ratios {
  margin-top: 10px;
}

.bank-ratio-bar {
  height: 4px;
  background-color: #f00;
  width: 80%;
  margin: 0 auto 5px auto;
}

.bank-ratio-fill {
  height: 100%;
  background-color: #0f0;
  transition: width 0.5s ease;
}

.bank-ratio-labels {
  display: flex;
  justify-content: space-between;
  width: 80%;
  margin: 0 auto;
  font-size: 8px;
}

.bank-section-title {
  text-align: center;
  font-size: 10px;
  color: #aaa;
  margin-bottom: 10px;
  border-bottom: 1px dashed #333;
  padding-bottom: 5px;
}

.bank-card {
  margin-bottom: 15px;
}

.bank-log {
  max-height: 250px;
  overflow-y: auto;
  text-align: left;
  font-size: 9px;
  color: #aaa;
}

.bank-entry {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #222;
}

.bank-entry-icon {
  display: none; /* Hide icons in terminal mode */
}

.bank-entry-details {
  flex: 1;
}

.bank-entry-title {
  color: #ccc;
  margin-bottom: 2px;
}

.bank-entry-time {
  font-size: 8px;
  color: #777;
}

.bank-entry-amount {
  font-weight: bold;
}

.bank-transfer {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bank-transfer-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.bank-transfer-help {
  text-align: center;
  color: #6b7280;
  font-size: 10px;
  margin-top: 8px;
}

.bank-transfer-msg {
  min-height: 16px;
  font-size: 12px;
  text-align: center;
  color: #9ca3af;
  margin-top: 8px;
}

.bank-loan {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bank-loan-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 15px;
}

.bank-stat-box {
  text-align: center;
}

.bank-stat-label {
  display: block;
  font-size: 8px;
  color: #aaa;
  margin-bottom: 4px;
}

.bank-stat-value {
  font-size: 14px;
}

.text-red { color: #f00; }
.text-yellow { color: #ff0; }
.text-green { color: #0f0; }

.bank-loan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Override existing stock market styles for the bank app */
.stock-market-card .stock-market {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.stock-portfolio-val {
  font-weight: bold;
  color: #aaa;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


.stock-market {
  border-top: 1px dashed #333;
  margin-top: 10px;
  padding-top: 10px;
}

.stock-market-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #aaa;
  margin-bottom: 8px;
}

.stock-market-grid {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr;
  gap: 16px;
}

.stock-list {
  max-height: 270px;
  overflow-y: auto;
  border: 1px solid #444;
  border-radius: 4px;
  background: #0a0a0a;
}

.stock-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid #333;
  background: #0a0a0a;
  color: var(--accent);
  font-family: inherit;
  font-size: 10px;
  padding: 12px 10px;
  display: flex;
  justify-content: space-between;
  transition: all 0.15s ease;
  cursor: pointer;
}

.stock-row:hover {
  background: #1a1a1a;
}

.stock-row.active {
  background: #1a1a1a;
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}

.stock-detail {
  border: 1px solid #444;
  background: #0a0a0a;
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stock-detail-title {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #ddd;
}

.stock-detail-price {
  font-size: 20px;
  color: var(--accent);
  text-shadow: 0 0 5px rgba(255,255,255,0.2);
  margin-bottom: 5px;
}

#stockChart {
  width: 100%;
  border: 1px solid #333;
  background: linear-gradient(180deg, #111 0%, #050505 100%);
  border-radius: 4px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
  image-rendering: auto;
}

.stock-detail-meta {
  font-size: 8px;
  color: #aaa;
  min-height: 18px;
}

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

.stock-mult-btn {
  padding: 6px 0;
  font-weight: bold;
  border: 1px solid #333;
  background: #111;
}

.stock-mult-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
}

.stock-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.stock-actions .term-btn {
  padding: 10px 0;
  font-size: 12px;
  font-weight: bold;
}

@media (max-width: 900px) {
  .stock-market-grid {
    grid-template-columns: 1fr;
  }
}

::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
}

/* --- ROULETTE --- */
.roulette-balance {
  margin-bottom: 8px;
  color: #ffd700;
  font-size: 14px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.roulette-history-wrap {
  width: min(94vw, 720px);
  border: 1px solid var(--accent-dim);
  padding: 8px;
  margin-bottom: 12px;
}

.roulette-history {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  min-height: 36px;
}

.roulette-history-empty {
  font-size: 10px;
  opacity: 0.6;
}

.roulette-history-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 1px solid #666;
  flex: 0 0 auto;
}

.roulette-history-chip.red {
  background: #9d1717;
}

.roulette-history-chip.black {
  background: #111;
}

.roulette-history-chip.green {
  background: #0c8b3e;
}

.roulette-wheel-wrap {
  position: relative;
  width: min(82vw, 360px);
  height: min(82vw, 360px);
  aspect-ratio: 1 / 1;
  margin: 8px auto 12px;
  flex: 0 0 auto;
}

.roulette-pointer {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 18px solid var(--accent);
  z-index: 4;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.roulette-wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid #111;
  box-shadow:
    inset 0 0 12px rgba(0, 0, 0, 0.8),
    0 0 16px var(--accent-dim);
  z-index: 1;
}

.roulette-wheel {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  overflow: hidden;
  z-index: 2;
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.1, 0.7, 0.12, 1);
  background: conic-gradient(
    #0c8b3e 0deg 9.73deg,
    #1f1f1f 9.73deg 19.46deg,
    #a11a1a 19.46deg 29.19deg,
    #1f1f1f 29.19deg 38.92deg,
    #a11a1a 38.92deg 48.65deg,
    #1f1f1f 48.65deg 58.38deg,
    #a11a1a 58.38deg 68.11deg,
    #1f1f1f 68.11deg 77.84deg,
    #a11a1a 77.84deg 87.57deg,
    #1f1f1f 87.57deg 97.3deg,
    #a11a1a 97.3deg 107.03deg,
    #1f1f1f 107.03deg 116.76deg,
    #a11a1a 116.76deg 126.49deg,
    #1f1f1f 126.49deg 136.22deg,
    #a11a1a 136.22deg 145.95deg,
    #1f1f1f 145.95deg 155.68deg,
    #a11a1a 155.68deg 165.41deg,
    #1f1f1f 165.41deg 175.14deg,
    #a11a1a 175.14deg 184.87deg,
    #1f1f1f 184.87deg 194.6deg,
    #a11a1a 194.6deg 204.33deg,
    #1f1f1f 204.33deg 214.06deg,
    #a11a1a 214.06deg 223.79deg,
    #1f1f1f 223.79deg 233.52deg,
    #a11a1a 233.52deg 243.25deg,
    #1f1f1f 243.25deg 252.98deg,
    #a11a1a 252.98deg 262.71deg,
    #1f1f1f 262.71deg 272.44deg,
    #a11a1a 272.44deg 282.17deg,
    #1f1f1f 282.17deg 291.9deg,
    #a11a1a 291.9deg 301.63deg,
    #1f1f1f 301.63deg 311.36deg,
    #a11a1a 311.36deg 321.09deg,
    #1f1f1f 321.09deg 330.82deg,
    #a11a1a 330.82deg 340.55deg,
    #1f1f1f 340.55deg 350.28deg,
    #a11a1a 350.28deg 360deg
  );
}

.roulette-wheel-numbers {
  position: absolute;
  inset: 0;
}

.roulette-marker {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.roulette-marker span {
  font-size: 10px;
  text-shadow: 0 1px 2px #000;
}

.roulette-marker span.red {
  color: #ff8a8a;
}

.roulette-marker span.black {
  color: #f5f5f5;
}

.roulette-marker span.green {
  color: #8fffbc;
}

.roulette-wheel-center {
  position: absolute;
  inset: 32%;
  border: 2px solid #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  font-size: 10px;
  letter-spacing: 1px;
}

.roulette-status {
  width: min(94vw, 720px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  margin-bottom: 10px;
}

.roulette-message {
  width: min(94vw, 720px);
  border: 1px solid var(--accent-dim);
  padding: 10px;
  text-align: center;
  margin-bottom: 12px;
}

.roulette-message.win {
  border-color: #0f0;
  color: #83ff83;
}

.roulette-message.loss {
  border-color: #f00;
  color: #ff8c8c;
}

.roulette-controls {
  width: min(94vw, 720px);
  border: 1px solid var(--accent-dim);
  padding: 10px;
  margin-bottom: 95px;
}

.roulette-bet-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roulette-label {
  font-size: 9px;
  letter-spacing: 1px;
  opacity: 0.8;
}

.roulette-presets {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.roulette-presets .menu-btn {
  width: 100%;
  min-width: 0;
}

.roulette-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.roulette-bet {
  border: 2px solid var(--accent);
  padding: 14px 8px;
  font-family: inherit;
  background: #111;
  color: var(--accent);
  cursor: pointer;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.roulette-bet.red {
  background: linear-gradient(#a11a1a, #6e0f0f);
}

.roulette-bet.black {
  background: linear-gradient(#1f1f1f, #060606);
}

.roulette-bet.green {
  background: linear-gradient(#0c8b3e, #075626);
  grid-column: span 2;
}

.roulette-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin-top: 10px;
}

/* --- SLOTS --- */
.slots-jackpot {
  margin: 0 0 10px;
  color: #ffd700;
  font-size: 13px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.slots-machine-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: min(94vw, 720px);
  margin: 10px auto 14px;
}

@media (max-width: 760px) {
  .slots-machine-wrap {
    flex-direction: column-reverse;
    gap: 10px;
  }
}

.slots-paytable {
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.6);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 10px;
  width: min(100%, 280px);
}

.slots-pt-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--accent-dim);
  padding-bottom: 4px;
}

.slots-pt-row .pt-val {
  color: #0f0;
}

.slots-machine {
  flex: 1;
  width: 100%;
  border: 3px solid var(--accent);
  border-radius: 16px;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, rgba(12, 139, 62, 0.35), transparent 70%),
    radial-gradient(circle at 0% 100%, rgba(161, 26, 26, 0.32), transparent 60%), #000;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(95, 238, 95, 0.3);
  position: relative;
  overflow: hidden;
}

.slots-machine-lights {
  position: absolute;
  top: 4px;
  left: 10px;
  right: 10px;
  bottom: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  pointer-events: none;
}

.slots-machine.spinning .slots-machine-lights {
  animation: slotsLightsPulse 0.5s infinite alternate;
}

@keyframes slotsLightsPulse {
  from { border-color: rgba(255, 215, 0, 0.2); box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.1); }
  to { border-color: rgba(255, 215, 0, 0.8); box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.4); }
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  position: relative;
  z-index: 2;
}

.slots-cell {
  border: 2px solid #2b2b2b;
  border-radius: 10px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(34px, 7vw, 54px);
  background: linear-gradient(180deg, #1f1f1f, #070707);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  position: relative;
}

.slots-cell-inner {
  transition: transform 0.05s linear;
}

.slots-cell[data-color="red"] {
  border-color: rgba(200, 30, 30, 0.85);
}

.slots-cell[data-color="black"] {
  border-color: rgba(140, 140, 140, 0.6);
}

.slots-cell[data-color="green"] {
  border-color: rgba(20, 180, 80, 0.9);
}

.slots-cell[data-color="gold"] {
  border-color: rgba(255, 215, 0, 0.9);
}

.slots-cell.win-pulse {
  animation: winCellPulse 1s infinite alternate;
}

@keyframes winCellPulse {
  from { box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.2), 0 0 5px rgba(255, 215, 0, 0.2); border-color: #aa9000; }
  to { box-shadow: inset 0 0 30px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.8); border-color: #ffd700; }
}

.slots-machine.spinning .slots-cell {
  animation: slotsPulse 0.15s linear infinite alternate;
}

@keyframes slotsPulse {
  from { filter: brightness(0.8); }
  to { filter: brightness(1.3); }
}

.slots-line-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  display: none;
  box-shadow: 0 0 10px #ffd700;
  background: #ffd700;
}

.slots-line-overlay.active {
  display: block;
  animation: lineFlash 0.5s infinite alternate;
}

@keyframes lineFlash {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

#slotsLineTOP { top: 30px; left: 0; right: 0; height: 4px; }
#slotsLineMID { top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%); }
#slotsLineBOT { bottom: 30px; left: 0; right: 0; height: 4px; }

#slotsLineV {
  top: 0; left: 0; right: 0; bottom: 0;
  background: transparent; box-shadow: none;
  border-top: 4px solid #ffd700; border-right: 4px solid #ffd700; border-bottom: none; border-left: none;
  clip-path: polygon(0 0, 50% 100%, 100% 0, 100% 10px, 50% calc(100% + 10px), 0 10px);
  background: #ffd700;
}
#slotsLineINV_V {
  top: 0; left: 0; right: 0; bottom: 0;
  background: transparent; box-shadow: none;
  clip-path: polygon(0 100%, 50% 0, 100% 100%, 100% calc(100% - 10px), 50% 10px, 0 calc(100% - 10px));
  background: #ffd700;
}

.slots-payline-hint {
  margin: 6px 0 4px;
  text-align: center;
  font-size: 10px;
  opacity: 0.85;
}

.slots-history {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  min-height: 34px;
}

.slots-history-empty {
  font-size: 10px;
  opacity: 0.6;
}

.slots-history-chip {
  border: 1px solid #666;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 10px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.slots-history-chip.red {
  background: #7e1313;
}

.slots-history-chip.black {
  background: #111;
}

.slots-history-chip.green,
.slots-history-chip.mix {
  background: #0b6f34;
}

.slots-history-chip.jackpot {
  background: linear-gradient(90deg, #8f7010, #f3d26b);
  color: #111;
  border-color: #f9da63;
}

/* --- BONK ARENA --- */
.bonk-sub {
  font-size: 10px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.bonk-wrap {
  width: min(840px, 95vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bonk-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

#baCanvas {
  width: min(780px, 94vw);
  height: auto;
  max-height: 62vh;
  border: 2px solid var(--accent);
  background: radial-gradient(circle at 50% 45%, #111 0%, #050505 65%);
  box-shadow: 0 0 20px var(--accent-dim);
}

.bonk-winner {
  min-height: 18px;
  font-size: 13px;
  color: #00ff9d;
}

/* --- NEON DRIFT --- */
.drift-hud {
  width: min(780px, 94vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 10px;
  margin-bottom: 8px;
}

#driftCanvas {
  width: min(780px, 94vw);
  height: auto;
  max-height: 62vh;
  border: 2px solid #43f0ff;
  box-shadow: 0 0 22px rgba(67, 240, 255, 0.35);
  background: #070a14;
}


/* CPU emulator overlay layout. */
.emu-layout {
  width: min(1100px, 94vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.emu-panel {
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.65);
  padding: 10px;
  min-height: 180px;
}
.emu-label {
  font-size: 9px;
  margin: 0 0 8px;
}
.emu-program {
  width: 100%;
  min-height: 140px;
  background: #000;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--font-type);
  font-size: 12px;
  padding: 8px;
  resize: vertical;
}
.emu-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.emu-doc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.emu-terminal-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 8px;
}

.emu-terminal-input {
  flex: 1;
  margin: 0;
  min-height: 56px;
  padding: 8px;
  border: 1px solid var(--accent);
  background: #000;
  color: var(--accent);
  font-family: var(--font-type);
  font-size: 12px;
  text-align: left;
  resize: vertical;
}

.emu-terminal-controls .term-btn {
  width: auto;
  min-width: 110px;
}

.emu-output {
  margin: 0 0 8px;
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.55);
  padding: 8px;
  min-height: 80px;
  white-space: pre-wrap;
  font-family: var(--font-type);
  font-size: 11px;
  color: var(--accent);
  text-shadow: none;
}
@media (max-width: 900px) {
  .emu-layout {
    grid-template-columns: 1fr;
  }
}

/* Ultimate Tic-Tac-Toe */
.uttt-headline {
  font-size: 12px;
  letter-spacing: 1px;
}
.uttt-subline {
  font-size: 9px;
  opacity: 0.82;
  margin: 8px 0 12px;
}
.uttt-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.uttt-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 84px;
}
.uttt-meta-cell {
  border: 1px solid var(--accent-dim);
  font-size: 12px;
  text-align: center;
  padding: 4px 0;
}
.uttt-meta-cell.x { color: #f66; }
.uttt-meta-cell.o { color: #86b9ff; }
.uttt-score {
  font-size: 10px;
}
.uttt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 8px;
  width: min(92vw, 640px);
}
.uttt-mini-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  border: 2px solid var(--accent-dim);
  padding: 2px;
  background: rgba(8, 12, 8, 0.65);
}
.uttt-mini-board.is-allowed {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-dim);
}
.uttt-mini-board.is-locked {
  opacity: 0.5;
}
.uttt-mini-board[data-winner="X"] {
  border-color: #f66;
}
.uttt-mini-board[data-winner="O"] {
  border-color: #86b9ff;
}
.uttt-mini-board[data-winner="draw"] {
  border-color: #888;
}
.uttt-cell {
  height: 38px;
  border: 1px solid var(--accent-dim);
  background: #0b0f0b;
  color: var(--accent);
  font-size: 20px;
  font-family: var(--font-main);
  cursor: pointer;
}
.uttt-cell.is-playable:hover {
  background: #152115;
}


@media (max-width: 560px) {
  .game-content-shell {
    padding: 10px 8px;
    gap: 6px;
  }

  .game-content-shell > h1 {
    font-size: clamp(20px, 6.4vw, 28px);
  }

  .top-bar-actions {
    width: 100%;
    justify-content: center;
  }

  .top-overlay-controls {
    width: 100%;
    justify-content: center;
  }

  .gamebox-header-actions {
    width: 100%;
  }

  .gamebox-header-actions .menu-btn {
    min-width: 0;
    width: 100%;
  }
}


/* Remove bottom utility bar elements inside game overlays. */
.overlay .mobile-hint.active,
.overlay .term-btn[id$="Action"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* Admin Panel Tabs Addition */
.admin-tab-content {
  display: none;
}
.admin-tab-content.active {
  display: block;
}

/* Added for FPS fullscreen */
#fpsGame:fullscreen { width: 100vw !important; height: 100vh !important; background: black; }
#fpsGame:fullscreen canvas { width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important; margin: 0 !important; object-fit: contain; }


/* ===== FPS Map Builder ===== */
body.fps-map-builder{
  --bg-darker: #090e18;
  --bg-dark: #0f172a;
  --bg-light: #1e293b;
  --bg-accent: #334155;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #334155;
}
body.fps-map-builder{margin:0;font-family:Inter,system-ui,Arial,sans-serif;background:var(--bg-darker);color:var(--text-main);height:100vh;overflow:hidden;display:flex;flex-direction:column}

/* Top Navigation */
body.fps-map-builder .top-nav{
  height: 48px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 10;
}
body.fps-map-builder .brand{ font-weight: 700; color: var(--accent); font-size: 18px; margin-right: 12px; }
body.fps-map-builder .top-nav .actions{ display: flex; gap: 8px; }
body.fps-map-builder .top-nav button{ background: var(--bg-light); border: 1px solid var(--border); color: var(--text-main); padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; }
body.fps-map-builder .top-nav button:hover{ background: var(--bg-accent); }
body.fps-map-builder .top-nav button.primary{ background: var(--accent); border-color: var(--accent); }
body.fps-map-builder .top-nav button.primary:hover{ background: var(--accent-hover); }

/* Main Layout */
body.fps-map-builder .main-layout{ flex: 1; display: flex; overflow: hidden; }

/* Sidebar */
body.fps-map-builder .sidebar{
  width: 280px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.fps-map-builder .right-sidebar{ border-right: none; border-left: 1px solid var(--border); width: 320px; }

body.fps-map-builder .section-title{
  padding: 10px 16px;
  background: var(--bg-darker);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

body.fps-map-builder .outliner-list{ flex: 1; overflow-y: auto; padding: 4px 0; }
body.fps-map-builder .outliner-item{
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
body.fps-map-builder .outliner-item:hover{ background: var(--bg-light); }
body.fps-map-builder .outliner-item.selected{ background: var(--accent); color: white; }

body.fps-map-builder .add-actions{
  padding: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
body.fps-map-builder .add-actions button{ background: var(--bg-light); border: 1px solid var(--border); color: var(--text-main); padding: 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
body.fps-map-builder .add-actions button:hover{ background: var(--bg-accent); }

/* Viewport Area */
body.fps-map-builder .viewport-area{ flex: 1; position: relative; display: flex; flex-direction: column; background: #000; }
body.fps-map-builder .viewport-toolbar{
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  z-index: 5;
}
body.fps-map-builder .viewport-toolbar button{ background: transparent; border: none; color: var(--text-muted); padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }
body.fps-map-builder .viewport-toolbar button.active{ background: var(--accent); color: white; }
body.fps-map-builder .viewport-toolbar .spacer{ width: 1px; background: var(--border); margin: 4px; }

body.fps-map-builder #view{ flex: 1; outline: none; }

/* Inspector */
body.fps-map-builder .inspector-content{ flex: 1; overflow-y: auto; padding: 16px; }
body.fps-map-builder .empty-msg{ text-align: center; color: var(--text-muted); margin-top: 40px; font-size: 14px; }
body.fps-map-builder .property-group{ margin-bottom: 20px; }
body.fps-map-builder .property-group h4{ margin: 0 0 12px 0; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
body.fps-map-builder .property-row{ display: flex; align-items: center; margin-bottom: 8px; gap: 8px; }
body.fps-map-builder .property-row label{ flex: 1; font-size: 12px; color: var(--text-muted); }
body.fps-map-builder .property-row input, body.fps-map-builder .property-row select{ width: 140px; background: var(--bg-darker); border: 1px solid var(--border); color: var(--text-main); padding: 4px 8px; border-radius: 4px; font-size: 12px; }
body.fps-map-builder .property-row input:focus{ border-color: var(--accent); outline: none; }

/* Bottom Bar */
body.fps-map-builder .bottom-bar{
  height: 24px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-muted);
}

body.fps-map-builder .kbd{ background: var(--bg-light); border: 1px solid var(--border); padding: 1px 4px; border-radius: 3px; font-family: monospace; font-size: 10px; }

/* ===== Shadow Assassin Safe Rooms ===== */
body.shadow-assassin-safe-rooms *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

body.shadow-assassin-safe-rooms{
            background: #0a0a0a;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            font-family: 'Courier New', monospace;
            overflow: hidden;
        }

body.shadow-assassin-safe-rooms #gameCanvas{
            border: 2px solid #8b4513;
            box-shadow: 0 0 30px rgba(139, 69, 19, 0.5);
            image-rendering: pixelated;
            image-rendering: crisp-edges;
            width: min(calc(100vw - 24px), calc((100vh - 24px) * 1.7143), 1200px);
            max-width: 1200px;
            aspect-ratio: 1200 / 700;
            height: auto;
            max-height: calc(100vh - 24px);
        }

body.shadow-assassin-safe-rooms #ui{
            position: absolute;
            top: 20px;
            left: 20px;
            color: #fff;
            font-size: 14px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            z-index: 10;
            width: max-content;
            max-width: min(260px, calc(100vw - 40px));
        }

body.shadow-assassin-safe-rooms .special-abilities-panel{
            margin-top: 15px;
            padding-top: 10px;
        }

body.shadow-assassin-safe-rooms #keybinds{
            position: absolute;
            top: 20px;
            right: 20px;
            color: #fff;
            font-size: 13px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            z-index: 10;
            background: rgba(0, 0, 0, 0.7);
            padding: 15px;
            border: 2px solid #8b4513;
            border-radius: 5px;
            min-width: 200px;
        }

body.shadow-assassin-safe-rooms #keybinds h3{
            color: #ffd700;
            margin-bottom: 10px;
            font-size: 16px;
            text-align: center;
        }

body.shadow-assassin-safe-rooms .keybind-item{
            display: flex;
            justify-content: space-between;
            margin: 5px 0;
            padding: 3px 0;
            border-bottom: 1px solid rgba(139, 69, 19, 0.3);
        }

body.shadow-assassin-safe-rooms .keybind-key{
            color: #ffd700;
            font-weight: bold;
        }

body.shadow-assassin-safe-rooms .keybind-ability{
            color: #ccc;
        }

body.shadow-assassin-safe-rooms #mythicPanel{
            position: absolute;
            top: 20px;
            left: 250px;
            background: rgba(0, 0, 0, 0.95);
            border: 3px solid #ffd700;
            padding: 15px;
            border-radius: 5px;
            max-height: 80vh;
            min-width: 400px;
            max-width: 500px;
            overflow-y: auto;
            display: none;
            z-index: 100;
            box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
        }

body.shadow-assassin-safe-rooms #mythicPanel h2{
            color: #ffd700;
            text-align: center;
            margin-bottom: 15px;
            font-size: 18px;
            text-shadow: 0 0 15px #ffd700;
            animation: mythicPulse 2s ease-in-out infinite;
        }

body.shadow-assassin-safe-rooms .mythic-ability{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px;
            margin: 5px 0;
            background: rgba(139, 69, 19, 0.3);
            border: 1px solid #8b4513;
            border-radius: 3px;
            cursor: pointer;
            transition: all 0.2s;
        }

body.shadow-assassin-safe-rooms .mythic-ability:hover{
            background: rgba(139, 69, 19, 0.5);
            border-color: #ffd700;
        }

body.shadow-assassin-safe-rooms .mythic-ability.active{
            background: rgba(255, 215, 0, 0.2);
            border-color: #ffd700;
        }

body.shadow-assassin-safe-rooms .mythic-ability-name{
            color: #fff;
            font-size: 12px;
            flex: 1;
        }

body.shadow-assassin-safe-rooms .mythic-ability-toggle{
            width: 40px;
            height: 20px;
            background: #444;
            border: 2px solid #666;
            border-radius: 10px;
            position: relative;
            transition: all 0.3s;
        }

body.shadow-assassin-safe-rooms .mythic-ability.active .mythic-ability-toggle{
            background: #4caf50;
            border-color: #66bb6a;
        }

body.shadow-assassin-safe-rooms .mythic-ability-toggle::after{
            content: '';
            position: absolute;
            width: 12px;
            height: 12px;
            background: #fff;
            border-radius: 50%;
            top: 2px;
            left: 2px;
            transition: all 0.3s;
        }

body.shadow-assassin-safe-rooms .mythic-ability.active .mythic-ability-toggle::after{
            left: 20px;
        }

body.shadow-assassin-safe-rooms #mythicToggleBtn{
            position: absolute;
            top: 120px;
            left: 20px;
            background: linear-gradient(135deg, #daa520, #ffd700);
            border: 3px solid #ffd700;
            padding: 12px 18px;
            color: #000;
            font-size: 14px;
            font-weight: bold;
            font-family: 'Courier New', monospace;
            cursor: pointer;
            display: none;
            z-index: 10;
            border-radius: 5px;
            box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
            animation: godPulse 2s ease-in-out infinite;
        }

        @keyframes godPulse {
            0%, 100% {
                box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
            }
            50% {
                box-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
            }
        }

body.shadow-assassin-safe-rooms #mythicToggleBtn:hover{
            background: linear-gradient(135deg, #ffd700, #ffed4e);
            transform: scale(1.08);
            box-shadow: 0 0 35px rgba(255, 215, 0, 1);
        }
        }

body.shadow-assassin-safe-rooms .health-bar{
            width: 200px;
            height: 20px;
            background: #222;
            border: 2px solid #8b4513;
            margin-top: 5px;
            position: relative;
        }

body.shadow-assassin-safe-rooms .health-fill{
            height: 100%;
            background: linear-gradient(90deg, #dc143c, #8b0000);
            transition: width 0.3s;
        }

body.shadow-assassin-safe-rooms .controls{
            position: absolute;
            bottom: 20px;
            left: 20px;
            color: #aaa;
            font-size: 12px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            display: none;
        }

body.shadow-assassin-safe-rooms #tutorialOverlay{
            position: absolute;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.85);
            z-index: 300;
        }

body.shadow-assassin-safe-rooms .tutorial-card{
            width: min(92vw, 720px);
            background: rgba(10, 10, 10, 0.96);
            border: 3px solid #ffd700;
            border-radius: 8px;
            padding: 22px;
            color: #fff;
            box-shadow: 0 0 30px rgba(255, 215, 0, 0.35);
        }

body.shadow-assassin-safe-rooms .tutorial-card h2{
            color: #ffd700;
            margin-bottom: 12px;
            text-align: center;
        }

body.shadow-assassin-safe-rooms .tutorial-grid{
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px 16px;
            margin: 12px 0 16px;
            font-size: 13px;
        }

body.shadow-assassin-safe-rooms .tutorial-actions{
            display: flex;
            gap: 10px;
            justify-content: center;
        }

body.shadow-assassin-safe-rooms .title{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: #fff;
            z-index: 5;
            pointer-events: none;
        }

body.shadow-assassin-safe-rooms .title h1{
            font-size: 48px;
            margin-bottom: 20px;
            color: #8b4513;
            text-shadow: 0 0 20px rgba(139, 69, 19, 0.8);
        }

body.shadow-assassin-safe-rooms .title p{
            font-size: 18px;
            color: #ccc;
        }

body.shadow-assassin-safe-rooms .fade-out{
            animation: fadeOut 2s forwards;
        }

        @keyframes fadeOut {
            to { opacity: 0; }
        }

body.shadow-assassin-safe-rooms .upgrade-screen{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 100;
        }

body.shadow-assassin-safe-rooms .upgrade-container{
            text-align: center;
            color: #fff;
        }

body.shadow-assassin-safe-rooms .upgrade-title{
            font-size: 36px;
            color: #ffd700;
            margin-bottom: 30px;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        }

body.shadow-assassin-safe-rooms .upgrade-options{
            display: flex;
            gap: 30px;
            justify-content: center;
        }

body.shadow-assassin-safe-rooms .upgrade-card{
            background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
            border: 3px solid #8b4513;
            padding: 20px;
            width: 250px;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
        }

body.shadow-assassin-safe-rooms .upgrade-card:hover{
            transform: translateY(-10px);
            border-color: #ffd700;
            box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
        }

body.shadow-assassin-safe-rooms .upgrade-card h3{
            color: #ffd700;
            font-size: 22px;
            margin-bottom: 10px;
        }

body.shadow-assassin-safe-rooms .upgrade-card .level{
            color: #ff8c00;
            font-size: 14px;
            margin-bottom: 10px;
        }

body.shadow-assassin-safe-rooms .upgrade-card p{
            color: #ccc;
            font-size: 14px;
            line-height: 1.5;
        }

body.shadow-assassin-safe-rooms .upgrade-card.mythic{
            border-color: #ff00ff;
            animation: mythicGlow 2s ease-in-out infinite;
        }

body.shadow-assassin-safe-rooms .upgrade-card.mythic h3{
            color: #ff00ff;
            text-shadow: 0 0 15px #ff00ff;
        }

        @keyframes mythicGlow {
            0%, 100% {
                box-shadow: 0 0 20px rgba(255, 0, 255, 0.6), 0 0 40px rgba(255, 0, 255, 0.4);
            }
            50% {
                box-shadow: 0 0 30px rgba(255, 0, 255, 0.8), 0 0 60px rgba(255, 0, 255, 0.6);
            }
        }

body.shadow-assassin-safe-rooms .game-over-screen{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.95);
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 100;
        }

body.shadow-assassin-safe-rooms .game-over-title{
            font-size: 48px;
            color: #ff0000;
            margin-bottom: 30px;
            text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
        }

body.shadow-assassin-safe-rooms .game-over-stats{
            color: #ffd700;
            font-size: 20px;
            margin-bottom: 30px;
        }

body.shadow-assassin-safe-rooms .button-container{
            display: flex;
            gap: 20px;
        }

body.shadow-assassin-safe-rooms .game-button{
            background: linear-gradient(135deg, #8b4513, #654321);
            border: 3px solid #ffd700;
            padding: 15px 40px;
            color: #fff;
            font-size: 18px;
            font-family: 'Courier New', monospace;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
        }

body.shadow-assassin-safe-rooms .game-button:hover{
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(255, 215, 0, 0.4);
            background: linear-gradient(135deg, #a0522d, #8b4513);
        }

body.shadow-assassin-safe-rooms .game-button:active{
            transform: translateY(-2px);
        }
        
body.shadow-assassin-safe-rooms .game-button:disabled{
            opacity: 0.5;
            cursor: not-allowed;
            background: linear-gradient(135deg, #4a4a4a, #2a2a2a);
            border-color: #666;
        }
        
body.shadow-assassin-safe-rooms .game-button:disabled:hover{
            transform: none;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
            background: linear-gradient(135deg, #4a4a4a, #2a2a2a);
        }
        
body.shadow-assassin-safe-rooms .main-menu{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 200;
        }

body.shadow-assassin-safe-rooms .main-menu h1{
            font-size: 64px;
            color: #8b4513;
            text-shadow: 0 0 30px rgba(139, 69, 19, 0.9);
            margin-bottom: 50px;
            animation: titlePulse 2s ease-in-out infinite;
        }

        @keyframes titlePulse {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.05);
            }
        }

body.shadow-assassin-safe-rooms .menu-buttons{
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

body.shadow-assassin-safe-rooms .menu-button{
            background: linear-gradient(135deg, #8b4513, #654321);
            border: 3px solid #ffd700;
            padding: 20px 60px;
            color: #fff;
            font-size: 24px;
            font-family: 'Courier New', monospace;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
            min-width: 300px;
        }

body.shadow-assassin-safe-rooms .menu-button:hover{
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(255, 215, 0, 0.4);
            background: linear-gradient(135deg, #a0522d, #8b4513);
        }

body.shadow-assassin-safe-rooms .settings-menu{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.95);
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 201;
        }

body.shadow-assassin-safe-rooms .settings-container{
            background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
            border: 3px solid #8b4513;
            padding: 40px;
            max-width: 600px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }

body.shadow-assassin-safe-rooms .settings-container h2{
            color: #ffd700;
            font-size: 32px;
            margin-bottom: 30px;
            text-align: center;
        }

body.shadow-assassin-safe-rooms .skill-tree-container{
            background: radial-gradient(circle at top, #1a2340 0%, #0b0f1d 65%, #06070f 100%);
            border: 2px solid #33d2ff;
            box-shadow: 0 0 25px rgba(51, 210, 255, 0.35);
            padding: 28px;
            max-width: 980px;
            width: 95%;
            max-height: 86vh;
            overflow-y: auto;
        }

body.shadow-assassin-safe-rooms .skill-tree-grid{
            display: grid;
            grid-template-columns: repeat(3, minmax(200px, 1fr));
            gap: 14px;
            margin-top: 14px;
        }

body.shadow-assassin-safe-rooms .skill-node{
            background: linear-gradient(160deg, rgba(20, 29, 55, 0.95), rgba(12, 16, 30, 0.95));
            border: 1px solid #2f4f7a;
            border-left: 4px solid #33d2ff;
            color: #dce8ff;
            padding: 12px;
            min-height: 130px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
        }

body.shadow-assassin-safe-rooms .skill-node:hover{
            transform: translateY(-2px);
            box-shadow: 0 0 12px rgba(51, 210, 255, 0.4);
            border-color: #56e0ff;
        }

body.shadow-assassin-safe-rooms .skill-node.locked{
            opacity: 0.62;
            border-left-color: #607190;
            filter: grayscale(0.35);
        }

body.shadow-assassin-safe-rooms .skill-node.maxed{
            border-left-color: #8dff89;
            box-shadow: 0 0 10px rgba(141, 255, 137, 0.45);
        }

body.shadow-assassin-safe-rooms .skill-node button{
            margin-top: auto;
            padding: 8px 10px;
            border: 1px solid #37b6ff;
            background: rgba(10, 27, 47, 0.85);
            color: #9be7ff;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            font-size: 12px;
        }

body.shadow-assassin-safe-rooms .skill-node button:disabled{
            opacity: 0.45;
            cursor: not-allowed;
        }

body.shadow-assassin-safe-rooms .setting-item{
            margin-bottom: 25px;
            color: #fff;
        }

body.shadow-assassin-safe-rooms .setting-item label{
            display: block;
            margin-bottom: 10px;
            font-size: 16px;
            color: #ffd700;
        }

body.shadow-assassin-safe-rooms .setting-item input[type="range"]{
            width: 100%;
            height: 8px;
            background: #444;
            outline: none;
            border-radius: 4px;
        }

body.shadow-assassin-safe-rooms .setting-item input[type="range"]::-webkit-slider-thumb{
            width: 20px;
            height: 20px;
            background: #ffd700;
            cursor: pointer;
            border-radius: 50%;
        }

body.shadow-assassin-safe-rooms .setting-value{
            display: inline-block;
            margin-left: 15px;
            color: #fff;
            font-weight: bold;
        }

body.shadow-assassin-safe-rooms .toggle-button{
            padding: 10px 20px;
            background: #444;
            border: 2px solid #666;
            color: #fff;
            cursor: pointer;
            transition: all 0.3s;
            font-family: 'Courier New', monospace;
        }

body.shadow-assassin-safe-rooms .toggle-button.active{
            background: #ffd700;
            border-color: #ffd700;
            color: #000;
        }

body.shadow-assassin-safe-rooms .setting-item select{
            width: 100%;
            padding: 10px;
            background: #444;
            border: 2px solid #666;
            color: #fff;
            font-family: 'Courier New', monospace;
            font-size: 14px;
        }

body.shadow-assassin-safe-rooms #safeRoomScreen{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 50, 0, 0.95);
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 150;
        }

body.shadow-assassin-safe-rooms #safeRoomScreen h2{
            color: #00ff00;
            font-size: 48px;
            margin-bottom: 20px;
            text-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
        }

body.shadow-assassin-safe-rooms #safeRoomScreen p{
            color: #90ee90;
            font-size: 20px;
            margin-bottom: 40px;
            text-align: center;
            max-width: 600px;
        }
