:root {
  --primary-color: #FF6B6B;
  --secondary-color: #4ECDC4;
  --accent-color: #FFE66D;
  --background-color: #F7FFF7;
  --text-color: #2C3E50;
  --card-bg: rgba(255, 255, 255, 0.95);
  --success-color: #95E1D3;
  --font-main: 'Comic Neue', cursive, sans-serif;
  --font-header: 'Fredoka One', cursive, sans-serif;
}

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

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background-color: var(--background-color);
  background-image: url('https://res.cloudinary.com/dihumurul/image/upload/v1764246782/background_rdukvm.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.4;
  font-size: 16px;
  /* Reduced base font size */
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px;
  /* Reduced padding */
}

.main-header {
  flex: 0 0 auto;
  text-align: center;
  padding: 5px 0;
  position: relative;
}

.main-header h1 {
  font-family: var(--font-header);
  font-size: 1.8rem;
  /* Reduced size */
  color: var(--primary-color);
  text-shadow: 2px 2px 0px var(--accent-color), 0 0 10px white;
  margin-bottom: 0;
}

.main-header p {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0;
  text-shadow: 0 0 5px white;
}

/* Language Selector */
.language-selector {
  position: absolute;
  top: 5px;
  right: 10px;
  z-index: 100;
}

.language-dropdown {
  padding: 5px 10px;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 2px solid var(--secondary-color);
  background: white;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s;
}

.language-dropdown:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

[dir='rtl'] {
  direction: rtl;
}

[dir='rtl'] .language-selector {
  right: auto;
  left: 10px;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 5px;
}

/* Setup Section - Full Width Grid */
#gameSetup {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 1fr auto;
  gap: 15px;
  /* Reduced gap */
  padding: 20px;
  /* Reduced padding */
  align-content: center;
}

#gameSetup h2 {
  grid-column: 1 / -1;
  font-size: 2rem;
  /* Reduced size */
  margin-top: 35px;
  margin-bottom: 5px;
}

.mode-selection {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.mode-selection .btn {
  flex: 1;
  max-width: 300px;
  font-size: 1.2rem;
  padding: 15px;
}

#randomControls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  align-items: start;
}

.control-item {
  background: rgba(248, 249, 250, 0.95);
  padding: 20px;
  /* Reduced padding */
  border-radius: 15px;
  border: 2px solid #eee;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.control-item label {
  font-size: 1.4rem;
  /* Reduced size */
  margin-bottom: 10px;
  color: var(--secondary-color);
}

.big-select {
  font-size: 1.2rem;
  padding: 12px;
  border-radius: 12px;
  width: 100%;
  border: 2px solid #ccc;
}

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

.big-slider {
  height: 30px;
  flex: 1;
}

.badge {
  font-size: 1.5rem;
  padding: 8px 20px;
  background: var(--accent-color);
  border-radius: 15px;
  font-weight: bold;
}

#generateWords {
  grid-column: 1 / -1;
  font-size: 1.8rem;
  /* Reduced size for mobile compatibility */
  padding: 20px;
  margin-top: 10px;
  border-radius: 20px;
  box-shadow: 0 8px 15px rgba(46, 204, 113, 0.3);
  transition: all 0.2s;
}

#generateWords:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 25px rgba(46, 204, 113, 0.4);
}

#manualControls {
  grid-column: 1 / -1;
  width: 100%;
}

.input-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  width: 100%;
}

.big-input {
  font-size: 1.3rem;
  padding: 15px;
  width: 60%;
  border-radius: 10px;
  border: 2px solid #ccc;
}

#addWordBtn {
  font-size: 1.3rem;
  padding: 15px 30px;
}

.manual-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 15px;
}

.manual-word-tag {
  background: var(--secondary-color);
  color: white;
  padding: 10px 20px;
  border-radius: 15px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.remove-word {
  cursor: pointer;
  font-weight: bold;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Game Area */
#gameArea {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  gap: 15px;
  max-width: 1200px;
}

.words-display-container {
  flex: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.words-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-content: center;
  overflow-y: auto;
  padding: 10px;
}

.game-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  gap: 15px;
}

