:root {
  --bg-color: #f5f5f5;
  --container-bg: #ffffff;
  --text-color: #333333;
  --placeholder-color: #888888;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --accent-color: #007bff;
  --nav-bg: rgba(255, 255, 255, 0.9);
}

[data-theme='dark'] {
  --bg-color: #1a1a1a;
  --container-bg: #2d2d2d;
  --text-color: #f5f5f5;
  --placeholder-color: #aaaaaa;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --nav-bg: rgba(45, 45, 45, 0.9);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Pretendard', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding-top: 70px; /* Space for fixed nav */
  transition: background-color 0.3s, color 0.3s;
  line-height: 1.6;
}

/* Navigation Bar */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 4px var(--shadow-color);
  z-index: 1000;
  display: flex;
  justify-content: center;
}

.nav-content {
  width: 90%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-weight: bold;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--accent-color);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent-color);
}

.nav-theme-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
}

/* Main Content */
.container {
  margin: 2rem auto;
  text-align: center;
  background: var(--container-bg);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 25px var(--shadow-color);
  width: 90%;
  max-width: 650px;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.container.text-left {
  text-align: left;
}

.site-header h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.subtitle {
  margin-bottom: 3rem;
  color: var(--placeholder-color);
  font-size: 1.1rem;
}

.description-text {
  margin-bottom: 2rem;
  font-size: 1rem;
  color: var(--text-color);
  opacity: 0.85;
  padding: 0 1rem;
}

.test-mode-toggle {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 2.5rem;
}

.mode-btn {
  background: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--placeholder-color);
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.upload-box, .webcam-box {
  border: 2px dashed var(--placeholder-color);
  border-radius: 16px;
  padding: 3rem;
  margin-bottom: 2rem;
  cursor: pointer;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: border-color 0.3s;
}

.upload-box:hover {
  border-color: var(--accent-color);
}

#webcam-container canvas {
  border-radius: 16px;
  max-width: 100%;
  height: auto;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#preview-container img {
  max-width: 100%;
  max-height: 350px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#label-container {
  margin-bottom: 2rem;
  text-align: left;
}

.result-bar-wrapper {
  margin-bottom: 15px;
}
.result-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
}
.result-bar-bg {
  background: rgba(0,0,0,0.05);
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
}

[data-theme='dark'] .result-bar-bg {
  background: rgba(255,255,255,0.1);
}

.result-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #00c6ff);
  width: 0%;
  transition: width 0.8s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.ad-container {
  margin: 3rem 0;
  min-height: 120px;
  background: var(--bg-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-divider {
  border: 0;
  height: 1px;
  background: var(--shadow-color);
  margin: 4rem 0;
}

.ball-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  min-height: 80px;
  margin-bottom: 2.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.ball {
  width: 55px;
  height: 55px;
  line-height: 55px;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  font-size: 1.3rem;
  box-shadow: 0 5px 10px rgba(0,0,0,0.15);
  animation: bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bounce {
  0% { transform: scale(0) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

button {
  padding: 14px 30px;
  font-size: 1.15rem;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0, 123, 255, 0.3); }

/* Info Section Styles */
.info-section {
  margin-top: 4rem;
  text-align: left;
}
.info-box {
  background: var(--bg-color);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}
.info-box h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
  color: var(--accent-color);
}
.info-box p {
  font-size: 0.95rem;
  margin: 0;
  color: var(--text-color);
  opacity: 0.9;
}

.partnership-section h2, .disqus-section h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.partnership-section, .disqus-section { margin-top: 4rem; text-align: left; }
.partnership-form { display: flex; flex-direction: column; gap: 1.2rem; }
.form-group { display: flex; flex-direction: column; gap: 0.6rem; }
.form-group input {
  padding: 12px;
  border: 1px solid var(--placeholder-color);
  border-radius: 8px;
  background: var(--container-bg);
  color: var(--text-color);
  font-size: 1rem;
}
.submit-btn { background-color: #28a745; box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2); }
.submit-btn:hover { background-color: #218838; box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3); }

/* Footer Styles */
.site-footer {
  margin-top: 4rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--shadow-color);
  font-size: 0.9rem;
  color: var(--placeholder-color);
}
.site-footer nav {
  margin-top: 1rem;
}
.site-footer a {
  color: var(--placeholder-color);
  text-decoration: none;
  margin: 0 10px;
}
.site-footer a:hover {
  text-decoration: underline;
  color: var(--accent-color);
}

/* Privacy/TOS Page Specifics */
.privacy-content h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  color: var(--text-color);
  border-left: 4px solid var(--accent-color);
  padding-left: 12px;
}
.privacy-content p, .privacy-content ul {
  font-size: 1rem;
  margin-bottom: 1.2rem;
  color: var(--text-color);
}
.privacy-content ul {
  padding-left: 1.5rem;
}
.footer-nav {
  margin-top: 3rem;
  text-align: center;
}
.home-link {
  display: inline-block;
  padding: 12px 25px;
  background: var(--accent-color);
  color: white !important;
  border-radius: 25px;
  text-decoration: none !important;
  font-weight: bold;
  transition: transform 0.2s;
}
.home-link:hover {
  transform: scale(1.05);
}

/* Ball colors */
.ball-y { background-color: #fbc400; }
.ball-b { background-color: #69c8f2; }
.ball-r { background-color: #ff7272; }
.ball-g { background-color: #aaaaaa; }
.ball-v { background-color: #b0d840; }

@media (max-width: 600px) {
  .nav-links { display: none; }
  .container { padding: 1.5rem; }
  .site-header h1 { font-size: 1.5rem; }
  .main-nav { height: 50px; }
  body { padding-top: 60px; }
}
