/* General styles for layout */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #fafafa;
  color: #333;
}

header {
  text-align: center;
  padding: 2rem 1rem;
  background: #f2f2f2;
  border-bottom: 1px solid #e0e0e0;
}

main {
  padding: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

section {
  margin-bottom: 2rem;
}

h1, h2 {
  margin-top: 0;
}

/* Customizer layout */
#customizer {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

#cat-container {
  flex: 1 1 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

#controls {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 260px;
}

#controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}

#controls input[type="color"],
#controls select {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Cat parts base styles */
.cat {
  position: relative;
  width: 220px;
  height: 320px;
}

/* Define CSS variables for colors with default fallbacks */
:root {
  --head-color: #50C878;
  --ear-color: #A300D6;
  --body-color: #00A1E4;
  --limb-color: #FE9E0D;
  --clothes-color: #FFFFFF;
}

.cat-head {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 160px;
  height: 160px;
  transform: translateX(-50%);
  background-color: var(--head-color);
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.cat-ear {
  position: absolute;
  width: 60px;
  height: 60px;
  background-color: var(--ear-color);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.cat-ear.left {
  top: 0;
  left: 20px;
}
.cat-ear.right {
  top: 0;
  right: 20px;
}

.cat-eye {
  position: absolute;
  width: 32px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 4px solid #000;
}
.cat-eye.left {
  top: 60px;
  left: 40px;
}
.cat-eye.right {
  top: 60px;
  right: 40px;
}

.cat-mouth {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 20px;
  border-radius: 20px;
  background: #ffb3c6;
}

.cat-body {
  position: absolute;
  top: 160px;
  left: 50%;
  width: 180px;
  height: 200px;
  transform: translateX(-50%);
  border-radius: 50% / 60%;
  background-color: var(--body-color);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.cat-arm {
  position: absolute;
  width: 35px;
  height: 100px;
  border-radius: 20px;
  background-color: var(--limb-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.cat-arm.left {
  top: 200px;
  left: -10px;
}
.cat-arm.right {
  top: 200px;
  right: -10px;
}

.cat-leg {
  position: absolute;
  width: 40px;
  height: 100px;
  border-radius: 20px;
  background-color: var(--limb-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.cat-leg.left {
  bottom: 0;
  left: 40px;
}
.cat-leg.right {
  bottom: 0;
  right: 40px;
}

.cat-tail {
  position: absolute;
  top: 260px;
  right: -80px;
  width: 140px;
  height: 24px;
  border-radius: 20px;
  background-color: var(--limb-color);
  transform: rotate(-30deg);
  transform-origin: left center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cat-clothes {
  position: absolute;
  top: 180px;
  left: 50%;
  width: 180px;
  height: 100px;
  transform: translateX(-50%);
  background-color: var(--clothes-color);
  border-top-left-radius: 90px 60px;
  border-top-right-radius: 90px 60px;
  z-index: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cat-accessory {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Accessory components created dynamically */
.hat {
  position: absolute;
  top: -25px;
  left: 50%;
  width: 120px;
  height: 60px;
  transform: translateX(-50%);
  background: #444;
  border-bottom-left-radius: 60px 40px;
  border-bottom-right-radius: 60px 40px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.horns {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
}
.horns::before, .horns::after {
  content: '';
  position: absolute;
  top: -30px;
  width: 30px;
  height: 30px;
  background: #900;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform-origin: bottom center;
}
.horns::before {
  left: -40px;
  transform: rotate(-20deg);
}
.horns::after {
  right: -40px;
  transform: rotate(20deg);
}

.bow {
  position: absolute;
  top: 50px;
  left: 50%;
  width: 80px;
  height: 40px;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
}
.bow::before, .bow::after {
  content: '';
  width: 40px;
  height: 20px;
  background: #e91e63;
  border-radius: 50% 50% 50% 50%;
  position: absolute;
}
.bow::before {
  transform: translateX(-50%);
}
.bow::after {
  transform: translateX(50%);
}

.glasses {
  position: absolute;
  top: 70px;
  left: 50%;
  width: 100px;
  height: 40px;
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.glasses .frame {
  width: 40px;
  height: 40px;
  border: 4px solid #222;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.glasses .bridge {
  width: 20px;
  height: 4px;
  background: #222;
  align-self: center;
}

/* YouTube section styling */
#videos iframe {
  width: 100%;
  max-width: 560px;
  height: 315px;
  border: none;
  margin-bottom: 1rem;
}

#videos .subscribe {
  margin-top: 0.5rem;
}

/* Ads section styling */
#ads {
  background: #fffbe6;
  padding: 1rem;
  border: 1px dashed #f0c36d;
}

@media (max-width: 600px) {
  #customizer {
    flex-direction: column;
    align-items: center;
  }
  #controls {
    max-width: none;
    width: 100%;
  }
}