:root {
  --primary-color: #ff9a9e;
  --primary-hover: #ff758c;
  --secondary-color: #fad0c4;
  --accent-color: #a18cd1;
  --text-color: #4a4a4a;
  --text-muted: #8e8e8e;
  --bg-color: #fff5f5;
  --card-bg: #ffffff;
  --border-color: #ffe0e0;
  --shadow-sm: 0 4px 6px rgba(255, 154, 158, 0.1);
  --shadow: 0 10px 20px rgba(255, 154, 158, 0.15);
  --shadow-lg: 0 15px 30px rgba(255, 154, 158, 0.2);
  --border-radius: 24px;
}

body.dark-mode {
  --primary-color: #ff8e8e;
  --primary-hover: #ff758c;
  --secondary-color: #4a3a3a;
  --accent-color: #bb86fc;
  --text-color: #e0e0e0;
  --text-muted: #b0b0b0;
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --border-color: #333333;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
  scroll-behavior: smooth;
}

body {
  font-family: 'Jua', 'Nunito', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding-top: 80px;
}

/* Navigation */
.main-nav {
  position: fixed;
  top: 0;
  width: 100%;
  height: 60px;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: center;
  z-index: 1000;
  border-bottom: 2px solid var(--secondary-color);
}

.nav-container {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-hover);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 20px;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: bold;
  font-size: 0.9rem;
}

/* Controls */
.top-controls {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: space-between;
  padding: 20px;
  align-items: center;
}

#lang-select {
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  font-family: 'Jua';
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 500px;
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 30px;
  text-align: center;
  border: 4px solid var(--secondary-color);
  margin-bottom: 40px;
}

.app-header h1 {
  font-size: 1.8rem;
  color: var(--primary-hover);
  margin-bottom: 10px;
}

/* Ad Slots */
.ad-slot {
  width: 100%;
  min-height: 100px;
  background-color: #f9f9f9;
  border: 1px dashed #ddd;
  margin: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Mode Buttons */
.mode-selection { display: flex; gap: 10px; margin-bottom: 25px; }
.mode-btn { flex: 1; padding: 12px; border-radius: 15px; border: none; background: var(--primary-color); color: white; font-family: 'Jua'; cursor: pointer; }

/* [중요] 스마트폰에서 꽉 차게 보이도록 수정된 프리뷰 박스 */
.image-preview-box {
  width: 100%;
  aspect-ratio: 1/1;
  max-width: 400px; /* 크기를 기존 300px에서 400px로 확대 */
  margin: 0 auto 20px;
  border-radius: 20px;
  overflow: hidden;
  border: 5px solid var(--secondary-color);
  background: #000;
  position: relative;
}

.image-preview-box video, 
.image-preview-box canvas, 
#image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 이미지가 잘리지 않고 꽉 차게 설정 */
}

/* Results & Bars */
.bars-container { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.result-bar-wrapper { text-align: left; }
.label-info { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; margin-bottom: 5px; }
.bar-bg { width: 100%; background: var(--border-color); height: 14px; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary-color), var(--accent-color)); width: 0%; transition: width 0.5s ease-out; }

/* Sections */
.upload-box { border: 3px dashed var(--primary-color); padding: 40px; border-radius: 20px; cursor: pointer; background: var(--bg-color); }
.retry-btn { width: 100%; padding: 15px; border-radius: 15px; border: none; background: var(--primary-color); color: white; font-family: 'Jua'; font-size: 1.1rem; cursor: pointer; }
.info-content, .privacy-section { text-align: left; margin-top: 40px; padding-top: 30px; border-top: 2px solid var(--border-color); }
.hidden { display: none !important; }
.app-footer { margin-top: 40px; font-size: 0.8rem; color: var(--text-muted); padding-bottom: 20px; }

/* 모바일 대응 (반응형) */
@media (max-width: 500px) {
    body { padding-top: 60px; }
    .app-container { 
        padding: 30px 15px; 
        border-radius: 0; /* 모바일에서 꽉 차게 보이도록 라운딩 제거 선택 가능 */
        border-left: none;
        border-right: none;
        max-width: 100%;
    }
    .image-preview-box {
        max-width: 100%; /* 모바일에서 가로폭을 100%로 설정 */
        border-radius: 10px;
    }
    .nav-logo { font-size: 1.1rem; }
    .nav-menu { gap: 10px; }
    .nav-menu a { font-size: 0.8rem; }
}