/* ========================================
   한자 학습 게임 — Style
   ======================================== */

:root {
  /* Warm palette */
  --bg-primary: #FFF8F0;
  --bg-card: #FFFFFF;
  --bg-card-shadow: rgba(210, 160, 100, 0.12);

  --accent: #E8844A;
  --accent-light: #FDEBD3;
  --accent-hover: #D4713B;

  --correct: #3DAA6D;
  --correct-bg: #E6F7ED;
  --wrong: #E05252;
  --wrong-bg: #FDE8E8;

  --text-primary: #2C2420;
  --text-secondary: #7A6B5E;
  --text-muted: #B5A89C;

  --border: #EDE4DA;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 16px 40px;

  /* Warm subtle pattern */
  background-image:
    radial-gradient(circle at 20% 10%, rgba(232, 132, 74, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(232, 132, 74, 0.05) 0%, transparent 50%);
}

/* ---- App Container ---- */
.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========================================
   VOLUME CONTROL
   ======================================== */
.volume-control-wrapper {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 10px 16px;
  border-radius: 30px;
  box-shadow: 0 4px 12px var(--bg-card-shadow);
  border: 1px solid var(--border);
  z-index: 1000;
  animation: fadeInScale 0.6s ease;
}

.btn-volume {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text-primary);
  transition: transform 0.2s;
}

.btn-volume:hover {
  transform: scale(1.1);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* 좁은 화면(양옆 여백이 없는 경우)에서는 콘텐츠를 가리지 않도록
   페이지 오른쪽 위의 작은 아이콘으로 두고(스크롤하면 함께 올라감),
   아이콘을 누르면 왼쪽으로 음량 슬라이더가 펼쳐짐 */
@media (max-width: 900px) {
  .volume-control-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: auto;
    left: auto;
    flex-direction: row-reverse;
    padding: 7px;
    gap: 0;
    border-radius: 30px;
  }

  .btn-volume {
    width: 26px;
    height: 26px;
    font-size: 1.2rem;
  }

  .volume-slider {
    display: none;
  }

  .volume-control-wrapper.expanded {
    gap: 12px;
    padding: 7px 7px 7px 16px;
  }

  .volume-control-wrapper.expanded .volume-slider {
    display: block;
    width: 120px;
    height: 8px;
  }

  .volume-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }
}

/* ========================================
   LOGIN SCREEN
   ======================================== */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 16px;
  position: relative;
  animation: fadeInScale 0.6s ease;
}

.login-decoration {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.login-hanzi-bg {
  font-family: 'Noto Serif SC', serif;
  font-size: 80px;
  font-weight: 900;
  color: var(--accent);
  opacity: 0.15;
  position: absolute;
}

.login-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
}

.btn-google {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-google:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-google:disabled {
  cursor: default;
  color: var(--text-muted);
}

.login-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.btn-guest {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 2px solid var(--border);
}

.btn-guest:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Welcome Message */
.welcome-message {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 16px;
  animation: fadeInScale 0.6s ease;
}

/* Record Summary */
.record-summary {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: -8px;
}

/* 오답 노트 · 나의 단어장 (반반 크기로 나란히) */
.sub-mode-row {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: -8px;
}

.btn-review {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 15px var(--bg-card-shadow);
}

.btn-review:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-review:disabled {
  cursor: default;
  opacity: 0.55;
  box-shadow: none;
}

.review-icon {
  font-size: 1.2rem;
}

.review-text {
  font-size: 0.95rem;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text-primary);
}

.review-count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--wrong-bg);
  color: var(--wrong);
  font-size: 0.8rem;
  font-weight: 700;
}

.review-count.wordbook-count {
  background: var(--accent-light);
  color: var(--accent);
}

/* Logout Button */
.btn-logout {
  margin-top: 0;
  padding: 6px 18px;
  font-size: 0.85rem;
}

/* ========================================
   START SCREEN
   ======================================== */
