/* ============================================
   BOOZNIAK FISZKI - STYLES (uproszczone)
   ============================================ */

:root {
  --boozniak-orange: #fdb21a;
  --boozniak-graphite: #3d4e5c;
  --boozniak-burgundy: #a0354a;
  --boozniak-purple: #673AB7;
  --boozniak-teal: #009688;
  --transition-slow: 0.6s;
}

/* ============================================
   TYPOGRAFIA
   ============================================ */
body {
  font-family: 'Inter', sans-serif;
}

.font-american-typewriter {
  font-family: "American Typewriter Semibold", "American Typewriter", Consolas, "Courier New", Courier, monospace;
  font-weight: 600;
}

/* ============================================
   ANIMACJE WIDOKÓW
   ============================================ */
#welcomeView, #confirmationView, #quizView, #resultsView {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* ============================================
   FISZKA - 3D FLIP
   ============================================ */
.card-container {
  perspective: 1000px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 20rem;
  overflow: visible;
}

.card-container:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--transition-slow);
  transform-style: preserve-3d;
}

.card-inner.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow-y: auto;
  overflow-x: hidden;
}

.card-back {
  transform: rotateY(180deg);
}

/* ============================================
   KBD (klawisze)
   ============================================ */
kbd {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  color: #374151;
}

.dark kbd {
  background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
  border-color: #4b5563;
  color: #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

/* ============================================
   RESPONSYWNOŚĆ - MOBILE
   ============================================ */
@media (min-width: 641px) {
  #mainContainer {
    max-width: 512px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }
  .card-container {
    height: 26rem;
  }
}

@media (max-width: 640px) {
  #mainContainer {
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding-top: 3rem !important;
  }

  /* Quiz fullscreen na mobile */
  #quizView:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: env(safe-area-inset-top, 2.5rem) 1rem env(safe-area-inset-bottom, 1rem) !important;
    padding-top: calc(env(safe-area-inset-top, 2.5rem) + 1rem) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: white !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .dark #quizView:not(.hidden) {
    background: rgb(31, 41, 55) !important;
  }

  .card-container {
    height: 20rem;
  }

  #wordToTranslate, #wordAnswer {
    font-size: 1.25rem !important;
    line-height: 1.8 !important;
    padding: 1.5rem !important;
  }
}

/* Responsive quiz instructions */
@media (max-width: 767px) {
  .mobile-quiz-instructions { display: block !important; }
  .desktop-quiz-instructions { display: none !important; }
}
@media (min-width: 768px) {
  .mobile-quiz-instructions { display: none !important; }
  .desktop-quiz-instructions { display: flex !important; }
}

/* ============================================
   TEKST NA FISZKACH - odstępy
   ============================================ */
#wordToTranslate, #wordAnswer {
  line-height: 2.0 !important;
  letter-spacing: 0.02em !important;
  padding: 2rem !important;
  max-height: 18rem;
  overflow-y: auto;
}

/* Scrollbar fiszek */
#wordToTranslate::-webkit-scrollbar,
#wordAnswer::-webkit-scrollbar {
  width: 6px;
}
#wordToTranslate::-webkit-scrollbar-track,
#wordAnswer::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}
#wordToTranslate::-webkit-scrollbar-thumb,
#wordAnswer::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}
.dark #wordToTranslate::-webkit-scrollbar-thumb,
.dark #wordAnswer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
#quizProgressBar {
  background-color: #fdb21a;
  height: 8px;
  min-width: 4px;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
  min-width: 250px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
  font-size: 14px;
  font-weight: 500;
}

.toast-success { background-color: #10b981; color: white; }
.toast-error { background-color: #ef4444; color: white; }
.toast-info { background-color: #3b82f6; color: white; }
.toast-warning { background-color: #f59e0b; color: white; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.hiding {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ============================================
   DARK MODE TOGGLE - mobile-friendly
   ============================================ */
@media (max-width: 640px) {
  button#darkModeToggle {
    padding: 1rem !important;
    font-size: 2.25rem !important;
    min-width: 48px;
    min-height: 48px;
  }
  button#darkModeToggle span {
    font-size: 2.25rem;
  }
  /* Footer logo big on mobile */
  .footer-logo-results {
    max-height: 180px;
  }
  /* Button big on mobile */
  #backToMenuBtn {
    padding: 3rem 1rem !important;
    font-size: 1.25rem !important;
  }
}

/* Desktop: smaller button and logo, no scroll */
@media (min-width: 641px) {
  .footer-logo-results {
    max-height: 100px;
  }
  #backToMenuBtn {
    padding: 1.2rem 1rem !important;
    font-size: 1.1rem !important;
  }
  #resultsView img[alt="Gratulacje!"] {
    max-height: 25vh !important;
  }
}