@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:wght@400;600&family=Courier+Prime:wght@700&family=Dancing+Script:wght@500&display=swap');

/* ==========================================================================
   FAILURE'S FAILS - MINIMALIST PASTEL REDESIGN
   ========================================================================== */

:root {
  --bg-color: #fcf6f6;
  --bg-gray: #dadada;
  --bg-brown: #ce9b7b;
  --bg-green: #85d196;
  
  --pink-card: #e28080;
  --front-card: #e4e4e4;
  
  --btn-correct: #9be0a3;
  --btn-skip: #dadada;
  --btn-wrong: #f15c5c;
  
  --text-dark: #333333;
  --text-white: #ffffff;
  
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 30px;
}

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

body {
  background-color: var(--bg-color);
  font-family: 'Zilla Slab', serif;
  color: var(--text-dark);
  overflow: hidden; /* STRICT MOBILE VIEWPORT - NO SCROLLING */
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Desktop Wrapper (forces mobile size on desktop) */
@media (min-width: 600px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e8dbdb;
  }
  #app {
    width: 390px;
    height: 844px; /* iPhone 12 Pro size */
    max-height: 95vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
  }
}

/* ==========================================================================
   BACKGROUND SHAPES
   ========================================================================== */
.bg-shape {
  position: absolute;
  bottom: 0;
  z-index: 0;
}
.shape-gray {
  width: 350px;
  height: 400px;
  background-color: var(--bg-gray);
  bottom: -150px;
  left: -120px;
  border-radius: 60px;
  transform: rotate(-15deg);
  z-index: 2;
}
.shape-brown {
  width: 300px;
  height: 400px;
  background-color: var(--bg-brown);
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%) rotate(5deg);
  border-radius: 50px;
  z-index: 1;
}
.shape-green {
  width: 350px;
  height: 400px;
  background-color: var(--bg-green);
  bottom: -150px;
  right: -100px;
  border-radius: 60px;
  transform: rotate(-20deg);
  z-index: 2;
}

/* ==========================================================================
   GLOBAL HEADER
   ========================================================================== */
.global-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 25px;
}
.header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.brand-pill {
  font-family: 'Dancing Script', cursive;
  font-size: 20px;
  background-color: #ebebeb;
  padding: 4px 16px;
  border-radius: 20px;
  margin-bottom: 5px;
  color: #333;
}
.brand-text {
  text-align: center;
  margin-left: 15px; /* align with right side of pill */
}
.brand-sub {
  font-family: 'Zilla Slab', serif;
  font-size: 10px;
  color: #888;
  letter-spacing: 0.5px;
  margin-bottom: -2px;
}
.brand-main {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0px;
  color: #000;
}

.header-right {
  display: flex;
  gap: 15px;
  align-items: center;
  padding-top: 5px;
}
.header-icon {
  cursor: pointer;
  width: 26px;
  height: 26px;
  transition: transform 0.2s;
}
.header-icon:active {
  transform: scale(0.9);
}

/* ==========================================================================
   SCREENS
   ========================================================================== */
