:root {
  --bg-color: #FFFDF6;
  --card-bg: #FFFFFF;
  --text-color: #3D2314;
  --subtext-color: #8C6D58;
  --primary: #FF8F00;
  --primary-dark: #E65100;
  --secondary: #FFE0B2;
  --border-color: #EFE6D5;
  --radius: 20px;
}

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

body {
  font-family: 'Fredoka', cursive, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  padding: 24px 16px;
}

/* Header Title */
header {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.app-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.app-title {
  font-size: 38px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
  line-height: 1;
}

.app-sub {
  font-size: 14px;
  font-weight: 500;
  color: var(--subtext-color);
  margin-top: 4px;
}

main {
  flex: 1;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
}

/* Navigation Tabs */
.tabs-list {
  display: flex;
  background-color: var(--secondary);
  border-radius: 9999px;
  padding: 5px;
  margin-bottom: 24px;
  border: none;
}

.tabs-trigger {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--subtext-color);
  cursor: pointer;
  font-family: 'Fredoka', cursive, sans-serif;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tabs-trigger.active {
  background-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(255, 143, 0, 0.35);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Card Container */
.card {
  background-color: var(--card-bg);
  border: 3px solid var(--border-color);
  border-radius: 28px;
  padding: 28px 28px 40px 28px;
  box-shadow: 0 8px 24px rgba(61, 35, 20, 0.06);
  margin-bottom: 24px;
  position: relative;
  overflow: visible;
}

/* Drop Zone */
.drop-zone {
  border: none;
  background-color: var(--secondary);
  border-radius: 22px;
  padding: 32px 20px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.drop-zone:hover {
  transform: scale(1.01);
  background-color: #FFD599;
}

.drop-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
}

/* SQUIRREL ANIMATION STAGE */
.squirrel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 20px 0 0 0;
  position: relative;
  min-height: 380px;
}

.squirrel-svg-wrapper {
  position: relative;
  width: 360px;
  height: 360px;
  margin: 0 auto;
}

.squirrel-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* KEYFRAME ANIMATIONS */
#cheek-left {
  transform-origin: 88px 100px;
}
#cheek-right {
  transform-origin: 152px 100px;
}

@keyframes cheekGrowInPlace {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

@keyframes gulpSwallow {
  0% { transform: translateY(0); }
  30% { transform: translateY(-12px) scaleY(1.1); }
  60% { transform: translateY(6px) scaleY(0.95); }
  100% { transform: translateY(0); }
}

@keyframes pullUpAndLandInCenter {
  0% {
    transform: translate(-50%, -40px) scale(0);
    opacity: 0;
  }
  45% {
    transform: translate(-50%, -85px) scale(0.65);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, 25px) scale(1);
    opacity: 1;
  }
}

@keyframes leftPawGripOuter {
  0% { transform: translate(0, 0); }
  45% { transform: translate(10px, -40px); }
  100% { transform: translate(-43px, 30px); }
}

@keyframes rightPawGripOuter {
  0% { transform: translate(0, 0); }
  45% { transform: translate(-10px, -40px); }
  100% { transform: translate(43px, 30px); }
}

@keyframes flyingFileCentered {
  0% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  80% { transform: translate(-50%, 115px) scale(0.4); opacity: 0.8; }
  100% { transform: translate(-50%, 140px) scale(0.1); opacity: 0; }
}

.gulping .squirrel-head {
  animation: gulpSwallow 0.8s ease-in-out;
}

.gulping #cheek-left, .gulping #cheek-right {
  animation: cheekGrowInPlace 0.8s ease-in-out;
}

.pulling-frame #squirrel-left-paw {
  animation: leftPawGripOuter 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.pulling-frame #squirrel-right-paw {
  animation: rightPawGripOuter 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.flying-file-badge {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #FFF;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  z-index: 20;
  display: none;
}

.flying-file-badge.animating {
  display: block;
  animation: flyingFileCentered 0.7s forwards cubic-bezier(0.5, 0, 0.75, 0);
}

/* Held QR Frame Container */
.held-qr-frame {
  position: absolute;
  top: 95px;
  left: 50%;
  transform: translate(-50%, -40px) scale(0);
  background-color: var(--secondary);
  border: none;
  border-radius: 20px;
  padding: 8px 8px 10px 8px;
  box-shadow: 0 10px 30px rgba(61, 35, 20, 0.15);
  z-index: 4;
  display: none;
  text-align: center;
  width: 236px;
}

.held-qr-frame.visible {
  display: block;
  animation: pullUpAndLandInCenter 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Front Paws Overlay */
.front-paws-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.canvas-container {
  background: #FFF;
  padding: 6px;
  border-radius: 14px;
  display: block;
  margin: 0 auto;
}

.frame-stats-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-color);
  margin-top: 6px;
  line-height: 1.3;
  padding: 0 4px;
}

/* Receiver Webcam Card */
.scanner-viewport {
  width: 100%;
  height: 300px;
  background-color: #000;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid var(--border-color);
  position: relative;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Fredoka', cursive, sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary {
  background-color: var(--primary);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(255, 143, 0, 0.35);
}

.btn-primary:hover {
  transform: scale(1.02);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--text-color);
  border: none;
}

.btn-secondary:hover {
  background-color: #FFD599;
}

.progress-bar-track {
  height: 12px;
  background-color: var(--secondary);
  border-radius: 9999px;
  overflow: hidden;
  border: none;
  margin-top: 12px;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  width: 0%;
  transition: width 0.2s ease;
}
