/* Import beautiful Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Quicksand:wght@500;700&display=swap');

:root {
  --bg-gradient-start: #0a0e1a;
  --bg-gradient-end: #121829;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: rgba(0, 0, 0, 0.35);

  --neon-purple: #ff6b6b;
  /* Warm Red-Orange */
  --neon-pink: #ffa502;
  /* Warm Gold */
  --neon-cyan: #ff7f50;
  /* Sunset Orange */
  --neon-green: #2ecc71;
  /* Success Green */
  --text-primary: #ffffff;
  /* Bright white text */
  --text-secondary: #a4b0be;
  /* Soft slate gray text */

  --btn-grad-primary: linear-gradient(135deg, #ff7f50, #ffa502);
  /* Sunset Orange to Gold (logo theme) */
  --btn-grad-secondary: linear-gradient(135deg, #ffa502, #f1c40f);
  /* Gold to Yellow (logo theme) */
  --danger-grad: linear-gradient(135deg, #ee5253, #ff6b6b);

  --font-title: 'Outfit', sans-serif;
  --font-body: 'Quicksand', sans-serif;

  --transition-speed: 0.3s;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  /* Set the premium elevator illustration as the body background */
  background: url('images/default.jpg') no-repeat center center fixed;
  background-size: cover;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Dark overlay over background image to preserve contrast and text readability */
body::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 26, 0.35);
  /* Translucent navy-blue mask */
  z-index: -2;
}

/* App container - Expanded to match large presentation screens */
.app-container {
  width: 86vw;
  /* Reduced from 96vw to reveal more background on both sides */
  max-width: 1200px;
  min-height: 86vh;
  /* Adjusted from 90vh for cleaner vertical alignment */
  padding: 25px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(20, 26, 46, 0.65);
  /* Sleek translucent sapphire glass */
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(25px);
  margin: 20px 0;
}

/* Header style */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.title-section h1 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 15px rgba(243, 156, 18, 0.22);
}

.sub-title-text {
  font-size: 0.8rem;
  color: var(--neon-cyan);
  font-weight: 700;
  letter-spacing: 3px;
  margin-top: 2px;
}

.stats-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}

.stat-badge.level {
  border-color: rgba(0, 242, 254, 0.4);
  color: var(--neon-cyan);
}

/* Admin status indicator */
.stat-badge.admin-status {
  border-color: rgba(255, 88, 88, 0.4);
  color: #ff5858;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat-badge.admin-status.logged {
  border-color: rgba(57, 255, 20, 0.4);
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
}

.stat-badge.admin-status:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.03);
}

/* Header buttons */
.header-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: var(--neon-cyan);
}

/* Screen setups */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease-out;
  position: relative;
  height: 100%;
}

.screen.hidden {
  display: none !important;
}

.hidden {
  display: none !important;
}


/* ==========================================
   0. WELCOME / LANDING SCREEN STYLING
   ========================================== */
#welcome-screen {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
}

.welcome-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  padding: 20px 0;
  z-index: 5;
}

.welcome-logo-container {
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  width: 100%;
}

.welcome-logo {
  max-width: 320px;
  width: 85%;
  height: auto;
  filter: drop-shadow(0 8px 25px rgba(243, 156, 18, 0.25));
  animation: logoPulse 4s infinite ease-in-out;
}

.welcome-title-container {
  text-align: center;
  margin: 30px 0;
}

.welcome-title {
  font-family: var(--font-title);
  font-size: 3.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(243, 156, 18, 0.3);
  letter-spacing: 3px;
}

.welcome-subtitle {
  font-size: 1.1rem;
  color: var(--neon-cyan);
  letter-spacing: 6px;
  margin-top: 8px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(255, 127, 80, 0.25);
}

.welcome-anniversary {
  font-size: 1.05rem;
  color: #ff9f43;
  /* Orange/gold color matching the World Elevator logo */
  letter-spacing: 2px;
  margin-top: 12px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(255, 159, 67, 0.35);
}

.welcome-action-container {
  margin: 20px 0;
}

.welcome-start-btn {
  padding: 16px 45px;
  font-size: 1.3rem;
  font-weight: 800;
  border-radius: 16px;
  letter-spacing: 1px;
  box-shadow: 0 8px 30px rgba(243, 156, 18, 0.25);
  transition: all 0.2s ease;
}

.welcome-start-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 35px rgba(243, 156, 18, 0.5);
}

.welcome-footer {
  width: 100%;
  max-width: 700px;
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
}

/* Global Elevator Doors for transitions */
.elevator-doors {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99;
  display: flex;
  pointer-events: none;
}

