/* Base terminal styling */
body {
  background-color: #141615;
  color: #33ff33;
  font-family: 'Courier New', Courier, monospace;
  padding: 30px 15px;
  text-shadow: 0 0 5px rgba(51, 255, 51, 0.4);
  margin: 0;
}

/* Subtle CRT scanline effect */
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%);
  z-index: 2;
  background-size: 100% 4px;
  pointer-events: none;
}

/* Main terminal container */
.ascii-box {
  border: 4px double #33ff33;
  padding: 25px;
  max-width: 850px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Top control hint bar */
.controls-hint {
  font-size: 0.85rem;
  border-bottom: 1px dashed #33ff33;
  padding-bottom: 10px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  opacity: 0.9;
}

/* Main Navigation Menu */
.menu {
  border-bottom: 4px double #33ff33;
  padding-bottom: 15px;
  margin-bottom: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.menu-item {
  color: #33ff33;
  text-decoration: none;
  padding: 6px 12px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

/* Active page tab (solid highlight) */
.menu-item.active-page {
  background-color: #33ff33;
  color: #141615;
  font-weight: bold;
}

/* Universal keyboard/hover cursor focus (softer blink on any focused element) */
.cursor-focus {
  outline: 2px dashed #33ff33 !important;
  outline-offset: 3px;
  animation: soft-cursor-blink 1.4s infinite;
}

@keyframes soft-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Section visibility */
.page-section {
  display: none;
}
.page-section.visible {
  display: block;
}

/* Buttons */
.btn-terminal {
  background-color: #141615;
  color: #33ff33;
  border: 2px solid #33ff33;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  font-weight: bold;
  padding: 8px 18px;
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  text-shadow: 0 0 5px rgba(51, 255, 51, 0.4);
}

.btn-terminal:hover:not(:disabled) {
  background-color: #33ff33;
  color: #141615;
}

.btn-terminal:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Slot Machine on HOME */
.slot-container {
  border: 2px dashed #33ff33;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
}

.reels {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 15px 0;
}

.reel {
  border: 4px double #33ff33;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  background-color: #0e100f;
}

.status-log {
  margin-top: 15px;
  font-weight: bold;
  min-height: 20px;
}

.cta-center {
  margin-top: 20px;
  text-align: center;
}

/* Casino Directory Filters & Table */
.filter-group {
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-label {
  font-weight: bold;
  margin-right: 5px;
}

.filter-btn {
  background: transparent;
  color: #33ff33;
  border: 1px solid #33ff33;
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
}

.filter-btn:hover,
.filter-btn.selected {
  background-color: #33ff33;
  color: #141615;
  font-weight: bold;
}

.casino-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.casino-table th,
.casino-table td {
  border: 1px solid #33ff33;
  padding: 12px 10px;
  text-align: left;
}

.casino-table th {
  background-color: rgba(51, 255, 51, 0.15);
}

.casino-table tr:hover {
  background-color: rgba(51, 255, 51, 0.08);
}

/* Contact Form */
.terminal-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 500px;
  margin-top: 20px;
}

.terminal-input {
  background-color: #0e100f;
  border: 2px solid #33ff33;
  color: #33ff33;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px;
  outline: none;
}

.terminal-input:focus {
  box-shadow: 0 0 8px rgba(51, 255, 51, 0.6);
}

/* Footer */
.terminal-footer {
  border-top: 4px double #33ff33;
  margin-top: 30px;
  padding-top: 15px;
  font-size: 0.8rem;
  opacity: 0.85;
  line-height: 1.5;
}

/* Bakgrundscanvas för rörliga ASCII-tecken */
#ascii-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* Ge huvudrutan en solid bakgrund så texten bakom inte blöder igenom */
.ascii-box {
  background-color: #141615;
}

/* Synkroniserat analogt CRT-spänningsfall (var 5.5:e sekund, rad-för-rad-våg) */
.terminal-input::placeholder {
  color: #239c23;
  opacity: 1;
  animation: crt-single-dip 5.5s linear infinite;
}

/* Måttlig fördröjning (90ms) så man ser vågen gå rad för rad */
input.terminal-input:nth-of-type(1)::placeholder {
  animation-delay: 0s;
}

input.terminal-input:nth-of-type(2)::placeholder {
  animation-delay: 0.09s;
}

textarea.terminal-input::placeholder {
  animation-delay: 0.18s;
}

@keyframes crt-single-dip {
  /* Stabilt och korrekt sken under nästan hela cykeln */
  0%, 60%, 63.2%, 100% {
    color: #239c23;
    text-shadow: 0 0 3px rgba(51, 255, 51, 0.22);
  }
  /* Ett enda kort spänningsfall */
  61.6% {
    color: #1a731a;
    text-shadow: none;
  }
}

/* Helt stabilt när man klickar i fältet */
.terminal-input:focus::placeholder {
  animation: none;
  color: #1b781b;
  text-shadow: none;
}
