:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --primary-subtle: #f0fdfa;
  --accent-cyan: #06b6d4;
  --accent-teal: #14b8a6;
  --accent-glow: rgba(20, 184, 166, 0.35);

  --text-dark: #0f172a;
  --text-muted: #475569;
  --text-light: #ffffff;

  --bg-app: #f4fbfb;
  --bg-card: #ffffff;
  --border-color: #d1fae5;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 12px rgba(13, 148, 136, 0.08);
  --shadow-md: 0 10px 25px -5px rgba(13, 148, 136, 0.15), 0 8px 10px -6px rgba(13, 148, 136, 0.1);
  --shadow-lg: 0 20px 30px -10px rgba(13, 148, 136, 0.25);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #e6fffa 0%, #ccfbf1 40%, #cffafe 100%);
  min-height: 100vh;
  color: var(--text-dark);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
}

/* Background floating numbers */
.background-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.decor-bubble {
  position: absolute;
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 4.5rem);
  color: rgba(13, 148, 136, 0.07);
  user-select: none;
  font-family: 'JetBrains Mono', monospace;
  animation: float 14s infinite ease-in-out;
}

.b1  { top: 5%;  left: 6%;  animation-duration: 16s; }
.b2  { top: 22%; right: 8%; animation-duration: 20s; animation-delay: -3s; }
.b3  { top: 45%; left: 3%;  animation-duration: 18s; animation-delay: -7s; }
.b4  { top: 68%; right: 5%; animation-duration: 22s; animation-delay: -11s; }
.b5  { top: 85%; left: 12%; animation-duration: 15s; animation-delay: -5s; }
.b6  { top: 12%; left: 75%; animation-duration: 19s; animation-delay: -2s; }
.b7  { top: 38%; left: 88%; animation-duration: 17s; animation-delay: -9s; }
.b8  { top: 60%; left: 15%; animation-duration: 21s; animation-delay: -4s; }
.b9  { top: 80%; right: 25%; animation-duration: 16s; animation-delay: -8s; }
.b10 { top: 92%; right: 8%; animation-duration: 24s; animation-delay: -13s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(6deg); }
}

#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* Container */
.app-container {
  width: 100%;
  max-width: 720px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  padding: 16px 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

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

.badge-seven {
  background: linear-gradient(135deg, #0d9488, #06b6d4);
  color: white;
  font-weight: 800;
  font-size: 1.5rem;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.35);
  font-family: 'JetBrains Mono', monospace;
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f766e;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: var(--primary-light);
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: #99f6e4;
  transform: translateY(-2px);
}

.streak-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: #b45309;
  font-size: 0.95rem;
}

.streak-label {
  font-weight: 500;
  font-size: 0.8rem;
  color: #d97706;
}

/* Nav tabs */
.mode-nav {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  padding: 6px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.nav-btn {
  flex: 1;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.nav-btn .icon {
  font-size: 1.1rem;
}

.nav-btn:hover {
  color: var(--primary);
  background: rgba(204, 251, 241, 0.5);
}

.nav-btn.active {
  background: #ffffff;
  color: #0f766e;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.15);
}

/* Main Card */
.game-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.9);
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.game-card.active {
  display: block;
}

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

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0fdfa;
}

.difficulty-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.difficulty-picker select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #a7f3d0;
  background: #f0fdfa;
  color: #0f766e;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.stats-mini {
  display: flex;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stats-mini strong {
  color: var(--primary);
}

/* Question Section */
.question-container {
  text-align: center;
  padding: 20px 0 28px 0;
}

.question-label {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.math-expression {
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 800;
  color: #0f766e;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 4px rgba(13, 148, 136, 0.1);
}

.feedback-msg {
  min-height: 28px;
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 10px;
  transition: all 0.2s;
}

.feedback-msg.correct {
  color: var(--success);
}

.feedback-msg.wrong {
  color: var(--danger);
}

/* Answers Grid */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.answer-btn {
  background: #f0fdfa;
  border: 2px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 18px 12px;
  font-size: 1.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #0f766e;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.answer-btn:hover {
  background: #ccfbf1;
  border-color: var(--accent-teal);
  transform: translateY(-3px);
  box-shadow: 0 6px 14px var(--accent-glow);
}

.answer-btn:active {
  transform: translateY(0);
}

.answer-btn.btn-correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: #065f46 !important;
  animation: pulseSuccess 0.4s ease-out;
}

.answer-btn.btn-wrong {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: #991b1b !important;
  animation: shakeWrong 0.35s ease-in-out;
}

@keyframes pulseSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.keyboard-hint {
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 10px;
}