.screen {
  position: absolute;
  top: 100px; /* Below header */
  left: 0;
  width: 100%;
  height: calc(100% - 100px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 6;
}

/* Hide global mindcards text and home icon on landing screen */
body:has(#landing-screen.active) .global-header .brand-text,
body:has(#landing-screen.active) .global-header .home-icon {
  display: none;
}

/* ==========================================================================
   LANDING HERO SCREEN
   ========================================================================== */
.landing-hero {
  top: 120px; /* shift down to center more */
}
.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 40px;
}

.hero-brand-sub {
  font-family: 'Zilla Slab', serif;
  font-size: 16px;
  color: #888;
  letter-spacing: 0.5px;
  margin-bottom: 0px;
}
.hero-brand-main {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 52px; /* Huge text to match proportion */
  letter-spacing: -1.5px;
  color: #000;
  margin-bottom: 15px;
  line-height: 1;
}

.hero-description {
  font-family: 'Zilla Slab', serif;
  font-size: 15px;
  color: #333;
  line-height: 1.4;
  margin-bottom: 40px;
  padding: 0 10px;
}

.hero-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.hero-btn {
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-family: 'Dancing Script', cursive;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-btn:active {
  transform: scale(0.95);
}

.btn-theory {
  background-color: #8a9eed; /* Light lavender purple */
  color: #ffffff;
}

.btn-practical {
  background-color: #fefefe; /* Off-white */
  color: #222222;
  border: 1px solid #ccc;
}

/* ==========================================================================
   SELECTION PAGES (Subjects, Chapters, Decks)
   ========================================================================== */
.selection-container {
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.section-title {
  font-family: 'Zilla Slab', serif;
  font-size: 18px;
  color: #555;
  border-bottom: 1px solid #333;
  padding-bottom: 2px;
  margin-bottom: 30px;
}
.selection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  width: 100%;
  max-width: 320px;
}
.selection-card {
  background-color: #efefef;
  border-radius: 12px;
  padding: 25px 15px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.05);
  transition: transform 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
}
.selection-card:active {
  transform: scale(0.95);
}

/* ==========================================================================
   FLASHCARD SCREEN
   ========================================================================== */
.progress-track {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.prog-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  font-family: 'Zilla Slab', serif;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.prog-box.completed {
  background-color: var(--btn-correct);
}
.prog-box.active {
  background-color: var(--btn-wrong);
}
.prog-box.remaining {
  background-color: var(--bg-gray);
  color: #fff;
}
.prog-box.upcoming {
  background-color: #ffffff;
  color: #999;
}

/* Card 3D Area */
.card-scene {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  perspective: 1000px;
  padding: 0 30px;
}
.fc-card-container {
  width: 100%;
  height: 55vh;
  max-height: 450px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.fc-card-container.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.fc-front {
  background-color: var(--front-card);
}
.fc-back {
  background-color: var(--pink-card);
  transform: rotateY(180deg);
}

.fc-card-text {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  color: #333;
}
.fc-card-text-back {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
}
.fc-card-hint {
  position: absolute;
  bottom: 20px;
  font-size: 14px;
  color: #777;
}
.fc-back .fc-card-hint {
  color: rgba(255,255,255,0.8);
}

/* Card Images */
.card-image {
  max-width: 100%;
  max-height: 50%;
  border-radius: var(--radius-sm);
  object-fit: contain;
  margin-bottom: 15px;
}

/* Study Controls */
.study-controls {
  position: absolute;
  bottom: 60px;
  display: flex;
  gap: 10px;
  width: 90%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.study-controls.visible {
  opacity: 1;
  pointer-events: auto;
}
.control-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 12px;
  border: none;
  font-family: 'Zilla Slab', serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}
.control-btn:active {
  transform: scale(0.95);
}
.fc-btn-correct { background-color: var(--btn-correct); }
.fc-btn-skip { background-color: var(--btn-skip); }
.fc-btn-wrong { background-color: var(--btn-wrong); }

/* Animation classes for swipe (keep existing class names for JS) */
.swipe-out-left { animation: swipeOutLeft 0.35s forwards ease-in; }
.swipe-out-right { animation: swipeOutRight 0.35s forwards ease-in; }
.swipe-in-left { animation: swipeInLeft 0.4s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.swipe-in-right { animation: swipeInRight 0.4s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes swipeOutLeft {
  from { transform: translateX(0) rotate(0); opacity: 1; }
  to { transform: translateX(-120%) rotate(-15deg); opacity: 0; }
}
@keyframes swipeOutRight {
  from { transform: translateX(0) rotate(0); opacity: 1; }
  to { transform: translateX(120%) rotate(15deg); opacity: 0; }
}
@keyframes swipeInLeft {
  from { transform: translateX(-100%) rotate(-10deg); opacity: 0; }
  to { transform: translateX(0) rotate(0); opacity: 1; }
}
@keyframes swipeInRight {
  from { transform: translateX(100%) rotate(10deg); opacity: 0; }
  to { transform: translateX(0) rotate(0); opacity: 1; }
}

/* Card Feedback Borders */
.status-correct .fc-front,
.status-correct .fc-back {
  border: 4px solid #b2d8b5 !important; /* muted pastel green */
  box-shadow: 0 0 15px rgba(178, 216, 181, 0.4) !important;
}
.status-wrong .fc-front,
.status-wrong .fc-back {
  border: 4px solid #e2a6a6 !important; /* muted pastel red */
  box-shadow: 0 0 15px rgba(226, 166, 166, 0.4) !important;
}
.status-skip .fc-front,
.status-skip .fc-back {
  border: 4px solid #d4d4d4 !important; /* muted pastel gray */
  box-shadow: 0 0 15px rgba(212, 212, 212, 0.4) !important;
}

.fc-front, .fc-back {
  border: 4px solid transparent; /* invisible default border to prevent layout shift */
  transition: border 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================================================
   RESULT SCREEN
   ========================================================================== */
.res-container {
  margin: 0 30px;
  background-color: var(--pink-card);
  border-radius: 20px;
  padding: 40px 30px;
  color: #fff;
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.res-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
  font-size: clamp(14px, 4.5vw, 20px); /* Responsive font scaling */
  font-weight: 400;
  font-family: 'Courier Prime', Courier, monospace; /* To match screenshot typewriter look */
  white-space: nowrap; /* Force single line */
}
.res-row {
  display: flex;
  justify-content: flex-start;
  gap: 5px;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis; /* Add ellipsis if it's too long */
}
.res-buttons {
  margin-top: 40px;
  display: flex;
  gap: 15px;
  justify-content: center;
}
.btn-res {
  padding: 12px 24px;
  border-radius: 20px;
  border: none;
  font-family: 'Zilla Slab', serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.btn-res:active {
  transform: scale(0.95);
}
.btn-res-primary {
  background-color: var(--btn-correct);
}
.btn-res-secondary {
  background-color: transparent;
  /* Not a border, actually it's just text in the screenshot */
  border: none;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  font-size: 18px;
}
