:root {
  /* Default Theme: NOIR (White/Black) */
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --accent-color: #1a1a1a;
  --secondary-bg: #f4f4f4;
  --border-color: #1a1a1a;
  --highlight-color: #e6e6e6;

  /* Shared */
  --shadow-color: rgba(0, 0, 0, 0.2);
}

/* Yellow Theme Override */
[data-theme="yellow"] {
  --bg-color: #fff100;
  --text-color: #1a1a1a;
  --accent-color: #ffffff;
  --secondary-bg: #fff;
  --border-color: #1a1a1a;
  --highlight-color: #fffaec;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Bebas Neue", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  overflow: hidden; /* Full screen feel */
  transition:
    background-color 0.3s,
    color 0.3s;
}

/* View Transition API */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.container {
  width: 100%;
  height: 100%;
  position: relative;
}

#effect-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50; /* Above game elements, below modals */
}

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition:
    opacity 0.5s ease-in-out,
    transform 0.5s ease-in-out;
  padding: 20px;
}

.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  z-index: -1;
}

/* MAIN MENU STYLES */
#main-menu {
  justify-content: center;
  z-index: 10;
}

.titles {
  font-size: 8rem;
  line-height: 0.9;
  text-align: center;
  margin-bottom: 50px;
  text-transform: uppercase;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

.main-btn {
  width: 100%;
  padding: 20px;
  font-size: 2.5rem;
  background: var(--text-color);
  color: var(--bg-color);
  border: none;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 2px;
  box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.1);
}

.main-btn:hover {
  transform: translate(-4px, -4px);
  box-shadow: 14px 14px 0px rgba(0, 0, 0, 0.1);
}

.main-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.1);
}

.secondary-btn {
  background: transparent;
  border: 3px solid var(--border-color);
  padding: 10px 20px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.secondary-btn:hover {
  background: var(--text-color);
  color: var(--bg-color);
}

.online-btn {
  margin-top: 15px;
  background: var(--bg-color);
  color: var(--text-color);
  border: 4px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.online-btn::before {
  content: "● LIVE";
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 0.8rem;
  color: #ff0000;
  animation: blink 1s infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ONLINE LOBBY STYLES (Variables) */
.input-field {
  width: 100%;
  padding: 15px;
  font-size: 1.5rem;
  border: 3px solid var(--border-color);
  background: var(--secondary-bg);
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  color: var(--text-color);
  transition: all 0.2s;
}

.input-field:focus {
  outline: none;
  background: var(--highlight-color);
  box-shadow: 5px 5px 0px var(--shadow-color);
}

.room-action-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 15px;
  background: rgba(
    255,
    255,
    255,
    0.5
  ); /* Keep semi-transparent or use variable? Keep for glass effect */
  padding: 20px;
  border: 3px dashed var(--border-color);
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border-color);
  border-top-color: var(--bg-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}
.online-btn:hover {
  background: var(--text-color);
  color: var(--bg-color);
  transform: translate(-4px, -4px);
  box-shadow: 14px 14px 0px rgba(0, 0, 0, 0.1); /* Match main-btn hover */
}

.settings-group {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.settings-group label {
  font-size: 1.5rem;
  font-weight: bold;
}

/* Modal */
/* ABOUT SCREEN STYLES (Pure Text + Custom Arrow) */
/* ABOUT SCREEN STYLES (Pure Text with Scrolling) */
#about-page-body {
  background: var(--bg-color);
  min-height: 100vh;
  padding: 60px 20px;
  overflow-y: auto; /* Enable vertical scroll */
  display: flex;
  justify-content: center;
}

.about-wrapper {
  width: 100%;
  max-width: 800px;
  height: auto;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  /* border: 8px solid var(--border-color); Removed card style */
  padding: 60px 40px;
  /* background: var(--secondary-bg); Removed card style */
  /* box-shadow: 20px 20px 0px var(--shadow-color); Removed card style */
}

/* Custom Navigation Button (Circle with Arrow) */
.custom-nav-btn {
  position: absolute;
  top: -40px;
  left: -40px;
  width: 80px;
  height: 80px;
  background: var(--text-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 50;
  text-decoration: none; /* For <a> tag */
}

.custom-nav-btn:hover {
  transform: scale(1.1) rotate(180deg);
}

.arrow-shape {
  width: 24px;
  height: 24px;
  border-left: 4px solid var(--bg-color);
  border-bottom: 4px solid var(--bg-color);
  transform: rotate(45deg);
  position: relative;
  left: 4px;
}

/* Typography Layout */
.content-block.text-content {
  display: block; /* Normal block flow for long text */
}

.huge-title {
  font-size: 5rem;
  line-height: 0.9;
  text-transform: uppercase;
  margin-bottom: 40px;
  border-bottom: 8px solid var(--border-color);
  padding-bottom: 20px;
  width: 100%;
  word-break: break-word;
}

.article-section {
  margin-bottom: 50px;
}

.article-section h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  background: var(--text-color);
  color: var(--bg-color);
  display: inline-block;
  padding: 5px 10px;
  transform: skew(-5deg);
}

.article-section p {
  font-family: "Roboto Mono", monospace; /* Tech/Document feel */
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text-color);
}

.highlight {
  background: var(--highlight-color);
  padding: 2px 5px;
  font-weight: bold;
  border: 1px solid var(--border-color);
}

/* Info List at bottom */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 40px;
  border: 3px solid var(--border-color);
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  font-size: 1.5rem;
  font-weight: bold;
  border-bottom: 3px solid var(--border-color);
  font-family: "Bebas Neue", sans-serif;
}