.keyboard-hint span {
  display: inline-block;
  padding: 1px 7px;
  background: #f1f5f9;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #475569;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #0d9488, #06b6d4);
  color: white;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0f766e, #0891b2);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
}

.btn-secondary {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.btn-secondary:hover {
  background: #ccfbf1;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.text-btn:hover {
  color: var(--danger);
}

/* Flashcards */
.flashcard-wrapper {
  perspective: 1000px;
  width: 100%;
  max-width: 380px;
  height: 240px;
  margin: 10px auto 28px auto;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, #ffffff, #f0fdfa);
  border: 2px solid #a7f3d0;
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #ccfbf1, #e0f2fe);
  border-color: #5eead4;
}

.card-hint-top {
  position: absolute;
  top: 14px;
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.card-math {
  font-size: 3.4rem;
  font-weight: 800;
  color: #0f766e;
  font-family: 'JetBrains Mono', monospace;
}

.card-math.highlight {
  color: #0d9488;
  font-size: 4.2rem;
}

.card-mnemonic {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #334155;
  font-weight: 500;
  text-align: center;
}

.card-tap-cue {
  position: absolute;
  bottom: 14px;
  font-size: 0.82rem;
  color: #0d9488;
  font-weight: 600;
}

.card-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.card-counter {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 14px;
  font-weight: 600;
}

/* Sequence Mode */
.sequence-instruction {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f766e;
  text-align: center;
  margin-bottom: 24px;
}

.sequence-display {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  padding: 16px;
  background: #f0fdfa;
  border-radius: var(--radius-md);
  border: 1px dashed #5eead4;
}

.seq-item {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: white;
  border: 2px solid #99f6e4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #0f766e;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}

.seq-item.missing {
  border: 2px dashed #0d9488;
  background: #ccfbf1;
  color: #0d9488;
  animation: pulseSlot 1.5s infinite;
}

@keyframes pulseSlot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); background: #99f6e4; }
}

.sequence-options {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.seq-option-btn {
  min-width: 80px;
  padding: 14px 20px;
  background: white;
  border: 2px solid #5eead4;
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #0f766e;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.seq-option-btn:hover {
  background: #ccfbf1;
  transform: translateY(-3px);
  border-color: #0d9488;
  box-shadow: 0 6px 14px var(--accent-glow);
}

/* Finder Mode (Lov Násobků) */
.finder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.finder-progress {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 20px;
}

.finder-progress span {
  color: var(--primary);
  font-size: 1.1rem;
}

.finder-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.finder-bubble {
  aspect-ratio: 1;
  background: #ffffff;
  border: 2px solid #99f6e4;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #0f766e;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.finder-bubble:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: var(--accent-teal);
  background: #f0fdfa;
}

.finder-bubble.found-correct {
  background: #10b981 !important;
  color: white !important;
  border-color: #059669 !important;
  cursor: default;
  transform: scale(0.95);
  box-shadow: none;
}

.finder-bubble.found-wrong {
  background: #ef4444 !important;
  color: white !important;
  border-color: #dc2626 !important;
  animation: shakeWrong 0.35s ease-in-out;
}

/* Cheat Sheet Mode */
.cheat-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  margin-top: 18px;
}

.table-wrap {
  background: #f0fdfa;
  border-radius: var(--radius-md);
  padding: 8px;
  border: 1px solid #99f6e4;
}

.multiplication-table {
  width: 100%;
  border-collapse: collapse;
}

.multiplication-table th,
.multiplication-table td {
  padding: 8px 12px;
  text-align: center;
  font-size: 0.95rem;
}

.multiplication-table th {
  border-bottom: 2px solid #5eead4;
  color: #0f766e;
  font-weight: 700;
}

.multiplication-table tr:not(:last-child) td {
  border-bottom: 1px solid #ccfbf1;
}

.multiplication-table td:nth-child(2) {
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #0d9488;
  font-size: 1.05rem;
}

.multiplication-table td:nth-child(3) {
  font-family: 'JetBrains Mono', monospace;
  color: #64748b;
}

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

.trick-box {
  background: #ffffff;
  border: 1px solid #ccfbf1;
  border-left: 4px solid #0d9488;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.06);
}

.trick-box h4 {
  color: #0f766e;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.trick-box p {
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.4;
}

.digits-seq {
  display: inline-block;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0d9488;
  letter-spacing: 0.1em;
}

/* Footer */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #64748b;
  padding: 4px 8px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .cheat-grid {
    grid-template-columns: 1fr;
  }
  .finder-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .math-expression {
    font-size: 2.6rem;
  }
  .answers-grid {
    gap: 10px;
  }
  .answer-btn {
    padding: 14px 8px;
    font-size: 1.5rem;
  }
}
