/* ===== QUIZPOP — Rick & Morty / Pop-Art Theme ===== */

:root {
  --acid-green: #97CE4C;
  --portal-blue: #00B5CC;
  --electric-yellow: #F0E14A;
  --hot-pink: #E4287C;
  --rick-blue: #44C8F5;
  --space-dark: #0B0E17;
  --space-mid: #151A30;
  --card-green: #7EC850;
  --card-blue: #2CC5D6;
  --card-pink: #F05A8E;
  --card-yellow: #F5D63D;
  --text-white: #F5F5F5;
  --text-dark: #1A1A2E;
  --border-thick: 3px solid #000;
  --shadow-comic: 4px 4px 0px #000;
  --font-comic: 'Bangers', 'Arial Black', 'Impact', sans-serif;
  --font-body: 'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', sans-serif;
  --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;
  font-family: var(--font-body);
  background: var(--space-dark) url('./assets/bg-cosmic.png') center / cover no-repeat fixed;
  color: var(--text-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== SCREENS ===== */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
}

#screen-home {
  overflow: hidden;
}

.screen-inner {
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  min-height: 100%;
  background: transparent;
}

/* ===== HOME BACKGROUND ===== */

.home-bg {
  position: relative;
  min-height: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
}

.home-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
}

.home-top-zone {
  flex-shrink: 0;
}

.home-main-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 12px;
}

.home-main-title-wrap {
  position: sticky;
  top: -26px;
  z-index: 12;
  display: flex;
  justify-content: center;
  background: transparent;
  margin-bottom: -86px;
  padding-top: 2px;
  pointer-events: none;
}

.home-main-title-image {
  width: 63%;
  height: auto;
  display: block;
}

.decks-scroll {
  flex: 1;
  min-height: 0;
  padding-top: 82px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.14) 6%,
    rgba(0, 0, 0, 0.38) 12%,
    rgba(0, 0, 0, 0.68) 18%,
    rgba(0, 0, 0, 0.9) 22%,
    #000 26%,
    #000 86%,
    rgba(0, 0, 0, 0.97) 89%,
    rgba(0, 0, 0, 0.9) 92%,
    rgba(0, 0, 0, 0.78) 94.5%,
    rgba(0, 0, 0, 0.62) 96.5%,
    rgba(0, 0, 0, 0.42) 98%,
    rgba(0, 0, 0, 0.22) 99%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.14) 6%,
    rgba(0, 0, 0, 0.38) 12%,
    rgba(0, 0, 0, 0.68) 18%,
    rgba(0, 0, 0, 0.9) 22%,
    #000 26%,
    #000 86%,
    rgba(0, 0, 0, 0.97) 89%,
    rgba(0, 0, 0, 0.9) 92%,
    rgba(0, 0, 0, 0.78) 94.5%,
    rgba(0, 0, 0, 0.62) 96.5%,
    rgba(0, 0, 0, 0.42) 98%,
    rgba(0, 0, 0, 0.22) 99%,
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.home-footer {
  position: relative;
  flex-shrink: 0;
  margin-top: 0;
  z-index: 5;
  background: transparent;
}

.home-header .logo-portal {
  animation: none;
}

.home-header .logo-text {
  color: var(--text-white);
}

.home-footer .btn-create-deck {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  width: 100%;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
}

.home-footer .btn-create-deck:active {
  transform: scale(0.92);
  filter: brightness(0.9);
}

.btn-create-deck-img {
  width: 63%;
  height: auto;
  display: block;
  margin: 0 auto;
  pointer-events: none;
}

/* ===== COSMIC DECORATIONS ===== */

.cosmic-deco {
  position: absolute;
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
}

.deco-portal-tl {
  width: 180px;
  height: 180px;
  top: -40px;
  left: -50px;
  background: radial-gradient(circle, rgba(151, 206, 76, 0.5) 0%, rgba(151, 206, 76, 0.15) 40%, transparent 70%);
  animation: portalPulse 5s ease-in-out infinite;
}

