/* ========================================
   CSS Variables (Design Tokens)
   ======================================== */
:root {
  --primary: #E6A817;
  --primary-dark: #C4900F;
  --primary-light: #F5D789;
  --background: #FFFFFF;
  --foreground: #1a1a1a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --card: #FFFFFF;
  --card-foreground: #1a1a1a;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   Header
   ======================================== */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--foreground);
}

.logo-placeholder {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1rem;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--muted-foreground);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: var(--muted);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover:not(:disabled) {
  background: var(--muted);
  border-color: var(--primary);
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--background) 100%);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

/* QR Section */
.qr-section {
  text-align: center;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.qr-container {
  margin-bottom: 1.5rem;
}

.qr-code {
  display: inline-block;
  padding: 1rem;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.qr-code svg {
  display: block;
}

.qr-hint {
  margin-top: 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.link-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Instructions */
.instructions-section,
.install-section {
  padding: 2rem 0;
}

.instructions-grid,
.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.instruction-card,
.install-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s;
}

.instruction-card:hover,
.install-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.instruction-number {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin: 0 auto 1rem;
}

.instruction-card h3,
.install-card h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.instruction-card p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.install-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.install-card ol {
  text-align: left;
  padding-left: 1.25rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.install-card li {
  margin-bottom: 0.25rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-top: 2rem;
}

/* ========================================
   Game Page
   ======================================== */
.game-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.game-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Search */
.search-container {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
}

.search-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 168, 23, 0.2);
}

/* Animals Grid */
.animals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .animals-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) {
  .animals-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1024px) {
  .animals-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1280px) {
  .animals-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* Animal Card */
.animal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.animal-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow);
}

.animal-card:active {
  transform: scale(0.98);
}

.animal-card.playing {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 168, 23, 0.3);
}

.animal-image-container {
  position: relative;
  padding-top: 100%; /* 1:1 Aspect Ratio */
}

.animal-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.animal-image-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.sound-indicator {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 0;
  transition: all 0.2s;
}

.animal-card:hover .sound-indicator,
.animal-card.playing .sound-indicator {
  opacity: 1;
}

.animal-card.playing .sound-indicator {
  animation: pulse 1s infinite;
}

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

.animal-name {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--muted-foreground);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 640px) {
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .logo-text {
    display: none;
  }
  
  .search-container {
    flex-direction: column;
  }
}