.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  gap: 16px;
  position: relative;
  animation: fadeInScale 0.6s ease;
}

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

.start-decoration {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.start-hanzi-bg {
  font-family: 'Noto Serif SC', serif;
  font-size: 8rem;
  font-weight: 900;
  color: var(--accent);
  opacity: 0.12;
  position: absolute;
  animation: floatHanzi 4s ease-in-out infinite;
  user-select: none;
}

@keyframes floatHanzi {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

.start-title {
  font-family: 'Noto Serif SC', 'Noto Sans KR', serif;
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 6px;
  text-shadow: 0 3px 12px rgba(232, 132, 74, 0.2);
}

.start-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 20px;
}

.mode-selection {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

.btn-mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 10px;
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 15px var(--bg-card-shadow);
}

.btn-mode:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(232, 132, 74, 0.3);
}

.btn-mode:active {
  transform: translateY(2px) scale(0.95);
}

.mode-icon {
  font-size: 2.5rem;
}

.mode-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.start-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 12px;
  animation: fadeIn 1s ease 0.5s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   DIFFICULTY SELECTION SCREEN
   ======================================== */
.difficulty-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 70vh;
  justify-content: center;
  gap: 20px;
  animation: fadeInScale 0.5s ease;
}

.difficulty-title {
  font-family: 'Noto Serif SC', 'Noto Sans KR', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 2px;
}

.difficulty-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

.difficulty-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.difficulty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 12px var(--bg-card-shadow);
  font-family: 'Noto Sans KR', sans-serif;
  position: relative;
  overflow: hidden;
}

.difficulty-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #F4A261);
  opacity: 0;
  transition: opacity var(--transition);
}

.difficulty-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(232, 132, 74, 0.2);
}

.difficulty-card:hover::before {
  opacity: 1;
}

.difficulty-card:active {
  transform: translateY(-1px);
}

.difficulty-card:nth-child(1) { animation: fadeInSlide 0.4s ease 0.1s both; }
.difficulty-card:nth-child(2) { animation: fadeInSlide 0.4s ease 0.2s both; }
.difficulty-card:nth-child(3) { animation: fadeInSlide 0.4s ease 0.3s both; }
.difficulty-card:nth-child(4) { animation: fadeInSlide 0.4s ease 0.4s both; }
.difficulty-card:nth-child(5) { animation: fadeInSlide 0.4s ease 0.5s both; }
.difficulty-card:nth-child(6) { animation: fadeInSlide 0.4s ease 0.6s both; }

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.difficulty-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #F4A261);
  padding: 4px 16px;
  border-radius: 100px;
}

.difficulty-emoji {
  font-size: 2.2rem;
  margin: 4px 0;
}

.difficulty-label {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-primary);
  text-align: center;
}

.difficulty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.difficulty-progress {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.difficulty-progress.has-record {
  color: var(--correct);
  font-weight: 700;
}

.btn-back {
  margin-top: 8px;
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-back:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ========================================
   COUNT SELECTION SCREEN
   ======================================== */
.count-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 70vh;
  justify-content: center;
  gap: 20px;
  animation: fadeInScale 0.5s ease;
}

.count-title {
  font-family: 'Noto Serif SC', 'Noto Sans KR', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 2px;
}

.count-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.count-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0;
}

.count-number {
  font-family: 'Noto Serif SC', serif;
  font-size: 5rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  transition: transform 0.2s ease;
  text-shadow: 0 3px 12px rgba(232, 132, 74, 0.2);
}

.count-unit {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.count-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 0 8px;
}

.count-label-min,
.count-label-max {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 24px;
  text-align: center;
}

.count-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border-radius: 100px;
  background: var(--border);
  outline: none;
  transition: background 0.2s;
}

.count-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F4A261);
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(232, 132, 74, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.count-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(232, 132, 74, 0.45);
}