.deco-portal-br {
  width: 200px;
  height: 200px;
  bottom: 80px;
  right: -60px;
  background: radial-gradient(circle, rgba(151, 206, 76, 0.4) 0%, rgba(151, 206, 76, 0.1) 40%, transparent 70%);
  animation: portalPulse 6s ease-in-out infinite reverse;
}

.deco-pink-tr {
  width: 140px;
  height: 200px;
  top: 20px;
  right: -30px;
  border-radius: 40% 60% 70% 30%;
  background: radial-gradient(ellipse, rgba(228, 40, 124, 0.35) 0%, rgba(228, 40, 124, 0.1) 50%, transparent 80%);
  animation: blobFloat 7s ease-in-out infinite;
}

.deco-pink-bl {
  width: 120px;
  height: 160px;
  bottom: 200px;
  left: -30px;
  border-radius: 60% 40% 30% 70%;
  background: radial-gradient(ellipse, rgba(228, 40, 124, 0.25) 0%, transparent 70%);
  animation: blobFloat 8s ease-in-out infinite reverse;
}

.deco-blue-r {
  width: 100px;
  height: 100px;
  top: 45%;
  right: -20px;
  background: radial-gradient(circle, rgba(68, 200, 245, 0.3) 0%, transparent 70%);
  animation: portalPulse 4s ease-in-out infinite;
}

@keyframes portalPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

@keyframes blobFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}

/* Cosmic stars & decorative elements */
.cosmic-star {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  font-size: 14px;
  opacity: 0.6;
  animation: twinkle 3s ease-in-out infinite;
}

.star-1 { top: 12%; left: 8%; color: var(--electric-yellow); animation-delay: 0s; }
.star-2 { top: 25%; right: 10%; color: var(--electric-yellow); font-size: 18px; animation-delay: 0.5s; }
.star-3 { top: 50%; left: 5%; color: var(--rick-blue); animation-delay: 1s; }
.star-4 { top: 65%; right: 6%; color: var(--electric-yellow); animation-delay: 1.5s; }
.star-5 { bottom: 25%; left: 12%; color: var(--acid-green); animation-delay: 2s; }
.star-6 { bottom: 8%; right: 15%; font-size: 18px; animation-delay: 0.8s; opacity: 0.4; }

@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ===== LOGO ===== */

.home-header {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-left: 24px;
}

.logo-image {
  height: 42px;
  width: auto;
  display: block;
}

.logo-spin {
  height: 42px;
  width: auto;
  display: block;
  animation: spin 15s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== GREETING PANEL ===== */

.greeting-panel {
  position: relative;
  background: rgba(11, 14, 23, 0.6);
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: none;
  margin-bottom: 24px;
  overflow: hidden;
}

.greeting-panel-halftone {
  display: none;
}

.greeting-panel-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

/* Avatar */
.avatar-circle {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 50%;
  border: 3px solid #000;
  background: var(--space-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 2px 2px 0 #000;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-emoji {
  font-size: 32px;
}

/* Greeting right side */
.greeting-right {
  flex: 1;
  min-width: 0;
}

/* Speech bubble */
.speech-bubble {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 6px 14px;
  display: inline-block;
  margin-bottom: 10px;
  box-shadow: none;
}

.speech-text {
  font-family: var(--font-comic);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text-white);
  white-space: nowrap;
}

.speech-tail {
  position: absolute;
  bottom: -10px;
  left: 16px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 4px solid transparent;
  border-top: 10px solid rgba(255, 255, 255, 0.2);
}

.speech-tail::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 4px solid transparent;
  border-top: 8px solid transparent;
}

/* Starburst badges */
.badges-row {
  display: flex;
  gap: 8px;
}

.badge-starburst {
  position: relative;
  width: auto;
  min-width: 90px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-starburst::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.badge-streak::before {
  background: transparent;
}

.badge-xp::before {
  background: transparent;
}

.badge-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 10px;
}

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

