*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* ===== DSEG digital font for countdowns ===== */
@font-face {
  font-family: "DSEG7";
  src: url("/fonts/DSEG7Modern-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}







body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #22d3ee 0, #1d4ed8 35%, #020617 85%);
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
}





#app {
  width: 100%;
  max-width: 960px;
  padding: 16px;
}

/* Screens */

.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* Generic hidden utility */

.hidden {
  display: none !important;
}

/* Cards */

.card {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(96, 165, 250, 0.6);
  margin-top: 20px;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  letter-spacing: 0.03em;
}

h1 {
  font-size: 1.8rem;
}

.subtitle {
  margin-bottom: 20px;
  color: #cbd5f5;
}

/* Mode toggle */

.mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.mode-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #1d4ed8;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #f9fafb;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease,
    background 0.12s ease, border-color 0.12s ease;
}

.mode-btn-active {
  background: linear-gradient(135deg, #f97316, #facc15);
  border-color: #facc15;
  color: #111827;
}

/* Legacy label / input defaults (overridden for glass fields) */

label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: #020617;
  color: #f9fafb;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.6);
}

/* Buttons */

button {
  margin-top: 16px;
  padding: 11px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #a3e635);
  color: #052e16;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  transition: transform 0.08s ease, box-shadow 0.12s ease,
    filter 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.6);
  filter: brightness(1.05);
}

button:active {
  transform: translateY(0);
  box-shadow: none;
  filter: brightness(0.98);
}

.error {
  color: #fb7185;
  margin-top: 8px;
}

.small {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Lobby */

#lobby-players {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 0;
}

#lobby-players li {
  padding: 4px 0;
}

/* Game layout */

.game-layout {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.game-main {
  flex: 2;
  display: flex;
  flex-direction: column;
}

.sidebar {
  flex: 1;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(96, 165, 250, 0.7);
}

#game-players {
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: 0.9rem;
}

#game-players li {
  padding: 4px 0;
}

/* Status bar */

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  font-size: 0.9rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.8);
}

#round-info {
  font-weight: 700;
  color: #facc15;
}

#status-message {
  color: #e5e7eb;
}

/* 3-2-1 countdown overlay */

#countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 999;
}

#countdown-number {
  font-size: clamp(4rem, 12vw, 6rem);
  color: #4ade80;
  font-weight: 800;
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.9),
    0 0 40px rgba(74, 222, 128, 0.8);
}

/* Simon board using image + invisible quadrants */

.board {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 16px auto 0;
}

/* Main Simon image */
#simon-image {
  position: relative;
  z-index: 1;
  width: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* Transparent hit areas: big quarters for fat fingers */
.pad {
  position: absolute;
  width: 50%;
  height: 50%;
  cursor: pointer;
  z-index: 2;
  background: transparent;
}

/* Top-left: green */
.pad-green {
  top: 0;
  left: 0;
}

/* Top-right: red */
.pad-red {
  top: 0;
  right: 0;
}

/* Bottom-left: yellow */
.pad-yellow {
  bottom: 0;
  left: 0;
}

/* Bottom-right: blue */
.pad-blue {
  bottom: 0;
  right: 0;
}

.pad.disabled {
  pointer-events: none;
}

/* Game actions (Give Up button) */

.game-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.give-up-btn {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fef2f2;
}

/* Elimination pill */

.elimination-pill {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #111827;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  white-space: nowrap;
  animation: pillSlideUp 0.4s ease-out;
}

@keyframes pillSlideUp {
  from {
    transform: translate(-50%, 30px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Leaderboard */

#leaderboard-list {
  margin: 12px 0 0;
}

/* Responsive */

@media (max-width: 768px) {
  #app {
    max-width: 100%;
  }

  .game-layout {
    flex-direction: column;
  }

  .sidebar {
    order: -1;
    margin-bottom: 16px;
  }

  .status-bar {
    font-size: 0.8rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .game-actions {
    justify-content: center;
  }

  .give-up-btn {
    width: 100%;
    max-width: 260px;
  }
}

/* ============================================
   CUSTOM INPUTS AND FORM STYLES
   ============================================ */

/* Container spacing */
.input-panel {
  margin-top: 8px;
}

/* Name + difficulty side by side on desktop, stacked on mobile */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.field {
  flex: 1 1 140px;
}

/* 🟢 FIX: Titles Name and Difficulty - Bold and White 🟢 */
.field-label {
  font-size: 1.0rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  /* NEW: Set to white and bold */
  color: #ffffff !important;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 10px;
}

/* 🔵 1. LIGHT BLUE PILL BACKGROUND STYLES (glass-field) 🔵 */
.glass-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;

  /* FIX: Aggressively set to very light blue background */
  background: #f0f9ff !important; 
  /* MODIFIED: Subtle light blue border */
  border: 1px solid #bae6fd;

  /* Softer, lighter shadow */
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);

  /* NEW: Font color black and slightly bold for the pill container (as requested) */
  color: #000000 !important; 
  font-weight: 600;
}