.count-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F4A261);
  cursor: pointer;
  border: none;
  box-shadow: 0 3px 12px rgba(232, 132, 74, 0.35);
}

.count-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.count-preset-btn {
  padding: 8px 18px;
  border: 2px solid var(--border);
  border-radius: 100px;
  background: var(--bg-card);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.count-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.count-preset-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #F4A261);
  box-shadow: 0 3px 12px rgba(232, 132, 74, 0.25);
}

.btn-start-quiz {
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--accent), #F4A261);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(232, 132, 74, 0.3);
  margin-top: 8px;
}

.btn-start-quiz:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(232, 132, 74, 0.4);
}

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

/* ---- Header ---- */
header {
  text-align: center;
  padding: 12px 0 4px;
}

.game-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-top-home {
  position: absolute;
  left: 0;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-top-home:hover {
  background: var(--accent-light);
  transform: scale(1.1);
}

header h1, .header-titles h1 {
  font-family: 'Noto Serif SC', 'Noto Sans KR', serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 4px;
  text-shadow: 0 2px 8px rgba(232, 132, 74, 0.15);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* ---- Quiz Screen ---- */
#quiz-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeInScale 0.5s ease;
}

/* ---- Progress ---- */
.progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-text {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--accent), #F4A261);
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-display {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.score-correct { color: var(--correct); }
.score-wrong { color: var(--wrong); }

/* ---- Quiz Card ---- */
.quiz-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 36px 24px 28px;
  box-shadow:
    0 4px 24px var(--bg-card-shadow),
    0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  border: 1px solid var(--border);
  transition: transform var(--transition), opacity var(--transition);
}

.quiz-card.slide-out {
  transform: translateX(-40px);
  opacity: 0;
}

.quiz-card.slide-in {
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---- Hanzi Display ---- */
.hanzi-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 0 8px;
}

.hanzi-char {
  font-family: 'Noto Serif SC', serif;
  font-size: 5.5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text-primary);
  text-shadow: 0 2px 12px rgba(44, 36, 32, 0.08);
  transition: transform 0.3s ease;
  cursor: default;
  user-select: none;
}

.hanzi-char:hover {
  transform: scale(1.06);
}

.pinyin-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 4px;
}

.hanzi-pinyin {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1.5px;
  line-height: 1.6;
  display: inline-block;
}

.btn-speak {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-speak:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(232, 132, 74, 0.25);
}

.btn-speak:active {
  transform: scale(0.95);
}

.btn-speak svg {
  width: 20px;
  height: 20px;
}

/* ---- Choices ---- */
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.choice-btn {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.choice-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(232, 132, 74, 0.15);
}

.choice-btn:active:not(:disabled) {
  transform: translateY(0);
}

.choice-btn:disabled {
  cursor: default;
}

.choice-btn.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: var(--correct);
  animation: pop 0.35s ease;
}

.choice-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
  color: var(--wrong);
  animation: shake 0.4s ease;
}

.choice-btn.dimmed {
  opacity: 0.45;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---- Feedback Area ---- */
.feedback-area {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-msg {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 100px;
  animation: fadeUp 0.3s ease;
}

.feedback-msg.correct {
  color: var(--correct);
  background: var(--correct-bg);
}

.feedback-msg.wrong {
  color: var(--wrong);
  background: var(--wrong-bg);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Next Button ---- */
.btn-next {
  background: linear-gradient(135deg, var(--accent), #F4A261);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(232, 132, 74, 0.25);
  animation: fadeUp 0.3s ease;
}

.btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 132, 74, 0.35);
}

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

/* ---- Result Screen ---- */
.result-screen {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 24px;
  box-shadow:
    0 4px 24px var(--bg-card-shadow),
    0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: slideIn 0.5s ease;
}

.result-icon {
  font-size: 4rem;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-8px); }
}

.result-screen h2 {
  font-size: 1.8rem;
  color: var(--text-primary);
}

.result-stats {
  display: flex;
  gap: 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
}

