/* ==========================================================================
   FAULR - PREMIUM iOS STYLE SHEET
   ========================================================================== */

:root {
  /* Colors */
  --bg-dark-primary: #0d0e12;
  --bg-dark-secondary: #161822;
  --card-bg-dark: #1c1e29;
  --card-border-dark: rgba(255, 255, 255, 0.08);
  
  --text-primary-dark: #ffffff;
  --text-secondary-dark: #9da4b7;
  --text-muted-dark: #62697b;

  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #ff9500;
  --ios-purple: #af52de;
  --ios-teal: #30b0c7;

  /* Category specific colors (Soft and premium dark styling) */
  --color-cat-utok: #ff453a;
  --color-cat-emoce: #ff375f;
  --color-cat-rozum: #0a84ff;
  --color-cat-manipulace: #bf5af2;
  --color-cat-pričina: #ffd60a;
  --color-cat-vyvozeni: #30d158;

  /* Gradients */
  --gradient-main: linear-gradient(135deg, #0d0e12 0%, #161822 100%);
  --gradient-card: linear-gradient(180deg, #1c1e29 0%, #151720 100%);
  --gradient-like: linear-gradient(135deg, #34c759 0%, #28a745 100%);
  --gradient-nope: linear-gradient(135deg, #ff3b30 0%, #d9251c 100%);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Layout constraints */
  --app-max-width: 440px;
  --app-max-height: 900px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 10% 20%, rgba(0, 122, 255, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(255, 59, 48, 0.06) 0%, transparent 40%),
              #05060b;
  color: var(--text-primary-dark);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin: 0;
  transition: gap 0.3s;
}

/* App Mockup for Desktops / Responsive Container */
.app-container {
  width: 100%;
  height: 100vh;
  max-width: 100%;
  max-height: 100vh;
  background: var(--gradient-main);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  padding-top: env(safe-area-inset-top);
}

@media (min-width: 480px) and (min-height: 650px) {
  .app-container {
    max-width: var(--app-max-width);
    max-height: var(--app-max-height);
    border-radius: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 0 12px #222533;
    height: 92vh;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Header */
.app-header {
  padding: 16px 20px 8px;
  background: rgba(13, 14, 18, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-accent {
  font-size: 22px;
  animation: pulse 2s infinite alternate;
}

.app-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #ffffff 0%, #a5b0c9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Icon Buttons & Badge */
.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--text-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s, transform 0.1s;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.95);
}

.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--ios-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid var(--bg-dark-primary);
  min-width: 18px;
  text-align: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.icon-btn .badge.empty {
  transform: scale(0);
}

/* Horizontal Categories Bar */
.categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none; /* Firefox */
}

.categories-bar::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.category-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary-dark);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.category-pill:active {
  transform: scale(0.96);
}

.category-pill.active {
  background: var(--ios-blue);
  color: white;
  border-color: var(--ios-blue);
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

/* Deck Container */
.deck-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 20px 20px;
  perspective: 1000px;
}

.card-deck {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 520px; /* Safeguard on tall devices */
}

/* Individual Card Styling */
.tinder-card {
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--gradient-card);
  border-radius: 24px;
  border: 1px solid var(--card-border-dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 
              0 1px 3px rgba(255, 255, 255, 0.05) inset;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  transform-origin: 50% 90%;
  will-change: transform, opacity;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1), opacity 0.5s;
}

.tinder-card:active {
  cursor: grabbing;
}

/* Stack styling (layered effect) */
.tinder-card.card-top {
  z-index: 5;
}

.tinder-card.card-next {
  z-index: 4;
  transform: scale(0.94) translateY(14px);
  opacity: 0.85;
  pointer-events: none;
}

.tinder-card.card-third {
  z-index: 3;
  transform: scale(0.88) translateY(28px);
  opacity: 0.5;
  pointer-events: none;
}

.tinder-card.card-back {
  z-index: 2;
  transform: scale(0.8) translateY(42px);
  opacity: 0;
  pointer-events: none;
}

/* Card Content Details */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.category-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.card-num {
  font-size: 12px;
  color: var(--text-muted-dark);
  font-weight: 500;
}

.fallacy-names {
  margin-bottom: 8px;
}

.cz-name {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.latin-name {
  font-size: 12px;
  font-style: italic;
  font-weight: 500;
  color: var(--text-secondary-dark);
}

.fallacy-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary-dark);
  margin-bottom: 12px;
}

/* Chat Example Simulation */
.chat-container {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 18px;
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: flex-start;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.03);
  margin-bottom: 12px;
}

.chat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted-dark);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  margin-top: 2px;
}

.bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 12.5px;
  line-height: 1.35;
  position: relative;
  word-break: break-word;
}

.bubble.oponent, .bubble.opponent {
  background: #2b2d3c;
  color: var(--text-primary-dark);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bubble.fallacy {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: #fff;
  font-weight: 500;
}

/* Tip / Defense Section */
.defense-box {
  background: rgba(52, 199, 89, 0.08);
  border: 1px dashed rgba(52, 199, 89, 0.25);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.defense-icon {
  color: var(--ios-green);
  flex-shrink: 0;
  margin-top: 2px;
}

.defense-text {
  font-size: 12px;
  line-height: 1.4;
  color: #d1ffd6;
  width: 100%;
}

.defense-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.card-more-info {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #d1ffd6;
  text-decoration: none;
  background: rgba(52, 199, 89, 0.15);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.2s, transform 0.1s;
  border: 1px solid rgba(52, 199, 89, 0.25);
}

.wiki-link:active {
  background: rgba(52, 199, 89, 0.3);
  transform: scale(0.96);
}

.wiki-link i {
  width: 12px;
  height: 12px;
}

/* Loader / Placeholder */
.deck-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary-dark);
  gap: 16px;
}

.loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

/* Overlays inside the main deck container */
.swipe-overlay {
  position: absolute;
  top: 100px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.swipe-like {
  right: 40px;
  border: 4px solid var(--ios-green);
  color: var(--ios-green);
  transform: rotate(15deg);
}

.swipe-nope {
  left: 40px;
  border: 4px solid var(--ios-red);
  color: var(--ios-red);
  transform: rotate(-15deg);
}

/* Action Buttons Footer */
.action-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 10px 20px 24px;
  z-index: 5;
}

.action-btn {
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s;
}

.action-btn:active {
  transform: scale(0.85);
}

.btn-small {
  width: 48px;
  height: 48px;
  background: #252836;
  color: var(--text-secondary-dark);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-small:active {
  background: #323648;
}

.btn-medium {
  width: 54px;
  height: 54px;
  background: #252836;
  color: var(--ios-blue);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-medium:active {
  background: #323648;
}

.btn-large {
  width: 64px;
  height: 64px;
}

.btn-nope {
  background: var(--gradient-nope);
  box-shadow: 0 6px 20px rgba(255, 59, 48, 0.3);
}

.btn-like {
  background: var(--gradient-like);
  box-shadow: 0 6px 20px rgba(52, 199, 89, 0.3);
}

/* iOS Bottom Sheet Styling */
.bottom-sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  visibility: hidden;
  transition: visibility 0.4s;
}

.bottom-sheet.open {
  visibility: visible;
}

.sheet-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.bottom-sheet.open .sheet-overlay {
  opacity: 1;
}

.sheet-content {
  background: #171822;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  width: 100%;
  max-height: 82%;
  min-height: 40%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bottom-sheet.open .sheet-content {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.sheet-header {
  padding: 12px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.sheet-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: white;
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sheet-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Search bar in sheet */
.search-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--text-muted-dark);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: white;
  width: 100%;
  font-family: var(--font-family);
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--text-muted-dark);
}

/* Favorites list inside drawer */
.favorites-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-msg {
  text-align: center;
  color: var(--text-muted-dark);
  font-size: 14px;
  padding: 40px 20px;
  line-height: 1.5;
}

.fav-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.fav-item:active {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(0.98);
}

.fav-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fav-title {
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.fav-latin {
  font-size: 11px;
  font-style: italic;
  color: var(--text-secondary-dark);
}

.fav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fav-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: uppercase;
}

.btn-remove-fav {
  background: transparent;
  border: none;
  color: var(--text-muted-dark);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background-color 0.2s;
}

.btn-remove-fav:hover, .btn-remove-fav:active {
  color: var(--ios-red);
  background: rgba(255, 59, 48, 0.1);
}

/* Info Sheet Content */
.info-body {
  color: var(--text-secondary-dark);
  line-height: 1.6;
}

.logo-big {
  font-size: 32px;
  font-weight: 900;
  text-align: center;
  margin: 10px 0 6px;
  color: white;
}

.lead {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary-dark);
  margin-bottom: 24px;
}

.info-guide {
  margin: 20px 0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 18px;
}

.info-guide h3 {
  color: white;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
}

.info-guide ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-guide li {
  display: flex;
  gap: 12px;
  font-size: 13px;
}

.info-guide li strong {
  color: var(--text-primary-dark);
}