.badge-num {
  font-family: var(--font-comic);
  font-size: 20px;
  color: var(--text-white);
  letter-spacing: 1px;
}

.badge-label {
  font-family: var(--font-comic);
  font-size: 12px;
  color: rgba(245, 245, 245, 0.7);
  letter-spacing: 0.5px;
  line-height: 1.1;
}

/* ===== SECTION TITLE ===== */

.section-title {
  font-family: var(--font-comic);
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--text-white);
  text-shadow:
    3px 3px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000;
  margin-bottom: 16px;
  text-align: center;
}

/* ===== DECKS GRID ===== */

.decks-section {
  margin-bottom: 16px;
}

.decks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 4px 6px 72px;
}

/* Deck card */
.deck-card {
  border: 3px solid #000;
  border-radius: 14px;
  padding: 14px 12px 10px;
  cursor: pointer;
  box-shadow: var(--shadow-comic);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease;
}

.deck-card:active {
  transform: scale(0.95) rotate(0deg) !important;
  box-shadow: 2px 2px 0 #000;
}

/* Card tilt for comic effect */
.deck-card:nth-child(4n+1) { transform: rotate(-2deg); }
.deck-card:nth-child(4n+2) { transform: rotate(1.5deg); }
.deck-card:nth-child(4n+3) { transform: rotate(1deg); }
.deck-card:nth-child(4n+4) { transform: rotate(-1.5deg); }

/* Card colors */
.deck-card:nth-child(4n+1) { background: var(--card-green); }
.deck-card:nth-child(4n+2) { background: var(--card-blue); }
.deck-card:nth-child(4n+3) { background: var(--card-pink); }
.deck-card:nth-child(4n+4) { background: var(--card-yellow); }
/* Halftone overlay on cards */
.deck-card::after {
  content: none;
}

.deck-emoji {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 2px;
}

.deck-name {
  font-family: var(--font-comic);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text-dark);
  text-shadow: none;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.deck-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.deck-progress-pct {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  opacity: 0.7;
  min-width: 28px;
}

.deck-progress {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.4);
  border-radius: 4px;
  overflow: hidden;
  border: 1.5px solid rgba(0,0,0,0.15);
}

.deck-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: rgba(255,255,255,0.85);
  transition: width 0.4s ease;
}

.deck-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  opacity: 0.6;
  font-family: var(--font-body);
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

/* Empty state */
.decks-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: rgba(245, 245, 245, 0.6);
  font-family: var(--font-body);
  font-size: 16px;
  opacity: 1;
}

.decks-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

/* ===== CREATE DECK BUTTON ===== */

.create-btn-wrap {
  position: relative;
  margin-top: 0;
  display: flex;
  justify-content: center;
}

.btn-create-deck {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
}

.btn-create-deck:active {
  transform: scale(0.92);
  filter: brightness(0.9);
}

/* ===== BACK BUTTON ===== */

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 3px solid #000;
  border-radius: 12px;
  background: var(--portal-blue);
  color: #000;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-comic);
  margin-bottom: 12px;
}

.btn-back:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

/* ===== COMING SOON ===== */

.coming-soon {
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  padding: 60px 20px;
  font-family: var(--font-body);
}

/* ===== ONBOARDING ===== */

.onboarding-bg {
  position: relative;
  min-height: 100%;
  background: transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.onboarding-content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* Slides */
.onboarding-slide {
  display: none;
  flex: 1;
  flex-direction: column;
}

.onboarding-slide.active {
  display: flex;
}

.ob-slide-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding-bottom: 48px;
}

/* Slide 1: Welcome */
.ob-portal-anim {
  font-size: 72px;
  animation: spin 4s linear infinite;
  margin-bottom: 4px;
}

.ob-title {
  font-family: var(--font-comic);
  font-size: 56px;
  letter-spacing: 3px;
  color: var(--text-white);
  text-shadow:
    4px 4px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000;
  line-height: 1;
}