.elevator-doors:not(.open) {
  pointer-events: auto;
  /* block clicks when closed */
}

.elevator-door {
  width: 50%;
  height: 100%;
  background: linear-gradient(135deg, #18191b 0%, #2f3439 50%, #18191b 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.85);
}

/* door grooves */
.elevator-door::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: rgba(0, 0, 0, 0.4);
}

.left-door {
  left: 0;
  transform: translateX(0);
  border-right: 2px solid #444;
}

.left-door::after {
  right: 12px;
}

.right-door {
  right: 0;
  transform: translateX(0);
  border-left: 2px solid #444;
}

.right-door::after {
  left: 12px;
}

/* Transition classes */
.elevator-doors.open .left-door {
  transform: translateX(-102%);
}

.elevator-doors.open .right-door {
  transform: translateX(102%);
}


/* ==========================================
   1. GAMEPLAY SCREEN STYLING
   ========================================== */
/* Centered layout: Image at the top, answers and controls below */
/* Centered layout: Control panel on the left, Image card on the right */
/* Centered layout: Image card centered and large, left buttons positioned absolutely to the far left */
.left-control-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 10;
  margin-top: 40px;
  /* Vertically align with centered puzzle card */
}

.control-side-btn {
  width: auto;
  min-width: 180px;
  padding: 12px 20px;
  height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.control-side-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Centered Main Content Area */
.game-center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 15px;
  gap: 25px;
  /* Khoảng hở giữa hình ảnh và các ô chữ bên dưới */
}

/* Centered Puzzle Card Container - Larger & Centered */
.puzzle-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 680px;
  /* Centered, larger image card */
  height: 360px;
  /* Taller card */
  aspect-ratio: 16/9;
}

.puzzle-image-wrapper {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.puzzle-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Fallback Emojis */
.puzzle-emoji-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  font-size: 7rem;
}

/* Centered details column */
.game-control-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Centered answer boxes and buttons */
  width: 100%;
  max-width: 900px;
  gap: 15px;
}

/* Suggestion Hint displays */
.hint-badge-display {
  width: 100%;
  text-align: center;
  font-size: 1.1rem;
  padding: 12px 20px;
  background: rgba(255, 165, 0, 0.08);
  border: 1px dashed var(--neon-pink);
  border-radius: 12px;
  color: var(--text-primary);
  display: none;
  animation: slideDown 0.3s ease-out;
  box-shadow: 0 4px 10px rgba(243, 156, 18, 0.15);
}

/* Answer Slots area */
.answer-area {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  width: 100%;
  margin-bottom: 10px;
}

/* Word Box */
.word-box {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 127, 80, 0.25);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.15),
    inset 0 0 10px rgba(255, 127, 80, 0.05);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  transition: border-color 0.3s ease;
}

.word-box:hover {
  border-color: var(--neon-pink);
}

/* Larger Letter Slot */
.letter-slot {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.letter-slot:hover:not(.filled) {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(255, 127, 80, 0.35);
  transform: scale(1.05);
}


.letter-slot.filled {
  background: rgba(255, 165, 0, 0.15);
  border-color: var(--neon-pink);
  box-shadow: 0 0 15px rgba(255, 165, 0, 0.4);
  color: #ff9f43;
  animation: popLetter 0.25s ease-out;
}

.letter-slot.revealed {
  background: rgba(46, 204, 113, 0.2);
  border-color: var(--neon-green);
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.45);
  color: var(--neon-green);
  cursor: not-allowed;
  animation: revealSlot 0.3s ease-out;
}

.answer-area.shake {
  animation: shakeAlert 0.4s ease-in-out;
}

/* Utility buttons */
.game-controls {
  display: flex;
  gap: 15px;
  width: 100%;
}

