* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #1a1a1a;
  color: #00ff00;
  font-family: 'VT323', monospace;
  font-size: 24px;
  line-height: 1.4;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

  .reveal-logout {
    margin-top: 20px;
  }

  .reveal-logout a {
    font-size: 14px;
  }
}

/* ============================================================================
   LOGIN SCREEN
   ============================================================================ */

#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
}

#terminal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 60px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#output {
  padding-bottom: 10px;
}

#output .line {
  white-space: pre-wrap;
  word-break: break-word;
}

#output .line.error {
  color: #ff4444;
}

#output .line.success {
  color: #44ff44;
}

#output .line.info {
  color: #888;
}

#input-line {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: #1a1a1a;
  z-index: 101;
}

#input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: transparent;
  font-family: 'VT323', monospace;
  font-size: 24px;
  caret-color: transparent;
  z-index: 1;
}

#input::placeholder {
  color: transparent;
}

#typed-text {
  color: #00ff00;
  font-family: 'VT323', monospace;
  font-size: 24px;
}

#cursor {
  color: #00ff00;
  animation: blink 1s step-end infinite;
  font-size: 24px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ============================================================================
   HOME SCREEN
   ============================================================================ */

#home-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  padding: 30px;
  z-index: 50;
  overflow-y: auto;
}

#home-screen:not(.hidden) {
  display: flex;
}

/* Presence Bar */
#presence-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #333;
  border-radius: 4px;
}

#presence-list {
  display: flex;
  gap: 12px;
  align-items: center;
}

.presence-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #888;
}

.presence-user.online {
  color: #00ff00;
}

.presence-user.selector {
  color: #ffcc00;
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #444;
}

.presence-user.online .presence-dot {
  background: #00ff00;
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

.presence-user.selector .presence-dot {
  background: #ffcc00;
  box-shadow: 0 0 6px rgba(255, 204, 0, 0.5);
}

.logout-link {
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}

.logout-link:hover {
  color: #ff3333;
}

#selector-info {
  font-size: 14px;
  color: #666;
}

#selector-label {
  letter-spacing: 1px;
}

#selector-label .selector-name {
  color: #ffcc00;
  font-weight: bold;
}

#selector-label .your-turn {
  color: #00ff00;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.section-title {
  font-size: 20px;
  color: #888;
  margin-bottom: 20px;
  letter-spacing: 4px;
}

/* Tonight's Lineup */
#tonight-section {
  flex: 0 0 auto;
  margin-bottom: 40px;
}

#tonight-slots {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.slot {
  width: 230px;
  height: 107px;
  border: 2px dashed #444;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
}

.slot.drag-over {
  border-color: #00ff00;
  background: rgba(0, 255, 0, 0.1);
}

.slot.filled {
  border-style: solid;
  border-color: #00ff00;
}

.slot-name {
  font-size: 18px;
  color: #666;
  letter-spacing: 2px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
}

.slot:not(.filled) {
  cursor: pointer;
}

.dice-btn {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.dice-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #00ff00;
  stroke-width: 2;
}

.dice-btn svg circle {
  fill: #00ff00;
  stroke: none;
}

.dice-btn .dice-label {
  font-size: 14px;
  color: #00ff00;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.slot:not(.filled):hover .dice-btn {
  opacity: 1;
}

.slot.filled .slot-name,
.slot.filled .dice-btn {
  display: none;
}

/* Slot machine spinning state */
.slot.spinning {
  cursor: default;
  border-color: #00ff00;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

.slot.spinning .slot-name,
.slot.spinning .dice-btn {
  display: none;
}

/* After Hours slot fade animation */
.slot.fade-in {
  animation: slotFadeIn 0.3s ease-out forwards;
}

.slot.fade-out {
  animation: slotFadeOut 0.3s ease-out forwards;
}

@keyframes slotFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slotFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.slot-machine-card {
  width: 100%;
  height: 100%;
  border: none;
  animation: slotFlicker 0.1s ease-in-out;
}

.slot-machine-card .game-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes slotFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Available Games */
#games-section {
  flex: 0 0 auto;
  margin-bottom: 30px;
}