.ob-headline {
  font-family: var(--font-comic);
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--acid-green);
  text-shadow: 2px 2px 0 #000;
}

.ob-subtext {
  font-family: var(--font-body);
  font-size: 16px;
  color: rgba(245, 245, 245, 0.7);
  line-height: 1.5;
  margin-bottom: 8px;
}

/* Slide 2: How It Works */
.ob-slide-title {
  font-family: var(--font-comic);
  font-size: 36px;
  letter-spacing: 2px;
  color: var(--text-white);
  text-shadow:
    3px 3px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000;
  margin-bottom: 8px;
}

.ob-steps {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.ob-step-card {
  flex: 1;
  position: relative;
  border: 3px solid #000;
  border-radius: 14px;
  padding: 16px 8px 14px;
  box-shadow: var(--shadow-comic);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.ob-step-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 5px 5px;
  border-radius: 11px;
}

.ob-step-card:nth-child(1) { background: var(--card-blue); transform: rotate(-3deg); }
.ob-step-card:nth-child(2) { background: var(--card-green); transform: rotate(1.5deg); }
.ob-step-card:nth-child(3) { background: var(--card-pink); transform: rotate(-1deg); }

.ob-step-icon {
  font-size: 32px;
  position: relative;
  z-index: 1;
}

.ob-step-num {
  position: absolute;
  top: 4px;
  right: 6px;
  font-family: var(--font-comic);
  font-size: 16px;
  color: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.ob-step-text {
  font-family: var(--font-comic);
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--text-dark);
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

/* Slide 3: Language Selection */
.ob-lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 12px;
}

.ob-lang-btn {
  border: 3px solid #000;
  border-radius: 12px;
  padding: 14px 10px;
  background: var(--space-mid);
  color: var(--text-white);
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.ob-lang-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.ob-lang-btn.selected {
  background: var(--acid-green);
  color: var(--text-dark);
}

/* Native language row */
.ob-native-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ob-native-label {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(245, 245, 245, 0.6);
}

.ob-native-value {
  font-family: var(--font-comic);
  font-size: 18px;
  color: var(--electric-yellow);
}

/* Buttons */
.btn-ob-next,
.btn-ob-start {
  width: 100%;
  max-width: 320px;
  padding: 16px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  font-family: var(--font-comic);
  font-size: 22px;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: 5px 5px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  margin-top: auto;
}

.btn-ob-next {
  background: var(--portal-blue);
  color: #000;
}

.btn-ob-start {
  background: var(--acid-green);
  color: #000;
}

.btn-ob-next:active,
.btn-ob-start:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #000;
}

.btn-ob-start:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-ob-start:disabled:active {
  transform: none;
  box-shadow: 5px 5px 0 #000;
}

/* Dot indicators */
.ob-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px 0 8px;
  position: relative;
  z-index: 2;
}

.ob-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(245, 245, 245, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  transition: background 0.3s ease, transform 0.3s ease;
}

.ob-dot.active {
  background: var(--acid-green);
  border-color: var(--acid-green);
  transform: scale(1.3);
}

/* ===== DECK DETAIL SCREEN ===== */

.deck-bg {
  position: relative;
  min-height: 100%;
  background: transparent;
  overflow: hidden;
}

.deck-content {
  position: relative;
  z-index: 2;
  padding: 16px;
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: calc(100px + var(--safe-bottom));
}

.deck-header-panel {
  position: relative;
  background: #F5F0E8;
  border: 3px solid #000;
  border-radius: 16px;
  box-shadow: var(--shadow-comic);
  margin-bottom: 16px;
  overflow: hidden;
}

.deck-header-halftone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 6px 6px;
}

.deck-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 8px;
}

.deck-header-emoji {
  font-size: 42px;
  line-height: 1;
}

.deck-header-info {
  flex: 1;
  min-width: 0;
}