.card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: 3px solid #eee;
}

h2 {
  font-family: var(--font-header);
  color: var(--secondary-color);
  font-size: 1.4rem;
  margin-bottom: 8px;
  text-align: center;
}

.btn {
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-family: var(--font-header);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.1s;
  margin: 5px;
}

.btn:active {
  transform: scale(0.95);
}

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

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

.btn-success {
  background-color: #2ecc71;
  color: white;
}

.btn-action {
  background-color: var(--accent-color);
  color: #333;
}

.btn-large {
  font-size: 1.1rem;
  padding: 12px 25px;
}

.btn-xl {
  font-size: 1.2rem;
  padding: 12px 25px;
  width: 100%;
}

.btn-xxl {
  font-size: 1.4rem;
  padding: 20px 30px;
  background-color: #FF9F43;
  color: white;
  width: 100%;
  border-bottom: 5px solid #e67e22;
}

.btn-xxl:active {
  border-bottom: 0;
  transform: translateY(5px);
}

.btn.active {
  border: 3px solid var(--text-color);
  transform: scale(1.05);
}

.word-card {
  background: rgba(240, 240, 240, 0.95);
  padding: 10px 20px;
  border-radius: 15px;
  font-size: 1.8rem;
  font-weight: bold;
  color: #555;
  border: 3px solid transparent;
  transition: all 0.3s;
}

.word-card.checked {
  background: var(--success-color);
  color: white;
  transform: scale(1.1);
  border-color: #27ae60;
  box-shadow: 0 0 15px var(--success-color);
}

.transcript-box {
  width: 100%;
  padding: 12px;
  background: rgba(249, 249, 249, 0.95);
  border-radius: 15px;
  height: 120px;
  overflow-y: auto;
  border: 2px solid #eee;
  font-size: 1rem;
  color: #666;
}

.transcript-placeholder {
  color: #aaa;
  font-style: italic;
  text-align: center;
  margin-top: 30px;
}

.feedback-message {
  min-height: 40px;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary-color);
  text-align: center;
  margin-top: 10px;
}

.recording-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: #e74c3c;
  font-weight: bold;
}

.pulse-ring {
  width: 15px;
  height: 15px;
  background-color: #e74c3c;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  font-size: 4rem;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

  body {
    overflow-y: auto !important;
    align-items: flex-start !important;
  }
  
  html, body {
    overflow: auto !important;
  }
  
  .app-container {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh !important;
  }
  .main-header {
    position: relative !important;
    width: 100%;
  }
  
  aside.auth-sidebar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
  }
  
  #signedOutView {
    display: block !important;
  }
  
  #signInBtn {
    display: flex !important;
  }
  
  /* Setup Section Mobile */
  #gameSetup {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    gap: 15px;
    padding: 15px;
  }

  #gameSetup h2 {
    font-size: 1.4rem;
    white-space: normal;
    word-wrap: break-word;
  }

  #randomControls {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .control-item {
    padding: 15px;
  }

  /* Game Area Mobile */
  #gameArea {
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  .words-display-container {
    flex: 1 1 auto;
    min-height: 40%;
    max-height: 50%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .words-display-container h2 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    flex-shrink: 0;
  }

  .words-grid {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    gap: 8px;
    align-content: flex-start;
  }

  .word-card {
    font-size: 1.2rem;
    padding: 8px 15px;
    min-width: auto;
    flex: 0 0 auto;
  }

  .game-sidebar {
    flex: 1 1 auto;
    padding: 10px;
    padding-bottom: 20px;
    overflow-y: auto;
  }

  .btn-xxl {
    font-size: 1.2rem;
    padding: 15px;
  }

  .transcript-box {
    height: 80px;
    font-size: 0.9rem;
  }

  .main-header {
    text-align: left;
    padding-left: 10px;
    padding-right: 60px;
  }

  #generateWords {
    font-size: 1.35rem;
    /* 25% smaller for mobile */
  }
}

/* Home button spacing */
#homeBtn {
  margin-top: 10px;
}