.stat-correct { background: var(--correct-bg); }
.stat-wrong { background: var(--wrong-bg); }
.stat-percent { background: var(--accent-light); }

.stat-number {
  font-size: 2rem;
  font-weight: 900;
}

.stat-correct .stat-number { color: var(--correct); }
.stat-wrong .stat-number { color: var(--wrong); }
.stat-percent .stat-number { color: var(--accent); }

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.result-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Retry Wrong Questions Prompt */
.retry-prompt {
  margin: 20px 0 8px;
  padding: 20px;
  background: var(--wrong-bg);
  border: 2px solid var(--wrong);
  border-radius: var(--radius-sm);
  text-align: center;
  animation: fadeInUp 0.4s ease;
}

.retry-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.retry-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-retry-yes {
  background: linear-gradient(135deg, var(--correct), #2E9059);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 32px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(61, 170, 109, 0.25);
}

.btn-retry-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(61, 170, 109, 0.35);
}

.btn-retry-no {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 32px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-retry-no:hover {
  background: var(--border);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-restart {
  background: linear-gradient(135deg, var(--accent), #F4A261);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(232, 132, 74, 0.25);
}

.btn-restart:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 132, 74, 0.35);
}

.btn-home {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-home:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
}

/* ---- Feedback Section (Bottom) ---- */
.feedback-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
}

.feedback-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.feedback-buttons {
  display: flex;
  gap: 16px;
}

.btn-feedback {
  font-size: 2rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.btn-feedback:hover {
  transform: scale(1.12);
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(232, 132, 74, 0.18);
}

.btn-feedback.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.1);
}

.feedback-input-wrapper {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 400px;
}

.feedback-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition);
  outline: none;
}

.feedback-input::placeholder {
  color: var(--text-muted);
}

.feedback-input:focus {
  border-color: var(--accent);
}

.btn-send {
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-send:hover {
  background: var(--accent-hover);
}

/* ---- Feedback Toast ---- */
.feedback-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: #fff;
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================
   Sentence Game Screen Styles
========================================= */
#sentence-screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sentence-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 8px 30px var(--bg-card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.korean-prompt {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 10px;
  word-break: keep-all;
  line-height: 1.4;
}

.answer-area {
  min-height: 80px;
  padding: 12px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  transition: all 0.3s ease;
}

.answer-area.correct-anim {
  border-color: var(--correct);
  background: var(--correct-bg);
}

.answer-area.wrong-anim {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  animation: shake 0.4s ease;
}

.word-bank {
  min-height: 100px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.word-piece {
  padding: 8px 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.word-char {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.word-pinyin {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.5px;
}

.word-piece.in-answer {
  background: var(--accent);
  border-color: var(--accent);
  cursor: grab;
  transition: transform 0.2s ease;
}

.word-piece.in-answer:active {
  cursor: grabbing;
}

.word-piece.in-answer .word-char,
.word-piece.in-answer .word-pinyin {
  color: #fff;
}

.word-piece:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(232, 132, 74, 0.2);
}

.word-piece.used {
  background: var(--border);
  border-color: var(--border);
  opacity: 0.5;
  pointer-events: none;
  box-shadow: none;
}

.word-piece.used .word-char,
.word-piece.used .word-pinyin {
  color: var(--text-muted);
}

.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.btn-action {
  padding: 12px 20px;
  border: none;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 150px;
  font-family: inherit;
}

.btn-hint {
  background: #FFF3CD;
  color: #856404;
}
.btn-hint:hover { background: #ffeeba; transform: translateY(-2px); }

.btn-skip {
  background: #E2E3E5;
  color: #383D41;
}
.btn-skip:hover { background: #d6d8db; transform: translateY(-2px); }

/* ---- Responsive ---- */
/* ========================================
   STUDY PLAN SCREEN
   ======================================== */
.plan-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeInScale 0.5s ease;
}

.plan-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
}

.plan-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.plan-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.plan-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #F4A261);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.plan-day-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.plan-arrow {
  flex: 0 0 40px;
  height: 64px;
  /* 단어 목록이 길어도 화살표가 화면 가운데에 따라오도록 */
  position: sticky;
  top: calc(50vh - 32px);
  align-self: flex-start;
  margin-top: 120px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px var(--bg-card-shadow);
}

.plan-arrow:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.plan-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.plan-arrow.locked {
  font-size: 1.1rem;
  color: var(--text-muted);
  background: var(--bg-primary);
}

.plan-day-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px var(--bg-card-shadow);
}