.info-guide li i {
  color: var(--ios-blue);
  flex-shrink: 0;
  margin-top: 1px;
}

.credits {
  font-size: 11px;
  text-align: center;
  color: var(--text-muted-dark);
  margin-top: 10px;
}

/* Toast styling */
.toast {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28, 30, 41, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Direct Card Load Fullscreen Overlay */
.fullscreen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 14, 18, 0.95);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.fullscreen-overlay.hidden {
  display: none;
}

.overlay-card-wrapper {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.overlay-card-wrapper .tinder-card {
  position: relative;
  height: 500px;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.direct-close-btn {
  background: var(--ios-blue);
  border: none;
  color: white;
  padding: 14px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
  transition: transform 0.1s, background-color 0.2s;
}

.direct-close-btn:active {
  transform: scale(0.97);
  background: #0062cc;
}

/* Keyframes */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.15); opacity: 1; }
}

/* Custom Scrollbar for Card Deck Internal Scroll (if needed) */
.tinder-card ::-webkit-scrollbar {
  width: 4px;
}
.tinder-card ::-webkit-scrollbar-track {
  background: transparent;
}
.tinder-card ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* Desktop Tips & Shortcuts Panel */
.desktop-tips {
  display: none;
  flex-direction: column;
  background: rgba(28, 30, 41, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
  border-radius: 24px;
  width: 290px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  gap: 16px;
  animation: fadeInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (min-width: 900px) and (min-height: 650px) {
  body {
    gap: 36px;
  }
  .desktop-tips {
    display: flex;
  }
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.tips-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.tips-header i {
  color: var(--ios-blue);
  width: 18px;
  height: 18px;
}

.tips-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary-dark);
}

.tip-row kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 700;
  color: white;
  min-width: 32px;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

.tips-footer {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted-dark);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* iOS Bottom Tab Navigation & Multi-Tab Layout */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  height: calc(100% - 60px); /* header height offset */
  min-height: 0; /* Flexbox height constraint fix */
}

.tab-content {
  display: none;
  flex-direction: column;
  height: 100%;
  flex: 1; /* Force flex child to fill height */
  overflow-y: auto;
  padding-bottom: 74px; /* bottom tab-bar height offset */
  min-height: 0; /* Flexbox height constraint fix */
}

#tab-swipe {
  overflow: hidden; /* Prevent swipe tab scrolling to resolve flexbox container collapsing bugs */
}

.tab-content.active-tab {
  display: flex;
}

.tab-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(20, 22, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.tab-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted-dark);
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: color 0.2s;
  outline: none;
}

.tab-item i {
  width: 20px;
  height: 20px;
  transition: transform 0.2s;
}

.tab-item.active {
  color: var(--ios-blue);
}

.tab-item.active i {
  transform: scale(1.1);
}

/* Tab 2: Training Game Mode Styles */
.game-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: auto;
  min-height: 100%;
}

.game-header-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 18px;
  border-radius: 16px;
}

