@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
  --font-main: 'IBM Plex Sans Thai', sans-serif;
  --font-title: 'IBM Plex Sans Thai', sans-serif;
  --font-hand: 'IBM Plex Sans Thai', sans-serif;
  
  --color-primary: #FF7B54;
  --color-primary-dark: #E05F36;
  --color-text-dark: #3D3130;
  --color-text-light: #706261;
}

body {
  font-family: var(--font-main);
  color: var(--color-text-dark);
  background-image: url('assets/crumpled_paper.jpg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-title {
  font-family: var(--font-title);
}

.font-hand {
  font-family: var(--font-hand);
}

/* Floating Top Logo Header Style */
.top-header-panel {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

/* Circle Highlight SVG Overlay */
.circle-highlight {
  position: relative;
  display: inline-block;
  z-index: 1;
  padding: 0 0.2em;
}

.circle-highlight::after {
  content: "";
  position: absolute;
  left: -0.1em;
  top: -0.05em;
  right: -0.1em;
  bottom: -0.1em;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 42" preserveAspectRatio="none"><path d="M6,21 C12,6 88,4 94,19 C98,31 66,38 34,39 C14,40 2,31 7,16" stroke="%23FF9F1C" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="300" stroke-dashoffset="300"><animate attributeName="stroke-dashoffset" values="300;0" dur="0.8s" fill="freeze" /></path></svg>');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: -1;
}

/* Circle Highlight for Export Layout (shifted lower) */
.circle-highlight-export {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
  z-index: 1;
  padding: 0 0.2em;
}

.circle-highlight-export::after {
  content: "";
  position: absolute;
  left: -0.1em;
  top: 0.3em;
  right: -0.1em;
  bottom: -0.32em;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 42" preserveAspectRatio="none"><path d="M6,21 C12,6 88,4 94,19 C98,31 66,38 34,39 C14,40 2,31 7,16" stroke="%23FF9F1C" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="300" stroke-dashoffset="300"><animate attributeName="stroke-dashoffset" values="300;0" dur="0.8s" fill="freeze" /></path></svg>');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: -1;
}

/* Kid Card Highlight Circle Override - Shifted lower */
.circle-highlight-export.kid-circle::after {
  top: 0.44em;
  bottom: -0.44em;
}

/* Notebook Paper Card Style */
.notebook-paper {
  background-color: #FCFBF7;
  background-image: linear-gradient(#e5ecf2 1.5px, transparent 1.5px);
  background-size: 100% 2.2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.notebook-red-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.5rem;
  width: 1px;
  background-color: #ffb3b2;
}

.notebook-content {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  line-height: 2.2rem;
  color: #FF7B54;
  padding-left: 1.2rem;
  margin-top: 0.6rem;
}

/* Masking Tape Deco */
.masking-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 80px;
  height: 22px;
  background-color: rgba(234, 227, 201, 0.75);
  border-left: 1px dashed rgba(0, 0, 0, 0.04);
  border-right: 1px dashed rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  z-index: 10;
}

.masking-tape-image {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(1.5deg);
  width: 50px;
  height: 16px;
  background-color: rgba(234, 227, 201, 0.7);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  z-index: 10;
}

/* White Pill Containers & Inputs */
.pill-input {
  background-color: #FFFFFF;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03), 0 4px 12px rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pill-input:focus {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02), 0 6px 16px rgba(255, 123, 84, 0.15);
  border-color: rgba(255, 123, 84, 0.25);
  outline: none;
}

/* Pill Buttons */
.pill-btn-white {
  background-color: #FFFFFF;
  color: var(--color-text-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1.5px solid rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pill-btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.pill-btn-orange {
  background-color: #C07030;
  background: linear-gradient(135deg, #D4803B, #B06025);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(176, 96, 37, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pill-btn-orange:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(176, 96, 37, 0.4);
}

/* 3D Card Flip Mechanism */
.perspective-1000 {
  perspective: 1000px;
}

.card-inner {
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

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

.card-front, .card-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.card-front {
  z-index: 2;
  transform: rotateY(0deg);
}

.card-back {
  z-index: 1;
  transform: rotateY(180deg);
}

.card-flipped .card-front {
  z-index: 1;
}

.card-flipped .card-back {
  z-index: 2;
}

/* Card Cover Pattern (Face-down card - plain cream rounded paper card style) */
.card-cover-pattern {
  background-color: #FCFBF7;
  border: 1.5px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04), inset 0 0 10px rgba(0, 0, 0, 0.01);
}

/* Notebook styling for Card Back */
.card-back-paper {
  background-color: #FCFBF7;
  background-image: 
    linear-gradient(#e5ecf2 1.5px, transparent 1.5px),
    url('assets/crumpled_paper.jpg');
  background-size: 100% 1.4rem, 150% 150%;
  background-repeat: repeat, no-repeat;
  background-position: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), inset 0 0 10px rgba(0, 0, 0, 0.02);
  border: 1.5px solid rgba(0, 0, 0, 0.03);
}

/* Card Red Margin Line (Responsive) */
.card-red-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.5rem;
  width: 1px;
  background-color: #ffb3b2;
}

@media (min-width: 640px) {
  .card-red-line {
    left: 1.2rem;
  }
}

/* Card Masking Tape (Responsive) */
.card-tape {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  height: 9px;
  width: 28px;
  background-color: rgba(234, 227, 201, 0.8);
  z-index: 10;
}

@media (min-width: 640px) {
  .card-tape {
    width: 45px;
    height: 13px;
  }
}

/* Responsive back drawings scaling */
.card-back-svg-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.card-back-svg-wrap svg {
  width: 100% !important;
  height: 100% !important;
}

@media (min-width: 640px) {
  .card-back-svg-wrap {
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 768px) {
  .card-back-svg-wrap {
    width: 56px;
    height: 56px;
  }
}

/* Hover and pop-out swell animations */
.card-hover-effect {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-hover-effect:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 15px 30px rgba(176, 96, 37, 0.14), 0 4px 8px rgba(0, 0, 0, 0.04);
}

.card-hover-effect:active {
  transform: scale(0.97);
}

/* Animations */
.animate-float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

.animate-pulse-slow {
  animation: pulse-slow 3s ease-in-out infinite;
}

@keyframes pulse-slow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Screen Transitions */
.screen-transition {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-in-up {
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Shrink card sizes and fonts for narrative screen side-by-side cards */
[id^="stacked-user-card-"],
[id^="stacked-kid-card-"] {
  font-size: 0.8rem !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}

[id^="stacked-user-card-"] .notebook-content,
[id^="stacked-kid-card-"] .notebook-content {
  font-size: 0.72rem !important;
  line-height: 1.15rem !important;
  margin-top: 0.2rem !important;
  padding-left: 0.6rem !important;
}

[id^="stacked-user-card-"] h3,
[id^="stacked-kid-card-"] h3 {
  font-size: 0.75rem !important;
  padding-bottom: 0.2rem !important;
  margin-bottom: 0.2rem !important;
}

[id^="stacked-kid-card-"] .relative.w-36.h-36 {
  width: 4.6rem !important;
  height: 4.6rem !important;
  margin-bottom: 0.2rem !important;
}

[id^="stacked-kid-card-"] .notebook-red-line,
[id^="stacked-user-card-"] .notebook-red-line {
  left: 1.8rem !important;
}

[id^="stacked-kid-card-"] .masking-tape,
[id^="stacked-user-card-"] .masking-tape {
  width: 60px !important;
  height: 16px !important;
  top: -8px !important;
}

[id^="stacked-kid-card-"] .masking-tape-image {
  width: 48px !important;
  height: 12px !important;
  top: -5px !important;
}

/* Hide disclaimer text in small stacked copies (Screens 7-9) and final Screen 10 */
[id^="stacked-kid-card-"] .kid-card-disclaimer,
#screen-10-kid-card-placeholder .kid-card-disclaimer {
  display: none !important;
}