.info-item:last-child {
  border-bottom: none;
}

.footer-note {
  font-family: "Roboto Mono", monospace;
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  margin-top: 50px;
  opacity: 0.6;
  border-top: 1px dashed #ccc;
  padding-top: 20px;
}

/* Animations included in screen transition */

.close-modal {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 2rem;
  cursor: pointer;
}

/* GAME INTERFACE STYLES */
#game-interface {
  justify-content: space-between;
  background: var(
    --bg-color
  ); /* White background for game per instruction? No, user liked yellow. Keep yellow but distinct layout. */
  background-color: var(--bg-color); /* Keep base yellow */
}

/* Game Header */
.game-header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  font-weight: bold;
}

.scoreboard {
  display: flex;
  gap: 40px;
  background: var(--bg-color);
  padding: 10px 30px;
  border: 3px solid var(--border-color);
  box-shadow: 6px 6px 0px var(--border-color);
  border-radius: 50px; /* Stadium shape */
}

.score-box {
  text-align: center;
}

.score-box span {
  display: block;
}

.score-box span:first-child {
  font-size: 1rem;
  color: #666;
}

.score-box span:last-child {
  font-size: 2.5rem;
  font-weight: bold;
  line-height: 1;
}

.game-info {
  font-size: 1.5rem;
  font-weight: bold;
  padding: 5px 15px;
  border: 3px solid var(--border-color);
  display: none; /* Optional */
}

/* Game Area */
.game-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 1000px;
}

.result-area {
  margin-bottom: 2rem;
  height: 60px;
}

#result-text {
  font-size: 4rem;
  text-transform: uppercase;
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
}

.hands-display {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 100px;
  margin-bottom: 50px;
}

.vs-text {
  font-size: 3rem;
  font-weight: bold;
  font-style: italic;
  color: var(--text-color);
}

/* SLOT ANIMATION STYLES */
.hand-container {
  width: 250px;
  height: 250px;
  position: relative;
  overflow: hidden; /* Mask the reel */
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px; /* Optional rounded */
  display: flex;
  justify-content: center;
  align-items: center;
}

.static-hand {
  /* Existing hand styling */
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(5px 5px 0px rgba(0, 0, 0, 0.2));
}

#hand1,
#hand1-container .reel {
  transform: scaleX(-1); /* Face Right */
}

#hand2,
#hand2-container .reel {
  transform: scaleX(1); /* Face Left */
}

.reel {
  display: none; /* Hidden by default */
  flex-direction: column;
  width: 100%;
  /* Position absolute to scroll */
  position: absolute;
  top: 0;
  left: 0;
}

.reel-icon {
  width: 250px;
  height: 250px;
  object-fit: contain;
  display: block;
  /* Grey trail effect: Drop shadow that extends up/down */
  filter: drop-shadow(0px 20px 0px rgba(128, 128, 128, 0.5))
    drop-shadow(0px -20px 0px rgba(128, 128, 128, 0.5));
}

/* Game Controls Styles */
.controls {
  display: flex;
  gap: 30px;
}

.choice-btn {
  background: var(--bg-color);
  border: 4px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 140px;
  height: 140px;
  box-shadow: 8px 8px 0px var(--shadow-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.choice-btn:hover {
  transform: translateY(-10px);
  box-shadow: 12px 12px 0px var(--shadow-color);
  background: var(--highlight-color);
}

.choice-btn:active {
  transform: translateY(2px);
  box-shadow: 4px 4px 0px var(--shadow-color);
}

.choice-btn.selected {
  background: var(--bg-color);
  border-color: #ff0000; /* Red border always */
  box-shadow: 12px 12px 0px var(--shadow-color);
  transform: translateY(-10px);
}

.choice-btn img {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
  object-fit: contain;
}

.choice-btn span {
  font-size: 1.5rem;
  font-weight: bold;
}

#reset-btn {
  margin-top: 30px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-black);
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.6;
  transition: opacity 0.2s;
}

