/* Reset and Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f5f5f5;
  color: #000000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Safe Area */
.safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Layout */
.max-w-md {
  max-width: 480px;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.min-h-screen {
  min-height: 100vh;
}

/* Flex */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

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

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1 1 0%;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

/* Grid */
.grid {
  display: grid;
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Background Colors */
.bg-white {
  background-color: #ffffff;
}

.bg-black {
  background-color: #000000 !important;
}

.bg-gray-100 {
  background-color: #f3f4f6;
}

.bg-gray-200 {
  background-color: #e5e7eb;
}

.bg-gray-300 {
  background-color: #d1d5db !important;
}

.bg-red-50 {
  background-color: #fef2f2;
}

/* Text Colors */
.text-white {
  color: #ffffff !important;
}

.text-black {
  color: #000000;
}

.text-gray-500 {
  color: #6b7280 !important;
}

.text-gray-600 {
  color: #4b5563;
}

.text-gray-700 {
  color: #374151;
}

.text-gray-800 {
  color: #1f2937;
}

.text-gray-900 {
  color: #111827;
}

.text-green-600 {
  color: #059669;
}

.text-red-500 {
  color: #ef4444;
}

/* Text Sizes */
.text-xs {
  font-size: 12px;
  line-height: 16px;
}

.text-sm {
  font-size: 14px;
  line-height: 20px;
}

.text-lg {
  font-size: 18px;
  line-height: 28px;
}

.text-xl {
  font-size: 20px;
  line-height: 28px;
}

.text-2xl {
  font-size: 24px;
  line-height: 32px;
}

.text-3xl {
  font-size: 30px;
  line-height: 36px;
}

.text-4xl {
  font-size: 36px;
  line-height: 40px;
}

.text-5xl {
  font-size: 48px;
  line-height: 1;
}

/* Font Weights */
.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* Text Align */
.text-center {
  text-align: center;
}

/* Padding */
.px-3 {
  padding-left: 12px;
  padding-right: 12px;
}

.px-4 {
  padding-left: 16px;
  padding-right: 16px;
}

.py-1 {
  padding-top: 4px;
  padding-bottom: 4px;
}

.py-3 {
  padding-top: 12px;
  padding-bottom: 12px;
}

.py-4 {
  padding-top: 16px;
  padding-bottom: 16px;
}

.py-6 {
  padding-top: 24px;
  padding-bottom: 24px;
}

.pb-32 {
  padding-bottom: 128px;
}

/* Margin */
.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.mb-8 {
  margin-bottom: 32px;
}

.mr-4 {
  margin-right: 16px;
}

/* Width */
.w-full {
  width: 100%;
}

.w-10 {
  width: 40px;
}

.w-12 {
  width: 48px;
}

.w-14 {
  width: 56px;
}

.w-16 {
  width: 64px;
}

/* Height */
.h-2 {
  height: 8px;
}

.h-10 {
  height: 40px;
}

.h-12 {
  height: 48px;
}

.h-16 {
  height: 64px;
}

.h-18 {
  height: 72px;
}

.h-20 {
  height: 80px;
}

.h-full {
  height: 100%;
}

.min-h-\[80px\] {
  min-height: 80px;
}

/* Border */
.border {
  border-width: 1px;
}

.border-2 {
  border-width: 2px;
}

.border-gray-200 {
  border-color: #e5e7eb;
}

.border-black {
  border-color: #000000;
}

/* Border Radius */
.rounded-lg {
  border-radius: 8px;
}

.rounded-xl {
  border-radius: 12px;
}

.rounded-2xl {
  border-radius: 16px;
}

.rounded-3xl {
  border-radius: 24px;
}

.rounded-full {
  border-radius: 9999px;
}

/* Shadow */
.shadow-2xl {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Position */
.sticky {
  position: sticky;
}

.fixed {
  position: fixed;
}

.absolute {
  position: absolute;
}

.relative {
  position: relative;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.inset-x-4 {
  left: 16px;
  right: 16px;
}

.top-0 {
  top: 0;
}

.top-1\/2 {
  top: 50%;
}

.-translate-y-1\/2 {
  transform: translateY(-50%);
}

/* Z-Index */
.z-50 {
  z-index: 50;
}

/* Overflow */
.overflow-hidden {
  overflow: hidden;
}

.overflow-y-auto {
  overflow-y: auto;
}

.max-h-60 {
  max-height: 240px;
}

.max-h-\[80vh\] {
  max-height: 80vh;
}

/* Transition */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

.transition-colors {
  transition-property: color, background-color, border-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

/* Visibility */
.hidden {
  display: none;
}

/* Cursor */
.cursor-not-allowed {
  cursor: not-allowed;
}

/* Hover States */
.hover\:bg-gray-800:hover {
  background-color: #1f2937 !important;
}

.hover\:bg-gray-300:hover {
  background-color: #d1d5db !important;
}

.hover\:border-gray-400:hover {
  border-color: #9ca3af;
}

.hover\:border-black:hover {
  border-color: #000000;
}

.hover\:text-black:hover {
  color: #000000;
}

.hover\:text-gray-600:hover {
  color: #4b5563;
}

/* Active States */
.active\:scale-95:active {
  transform: scale(0.95);
}

.active\:bg-gray-100:active {
  background-color: #f3f4f6;
}

/* Header Styles */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

/* Progress Bar */
#progressBar {
  height: 8px;
  background-color: #000000;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Audio Player Container */
#audioPlayer {
  display: none;
}

/* Keypad Buttons */
.keypad-btn {
  height: 64px;
  font-size: 24px;
  font-weight: 600;
  border-radius: 16px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.1s;
  color: #000000;
}

.keypad-btn:hover {
  border-color: #000000;
}

.keypad-btn:active {
  background-color: #f3f4f6;
  transform: scale(0.95);
}

/* Action Buttons */
#replayBtn,
#answerBtn {
  background-color: #000000 !important;
  color: #ffffff !important;
  border: none;
}

#replayBtn:hover,
#answerBtn:hover {
  background-color: #1f2937 !important;
}

#replayBtn:active,
#answerBtn:active {
  transform: scale(0.95);
}

#submitBtn {
  border: none;
}