.btn {
  padding: 14px 22px;
  border-radius: 14px;
  border: none;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.btn-primary {
  background: var(--btn-grad-primary);
}

.btn-primary:hover {
  box-shadow: 0 0 25px rgba(243, 156, 18, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--btn-grad-secondary);
}

.btn-secondary:hover {
  box-shadow: 0 0 25px rgba(255, 165, 0, 0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(1px);
}

/* Centered Keyboard Panel */
.keyboard-panel {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 680px;
  /* Centered width matches image and slots */
  margin-left: auto;
  margin-right: auto;
}

.key-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  height: 46px;
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.key-btn:hover:not(.disabled) {
  background: var(--btn-grad-primary);
  color: #fff;
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow: 0 5px 12px rgba(255, 127, 80, 0.35);
}

.key-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: scale(0.95);
  box-shadow: none;
}


/* ==========================================
   2. CONFIGURATION SCREEN
   ========================================== */
#config-screen {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* Prevent header button text wrapping */
header .btn {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* Password Box / Admin Verification Container styling */
.password-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 40px auto;
  padding: 45px 30px;
  max-width: 440px;
  width: 100%;
  background: rgba(20, 26, 46, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  text-align: center;
  animation: zoomSuccess 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.password-box span {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 3.5rem;
  filter: drop-shadow(0 0 12px rgba(255, 127, 80, 0.35));
  animation: floatEmoji 3s ease-in-out infinite;
}

.password-box h2 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.password-box p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.password-box input[type="password"] {
  width: 100%;
  max-width: 320px;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 1.25rem;
  text-align: center;
  letter-spacing: 4px;
  margin-bottom: 22px;
  outline: none;
  transition: all 0.3s ease;
}

.password-box input[type="password"]::placeholder {
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 1rem;
}

.password-box input[type="password"]:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(255, 127, 80, 0.3);
  background: rgba(0, 0, 0, 0.45);
}

.password-box button {
  width: 100%;
  max-width: 320px;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--neon-cyan), #0072ff);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

.password-box button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 242, 254, 0.5);
}

.password-box button:active {
  transform: translateY(0);
}

@keyframes floatEmoji {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.admin-db-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

@media(max-width: 750px) {
  .admin-db-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.level-list-container {
  overflow-y: auto;
  max-height: 50vh;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
}

.level-row-item {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 10px;
  gap: 20px;
  transition: all 0.2s ease;
}

.level-row-item:hover {
  background: rgba(255, 127, 80, 0.06);
  border-color: var(--neon-cyan);
}

.row-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-info {
  flex: 1;
}

.row-info-title {
  font-size: 1.1rem;
}

.row-info-hint {
  font-size: 0.85rem;
}

.row-btn {
  width: 34px;
  height: 34px;
  font-size: 0.95rem;
  border-radius: 8px;
}


/* Visibility classes based on admin login state */
body:not(.admin-mode) .admin-only-control {
  display: none !important;
}

body.admin-mode .admin-only-control {
  display: flex !important;
}

body.admin-mode .keyboard-panel.admin-only-control {
  display: grid !important;
  /* Keyboard needs grid layout */
}


/* ==========================================
   MODAL WINDOWS & ALERTS
   ========================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.65);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  /* over doors */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(20, 26, 46, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  border-radius: 24px;
  width: 90%;
  padding: 30px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

/* Success Modal Answer Text */
.success-answer {
  font-size: 2.8rem;
  font-weight: 800;
  color: #ff7f50;
  text-transform: uppercase;
  margin: 15px 0;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(243, 156, 18, 0.25);
  background: rgba(243, 156, 18, 0.08);
  border: 1px solid rgba(243, 156, 18, 0.25);
  border-radius: 12px;
  padding: 10px 20px;
  display: inline-block;
  box-sizing: border-box;
}

/* Custom Form Elements for Modals */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-cyan);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-input,
.form-select {
  width: 100% !important;
  box-sizing: border-box;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  background: rgba(0, 0, 0, 0.25) !important;
  color: #ffffff !important;
  font-size: 1rem !important;
  outline: none !important;
  transition: all 0.3s ease !important;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 10px rgba(255, 127, 80, 0.3) !important;
  background: rgba(0, 0, 0, 0.45) !important;
}

/* File Upload Box Container */
.file-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 20px;
  box-sizing: border-box;
  border: 2px dashed rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 5px;
}

.file-upload-box:hover {
  background: rgba(255, 127, 80, 0.03);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(255, 127, 80, 0.15);
}

.file-upload-box span {
  font-size: 2rem;
  margin-bottom: 8px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.file-upload-box:hover span {
  transform: translateY(-3px);
}

.file-upload-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Upload preview image styling inside Modal */
.upload-preview {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-height: 240px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.6);
}

.upload-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  /* Keeps aspect ratio! */
  border-radius: 12px;
}

/* Modal Actions Layout (Horizontal Row) */
.modal-actions {
  display: flex;
  gap: 15px;
  margin-top: 25px;
  justify-content: flex-end;
  width: 100%;
}

.modal-actions .btn {
  flex: 1;
  /* Equal width buttons */
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
}


