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

body {
  font-family: 'Noto Sans', sans-serif;
  background: linear-gradient(135deg, #f6f7fb 0%, #eef2ff 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* small icon above the page title */
.page-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}
#page-icon {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(16,24,40,0.12);
  border: 4px solid #fff;
}
@media (max-width: 420px) {
  #page-icon {
    width: 52px;
    height: 52px;
  }
}

/* Page title in bold comic style */
.page-title {
  font-size: 2.25rem;
  line-height: 1;
  margin: 8px 0 20px 0;
  text-align: center;
  font-weight: 900;
  letter-spacing: 1px;
  color: #0f172a;
  /* playful comic-like look using heavy stroke shadow */
  text-shadow:
    -3px -3px 0 #fff8,
    4px 4px 0 rgba(0,0,0,0.12),
    6px 6px 0 rgba(0,0,0,0.06);
  background: linear-gradient(90deg, #ff8a00 0%, #ff5c8a 50%, #ffb86b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 6px 12px;
  border-radius: 10px;
  display: inline-block;
  transform: skewX(-3deg);
}

/* make title larger on wide screens and scale down on small */
@media (min-width: 900px) {
  .page-title {
    font-size: 3rem;
  }
}

/* Simple index / table of contents styles */
.index-nav {
  display: flex;
  justify-content: center;
  margin: 10px 0 20px;
}
.index-list {
  list-style: none;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0;
}
.index-link {
  display: inline-block;
  padding: 12px 16px;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  font-weight: 900;
  color: #0f172a;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0,0,0,0.08);
  transition: transform 0.16s, box-shadow 0.16s;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.index-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(16,24,40,0.12);
}
@media (max-width: 420px) {
  .page-title {
    font-size: 1.5rem;
    transform: none;
    padding: 4px 8px;
  }
}

/* improved header-like spacing for grid */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  perspective: 1000px;
  max-width: 1600px;
}

/* Title shown above the second section - big comic letters */
.section-title {
  font-size: 2rem;
  line-height: 1;
  margin: 28px 0 12px;
  text-align: center;
  font-weight: 900;
  letter-spacing: 1px;
  color: #0f172a;
  /* playful comic-like look using heavy stroke shadow and warm gradient */
  text-shadow:
    -3px -3px 0 rgba(255,255,255,0.6),
    4px 4px 0 rgba(0,0,0,0.12),
    6px 6px 0 rgba(0,0,0,0.06);
  background: linear-gradient(90deg, #ff8a00 0%, #ff5c8a 50%, #ffb86b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-block;
  transform: skewX(-3deg);
  align-self: center;
}

/* Make section title slightly smaller on narrow screens but keep the comic look */
@media (max-width: 768px) {
  .section-title {
    font-size: 1.4rem;
    transform: none;
    padding: 4px 10px;
    text-align: center;
    margin-top: 20px;
  }
}

.flashcard {
  aspect-ratio: 16 / 10;
  cursor: pointer;
  position: relative;
  min-height: 360px;
  transition: transform 0.28s ease;
}

.flashcard:hover {
  transform: translateY(-6px);
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
}

.flashcard-front {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  display: flex;
  flex-direction: column;
}

.flashcard-front img {
  width: 100%;
  height: 85%;
  object-fit: cover;
}

/* placeholder front when no image is provided */
.placeholder-front {
  width: 100%;
  height: 85%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: left;
  gap: 8px;
  flex-direction: column;
  background: linear-gradient(135deg, #ffd7a8 0%, #ffb4a2 100%);
  color: #1f2937;
  font-weight: 600;
}

.placeholder-front .title {
  font-size: 1.25rem;
  font-weight: 700;
}

.placeholder-front .keywords {
  font-size: 0.95rem;
  color: rgba(31,41,55,0.9);
  line-height: 1.4;
  letter-spacing: 0.2px;
}

/* numbered badge overlay */
.number-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  min-width: 40px;
  height: 40px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.95);
  color: #111827;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  z-index: 4;
}

/* default caption (used for main section cards) */
.card-caption {
  height: 15%;
  background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 10px;
  text-align: center;
  letter-spacing: 0.4px;
}

/* CATEGORY VARIANTS FOR NEW SECTION CARDS */
/* Roommates - warm orange */
.section-roommates .card-caption {
  background: linear-gradient(135deg, #ffb347 0%, #ffcc33 100%);
  color: #1f2937;
}
.section-roommates .placeholder-front {
  background: linear-gradient(135deg, #fff4e6 0%, #ffe7cc 100%);
}
.section-roommates .keyword-tag {
  background: rgba(245, 158, 11, 0.08);
  color: #b45309;
}

/* Siblings - teal / green */
.section-siblings .card-caption {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  color: #052e1f;
}
.section-siblings .placeholder-front {
  background: linear-gradient(135deg, #e6fffa 0%, #ccfff0 100%);
}
.section-siblings .keyword-tag {
  background: rgba(16, 185, 129, 0.08);
  color: #047857;
}

/* Neighbors - blue */
.section-neighbors .card-caption {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  color: #04244f;
}
.section-neighbors .placeholder-front {
  background: linear-gradient(135deg, #e8f0ff 0%, #dbe9ff 100%);
}
.section-neighbors .keyword-tag {
  background: rgba(59,130,246,0.08);
  color: #1e40af;
}

/* Customer/shop disputes - magenta/pink */
.section-customer .card-caption {
  background: linear-gradient(135deg, #f472b6 0%, #fb7185 100%);
  color: #2b0219;
}
.section-customer .placeholder-front {
  background: linear-gradient(135deg, #fff0f6 0%, #ffe6ee 100%);
}
.section-customer .keyword-tag {
  background: rgba(236,72,153,0.08);
  color: #9f1239;
}

.flashcard-back {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: none;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px;
  text-align: center;
}

.flashcard-back h2 {
  font-size: 1.9rem;
  margin-bottom: 18px;
  color: #0f172a;
  font-weight: 800;
}

.flashcard-back p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #334155;
  font-weight: 400;
}

/* small tag for keyword list on back */
.keyword-tag {
  display: inline-block;
  margin: 6px 6px 0 6px;
  padding: 6px 10px;
  background: rgba(99,102,241,0.1);
  color: #4f46e5;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .flashcard-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  
  .flashcard-back h2 {
    font-size: 1.3rem;
  }
  
  .flashcard-back p {
    font-size: 1rem;
  }
  
  .flashcard-back {
    padding: 26px 18px;
  }

  .placeholder-front .title {
    font-size: 1.05rem;
  }
  
  .placeholder-front .keywords {
    font-size: 0.9rem;
  }
}