.plan-day-card.shake {
  animation: shake 0.4s ease;
}

.plan-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-day-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
}

.plan-day-status {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  white-space: nowrap;
}

.plan-day-status.done {
  background: var(--correct-bg);
  color: var(--correct);
}

.plan-day-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan-word-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-word {
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(72px, auto) 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.plan-word:hover {
  background: var(--accent-light);
}

.plan-word-hanzi {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-word-pinyin {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.plan-word-meaning {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: right;
}

.plan-word-level {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
}

/* 단어장 저장 별 버튼 */
.plan-word-star {
  align-self: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}

.plan-word-star:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.plan-word-star.saved {
  color: #E9A23B;
}

/* 퀴즈 화면의 단어장 저장 버튼 */
.btn-save-word {
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-save-word:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-save-word.saved {
  border-color: #E9A23B;
  background: #FFF4DC;
  color: #C7831F;
}

/* 나의 단어장 화면 */
.wordbook-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeInScale 0.5s ease;
}

/* 노트 모양: 위쪽 스프링 고리 + 줄 노트 종이 + 왼쪽 빨간 여백 선 */
.notebook {
  --paper: #FFFEF8;
  --rule: #C9DCEB;
  --margin-line: #F0A8A0;
  --ring: #A8998C;
  position: relative;
  width: 100%;
  padding-top: 14px;
}

.notebook-rings {
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 30px;
  z-index: 2;
  /* 고리(테두리만 있는 둥근 링)를 일정 간격으로 반복 */
  background: radial-gradient(circle at 50% 55%, transparent 0 5px, var(--ring) 5px 7.5px, transparent 8px) 0 0 / 36px 30px repeat-x;
  pointer-events: none;
}

.notebook-page {
  position: relative;
  padding: 30px 16px 22px 58px;
  border: 1px solid var(--border);
  border-radius: 8px 8px 16px 16px;
  background:
    linear-gradient(90deg, transparent 44px, var(--margin-line) 44px, var(--margin-line) 46px, transparent 46px),
    var(--paper);
  box-shadow:
    0 6px 24px var(--bg-card-shadow),
    4px 4px 0 -1px #F4EDE3,
    4px 4px 0 0 var(--border);
}

/* 고리가 끼워지는 종이 구멍 */
.notebook-page::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 28px;
  right: 28px;
  height: 12px;
  background: radial-gradient(circle at 50% 50%, var(--bg-primary) 0 4.5px, transparent 5px) 0 0 / 36px 12px repeat-x;
}

.notebook-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--rule);
}

.notebook-title {
  font-family: 'Nanum Pen Script', 'Noto Sans KR', cursive;
  font-size: 2.1rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1.1;
}

.notebook-count {
  font-family: 'Nanum Pen Script', 'Noto Sans KR', cursive;
  font-size: 1.4rem;
  color: var(--text-secondary);
}

.notebook-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}

.notebook-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}

.notebook-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* 정렬: 최신순 / 급수순 */
.notebook-sort {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-primary);
}