/* ==========================================
   ANIMATIONS KEYFRAMES
   ========================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoPulse {

  0%,
  100% {
    transform: scale(1) translateY(0);
  }

  50% {
    transform: scale(1.03) translateY(-4px);
  }
}

@keyframes popLetter {
  0% {
    transform: scale(0.7);
  }

  50% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes revealSlot {
  0% {
    transform: scale(0.7);
    filter: brightness(1.5);
  }

  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes zoomSuccess {
  0% {
    transform: scale(0);
  }

  80% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes shakeAlert {

  0%,
  100% {
    transform: translateX(0);
  }

  15%,
  45%,
  75% {
    transform: translateX(-12px);
  }

  30%,
  60%,
  90% {
    transform: translateX(12px);
  }
}

/* Level Grid Board Screen Styling */
.grid-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 30px 10px;
  width: 100%;
}

.grid-board-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  margin-bottom: 30px;
  text-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
  text-align: center;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  /* 9 columns to keep original cell size on widescreen */
  gap: 15px;
  max-width: 820px;
  width: 100%;
}

@media (max-width: 820px) {
  .level-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
  }
}

@media (max-width: 550px) {
  .level-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }
}

.grid-item {
  aspect-ratio: 1/1;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Admin can hover, guest cannot */
body.admin-mode .grid-item:hover:not(.solved):not(.active) {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--neon-cyan);
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(255, 127, 80, 0.35);
}

.grid-item.active {
  background: rgba(255, 127, 80, 0.15);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(255, 127, 80, 0.35);
}

.grid-item.solved {
  background: rgba(46, 204, 113, 0.25) !important;
  border-color: var(--neon-green) !important;
  color: var(--neon-green) !important;
  box-shadow: inset 0 0 10px rgba(46, 204, 113, 0.15), 0 0 15px rgba(46, 204, 113, 0.3) !important;
}

body:not(.admin-mode) .grid-item {
  cursor: default;
}

/* Right Side Robot Panel */
.right-robot-panel {
  width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  margin-top: 40px;
  /* Vertically align with centered puzzle card */
}

.robot-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.robot-image {
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 242, 254, 0.25));
  opacity: 1;
  transition: opacity 0.2s ease, filter 0.2s ease;
  animation: robotFloat 4s ease-in-out infinite;
}

/* Floating animation for thinking state with pulsing shadow */
@keyframes robotFloat {

  0%,
  100% {
    transform: translateY(0px) rotate(-1deg);
    filter: drop-shadow(0 4px 12px rgba(0, 242, 254, 0.25));
  }

  50% {
    transform: translateY(-10px) rotate(1.5deg);
    filter: drop-shadow(0 12px 22px rgba(0, 242, 254, 0.5));
  }
}

/* Excited animation for correct state (Smooth cartoon squash and stretch) */
.robot-image.celebrating {
  animation: robotCelebrate 1.2s ease-in-out infinite;
  filter: drop-shadow(0 0 25px rgba(56, 239, 125, 0.9));
}

@keyframes robotCelebrate {

  0%,
  100% {
    transform: translateY(0) scale(1, 1) rotate(0deg);
  }

  15% {
    transform: translateY(3px) scale(1.06, 0.94) rotate(0deg);
    /* Squash down before jump */
  }

  45% {
    transform: translateY(-18px) scale(0.94, 1.06) rotate(-2deg);
    /* Stretch up in mid-air */
  }

  75% {
    transform: translateY(1px) scale(1.02, 0.98) rotate(2deg);
    /* Soft landing squash */
  }
}

/* Speech Bubble */
.robot-speech-bubble {
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  animation: bubblePulse 2s infinite ease-in-out;
  transition: all 0.3s ease;
}

/* Speech bubble pointer arrow pointing down */
.robot-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.08) transparent;
  display: block;
  width: 0;
}

@keyframes bubblePulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.03);
  }
}

.robot-speech-bubble.correct {
  background: rgba(46, 204, 113, 0.15);
  border-color: var(--neon-green);
  color: var(--neon-green);
  animation: bubblePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bubblePop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }

  100% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Close "X" button in modals */
.modal-close-x {
  position: absolute;
  top: 15px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 10;
  padding: 5px;
  line-height: 1;
}

.modal-close-x:hover {
  color: #ff3366;
  transform: scale(1.2) rotate(90deg);
}

/* Premium Volume Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  outline: none;
  transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  cursor: pointer;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* ==========================================================================
   MOBILE RESPONSIVENESS AND TABLET STYLES (SCREEN WIDTH < 768px)
   ========================================================================== */