#games-list {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  padding: 10px;
}

/* Upcoming Games */
#upcoming-section {
  flex: 0 0 auto;
}

#upcoming-list {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  padding: 10px;
}

/* Upcoming card styling */
.game-card.upcoming {
  position: relative;
}

/* Only show pointer cursor if the card has a context menu (Steam ID) */
.game-card.upcoming[data-steam-id] {
  cursor: pointer;
}

.game-card.upcoming[data-steam-id]:hover {
  border-color: #00ff00;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 255, 0, 0.3);
}

/* Coming Soon overlay for non-Steam games */
.game-card.coming-soon::after {
  content: 'COMING SOON';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  color: #00ff00;
  font-family: 'VT323', monospace;
  font-size: 14px;
  text-align: center;
  padding: 20px 5px 5px;
  pointer-events: none;
}

/* Backlog Section Lock */
#upcoming-section.locked {
  display: none;
}

/* Backlog Context Menu */
.backlog-menu {
  position: absolute;
  background: #1a1a1a;
  border: 2px solid #00ff00;
  z-index: 1000;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.backlog-menu-item {
  padding: 8px 12px;
  color: #00ff00;
  font-family: 'VT323', monospace;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.backlog-menu-item:hover {
  background: #00ff00;
  color: #1a1a1a;
}

/* Retired Games */
#retired-section {
  flex: 0 0 auto;
  opacity: 0.6;
}

#retired-section:hover {
  opacity: 0.8;
}

#retired-list {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  padding: 10px;
}

/* Retired card styling */
.game-card.retired {
  cursor: default;
  filter: grayscale(0.7);
}

/* Retired cards with pages get hover effects */
.game-card.retired.has-page {
  cursor: pointer;
}

.game-card.retired.has-page:hover {
  filter: grayscale(0.3);
  border-color: #00ff00;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 255, 0, 0.3);
}

.game-card.retired .game-overlay {
  opacity: 1;
}

.game-card.retired .game-name {
  color: #888;
}

.game-card {
  width: 230px;
  height: 107px;
  background: #252525;
  border: 2px solid #444;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
  overflow: visible;
}

.game-card:not(.retired):hover {
  border-color: #00ff00;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 255, 0, 0.3);
}

.game-card.dragging {
  opacity: 0.5;
  transform: none;
  border: 2px solid #00ff00;
}

.game-card .game-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.8);
  transition: filter 0.2s ease;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.game-card:hover .game-img {
  filter: saturate(1);
}

/* SpiderHeck details text */
.game-card.has-details::after {
  content: 'Click For More';
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  color: #00ff00;
  font-family: 'VT323', monospace;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.game-card.has-details:hover::after {
  opacity: 1;
}

.game-card .game-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.game-card:hover .game-overlay {
  opacity: 1;
}

.game-card .game-name {
  font-size: 14px;
  color: #00ff00;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* Click hint */
.click-hint {
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  color: #00ff00;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.game-card:hover .click-hint {
  opacity: 1;
}

/* Card in slot */
.slot .game-card {
  width: 100%;
  height: 100%;
  border: none;
}

.slot .game-card:hover {
  transform: none;
  box-shadow: none;
}

/* Click hint in slots - show below the slot on hover */
.slot .game-card .click-hint {
  bottom: -28px;
}

.slot:hover .game-card .click-hint {
  opacity: 1;
}

/* Remove button on slotted cards */
.slot .game-card .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: #ff4444;
  color: #1a1a1a;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.slot:hover .game-card .remove-btn {
  opacity: 1;
}

/* ============================================================================
   PIXELATION OVERLAY
   ============================================================================ */

#pixel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
  display: none;
}

#pixel-overlay.active {
  display: block;
}

/* ============================================================================
   SCANLINE EFFECT (applies to both screens)
   ============================================================================ */

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 1000;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

::selection {
  background: #00ff00;
  color: #1a1a1a;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: #333;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}
