/* ===== 공통 디자인 시스템 ===== */
:root {
  --primary: #667eea;
  --primary-dark: #4a3b8c;
  --accent: #ffd93d;
  --bg: #f6f7fb;
  --text: #2b2d42;
  --text-light: #6b7080;
  --card: #ffffff;
  --border: #e6e8f0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== 헤더 / 내비게이션 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.site-header .inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 60px;
}

.logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.logo:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
}

.site-nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--primary);
  background: #eef0fd;
}

/* ===== 히어로(도구 영역) ===== */
.hero {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  padding: 48px 20px;
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.hero .subtitle {
  opacity: 0.85;
  margin-bottom: 28px;
}

.tool-card {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ===== 본문 콘텐츠 ===== */
.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 20px;
}

.content section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
}

.content h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--primary-dark);
}

.content h3 {
  font-size: 1.1rem;
  margin: 20px 0 8px;
}

.content p {
  margin-bottom: 12px;
  color: var(--text);
}

.content ul,
.content ol {
  margin: 0 0 12px 22px;
}

.content li {
  margin-bottom: 6px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.95rem;
}

.content th,
.content td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.content th {
  background: var(--bg);
}

.notice {
  background: #eef0fd;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.95rem;
  margin: 12px 0;
}

/* FAQ 아코디언 */
details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  background: var(--bg);
}

details summary {
  font-weight: 700;
  cursor: pointer;
}

details p {
  margin-top: 10px;
}

/* 카드 그리드 (관련 콘텐츠 링크) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card-grid a.card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-grid a.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}

.card-grid .card .card-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.card-grid .card .card-desc {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ===== 도구 UI (표정 분석기 / 로또) ===== */
.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.tab {
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary-dark);
}

#preview-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  min-height: 40px;
}

#preview-container canvas,
#preview-container img,
#upload-preview img {
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  max-width: 320px;
  max-height: 320px;
  object-fit: contain;
}

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 40px 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 20px;
  font-size: 0.95rem;
  opacity: 0.9;
}

.drop-zone:hover,
.drop-zone.dragover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
}

.drop-zone .icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.result-emoji {
  font-size: 4rem;
  margin-bottom: 4px;
  min-height: 72px;
  line-height: 72px;
}

.result-label {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  min-height: 32px;
}

.bars {
  text-align: left;
  margin-bottom: 8px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bar-name {
  width: 70px;
  font-size: 0.95rem;
  font-weight: 600;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 9px;
  transition: width 0.2s ease;
}

.bar-fill.angry    { background: #ff6b6b; }
.bar-fill.happy    { background: #ffd93d; }
.bar-fill.sad      { background: #6bcbff; }
.bar-fill.surprise { background: #b980ff; }

.bar-pct {
  width: 52px;
  font-size: 0.9rem;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.action-btn {
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  background: var(--accent);
  color: var(--prim-dark, #4a3b8c);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.status {
  margin-top: 16px;
  font-size: 0.9rem;
  opacity: 0.8;
  min-height: 20px;
}

/* 로또 공 */
.balls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
  min-height: 64px;
  flex-wrap: wrap;
}

.ball {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  box-shadow: inset -4px -4px 8px rgba(0, 0, 0, 0.25),
              0 4px 8px rgba(0, 0, 0, 0.3);
  animation: pop 0.4s ease backwards;
}

.ball:nth-child(1) { animation-delay: 0s; }
.ball:nth-child(2) { animation-delay: 0.1s; }
.ball:nth-child(3) { animation-delay: 0.2s; }
.ball:nth-child(4) { animation-delay: 0.3s; }
.ball:nth-child(5) { animation-delay: 0.4s; }
.ball:nth-child(6) { animation-delay: 0.5s; }

@keyframes pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.ball.yellow { background: radial-gradient(circle at 35% 30%, #ffd54f, #fbc400); color: #333; }
.ball.blue   { background: radial-gradient(circle at 35% 30%, #64b5f6, #69c8f2); }
.ball.red    { background: radial-gradient(circle at 35% 30%, #ff8a80, #ff7272); }
.ball.gray   { background: radial-gradient(circle at 35% 30%, #bdbdbd, #aaaaaa); }
.ball.green  { background: radial-gradient(circle at 35% 30%, #aed581, #b0d840); color: #333; }

.hidden {
  display: none !important;
}

/* ===== 푸터 ===== */
.site-footer {
  background: #2b2d42;
  color: #cfd2e0;
  padding: 32px 20px;
  margin-top: 24px;
}

.site-footer .inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
}

.site-footer a {
  color: #cfd2e0;
  margin-right: 16px;
}

.site-footer a:hover {
  color: #fff;
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .content section { padding: 22px; }
  .site-header .inner { justify-content: center; gap: 4px; padding: 8px 12px; }
}
