:root {
  --bg1: #09090b;
  --bg2: #18181b;
  --card: rgba(39, 39, 42, 0.6);
  --line: rgba(63, 63, 70, 0.5);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #c2902d;
  --accent2: #006680;
  --danger: #ef4444;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  --btn-ghost: rgba(39, 39, 42, 0.8);
  --btn-ghost-border: rgba(63, 63, 70, 0.5);
  --stat-bg: rgba(24, 24, 27, 0.8);
  --stat-border: rgba(63, 63, 70, 0.4);
}

body.light-mode {
  --bg1: #f8fafc;
  --bg2: #f1f5f9;
  --card: #ffffff;
  --line: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --accent: #b28522;
  --accent2: #0284c7;
  --danger: #dc2626;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  --btn-ghost: #f1f5f9;
  --btn-ghost-border: #94a3b8;
  --stat-bg: #f1f5f9;
  --stat-border: #cbd5e1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Pretendard', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  padding: 24px;
  transition: background 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
}

.theme-toggle button {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wrap { max-width: 1100px; margin: 0 auto; position: relative; }

.hero { text-align: center; margin: 60px 0 40px; }
.hero h1 { font-size: clamp(2.5rem, 5vw, 4rem); color: var(--accent); letter-spacing: 2px; margin-bottom: 10px; }
.hero p { color: var(--muted); font-size: 1.2rem; }

.lane-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.lane-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 24px 16px;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lane-card:hover { border-color: var(--accent); transform: translateY(-5px); }

.lane-champ-img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  margin-bottom: 15px;
  object-fit: cover;
  background: var(--bg1);
}

.lane-name { font-size: 0.9rem; color: var(--muted); font-weight: 800; margin-bottom: 10px; }
.champ-name { font-size: 1.4rem; font-weight: 800; color: var(--text); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.rich-text-section { text-align: left; }
.rich-text-section h2 { color: var(--accent); margin-bottom: 20px; }
.rich-text-section h3 { margin-top: 30px; color: var(--text); }
.rich-text-section p { margin-bottom: 15px; color: var(--muted); font-size: 1.05rem; }
.rich-text-section ul { padding-left: 20px; color: var(--muted); }
.rich-text-section li { margin-bottom: 10px; }

.controls { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }

button { border: 0; cursor: pointer; border-radius: 14px; padding: 16px 32px; font-size: 1.1rem; font-weight: 700; transition: all 0.2s ease; }
.primary { background: linear-gradient(135deg, var(--accent), #8a661b); color: white; box-shadow: 0 10px 24px rgba(194, 144, 45, 0.3); }
.ghost { background: var(--btn-ghost); color: var(--text); border: 1px solid var(--btn-ghost-border); }

.footer { text-align: center; margin-top: 60px; padding: 40px 0; border-top: 1px solid var(--line); color: var(--muted); }
.footer-links button { background: none; color: var(--accent); font-size: 0.9rem; padding: 5px 10px; font-weight: normal; }
.disclaimer { font-size: 0.8rem; margin: 20px 0; opacity: 0.7; max-width: 800px; margin-left: auto; margin-right: auto; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px; }
.modal-content { max-width: 600px; width: 100%; max-height: 80vh; overflow: hidden; display: flex; flex-direction: column; }
.scroll-area { overflow-y: auto; margin: 20px 0; text-align: left; font-size: 0.95rem; }

/* AI Test Styles */
.face-test-section { text-align: center; }
.upload-area { border: 2px dashed var(--line); border-radius: 20px; padding: 40px; cursor: pointer; background: var(--stat-bg); min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#previewImg, #webcam-container canvas { max-width: 100%; max-height: 350px; border-radius: 16px; box-shadow: var(--shadow); }
.result-container { margin-top: 24px; padding: 30px; border-radius: 30px; background: var(--card); border: 1px solid var(--line); }
.champ-result-img { width: 180px; height: 180px; border-radius: 50%; border: 4px solid var(--accent); object-fit: cover; }
.similarity-badge { background: var(--accent); color: white; padding: 8px 20px; border-radius: 999px; font-size: 1.2rem; font-weight: 900; margin-top: 10px; }
.result-bar-container { height: 24px; background: var(--bg1); border-radius: 12px; overflow: hidden; margin: 20px 0; border: 1px solid var(--line); }
.result-bar { height: 100%; transition: width 0.8s ease; display: flex; align-items: center; justify-content: center; font-weight: 800; color: white; font-size: 0.8rem; }
.bar-male { background: #006680; }
.bar-female { background: #ec4899; }

@media (max-width: 600px) {
  .hero { margin-top: 80px; }
  .lane-grid { grid-template-columns: 1fr 1fr; }
  .panel { padding: 20px; }
}