.deck-header-title {
  font-family: var(--font-comic);
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--text-dark);
  line-height: 1.1;
  word-break: break-word;
}

.deck-header-langs {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: rgba(26, 26, 46, 0.6);
}

.deck-stats-row {
  position: relative;
  display: flex;
  border-top: 2px solid rgba(0,0,0,0.1);
  padding: 10px 14px;
}

.deck-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.deck-stat-num {
  font-family: var(--font-comic);
  font-size: 22px;
  color: var(--text-dark);
  letter-spacing: 1px;
}

.deck-stat-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  color: rgba(26,26,46,0.5);
  text-transform: uppercase;
}

.btn-start-quiz {
  width: 100%;
  padding: 16px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--acid-green);
  color: #000;
  font-family: var(--font-comic);
  font-size: 24px;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: 5px 5px 0px #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  margin-bottom: 20px;
}

.btn-start-quiz:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #000;
}

.btn-start-quiz:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-start-quiz:disabled:active {
  transform: none;
  box-shadow: 5px 5px 0px #000;
}

.deck-cards-section {
  margin-bottom: 16px;
}

.deck-cards-title {
  font-family: var(--font-comic);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text-white);
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 10px;
}

.deck-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--space-mid);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 14px;
}

.card-item-state {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-item-state.state-new { background: rgba(255,255,255,0.3); }
.card-item-state.state-learning { background: var(--electric-yellow); }
.card-item-state.state-review { background: var(--acid-green); }
.card-item-state.state-relearning { background: var(--hot-pink); }

.card-item-text {
  flex: 1;
  min-width: 0;
}

.card-item-term {
  font-family: var(--font-comic);
  font-size: 16px;
  color: var(--text-white);
  letter-spacing: 0.5px;
}

.card-item-arrow {
  color: rgba(255,255,255,0.3);
  font-size: 12px;
  margin: 0 2px;
}

.card-item-translation {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(245,245,245,0.6);
}

.deck-cards-empty {
  text-align: center;
  padding: 24px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-body);
  font-size: 14px;
}

.btn-add-card {
  width: 100%;
  padding: 14px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--portal-blue);
  color: #000;
  font-family: var(--font-comic);
  font-size: 20px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 4px 4px 0px #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-add-card:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

/* Add card form */
.add-card-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-comic {
  width: 100%;
  padding: 12px 14px;
  border: 3px solid #000;
  border-radius: 12px;
  background: var(--space-mid);
  color: var(--text-white);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 3px 3px 0 #000;
  outline: none;
}

.input-comic::placeholder {
  color: rgba(245,245,245,0.3);
  font-weight: 400;
}

.input-comic:focus {
  border-color: var(--acid-green);
  box-shadow: 3px 3px 0 var(--acid-green);
}

.add-card-btns {
  display: flex;
  gap: 10px;
}

