
:root {
  color-scheme: dark;
  --bg: #0f172a;
  --card: rgba(15, 23, 42, 0.95);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --accent-2: #38bdf8;
  --border: rgba(255, 255, 255, 0.1);
}

body.light-theme {
  color-scheme: light;
  --bg: #f8fafc;
  --card: rgba(255, 255, 255, 0.95);
  --text: #0f172a;
  --muted: #475569;
  --accent: #d97706;
  --accent-2: #0284c7;
  --border: rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Apple SD Gothic Neo", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #020617, #111827 45%, #1e293b);
}

body.light-theme {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9 45%, #e2e8f0);
}

button,
input,
textarea,
a {
  font: inherit;
}

body,
button,
input,
textarea,
select {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(100%, 980px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  padding: 36px;
  position: relative;
}

.theme-toggle-container {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 10;
}

.theme-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

body.light-theme .theme-toggle-btn {
  background: rgba(0, 0, 0, 0.04);
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
}

.hero {
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.subtitle {
  margin: 16px auto 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 1rem;
}

.hero-note {
  margin: 24px auto 28px;
  max-width: 820px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  line-height: 1.8;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.page-nav a {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
}

.page-nav a:hover,
.page-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-2);
}

.content-section {
  margin-top: 34px;
  padding: 30px 30px 26px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.section-header {
  margin-bottom: 20px;
}

.content-grid,
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.info-card,
.policy-box,
.faq-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 22px;
}

.info-card h2,
.info-card h3,
.policy-box h3 {
  margin-top: 0;
}

.feature-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.feature-list li {
  margin-bottom: 10px;
}

.section-header p,
.faq-item p,
.policy-box p,
.contact-description,
.hero-note {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  transform: translateY(-2px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #fb923c);
  color: #111827;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.24);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
}

.result-panel {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 26px;
  align-items: start;
}

.result-area,
.history-area,
.animal-test-area,
.insights-area,
.faq-area,
.privacy-area,
.contact-area,
.comments-area {
  margin-top: 0;
}

.result-area h3,
.history-area h3,
.comments-area h2,
.privacy-area h2,
.faq-area h2,
.contact-area h2 {
  margin-bottom: 20px;
}

.contact-form {
  display: grid;
  gap: 14px;
}

.contact-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--muted);
}

.contact-form textarea {
  resize: vertical;
  min-height: 130px;
}

.contact-submit {
  justify-self: start;
}

.form-status {
  min-height: 1.3rem;
  margin: 0;
  color: var(--accent-2);
}

.animal-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.webcam-container {
  display: grid;
  place-items: center;
  width: 100%;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 16px;
}

.webcam-container canvas {
  width: 100%;
  max-width: 640px;
  height: auto;
  border-radius: 18px;
}

.label-container {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  font-weight: 700;
}

.animal-status {
  color: var(--muted);
}

.number-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
}

.number-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 14px 18px;
  width: 100%;
  justify-content: space-between;
}

.row-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.balls-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ball {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.1rem;
  color: #111827;
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.18);
}

.ball-yellow {
  background: linear-gradient(135deg, #fef08a, #eab308);
  color: #1e293b;
}

.ball-blue {
  background: linear-gradient(135deg, #93c5fd, #2563eb);
  color: #ffffff;
}

.ball-red {
  background: linear-gradient(135deg, #fca5a5, #dc2626);
  color: #ffffff;
}

.ball-grey {
  background: linear-gradient(135deg, #cbd5e1, #475569);
  color: #ffffff;
}

.ball-green {
  background: linear-gradient(135deg, #86efac, #16a34a);
  color: #ffffff;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.history-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 16px 0;
}

.site-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .result-panel,
  .content-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .page-nav a {
    padding: 8px 14px;
  }
}

@media (max-width: 580px) {
  .card {
    padding: 26px 18px 22px;
  }

  .hero-note {
    padding: 18px 16px;
  }

  .page-nav {
    gap: 8px;
  }

  .result-panel,
  .info-grid,
  .content-grid {
    gap: 18px;
  }

  .number-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .balls-container {
    justify-content: flex-start;
  }

  .ball {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .row-label {
    width: 30px;
    height: 30px;
  }

  .webcam-container {
    padding: 12px;
  }
}
