/* ================================================================
   THEME — Variables, Reset, Global Styles, CRT Overlay
   ================================================================ */

:root {
  --green:      #33FF33;
  --green-dim:  #1a8c1a;
  --green-dark: #0a2e0a;
  --cyan:       #00FFFF;
  --magenta:    #FF00FF;
  --yellow:     #FFFF00;
  --red:        #FF3333;
  --amber:      #FF8C00;
  --black:      #000000;
  --gray:       #333333;

  --font-body:  'VT323', 'Courier New', monospace;
  --font-pixel: 'Press Start 2P', 'Courier New', monospace;

  --hdr-height: 54px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background: var(--black);
  color: var(--green);
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.4;
  min-height: 100%;
  overflow-x: hidden;
  /* prevent FOUC flash before fonts load */
  -webkit-font-smoothing: none;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--green-dim); }

/* --- Utilities --- */
.hidden { display: none !important; }
.green   { color: var(--green); }
.cyan    { color: var(--cyan); }
.red     { color: var(--red); }
.yellow  { color: var(--yellow); }
.magenta { color: var(--magenta); }

/* --- Blink animations (all <= 1 Hz — safe) --- */
@keyframes blink-1hz {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.blink { animation: blink-1hz 1s step-start infinite; }

/* Reduce Motion overrides */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

/* --- CRT Scanline Overlay --- */
#crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  /* scanlines */
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
  /* vignette */
  box-shadow: inset 0 0 140px rgba(0,0,0,0.65);
  opacity: 1;
  transition: opacity 0.3s;
}
body:not(.crt-on) #crt-overlay { opacity: 0; }

/* --- Header --- */
#app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--hdr-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  background: var(--black);
  border-bottom: 2px solid var(--green);
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
  letter-spacing: 2px;
  white-space: nowrap;
}

.demo-badge {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  padding: 3px 5px;
  letter-spacing: 1px;
  white-space: nowrap;
  animation: blink-1hz 1s step-start infinite;
}

.hdr-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hdr-player {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.hdr-name {
  font-size: 16px;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
}

.hdr-balance {
  font-size: 20px;
  color: var(--green);
}

.btn-icon {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  padding: 3px 8px;
  position: relative;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--green); color: var(--black); }

.btn-icon-person { padding: 4px 8px; }

.notif-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--red);
  color: var(--black);
  font-family: var(--font-pixel);
  font-size: 8px;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

/* --- Notification Panel --- */
.notif-panel {
  position: fixed;
  top: var(--hdr-height);
  right: 0;
  z-index: 500;
  width: min(360px, 100vw);
  max-height: calc(100vh - var(--hdr-height));
  background: var(--black);
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--green-dim);
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--green);
  flex-shrink: 0;
}

.notif-panel-hdr button {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--red);
  background: transparent;
  border: 1px solid var(--red);
  padding: 2px 6px;
}
.notif-panel-hdr button:hover { background: var(--red); color: var(--black); }

.notif-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.notif-empty {
  color: var(--green-dim);
  text-align: center;
  padding: 20px;
  font-size: 18px;
}

.notif-item {
  padding: 8px 14px;
  border-bottom: 1px solid var(--green-dark);
  font-size: 18px;
  line-height: 1.3;
}
.notif-item .notif-time { font-size: 14px; color: var(--green-dim); display: block; margin-top: 2px; }
.notif-item.notif-unread { border-left: 3px solid var(--cyan); }

/* --- Toasts --- */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(440px, 90vw);
}

.toast {
  background: var(--black);
  border: 2px solid var(--green);
  color: var(--green);
  font-family: var(--font-body);
  font-size: 20px;
  padding: 10px 18px;
  width: 100%;
  text-align: center;
  animation: toast-in 0.2s ease-out, toast-out 0.3s 2.7s ease-in forwards;
  pointer-events: auto;
}
.toast.toast-win   { border-color: var(--green); color: var(--green); }
.toast.toast-loss  { border-color: var(--red); color: var(--red); }
.toast.toast-info  { border-color: var(--cyan); color: var(--cyan); }
.toast.toast-warn  { border-color: var(--yellow); color: var(--yellow); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