.btn-save-card {
  flex: 1;
  padding: 12px;
  border: 3px solid #000;
  border-radius: 12px;
  background: var(--acid-green);
  color: #000;
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

.btn-save-card:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.btn-cancel-card {
  padding: 12px 20px;
  border: 3px solid #000;
  border-radius: 12px;
  background: var(--space-mid);
  color: var(--text-white);
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

.btn-cancel-card:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

/* ===== QUIZ MODE SCREEN ===== */

.quiz-bg {
  position: relative;
  min-height: 100%;
  background: transparent;
  overflow: hidden;
}

.quiz-content {
  position: relative;
  z-index: 2;
  padding: 16px;
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.quiz-top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-back-small {
  width: 38px;
  height: 38px;
  min-width: 38px;
  font-size: 16px;
  margin-bottom: 0;
}

.quiz-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quiz-progress-bar {
  height: 10px;
  background: var(--space-mid);
  border-radius: 5px;
  border: 2px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--acid-green);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.quiz-progress-text {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: rgba(245,245,245,0.5);
  text-align: right;
}

/* Flashcard */
.flashcard-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  margin-bottom: 24px;
}

.flashcard {
  width: 100%;
  max-width: 340px;
  min-height: 240px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 3px solid #000;
  border-radius: 20px;
  box-shadow: 6px 6px 0 #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  overflow: hidden;
}

.flashcard-front::after,
.flashcard-back::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 5px 5px;
  border-radius: 17px;
}

.flashcard-front {
  background: var(--card-blue);
}

.flashcard-back {
  background: var(--card-green);
  transform: rotateY(180deg);
}

.flashcard-term {
  font-family: var(--font-comic);
  font-size: 36px;
  letter-spacing: 2px;
  color: var(--text-dark);
  text-align: center;
  word-break: break-word;
  position: relative;
  z-index: 1;
}

.flashcard-example {
  font-family: var(--font-body);
  font-size: 15px;
  color: rgba(26,26,46,0.6);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
  position: relative;
  z-index: 1;
}

.flashcard-translation {
  font-family: var(--font-comic);
  font-size: 36px;
  letter-spacing: 2px;
  color: var(--text-dark);
  text-align: center;
  word-break: break-word;
  position: relative;
  z-index: 1;
}

/* Quiz actions */
.quiz-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-show-answer {
  width: 100%;
  padding: 16px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--electric-yellow);
  color: #000;
  font-family: var(--font-comic);
  font-size: 22px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 5px 5px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-show-answer:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #000;
}

.rating-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-rating {
  padding: 14px 8px;
  border: 3px solid #000;
  border-radius: 12px;
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  color: #000;
}