@media (max-width: 768px) {

  /* 1. General layout container adjustments */
  .app-container {
    width: 95vw !important;
    max-width: 95vw !important;
    min-height: 92vh !important;
    padding: 15px !important;
    margin: 10px auto !important;
    border-radius: 16px !important;
  }

  /* 2. Responsive Header */
  header {
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding-bottom: 10px !important;
    margin-bottom: 15px !important;
  }

  .header-left {
    flex: 0 0 auto !important;
  }

  .header-left img {
    height: 38px !important;
    /* Smaller logo in header */
  }

  .header-center {
    flex: 1 1 100% !important;
    /* Force title to occupy full width at top-center */
    order: -1 !important;
    width: 100% !important;
    margin-bottom: 5px !important;
  }

  .header-center h1 {
    font-size: 1.4rem !important;
  }

  .header-center .sub-title-text {
    font-size: 0.7rem !important;
    letter-spacing: 1px !important;
  }

  .header-right {
    flex: 0 0 auto !important;
  }

  /* 3. Welcome Screen adjustments */
  .welcome-logo {
    max-width: 220px !important;
  }

  .welcome-title {
    font-size: 2.2rem !important;
  }

  .welcome-subtitle {
    font-size: 0.85rem !important;
    letter-spacing: 3px !important;
  }

  .welcome-anniversary {
    font-size: 0.9rem !important;
  }

  .welcome-start-btn {
    padding: 12px 32px !important;
    font-size: 1.1rem !important;
    border-radius: 12px !important;
  }

  /* 4. Gameplay 3-Column to Stacking layout */
  .gameplay-layout-row {
    flex-direction: column !important;
    align-items: center !important;
    gap: 15px !important;
    width: 100% !important;
  }

  /* Stacking orders */
  .left-control-panel {
    order: 2 !important;
    /* Below the image card */
    width: 100% !important;
    flex-direction: row !important;
    justify-content: center !important;
    gap: 10px !important;
    margin-top: 10px !important;
  }

  .control-side-btn {
    min-width: 0 !important;
    flex: 1 !important;
    height: 42px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    border-radius: 10px !important;
  }

  .right-robot-panel {
    order: 3 !important;
    /* At the bottom */
    width: 100% !important;
    margin-top: 10px !important;
  }

  .robot-container {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
  }

  .robot-image {
    width: 65px !important;
    height: 65px !important;
  }

  .robot-speech-bubble {
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
    border-radius: 10px !important;
  }

  .robot-speech-bubble::after {
    display: none !important;
    /* Hide speech bubble pointer on mobile */
  }

  /* 5. Responsive Center game elements */
  .puzzle-card {
    height: auto !important;
    max-width: 100% !important;
    aspect-ratio: 4/3 !important;
    padding: 8px !important;
    border-radius: 12px !important;
  }

  .word-box {
    padding: 8px 10px !important;
    gap: 6px !important;
    border-radius: 12px !important;
    flex-wrap: wrap !important;
    /* Let letters wrap if screen is very narrow */
    justify-content: center !important;
  }

  .letter-slot {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.25rem !important;
    border-radius: 8px !important;
    border-width: 1px !important;
  }

  /* 6. Keyboard sizing on mobile */
  .keyboard-panel {
    gap: 4px !important;
    padding: 6px !important;
    border-radius: 12px !important;
  }

  .key-btn {
    height: 38px !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
  }

  /* 7. Grid items */
  .grid-item {
    font-size: 1.1rem !important;
    border-radius: 12px !important;
  }

  .grid-board-title {
    font-size: 1.1rem !important;
    margin-bottom: 15px !important;
  }

  /* 8. Admin config list and buttons */
  .admin-db-actions {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body {
    overflow: auto !important;
    /* Enable scrolling on body if container exceeds viewport on mobile */
  }

  .config-list-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    text-align: center !important;
  }

  .config-list-header h3 {
    margin: 0 !important;
    text-align: center !important;
  }

  .config-list-header button {
    width: 100% !important;
  }

  .level-row-item {
    flex-wrap: wrap !important;
    padding: 10px !important;
    gap: 12px !important;
  }

  .row-info {
    min-width: 150px !important;
  }

  .row-actions {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    margin-top: 5px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-top: 10px !important;
  }
}

/* Robot Error States */
.robot-speech-bubble.error {
  background: rgba(231, 76, 60, 0.15) !important;
  border-color: #e74c3c !important;
  color: #e74c3c !important;
}

.robot-speech-bubble.error::after {
  border-top-color: rgba(231, 76, 60, 0.15) !important;
}

.robot-image.error {
  filter: drop-shadow(0 4px 12px rgba(231, 76, 60, 0.45)) !important;
}

#game-answer-input:focus {
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 20px rgba(255, 127, 80, 0.6) !important;
  background: rgba(0, 0, 0, 0.65) !important;
}