.streak-indicator {
  font-weight: 700;
  color: var(--ios-red);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.score-indicator {
  font-weight: 600;
  color: var(--text-secondary-dark);
  font-size: 13px;
}

.game-card {
  background: rgba(28, 30, 41, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-question-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-chat-wrapper {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 16px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.04);
  max-height: 240px;
  overflow-y: auto;
}

.game-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.choice-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.choice-btn:active {
  transform: scale(0.98);
}

.choice-btn.correct {
  background: rgba(52, 199, 89, 0.18) !important;
  border-color: rgba(52, 199, 89, 0.7) !important;
  color: #34c759 !important;
  box-shadow: 0 0 15px rgba(52, 199, 89, 0.15);
}

.choice-btn.wrong {
  background: rgba(255, 59, 48, 0.18) !important;
  border-color: rgba(255, 59, 48, 0.7) !important;
  color: #ff3b30 !important;
  box-shadow: 0 0 15px rgba(255, 59, 48, 0.1);
}

.choice-btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.choice-btn.correct:disabled, .choice-btn.wrong:disabled {
  opacity: 1;
}

.game-feedback {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.feedback-title {
  font-size: 14.5px;
  font-weight: 700;
}

.feedback-title.correct-title {
  color: #34c759;
}

.feedback-title.wrong-title {
  color: #ff3b30;
}

.feedback-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary-dark);
}

.game-next-btn {
  background: var(--ios-blue);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.game-next-btn:active {
  transform: scale(0.97);
}

/* Tab 3: Statistics Styles */
.stats-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: auto;
  min-height: 100%;
}

.stats-level-banner {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.15) 0%, rgba(255, 45, 85, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-icon {
  font-size: 28px;
}

.level-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-label {
  font-size: 10px;
  color: var(--text-muted-dark);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.level-name {
  font-size: 16px;
  font-weight: 800;
  color: white;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  background: rgba(28, 30, 41, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.stat-num {
  font-size: 17px;
  font-weight: 800;
  color: var(--ios-blue);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted-dark);
  font-weight: 600;
}

.stats-section {
  background: rgba(28, 30, 41, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-section h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: white;
}

.stats-desc {
  font-size: 11px;
  color: var(--text-muted-dark);
  margin-top: -8px;
  line-height: 1.4;
}

.category-chart-wrapper {
  display: flex;
  flex-direction: column;
}

.chart-visual {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 10px;
}

.bar-row .lbl {
  width: 90px;
  color: var(--text-secondary-dark);
}

.bar-row .progress {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.bar-row .fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--ios-blue) 0%, rgba(0, 122, 255, 0.5) 100%);
  width: 0%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-row .val {
  width: 24px;
  text-align: right;
  font-weight: 700;
  color: white;
}

.leaderboard-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12.5px;
}

.leaderboard-row:nth-child(1) {
  background: rgba(255, 215, 0, 0.06);
  border-color: rgba(255, 215, 0, 0.18);
}

.leaderboard-row:nth-child(2) {
  background: rgba(192, 192, 192, 0.04);
  border-color: rgba(192, 192, 192, 0.15);
}

.leaderboard-row:nth-child(3) {
  background: rgba(205, 127, 50, 0.03);
  border-color: rgba(205, 127, 50, 0.12);
}

.rank-tag {
  font-weight: 800;
  width: 24px;
  font-size: 11.5px;
}

.leaderboard-row:nth-child(1) .rank-tag { color: #ffd700; }
.leaderboard-row:nth-child(2) .rank-tag { color: #c0c0c0; }
.leaderboard-row:nth-child(3) .rank-tag { color: #cd7f32; }

.leaderboard-name {
  flex: 1;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.leaderboard-count {
  font-weight: 700;
  color: var(--text-muted-dark);
}

.leaderboard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted-dark);
  padding: 20px 0;
}

.loader-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top: 2px solid var(--ios-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive adjustments for shorter viewports to optimize card spacing */
@media (max-height: 740px), (max-width: 360px) {
  .app-header {
    padding: 10px 16px 6px;
  }
  .header-top {
    margin-bottom: 0;
  }
  .app-header h1 {
    font-size: 20px;
  }
  .logo-accent {
    font-size: 18px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .icon-btn i {
    width: 16px;
    height: 16px;
  }
  .deck-container {
    padding: 8px 12px 10px;
  }
  .category-pill {
    padding: 6px 12px;
    font-size: 12px;
  }
  .action-buttons {
    padding: 4px 10px 10px;
    gap: 12px;
  }
  .btn-small {
    width: 38px;
    height: 38px;
  }
  .btn-medium {
    width: 44px;
    height: 44px;
  }
  .btn-large {
    width: 52px;
    height: 52px;
  }
  .action-btn i {
    width: 20px;
    height: 20px;
  }
  .btn-small i {
    width: 16px;
    height: 16px;
  }
  .tab-bar {
    height: 52px;
  }
  .tab-item i {
    width: 18px;
    height: 18px;
  }
  .tab-item span {
    font-size: 9px;
  }
  .tab-content {
    padding-bottom: 60px;
  }
  .tinder-card {
    padding: 14px 16px;
    overflow-y: auto;
  }
  .cz-name {
    font-size: 17px;
    margin-bottom: 2px;
  }
  .latin-name {
    font-size: 10px;
    margin-bottom: 4px;
  }
  .fallacy-desc {
    font-size: 11px;
    margin-bottom: 8px;
    line-height: 1.3;
  }
  .chat-label {
    margin-top: 2px;
    margin-bottom: 4px;
    font-size: 9px;
  }
  .chat-container {
    padding: 6px 8px;
    margin-bottom: 8px;
    gap: 4px;
  }
  .bubble {
    font-size: 11.5px;
    padding: 5px 10px;
    border-radius: 14px;
  }
  .defense-box {
    padding: 8px 10px;
    gap: 8px;
    border-radius: 12px;
  }
  .defense-text {
    font-size: 11px;
    line-height: 1.3;
  }
  .card-more-info {
    margin-top: 4px;
  }
  .wiki-link {
    font-size: 10px;
  }
}