.btn-rating:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.btn-rating-again { background: #FF6B6B; }
.btn-rating-hard { background: #FFB347; }
.btn-rating-good { background: var(--acid-green); }
.btn-rating-easy { background: var(--rick-blue); }

/* ===== RESULTS SCREEN ===== */

.results-bg {
  position: relative;
  min-height: 100%;
  background: transparent;
  overflow: hidden;
}

.results-content {
  position: relative;
  z-index: 2;
  padding: 16px;
  padding-top: calc(40px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
}

.results-trophy {
  font-size: 72px;
  animation: bounce 1s ease-in-out infinite alternate;
  margin-bottom: 8px;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-12px); }
}

.results-title {
  font-family: var(--font-comic);
  font-size: 36px;
  letter-spacing: 2px;
  color: var(--text-white);
  text-shadow:
    3px 3px 0 #000,
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000;
  margin-bottom: 20px;
  text-align: center;
}

.results-panel {
  position: relative;
  background: #F5F0E8;
  border: 3px solid #000;
  border-radius: 16px;
  box-shadow: var(--shadow-comic);
  width: 100%;
  max-width: 340px;
  margin-bottom: 24px;
  overflow: hidden;
}

.results-panel-halftone {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(circle, #000 1px, transparent 1px);
  background-size: 6px 6px;
}

.results-panel-inner {
  position: relative;
  display: flex;
  padding: 20px;
  gap: 20px;
}

.results-stat-big {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.results-stat-num {
  font-family: var(--font-comic);
  font-size: 42px;
  color: var(--text-dark);
  letter-spacing: 2px;
  line-height: 1;
}

.results-stat-num.results-xp {
  color: var(--hot-pink);
}

.results-stat-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: rgba(26,26,46,0.5);
  text-transform: uppercase;
  margin-top: 4px;
}

.results-breakdown {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.results-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-bar-label {
  font-family: var(--font-comic);
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text-white);
  width: 50px;
  text-align: right;
}

.results-bar {
  flex: 1;
  height: 16px;
  background: var(--space-mid);
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.results-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
}

.results-bar-again .results-bar-fill { background: #FF6B6B; }
.results-bar-hard .results-bar-fill { background: #FFB347; }
.results-bar-good .results-bar-fill { background: var(--acid-green); }
.results-bar-easy .results-bar-fill { background: var(--rick-blue); }

.results-bar-count {
  font-family: var(--font-comic);
  font-size: 16px;
  color: var(--text-white);
  width: 24px;
}

.results-actions {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-study-more {
  width: 100%;
  padding: 16px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--acid-green);
  color: #000;
  font-family: var(--font-comic);
  font-size: 22px;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: 5px 5px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-study-more:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #000;
}

.btn-back-to-deck {
  width: 100%;
  padding: 14px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--space-mid);
  color: var(--text-white);
  font-family: var(--font-comic);
  font-size: 20px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-back-to-deck:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

/* ===== CREATE DECK SCREEN ===== */

.create-bg {
  position: relative;
  min-height: 100%;
  background: transparent;
  overflow: hidden;
}

.create-content {
  position: relative;
  z-index: 2;
  padding: 16px;
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

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

.create-label {
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--text-white);
  text-shadow: 2px 2px 0 #000;
  margin-top: 4px;
}

.input-full {
  width: 100%;
}

.create-lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.create-lang-btn {
  border: 2.5px solid #000;
  border-radius: 10px;
  padding: 10px 6px;
  background: var(--space-mid);
  color: var(--text-white);
  font-family: var(--font-comic);
  font-size: 16px;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.create-lang-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.create-lang-btn.selected {
  background: var(--acid-green);
  color: var(--text-dark);
}

.btn-create-submit {
  width: 100%;
  padding: 16px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: var(--acid-green);
  color: #000;
  font-family: var(--font-comic);
  font-size: 24px;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: 5px 5px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  margin-top: 8px;
}

.btn-create-submit:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 #000;
}

.btn-create-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-create-submit:disabled:active {
  transform: none;
  box-shadow: 5px 5px 0 #000;
}

/* ===== SWIPE-TO-DELETE ===== */

.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.swipe-content {
  position: relative;
  z-index: 2;
  transform: translateX(0);
  will-change: transform;
}

.swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 72px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FF6B6B;
  border-radius: 0 12px 12px 0;
  font-size: 24px;
  cursor: pointer;
}

/* ===== DELETE DECK BUTTON ===== */

.btn-delete-deck {
  width: 100%;
  padding: 12px 24px;
  border: 3px solid #000;
  border-radius: 14px;
  background: transparent;
  color: #FF6B6B;
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: none;
  border-color: #FF6B6B;
  margin-top: 24px;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-delete-deck:active {
  background: rgba(255, 107, 107, 0.15);
  transform: translate(2px, 2px);
}

/* ===== CONFIRM MODAL ===== */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.confirm-overlay.active {
  display: flex;
}

.confirm-modal {
  width: 100%;
  max-width: 320px;
  background: var(--space-mid);
  border: 3px solid #000;
  border-radius: 18px;
  box-shadow: 6px 6px 0 #000;
  padding: 24px 20px 18px;
  text-align: center;
  animation: modalPop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.confirm-title {
  font-family: var(--font-comic);
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--text-white);
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 8px;
}

.confirm-message {
  font-family: var(--font-body);
  font-size: 15px;
  color: rgba(245, 245, 245, 0.7);
  line-height: 1.4;
  margin-bottom: 20px;
  word-break: break-word;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.btn-confirm-cancel {
  flex: 1;
  padding: 12px 8px;
  border: 3px solid #000;
  border-radius: 12px;
  background: var(--space-mid);
  color: var(--text-white);
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-confirm-cancel:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.btn-confirm-delete {
  flex: 1;
  padding: 12px 8px;
  border: 3px solid #000;
  border-radius: 12px;
  background: #FF6B6B;
  color: #000;
  font-family: var(--font-comic);
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-confirm-delete:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}

.btn-confirm-delete:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-confirm-delete:disabled:active {
  transform: none;
  box-shadow: 3px 3px 0 #000;
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(151, 206, 76, 0.3); border-radius: 2px; }
