/* ============================================
   DeutschTok — Reels-style German flashcards
   ============================================ */

:root {
  --bg: #0a0a0f;
  --bg-card: #14141f;
  --text: #e8e8f0;
  --text-dim: #6a6a80;
  --text-hint: #8888aa;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.25);
  --easy: #00cec9;
  --hard: #fd79a8;
  --new-badge: #fdcb6e;
  --card-radius: 24px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Top bar ---- */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  background: linear-gradient(to bottom, var(--bg) 50%, transparent);
}

#streak-display {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 700;
}

#streak-flame { font-size: 18px; color: var(--accent); }

#mode-switcher {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 3px;
}

.mode-btn {
  background: none; border: none;
  color: var(--text-dim);
  font-size: 11px; font-weight: 600;
  padding: 5px 12px;
  border-radius: 17px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

#progress-ring-container { position: relative; width: 34px; height: 34px; }
#progress-ring { display: block; }
#progress-circle { transition: stroke-dashoffset 0.5s ease; }
#progress-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--text-dim);
}

/* ---- Lesson selector ---- */
#lesson-selector {
  position: fixed;
  top: calc(var(--safe-top) + 50px);
  left: 16px; right: 16px;
  z-index: 99;
}
#lesson-selector.hidden { display: none; }
#lesson-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; font-size: 13px; outline: none;
}

/* ---- Reel progress bar (Stories-style) ---- */
#reel-progress {
  position: fixed;
  top: calc(var(--safe-top) + 44px);
  left: 12px; right: 12px;
  z-index: 101;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

#reel-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* ---- Pause indicator ---- */
#pause-indicator {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 200;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease;
}

#pause-indicator.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

#pause-indicator svg {
  width: 32px; height: 32px;
  fill: white;
}

/* ---- Card viewport ---- */
#card-viewport {
  position: fixed; inset: 0;
  padding-top: calc(var(--safe-top) + 52px);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}

#card-stack {
  width: 100%; height: 100%;
  position: relative;
}

/* ---- Reel card (single face, no flip) ---- */
.reel-card {
  position: absolute;
  inset: 6px 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--card-radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  overflow: hidden;
  will-change: transform, opacity;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.4s ease;
}

@media (min-width: 600px) {
  .reel-card { left: 40px; right: 100px; }
}

.reel-card.active { transform: translateY(0); opacity: 1; }
.reel-card.exiting-up { transform: translateY(-110%); opacity: 0; }
.reel-card.entering-up { transform: translateY(100%); opacity: 0; }
.reel-card.exiting-down { transform: translateY(110%); opacity: 0; }
.reel-card.entering-down { transform: translateY(-100%); opacity: 0; }

/* Type badge */
.reel-card .type-badge {
  position: absolute;
  top: 18px; left: 18px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 8px;
}

.reel-card .new-badge {
  position: absolute;
  top: 18px; right: 18px;
  font-size: 9px; font-weight: 700;
  color: var(--new-badge);
  background: rgba(253, 203, 110, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- German (always visible) ---- */
.reel-german {
  font-size: clamp(24px, 7vw, 42px);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* When reveal happens, German slides up to make room */
.reel-card.revealed .reel-german {
  transform: translateY(-20px);
}

.reel-hint {
  font-size: 13px;
  color: var(--text-hint);
  font-style: italic;
  margin-bottom: 4px;
  opacity: 0.7;
}

/* ---- Reveal section (slides in from below) ---- */
.reel-reveal {
  width: 100%;
  max-width: 400px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease,
              transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.reel-card.revealed .reel-reveal {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.reel-divider {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: 16px auto;
  border-radius: 1px;
}

.reel-translation {
  font-size: clamp(18px, 4.5vw, 28px);
  font-weight: 700;
  color: var(--easy);
  margin-bottom: 10px;
}

.reel-details {
  font-size: 13px;
  color: var(--text-hint);
  line-height: 1.5;
  margin-bottom: 12px;
}

.reel-examples {
  text-align: left;
  width: 100%;
}

.reel-example {
  padding: 8px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.reel-example-de {
  font-size: 14px;
  color: var(--text);
  font-style: italic;
  margin-bottom: 2px;
}

.reel-example-en {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---- Bottom info area ---- */
.reel-bottom {
  position: absolute;
  bottom: 20px; left: 24px; right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.5;
}

/* ---- Swipe feedback overlays ---- */
.feedback-overlay {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  z-index: 200;
  font-size: 28px; font-weight: 800;
  padding: 14px 28px;
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#feedback-easy { right: 16px; color: var(--easy); background: rgba(0, 206, 201, 0.15); }
#feedback-hard { left: 16px; color: var(--hard); background: rgba(253, 121, 168, 0.15); }
.feedback-overlay.show { opacity: 1; }

/* ---- Empty state ---- */
#empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 8px;
}
#empty-state.hidden { display: none; }
#empty-state p { font-size: 18px; color: var(--text-dim); }
#empty-state .sub { font-size: 14px; color: var(--text-dim); opacity: 0.5; }

/* ---- Goal celebration ---- */
#goal-complete {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#goal-complete.hidden { display: none; }
.celebration-text {
  font-size: 28px; font-weight: 800; color: var(--accent);
  text-align: center;
  animation: celebrationPop 0.6s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}
@keyframes celebrationPop {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Desktop nav ---- */
#desktop-nav {
  position: fixed; right: 24px; top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex; flex-direction: column;
  gap: 8px; align-items: center;
}

@media (hover: none) and (pointer: coarse) {
  #desktop-nav { display: none; }
}

.nav-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.nav-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: rgba(255,255,255,0.2); }
.nav-btn-wide {
  width: auto; border-radius: 24px;
  padding: 0 18px; font-size: 12px; font-weight: 600;
}
.nav-btn-pause { font-size: 11px; }
#desktop-rating { display: flex; gap: 8px; margin-top: 4px; }
#desktop-rating.hidden { display: none; }
.rate-easy { width: auto; border-radius: 24px; padding: 0 16px; font-size: 12px; font-weight: 600; color: var(--easy); border-color: rgba(0, 206, 201, 0.3); }
.rate-easy:hover { background: rgba(0, 206, 201, 0.15); }
.rate-hard { width: auto; border-radius: 24px; padding: 0 16px; font-size: 12px; font-weight: 600; color: var(--hard); border-color: rgba(253, 121, 168, 0.3); }
.rate-hard:hover { background: rgba(253, 121, 168, 0.15); }

/* ---- Scrollbar hide ---- */
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }
