/* =========================================================
   기본 색 (여기 값만 바꾸면 사이트 전체 색이 바뀝니다)
   ========================================================= */
:root {
  --bg: #0a0c1e;           /* 배경 (짙은 남색) */
  --surface: #14173a;      /* 카드·상자 배경 */
  --line: rgba(255, 255, 255, 0.08);
  --text: #f2f3fa;
  --text-dim: #a3a7c7;
  --point: #ff6b6b;        /* 대표 색 (일본 국기의 붉은색) */
}

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

body {
  font-family: "Noto Sans KR", "Noto Sans JP", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button { font-family: inherit; }

/* =========================================================
   머리글 + 메뉴
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 32px;
  background: rgba(10, 12, 30, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--point);
  border-radius: 10px;
  color: var(--point);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 20px;
}

#menu { display: flex; flex-wrap: wrap; gap: 8px 36px; }

.menu-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text);
  padding: 6px 0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.menu-btn:hover  { color: var(--point); }
.menu-btn.active { color: var(--point); border-bottom-color: var(--point); }

#auth-area { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.auth-link {
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.auth-link:hover { color: var(--point); }
.hello { color: var(--text-dim); }

/* =========================================================
   메인 카드 슬라이더 (히어로)
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  height: min(86vh, 760px);
  min-height: 520px;
  /* 모눈종이 같은 격자 무늬 */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* 슬라이드들이 옆으로 나란히 서 있는 기차 */
.hero-track {
  display: flex;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 40px;
  padding: 0 80px 100px;
}

/* 슬라이드마다 다른 색의 은은한 빛 */
.hero-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 75% 40%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 45%),
    radial-gradient(circle at 90% 90%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%);
  pointer-events: none;
}

.hero-text { position: relative; }

.hero-kicker {
  color: var(--accent);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.2em;
  margin-bottom: 12px;
}
.hero-title {
  font-size: clamp(56px, 9vw, 128px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero-desc {
  margin: 28px 0 44px;
  color: var(--text-dim);
  font-size: clamp(17px, 1.8vw, 24px);
  font-weight: 300;
}

.hero-btn {
  background: transparent;
  color: var(--text);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 18px 40px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.hero-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* 지금 보이는 슬라이드의 글자가 아래에서 살짝 떠오르는 효과 */
.hero-slide .hero-text > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s, transform 0.7s;
}
.hero-slide.active .hero-text > * { opacity: 1; transform: none; }
.hero-slide.active .hero-text > :nth-child(2) { transition-delay: 0.1s; }
.hero-slide.active .hero-text > :nth-child(3) { transition-delay: 0.2s; }
.hero-slide.active .hero-text > :nth-child(4) { transition-delay: 0.3s; }

/* ----- 오른쪽 그림 ----- */
.hero-art {
  position: relative;
  color: var(--accent);
}
.hero-art svg { width: 100%; max-height: 460px; display: block; }
.hero-art figcaption {
  margin-top: 8px;
  text-align: right;
  color: var(--text-dim);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 14px;
  letter-spacing: 0.1em;
}

/* 그림 공통 스타일: 테두리는 슬라이드 색, 안쪽은 아주 옅게 */
.hero-art .shape {
  fill: color-mix(in srgb, currentColor 18%, transparent);
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}
.hero-art .shape.strong { fill: color-mix(in srgb, currentColor 45%, transparent); }
.hero-art .shape.solid  { fill: #12163a; }
.hero-art .shape.opaque { fill: color-mix(in srgb, currentColor 22%, #0a0c1e); }
.hero-art .shape.opaque.strong { fill: color-mix(in srgb, currentColor 55%, #0a0c1e); }
.hero-art .shape.snow   { fill: #f2f3fa; stroke: #f2f3fa; }
.hero-art .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hero-art .line.thin { stroke-width: 1.2; opacity: 0.5; }
.hero-art .sun  { fill: currentColor; opacity: 0.9; }
.hero-art .halo { fill: color-mix(in srgb, currentColor 10%, transparent); }
.hero-art .ring { fill: none; stroke: currentColor; stroke-width: 2; }
.hero-art .ring.thin { stroke-width: 1; opacity: 0.4; }

/* 벚꽃 */
.hero-art .branch { fill: none; stroke: #8a6f80; stroke-width: 7; stroke-linecap: round; }
.hero-art .branch.thin-branch { stroke-width: 4; }
.hero-art .flower use { fill: color-mix(in srgb, currentColor 55%, transparent); stroke: currentColor; stroke-width: 1.5; }
.hero-art .flower .center { fill: #ffe0ec; }
.hero-art .falling { opacity: 0.7; }

/* 초칭 글자 */
.hero-art .lantern-text {
  fill: currentColor;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 110px;
  font-weight: 700;
}

/* 세이가이하 물결 무늬 */
.hero-art .scale { fill: var(--bg); stroke: currentColor; stroke-width: 1.5; opacity: 0.9; }
.hero-art .scale.outer { fill: #101436; }

/* ----- 아래쪽 조작 버튼 ----- */
.hero-controls {
  position: absolute;
  left: 80px;
  bottom: 40px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.circle-btn {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
}
.circle-btn:hover { background: rgba(255, 255, 255, 0.1); }
.circle-btn svg,
.pause-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero-counter { font-size: 20px; font-weight: 500; min-width: 48px; text-align: center; }

.pause-btn { background: none; border: none; cursor: pointer; display: grid; place-items: center; }
.pause-btn .icon-play { display: none; fill: var(--text); }
.pause-btn.paused .icon-play  { display: block; }
.pause-btn.paused .icon-pause { display: none; }
.pause-btn .icon-pause { stroke-width: 3; }

/* =========================================================
   단어 카드 영역
   ========================================================= */
/* 단어 카드 영역은 머리글 아래 화면 전체를 꽉 채움 */
.words-section {
  --header-h: 68px;                           /* app.js가 실제 머리글 높이로 바꿔 줌 */
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  min-height: 560px;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 20px;
  scroll-margin-top: var(--header-h);         /* 스크롤하면 머리글 바로 아래에 딱 맞게 */
}

#title {
  text-align: center;
  margin-bottom: 20px;
  font-size: 28px;
  font-weight: 500;
}

.slider {
  flex: 1;                 /* 제목과 번호를 뺀 나머지 높이를 모두 사용 */
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* 카드 한 장만 보이게 하는 창문 */
.viewport {
  flex: 1;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--line);
}

/* 카드들이 옆으로 나란히 서 있는 기차 */
.track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
}

.card {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  font-size: 22px;
}
.kanji   { font-family: "Noto Sans JP", sans-serif; font-size: clamp(72px, 13vh, 150px); font-weight: 500; line-height: 1.15; margin-bottom: 12px; }
.reading-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.reading { font-family: "Noto Sans JP", sans-serif; font-size: clamp(26px, 4vh, 38px); color: var(--point); }
.meaning { font-size: clamp(26px, 4vh, 36px); color: var(--text-dim); }

/* 예문 상자 */
.example-box {
  width: 100%;
  max-width: 900px;
  margin-top: clamp(24px, 5vh, 48px);
  padding-top: clamp(20px, 4vh, 40px);
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  text-align: center;
}
.example-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.example { font-family: "Noto Sans JP", sans-serif; font-size: clamp(20px, 3.2vh, 30px); line-height: 1.6; }
.example-meaning { margin-top: 10px; color: var(--text-dim); font-size: clamp(16px, 2.4vh, 22px); line-height: 1.5; }

/* 카드 안 스피커는 크게 */
.card .speak-btn { width: 52px; height: 52px; }
.card .speak-btn svg { width: 26px; height: 26px; }

/* 스피커 버튼 */
.speak-btn {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.speak-btn:hover { border-color: var(--point); background: color-mix(in srgb, var(--point) 15%, transparent); }
.speak-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.speak-btn svg .body { fill: var(--text); stroke: none; }
.speak-btn.speaking { border-color: var(--point); background: color-mix(in srgb, var(--point) 25%, transparent); }
.speak-btn.speaking .wave  { stroke: var(--point); animation: wave 0.9s infinite; }
.speak-btn.speaking .wave2 { animation-delay: 0.3s; }
@keyframes wave { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* 왼쪽/오른쪽 화살표 버튼 */
.arrow {
  flex-shrink: 0;
  align-self: center;
  width: 64px;
  height: 64px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.arrow:hover { background: rgba(255, 255, 255, 0.1); }
.arrow:disabled { opacity: 0.25; cursor: default; background: transparent; }

#counter {
  text-align: center;
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 16px;
}

/* =========================================================
   로그인 · 회원가입 상자
   ========================================================= */
main { padding: 60px 16px; }

.auth-box {
  max-width: 420px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 36px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-box h2 { text-align: center; font-weight: 500; }
.auth-box label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.auth-box input {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
}
.auth-box input:focus { outline: 2px solid var(--point); border-color: transparent; }
.guide { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

.submit-btn {
  background: var(--point);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.submit-btn:disabled { opacity: 0.5; cursor: default; }

.msg { font-size: 14px; text-align: center; min-height: 20px; }
.msg.ok    { color: #4fd1a0; }
.msg.error { color: #ff7b7b; }

.links { display: flex; justify-content: center; gap: 16px; font-size: 14px; }
.links a { color: var(--point); }

/* =========================================================
   관리자 페이지
   ========================================================= */
.admin-wrap { max-width: 1100px; margin: 0 auto; }
.admin-title { font-size: 30px; font-weight: 500; margin-bottom: 24px; }
.admin-guard { color: var(--text-dim); }
.admin-guard a { color: var(--point); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 28px;
}
.panel h2 { font-size: 20px; font-weight: 500; }

.word-form { display: flex; flex-direction: column; gap: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.field small { color: #6f7396; font-size: 12px; }
.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-family: "Noto Sans JP", "Noto Sans KR", sans-serif;
}
.field input:focus,
.field select:focus { outline: 2px solid var(--point); border-color: transparent; }
.input-with-speak { display: flex; align-items: center; gap: 8px; }
.input-with-speak .speak-btn { width: 44px; height: 44px; }

.form-buttons { display: flex; gap: 12px; }
.form-buttons .submit-btn { flex: 1; }
.ghost-btn {
  padding: 14px 20px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

.list-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.count-badge { color: var(--point); font-size: 16px; margin-left: 6px; }
.level-tabs { display: flex; gap: 6px; }
.level-tabs button {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.level-tabs button.active { background: var(--point); border-color: var(--point); color: white; }

.table-scroll { overflow-x: auto; }
.word-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.word-table th,
.word-table td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 15px; }
.word-table th { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.word-table .jp { font-family: "Noto Sans JP", sans-serif; }
.word-table .big { font-size: 22px; }
.word-table .sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.word-table .empty { text-align: center; color: var(--text-dim); padding: 40px; }
.cell-speak { display: inline-flex; align-items: center; gap: 8px; }
.cell-speak .speak-btn { width: 30px; height: 30px; }
.cell-speak .speak-btn svg { width: 16px; height: 16px; }
.actions { white-space: nowrap; }
.small-btn {
  padding: 6px 12px;
  margin-right: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.small-btn:hover { background: rgba(255, 255, 255, 0.08); }
.small-btn.danger { border-color: rgba(255, 107, 107, 0.5); color: #ff8b8b; }

/* =========================================================
   휴대폰 화면
   ========================================================= */
@media (max-width: 900px) {
  .site-header { padding: 12px 16px; }
  #menu { order: 3; width: 100%; gap: 6px 20px; overflow-x: auto; flex-wrap: nowrap; }
  .menu-btn { font-size: 14px; white-space: nowrap; }

  .hero { height: auto; min-height: 640px; }
  .hero-slide {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 40px 16px 120px;
    align-content: start;
  }
  .hero-art { order: -1; max-width: 360px; margin: 0 auto; }
  .hero-art figcaption { text-align: center; }
  .hero-desc { margin: 16px 0 28px; }
  .hero-btn { padding: 14px 30px; font-size: 16px; }
  .hero-controls { left: 16px; bottom: 28px; gap: 18px; }
  .circle-btn { width: 52px; height: 52px; }
  .field-row { grid-template-columns: 1fr; }
  .words-section { padding: 16px 12px 14px; min-height: 480px; }
  #title { font-size: 22px; margin-bottom: 12px; }
  /* 휴대폰: 카드는 가로 전체, 화살표는 카드 아래로 */
  .slider {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px 24px;
  }
  .viewport { grid-column: 1 / -1; grid-row: 1; }
  #prev { grid-row: 2; grid-column: 1; justify-self: end; }
  #next { grid-row: 2; grid-column: 2; justify-self: start; }
  .arrow { width: 48px; height: 48px; font-size: 22px; }
  .card { padding: 24px 16px; }
  .card .speak-btn { width: 44px; height: 44px; }
  .panel { padding: 20px; }
}

/* 움직임 줄이기 설정을 켠 사용자를 위해 애니메이션 끄기 */
@media (prefers-reduced-motion: reduce) {
  .hero-track, .track, .hero-slide .hero-text > * { transition: none; }
}