/* Icon bubble */
.field-icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: radial-gradient(circle at 30% 20%, #facc15, #f97316);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

/* 🔵 2. BLACK, BOLD TEXT STYLES (glass-field inputs) 🔵 */
/* This is the key rule that styles the text typed inside the pill inputs */
.glass-field input,
.glass-field select {
  /* FIX: Ensure the input area is transparent to show the pill background */
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin-top: 0;
  padding: 4px 4px;
  width: 100%;
  /* FIX: Black text color */
  color: #000000 !important;
  /* FIX: Slightly bold font weight */
  font-weight: 600; 
  font-size: 0.9rem;
}

/* Focus halo on the shell */
.glass-field:focus-within {
  /* MODIFIED: Brighter blue border on focus */
  border-color: #3b82f6;
  /* MODIFIED: Blue focus ring */
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Custom arrow for selects */
.glass-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 26px;
  /* MODIFIED: Changed arrow color to black (#000000) */
  background-image:
    linear-gradient(45deg, #000000 50%, transparent 50%),
    linear-gradient(135deg, #000000 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 10px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

/* Slight dim on placeholder */
.glass-field input::placeholder {
  /* MODIFIED: Lighter gray for placeholder */
  color: #94a3b8;
}

/* Ensure dropdown options are visible on dark theme */
.glass-field select {
  /* MODIFIED: Black text for the selected option */
  color: #000000;
}

/* Style the popup list (many browsers honour this now) */
.glass-field select option {
  /* MODIFIED: Light blue background and black text for options */
  background-color: #f0f9ff;
  color: #000000;
}


/* 📱 3. MOBILE SPACING FIXES 📱 */
@media (max-width: 480px) {
  /* FIX: Aggressively eliminate the margin below the label text */
  label {
    margin-bottom: 0 !important; 
  }

  /* FIX: Aggressively eliminate the margin above the input panel */
  .input-panel {
    margin-top: 0 !important; 
  }
  
  .field-row {
    flex-direction: column;
    /* Maintain a small gap if needed for readability, or use 0px */
    gap: 2px !important; 
    /* Aggressively eliminate bottom margin on the row container */
    margin-bottom: 4px !important; 
  }

  /* Ensure the container of the pill has no extra bottom margin */
  .field {
    margin-bottom: 20px !important;
    padding: 0 !important;
    flex: 0 0 auto;
  }

  /* 👇 ADD THIS */
  button {
    margin-top: 15px;
  }

.field-row {
    gap: 2px !important;
    margin-bottom: 4px !important;
  }

  .input-panel {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .field {
    margin: 0 !important;
    padding: 0 !important;
  }




}

/* Additional responsive tweaks */
@media (max-width: 760px) {
  body {
    align-items: flex-start;
    justify-content: flex-start;
  }

  #app {
    padding-top: 20px;
  }
}

/* ============================================================
   REMOVE ANDROID/SAMSUNG TAP HIGHLIGHT GREY EFFECT
   ============================================================ */

/* 1. Chrome / Samsung Browser tap highlight */
* {
  -webkit-tap-highlight-color: transparent !important;
}

/* 2. Remove focus outline from buttons/links/pads on tap */
button,
a,
.pad,
.mode-btn,
.give-up-btn,
input,
select {
  outline: none !important;
}

/* 3. Prevent Android from showing "pressed" grey overlay */
button:active,
a:active,
.pad:active,
.mode-btn:active,
.give-up-btn:active {
  background-color: transparent !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* ============================================
   LEADERBOARD MODAL STYLE
   ============================================ */

.leaderboard-card {
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.leaderboard-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: radial-gradient(circle at 30% 20%, #facc15, #f97316);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.7);
}

.leaderboard-title {
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Table layout */

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.leaderboard-table thead {
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 6px 4px;
}

.leaderboard-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
  font-weight: 600;
}

/* Column alignment */
.col-rank {
  width: 2.2em;
  text-align: left;
}
.col-name {
  text-align: left;
}
.col-correct,
.col-time {
  width: 4.5em;
  text-align: right;
}

/* Body rows */
.leaderboard-table tbody tr {
  border-bottom: 1px solid rgba(30, 64, 175, 0.45);
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.55);
}

.leaderboard-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.25);
}

/* Close button style */
.leaderboard-close-btn {
  width: 100%;
  margin-top: 8px;
}


/* ============================================
   THIN, SHARP, BRIGHT PURPLE TITLE
   ============================================ */

.neon-title {
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 10px;

  /* bright tube colour (solid) */
  color: #d8b4fe;  /* nice bright purple */
}

/* Mobile: smaller so it fits on one line */
@media (max-width: 480px) {
  .neon-title {
    font-size: 1.1rem;
    letter-spacing: 0.14em;
  }
}

/* ===============================
   CENTERED LEADERBOARD HEADER
   =============================== */

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;           /* space between trophy + text */
  margin-bottom: 16px;
  text-align: center;
}

.leaderboard-icon {
  font-size: 1.9rem;
  line-height: 1;
}

.leaderboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

/* ============================================
   LEADERBOARD ROW SLIDE-IN ANIMATION
   ============================================ */

@keyframes leaderboardRowSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.leaderboard-row-animate {
  opacity: 0; /* will be faded in by animation */
  animation-name: leaderboardRowSlideIn;
  animation-duration: 0.35s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

/* ============================================
   LEADERBOARD ROW SLIDE-IN ANIMATION
   ============================================ */

@keyframes leaderboardRowSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.leaderboard-row-animate {
  opacity: 0; /* start invisible, fade in */
  animation-name: leaderboardRowSlideIn;
  animation-duration: 0.35s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

/* Join form: narrower name pill on desktop */
@media (min-width: 768px) {
  #join-form .glass-field {
    max-width: 420px;       /* adjust until it feels right */
    margin-inline: auto;    /* center within the card */
  }
}

/* Generic primary button (reused for Start Now) */
.primary-btn {
  display: inline-block;
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;

  background: linear-gradient(90deg, #22c55e, #16a34a);
  color: #02111f;
  box-shadow: 0 6px 14px rgba(34, 197, 94, 0.4);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.55);
}

/* Lobby 30s countdown uses DSEG digital font */
#lobby-countdown {
  font-family: "DSEG7", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: #ff4b4b;
  letter-spacing: 0.12em;
}