.sort-btn {
  padding: 3px 10px;
  border: none;
  border-radius: 999px;
  background: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.sort-btn.active {
  background: var(--accent);
  color: #fff;
}

.notebook-hint {
  flex-basis: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.notebook-list {
  list-style: none;
  counter-reset: nb;
}

/* 단어 한 줄: 윗줄에 한자·병음·급수, 아랫줄에 뜻 (긴 단어도 뜻이 좁아지지 않도록) */
.notebook-word {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "hanzi pinyin star"
    "meaning meaning star";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  counter-increment: nb;
}

/* 왼쪽 여백에 손글씨 번호 */
.notebook-word::before {
  content: counter(nb);
  position: absolute;
  left: -46px;
  width: 36px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-family: 'Nanum Pen Script', cursive;
  font-size: 1.3rem;
  color: #D9776C;
}

.nb-hanzi {
  grid-area: hanzi;
  font-family: 'Noto Serif SC', serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nb-pinyin {
  grid-area: pinyin;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.nb-meaning {
  grid-area: meaning;
  justify-self: start;
  padding: 0 4px;
  border-radius: 4px;
  font-family: 'Nanum Pen Script', 'Noto Sans KR', cursive;
  font-size: 1.45rem;
  line-height: 1.2;
  color: #3B4A6B;
}

.notebook-word .plan-word-star {
  grid-area: star;
}

/* 뜻 가리기: 마스킹 테이프를 붙인 것처럼 가리고, 누른 단어만 보여 줌 */
.notebook-list.hide-meaning .notebook-word:not(.revealed) .nb-meaning {
  min-width: 5em;
  color: transparent;
  background: repeating-linear-gradient(-45deg, #F6E3C4 0 8px, #F1D9B2 8px 16px);
}

/* 쪽 넘기기 */
.notebook-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 14px;
}

.pager-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.pager-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pager-text {
  min-width: 70px;
  text-align: center;
  font-family: 'Nanum Pen Script', 'Noto Sans KR', cursive;
  font-size: 1.4rem;
  color: var(--text-secondary);
}

.notebook-list.turn-next {
  animation: pageInNext 0.28s ease;
}

.notebook-list.turn-prev {
  animation: pageInPrev 0.28s ease;
}

@keyframes pageInNext {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

@keyframes pageInPrev {
  from { opacity: 0; transform: translateX(-28px); }
  to { opacity: 1; transform: none; }
}

.wordbook-empty {
  padding: 32px 8px;
  text-align: center;
  font-family: 'Nanum Pen Script', 'Noto Sans KR', cursive;
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Result: plan message */
.result-plan-message {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--wrong);
  background: var(--wrong-bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}

.result-plan-message.passed {
  color: var(--correct);
  background: var(--correct-bg);
}

@media (max-width: 400px) {
  .plan-arrow {
    flex-basis: 32px;
    font-size: 1.4rem;
  }
}

/* 단어 목록이 좁으면(화면 폭·양옆 화살표에 따라 달라짐) 뜻을 아랫줄로 내림 */
.plan-word-list {
  container-type: inline-size;
}

@container (max-width: 380px) {
  .plan-word {
    grid-template-columns: auto 1fr auto;
  }

  .plan-word-meaning {
    grid-column: 1 / -1;
    text-align: left;
  }

  .plan-word-star {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (max-width: 480px) {
  .hanzi-char {
    font-size: 5.5rem;
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .result-stats {
    gap: 12px;
  }

  .stat-item {
    padding: 12px 16px;
  }

  .stat-number {
    font-size: 1.6rem;
  }

  .mode-selection {
    flex-direction: column;
    gap: 12px;
  }

  .start-title {
    font-size: 2.4rem;
  }
}

/* 계정 삭제 (눈에 덜 띄는 작은 텍스트 버튼) */
.btn-delete-account {
  margin-top: -8px;
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.btn-delete-account:hover {
  color: var(--wrong);
}

.privacy-link {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.privacy-link {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   SETTINGS BUTTON (시작 화면 왼쪽 위)
   ======================================== */
.btn-settings {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  box-shadow: 0 4px 12px var(--bg-card-shadow);
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform var(--transition);
}

.btn-settings:hover {
  transform: rotate(30deg);
}

/* ========================================
   NICKNAME SCREEN
   ======================================== */
.nickname-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  gap: 16px;
  text-align: center;
  position: relative;
  animation: fadeInScale 0.5s ease;
}

.nickname-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.nickname-input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.nickname-input:focus {
  border-color: var(--accent);
}

.nickname-error {
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--wrong);
  text-align: left;
}

/* ========================================
   SETTINGS SCREEN
   ======================================== */
.settings-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeInScale 0.5s ease;
}

.settings-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px var(--bg-card-shadow);
}

.settings-heading {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row-wrap {
  flex-wrap: wrap;
}

.settings-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-note {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.settings-nickname-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-settings-save {
  flex: 0 0 auto;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-settings-save:hover {
  background: var(--accent-hover);
}

.settings-range {
  flex: 1;
  max-width: 200px;
  accent-color: var(--accent);
}

/* 켜기/끄기 스위치 */
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--transition);
}

.switch-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition);
}

.switch input:checked + .switch-slider {
  background: var(--accent);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 느리게 / 보통 / 빠르게 */
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-primary);
}

.segment {
  padding: 5px 12px;
  border: none;
  border-radius: 999px;
  background: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.segment.active {
  background: var(--accent);
  color: #fff;
}

.btn-preview-speech {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  font-family: 'Noto Sans KR', 'Noto Serif SC', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-preview-speech:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-account-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-account-buttons .btn-logout,
.settings-account-buttons .btn-delete-account {
  margin-top: 0;
}

/* 단어 퀴즈: 병음 가리기 (설정) */
.hanzi-pinyin.pinyin-hidden {
  min-width: 4em;
  border-radius: 6px;
  color: transparent;
  background: var(--accent-light);
  cursor: pointer;
}

/* ========================================
   닉네임 중복 확인 · 고유 번호
   ======================================== */
.nickname-check-row {
  display: flex;
  gap: 8px;
}

.btn-check-nickname {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--accent);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-check-nickname:hover {
  background: var(--accent-light);
}

.nickname-error.ok {
  color: var(--correct);
}

.user-code {
  padding: 4px 10px;
  border: 1px dashed var(--accent);
  border-radius: 999px;
  background: var(--accent-light);
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  cursor: pointer;
}

/* 시작 화면 아래 줄: 오답 노트 · 단어장 · 친구 세 칸 */
.sub-mode-row .btn-review {
  flex-direction: column;
  gap: 2px;
  padding: 10px 4px;
  position: relative;
}

.sub-mode-row .review-count {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 20px;
  padding: 0 6px;
  font-size: 0.72rem;
}

.friend-request-count {
  background: var(--wrong);
  color: #fff;
}

/* ========================================
   FRIENDS SCREEN
   ======================================== */
.friends-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeInScale 0.5s ease;
}

.friends-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.friends-loading {
  text-align: center;
}

.my-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.friend-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.friend-item:last-child {
  border-bottom: none;
}

.friend-avatar {
  flex: 0 0 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #F4A261);
  color: #fff;
  font-family: 'Noto Sans KR', 'Noto Serif SC', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.friend-names {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.friend-nickname {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.friend-code {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.friend-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.friend-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.friend-btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.friend-btn.danger:hover {
  border-color: var(--wrong);
  color: var(--wrong);
}

.friend-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.friend-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.friend-count {
  margin-left: 4px;
  color: var(--text-muted);
}

.friend-search-result:empty {
  display: none;
}

/* 하단 사이트 안내 (웹에서만, 앱에서는 숨김) */
.site-info {
  width: 100%;
  max-width: 480px;
  margin: 8px auto 0;
  padding: 12px 16px 24px;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.site-info-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin-top: 6px;
}

.site-info-links a {
  color: var(--text-secondary);
}

.native-app .site-info {
  display: none;
}
