:root {
  --bg-color: #fafafa;
  --text-main: #171717;
  --text-muted: #737373;
  --card-bg: #ffffff;
  --border-color: #e5e5e5;
  --primary-color: #171717;
  --primary-hover: #404040;
  --danger-color: #ef4444;
  --radius: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
  line-height: 1.5;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 4rem;
}

.app-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.app-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Main Grid */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 1200px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card:hover {
  border-color: #d4d4d4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-header {
  margin-bottom: 1rem;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Content Area inside Cards */
.card-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 160px;
  background: var(--bg-color);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Buttons and Inputs */
.card-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.primary-btn, .secondary-btn {
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  border: 1px solid transparent;
}

.primary-btn {
  background-color: var(--primary-color);
  color: white;
}

.primary-btn:hover {
  background-color: var(--primary-hover);
}

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

.secondary-btn:hover {
  background-color: var(--bg-color);
  border-color: #d4d4d4;
}

.minimal-input {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  background-color: white;
  transition: border-color 0.2s ease;
  width: auto;
}

.minimal-input:focus {
  border-color: var(--primary-color);
}

.minimal-input-full {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.6rem;
  font-size: 0.9rem;
}

/* States */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 0.8s linear infinite;
}

.error-message {
  color: var(--danger-color);
  font-size: 0.85rem;
  background: #fef2f2;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #fecaca;
  width: 100%;
}

/* Dynamic Content Styles */
.pet-image {
  max-width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.item-badge {
  background: var(--bg-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
  margin-bottom: 0.5rem;
}

.joke-setup, .trivia-q {
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.joke-punchline, .trivia-a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.trivia-a-hidden {
  filter: blur(4px);
  user-select: none;
  cursor: pointer;
  transition: filter 0.3s ease;
}
.trivia-a-hidden:hover {
  filter: blur(2px);
}

.user-avatar {
  border-radius: 50%;
  width: 64px;
  height: 64px;
  margin-bottom: 0.75rem;
}

.user-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.json-title, .advice-text, .activity-text {
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.json-body {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: left;
}

.country-flag {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .app-header h1 {
    font-size: 1.5rem;
  }
}