#reset-btn:hover {
  opacity: 1;
}

/* Animations handled by GSAP */
/* .reel-icon styles are defined above */

/* Responsive */
/* RESPONSIVE DESIGN (Strong Mobile Support) */
@media (max-width: 1024px) {
  .titles {
    font-size: 6rem;
  }
  .game-area {
    max-width: 90%;
  }
  .hand-container {
    width: 200px;
    height: 200px;
  }
  .reel-icon {
    width: 200px;
    height: 200px;
  }
  .choice-btn {
    width: 120px;
    height: 120px;
  }
}

@media (max-width: 768px) {
  .titles {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 30px;
  }

  .menu-options {
    width: 90%;
    max-width: 350px;
  }

  .scoreboard {
    padding: 10px 20px;
    gap: 20px;
    border-radius: 30px;
  }
  .score-box span:last-child {
    font-size: 2rem;
  }

  .hands-display {
    gap: 40px;
  }
  .hand-container {
    width: 160px;
    height: 160px;
  }
  .reel-icon {
    width: 160px;
    height: 160px;
  }

  .controls {
    gap: 15px;
  }
  .choice-btn {
    width: 100px;
    height: 100px;
    padding: 10px;
  }
  .choice-btn img {
    width: 40px;
    height: 40px;
    margin-bottom: 5px;
  }
  .choice-btn span {
    font-size: 1.2rem;
  }

  /* Lobby Tablet */
  .room-action-group {
    padding: 15px;
  }
  .info-text {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  /* --- MOBILE PRO MAX --- */

  /* 1. COMPACT HEADER */
  .game-header {
    flex-direction: row; /* Keep row */
    justify-content: space-between;
    padding: 10px 5px;
    height: 60px;
    align-items: center;
  }

  .game-info {
    display: none;
  } /* Hide Game Mode text */
  #back-home-btn {
    font-size: 1rem;
  }
  #back-home-btn i {
    width: 16px;
    height: 16px;
  }

  .scoreboard {
    padding: 2px 15px;
    gap: 15px;
    border-radius: 20px;
    scale: 0.9; /* Slight shrink to fit */
    margin: 0;
  }
  .score-box span:first-child {
    font-size: 0.8rem;
  }
  .score-box span:last-child {
    font-size: 1.8rem;
  }

  /* 2. MAXIMIZED GAME AREA */
  .game-area {
    justify-content: space-evenly; /* Spread out */
    padding-bottom: 20px;
    width: 100%;
  }

  .result-area {
    margin-bottom: 10px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #result-text {
    font-size: 3rem; /* BIGGER */
    line-height: 1;
    white-space: nowrap;
  }

  .hands-display {
    width: 100%;
    margin-bottom: 20px;
    gap: 10px;
    justify-content: space-between;
    padding: 0 10px;
  }

  .hand-container {
    width: 44vw; /* Almost half screen width */
    height: 44vw;
    max-width: 180px;
    max-height: 180px;
    background: rgba(255, 255, 255, 0.2) border-box; /* Subtle bg */
    border: 3px solid rgba(0, 0, 0, 0.1);
  }

  .reel-icon,
  .static-hand {
    width: 110%; /* Slight overflow for impact */
    height: 110%;
  }

  .vs-text {
    position: absolute; /* Floating VS */
    z-index: 10;
    font-size: 3rem;
    text-shadow: 2px 2px 0px var(--text-white);
    left: 50%;
    transform: translateX(-50%);
  }

  /* 3. BIGGER CONTROLS */
  .controls {
    width: 100%;
    gap: 12px;
    padding: 0 10px;
  }

  .choice-btn {
    flex: 1; /* Stretch to fill */
    height: auto;
    aspect-ratio: 1/1; /* Square */
    padding: 5px;
    border-width: 3px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .choice-btn img {
    width: 50%; /* Relative to container */
    height: 50%;
    margin-bottom: 5px;
  }

  .choice-btn span {
    font-size: 1.2rem;
  }

  /* PvP Controls Override */
  #pvp-active-controls {
    width: 100%;
    flex-direction: row;
    gap: 10px;
  }

  /* 4. MAIN MENU & LOBBY */
  .titles {
    font-size: 4.5rem;
    line-height: 0.9;
    margin-bottom: 40px;
  }

  .menu-options {
    width: 100%;
    padding: 0 20px;
  }

  .main-btn,
  .online-btn {
    height: 80px; /* Taller touch target */
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .join-row {
    flex-direction: column;
  }

  #room-id-input,
  #join-room-btn {
    width: 100% !important;
    height: 60px;
    font-size: 1.5rem;
  }
}