#submitBtn:disabled {
  background-color: #d1d5db !important;
  color: #6b7280 !important;
  cursor: not-allowed;
}

#submitBtn:not(:disabled) {
  background-color: #000000 !important;
  color: #ffffff !important;
}

#submitBtn:not(:disabled):hover {
  background-color: #1f2937 !important;
}

/* Play Button */
#playBtn {
  background-color: #000000 !important;
  color: #ffffff !important;
}

#playBtn:hover {
  background-color: #1f2937 !important;
}

/* Home Button */
#homeBtn {
  background-color: #000000 !important;
  color: #ffffff !important;
  border: none;
}

#homeBtn:hover {
  background-color: #1f2937 !important;
}

/* Modal Overlay */
#answerModalOverlay,
#resultModalOverlay,
#settingsModalOverlay,
#loginModalOverlay,
#registerModalOverlay {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* Modal Buttons */
#closeAnswerModal,
#restartBtn {
  background-color: #000000 !important;
  color: #ffffff !important;
}

#closeAnswerModal:hover,
#restartBtn:hover {
  background-color: #1f2937 !important;
}

#shareBtn {
  background-color: #e5e7eb !important;
  color: #1f2937 !important;
}

#shareBtn:hover {
  background-color: #d1d5db !important;
}

/* Settings Modal Buttons */
.difficulty-btn {
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background-color: #ffffff;
  color: #4b5563;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.difficulty-btn:hover {
  border-color: #000000;
}

.difficulty-btn.active {
  background-color: #000000;
  color: #ffffff;
  border-color: #000000;
}

/* Login/Register Buttons */
#doLoginBtn,
#doRegisterBtn {
  background-color: #000000 !important;
  color: #ffffff !important;
}

#doLoginBtn:hover,
#doRegisterBtn:hover {
  background-color: #1f2937 !important;
}

/* Input Fields */
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  color: #000000;
  background-color: #ffffff;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
  border-color: #000000;
  outline: none;
}

input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="text"]::placeholder {
  color: #9ca3af;
}

/* Range Input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 9999px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background-color: #000000;
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background-color: #000000;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Wrong Answers List */
#wrongAnswersList > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background-color: #fef2f2;
  border-radius: 12px;
}

/* SVG Icons */
svg {
  display: block;
}

/* Backdrop Filter */
.backdrop-blur-sm {
  backdrop-filter: blur(4px);
}

/* Black/White Background Override */
.bg-black {
  background-color: #000000 !important;
}

/* Text White Override */
.text-white {
  color: #ffffff !important;
}
