/* ==========================================================================
   1번 디자인: 좌측 사이드바 & 모던 벤토 그리드 (정밀 레이아웃 & 완벽 중앙 정렬 & 로그아웃 UI)
   ========================================================================== */
:root {
  --bg-app: #F7F5F0;          /* 따뜻한 화지 아이보리 베이스 */
  --bg-card: #FFFFFF;         /* 순백색 벤토 카드 */
  --bg-sidebar: #FFFFFF;      /* 사이드바 배경 */
  --bg-subtle: #EFECE6;       /* 부드러운 샌드 베이지 */
  --bg-input: #FFFFFF;
  --bg-glass: rgba(247, 245, 240, 0.95);

  --primary: #5B8C5A;         /* 말차 그린 */
  --primary-hover: #4A7349;
  --primary-light: #EBF5EB;
  --primary-glow: rgba(91, 140, 90, 0.18);

  --accent-sakura: #FF6B8B;   /* 소프트 사쿠라 핑크 */
  --accent-sakura-light: #FFE4E8;
  --accent-matcha: #22C55E;   /* 산뜻한 말차 그린 */
  --accent-matcha-light: #DCFCE7;
  --accent-sky: #0EA5E9;      /* 스카이 블루 */
  --accent-sky-light: #E0F2FE;
  --accent-amber: #F59E0B;    /* 웜 앰버 옐로우 */
  --accent-amber-light: #FEF3C7;
  --accent-wisteria: #A855F7; /* 위스테리아 퍼플 */
  --accent-wisteria-light: #F3E8FF;

  --text-main: #24292F;       /* 먹색 다크 챠콜 */
  --text-muted: #656D76;      /* 차분한 슬레이트 그레이 */
  --text-subtle: #9EA5AD;     /* 연한 그레이 */

  --border-color: #E8E5DE;
  --border-hover: #D0CCC2;

  --radius-xs: 8px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(45, 40, 35, 0.03);
  --shadow-card: 0 4px 20px rgba(45, 40, 35, 0.04), 0 1px 3px rgba(45, 40, 35, 0.02);
  --shadow-hover: 0 10px 28px rgba(45, 40, 35, 0.08), 0 2px 6px rgba(45, 40, 35, 0.04);
  --shadow-bento: 0 8px 30px rgba(45, 40, 35, 0.06);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-app: #18191E;
  --bg-card: #22242B;
  --bg-sidebar: #1F2128;
  --bg-subtle: #2B2E37;
  --bg-input: #292B34;
  --bg-glass: rgba(24, 25, 30, 0.95);

  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-subtle: #6B7280;

  --border-color: #323642;
  --border-hover: #454B5C;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-bento: 0 8px 30px rgba(0, 0, 0, 0.35);

  --primary-light: rgba(91, 140, 90, 0.2);
  --accent-sakura-light: rgba(255, 107, 139, 0.18);
  --accent-matcha-light: rgba(34, 197, 94, 0.18);
  --accent-sky-light: rgba(14, 165, 233, 0.18);
  --accent-amber-light: rgba(245, 158, 11, 0.18);
  --accent-wisteria-light: rgba(168, 85, 247, 0.18);
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

.jp-text, .word-jp, .kana-char, .bento-kana-char {
  font-family: 'Noto Sans JP', 'Pretendard', sans-serif;
}

/* ==========================================================================
   Main App Layout: Left Sidebar + Right Body Canvas
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* 1. Left Sidebar */
.app-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 24px;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  margin-left: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.sidebar-nav-item .nav-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.sidebar-nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  transform: translateX(3px);
}

.sidebar-nav-item.active {
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.sidebar-logout-nav-item {
  color: #EF4444 !important;
  margin-top: 10px;
  border-top: 1px dashed var(--border-color);
  padding-top: 14px;
}

.sidebar-logout-nav-item:hover {
  background: #FEE2E2 !important;
  color: #DC2626 !important;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user-card:hover {
  background: var(--bg-subtle);
}

.sidebar-logout-icon {
  margin-left: auto;
  font-size: 1.1rem;
  opacity: 0.7;
}

.user-avatar {
  font-size: 1.6rem;
  background: var(--bg-subtle);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 700;
}

/* 2. Right Body Canvas */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

/* Topbar */
.app-topbar {
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 1.2rem;
  cursor: pointer;
}

.topbar-pill-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.pill-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.pill-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.topbar-logout-btn {
  color: #EF4444;
  border-color: #FCA5A5;
  background: var(--bg-card);
}

.topbar-logout-btn:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search span {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.topbar-search input {
  padding: 8px 14px 8px 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  width: 200px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.topbar-search input:focus {
  width: 240px;
  border-color: var(--primary);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-subtle);
  transform: scale(1.05);
}

/* App Main Content Container */
.app-main-content {
  padding: 0 28px 40px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: var(--shadow-hover);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu-toggle {
    display: block;
  }
  .app-main-content {
    padding: 0 16px 80px;
  }
  .app-topbar {
    padding: 14px 16px;
  }
}

/* ==========================================================================
   Bento Grid Layout (12 Columns)
   ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  width: 100%;
}

.bento-card, .card-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  padding: 22px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.bento-card:hover, .card-panel:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }
.col-2  { grid-column: span 2; }

@media (max-width: 1200px) {
  .col-5, .col-4, .col-3, .col-2 {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .col-8, .col-6, .col-5, .col-4, .col-3, .col-2 {
    grid-column: span 12;
  }
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-head h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   Bento Level Cards (Image 2 Pastel Blocks)
   ========================================================================== */
.bento-level-card {
  border-radius: var(--radius-md);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 125px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

.bento-level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.bento-level-card.N5 {
  background: #FFE4E8 !important;
  color: #9E1C38 !important;
  border-color: #FECDD3;
}
.bento-level-card.N5 .bento-badge { background: #FFB3C1; color: #780E25; }
.bento-level-card.N5 .bento-bar-fill { background: #FF4D6D !important; }

.bento-level-card.N4 {
  background: #DCFCE7 !important;
  color: #166534 !important;
  border-color: #BBF7D0;
}
.bento-level-card.N4 .bento-badge { background: #BBF7D0; color: #14532D; }
.bento-level-card.N4 .bento-bar-fill { background: #22C55E !important; }

.bento-level-card.N3 {
  background: #E0F2FE !important;
  color: #075985 !important;
  border-color: #BAE6FD;
}
.bento-level-card.N3 .bento-badge { background: #BAE6FD; color: #0369A1; }
.bento-level-card.N3 .bento-bar-fill { background: #0EA5E9 !important; }

.bento-level-card.N2 {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border-color: #FDE68A;
}
.bento-level-card.N2 .bento-badge { background: #FDE68A; color: #78350F; }
.bento-level-card.N2 .bento-bar-fill { background: #F59E0B !important; }

.bento-level-card.N1 {
  background: #F3E8FF !important;
  color: #6B21A8 !important;
  border-color: #E9D5FF;
}
.bento-level-card.N1 .bento-badge { background: #E9D5FF; color: #581C87; }
.bento-level-card.N1 .bento-bar-fill { background: #A855F7 !important; }

[data-theme="dark"] .bento-level-card.N5 { background: #3B1B22 !important; color: #FFB3C1 !important; }
[data-theme="dark"] .bento-level-card.N4 { background: #162E20 !important; color: #86EFAC !important; }
[data-theme="dark"] .bento-level-card.N3 { background: #152B3C !important; color: #7DD3FC !important; }
[data-theme="dark"] .bento-level-card.N2 { background: #382914 !important; color: #FDE68A !important; }
[data-theme="dark"] .bento-level-card.N1 { background: #2E1A3C !important; color: #D8B4FE !important; }

.bento-level-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.bento-level-title {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.5px;
}

.bento-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.bento-level-sub {
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.85;
}

.bento-bar-bg, .progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 10px 0 6px;
}

[data-theme="dark"] .bento-bar-bg, [data-theme="dark"] .progress-bar-bg {
  background: rgba(255, 255, 255, 0.12);
}

.bento-bar-fill, .progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.bento-level-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ==========================================================================
   Streak & Mini Widgets
   ========================================================================== */
.streak-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.streak-flame {
  font-size: 2rem;
  line-height: 1;
}

.streak-val {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.streak-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Mini Kana Grid */
.bento-kana-mini-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.bento-kana-chip {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.bento-kana-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.bento-kana-chip .char {
  font-size: 1.4rem;
  font-weight: 900;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text-main);
  display: block;
}

.bento-kana-chip .romaji {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

/* Vocabulary Deck Card Items */
.vocab-deck-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.vocab-deck-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vocab-deck-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateX(2px);
}

/* Weekly Progress Bar Graph */
.weekly-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 90px;
  gap: 8px;
  margin: 12px 0 6px;
  padding: 0 6px;
}

.chart-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.chart-bar-pillar {
  width: 100%;
  max-width: 16px;
  background: #FF6B8B;
  border-radius: var(--radius-full);
  transition: height 0.4s ease;
}

.chart-bar-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-sakura {
  background: var(--accent-sakura);
  color: #FFFFFF;
}

.btn-sakura:hover {
  background: #E65373;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-light);
}

.audio-btn {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.audio-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* ==========================================================================
   Words List & Masking
   ========================================================================== */
.toolbar-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.level-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-full);
}

.level-tab {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.level-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
}

.mask-toggles {
  display: flex;
  gap: 6px;
}

.mask-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mask-btn.active {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FCA5A5;
}

/* Words Grid */
.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.word-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.word-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
}

.word-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.word-jp {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.word-kana {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.word-meaning {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
}

.word-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

.level-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.level-badge.N5 { background: #FFE4E8; color: #9E1C38; }
.level-badge.N4 { background: #DCFCE7; color: #166534; }
.level-badge.N3 { background: #E0F2FE; color: #075985; }
.level-badge.N2 { background: #FEF3C7; color: #92400E; }
.level-badge.N1 { background: #F3E8FF; color: #6B21A8; }
.level-badge.ALL { background: var(--bg-subtle); color: var(--text-muted); }

.masked-text {
  filter: blur(5px);
  user-select: none;
  transition: filter 0.2s ease;
}

.masked-text:hover {
  filter: blur(0);
}

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

.page-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Quiz & Flashcard Interfaces
   ========================================================================== */
.quiz-container {
  max-width: 680px;
  margin: 0 auto;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 24px;
}

.option-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.option-btn.correct {
  background: #DCFCE7 !important;
  border-color: #22C55E !important;
  color: #15803D !important;
}

.option-btn.wrong {
  background: #FEE2E2 !important;
  border-color: #EF4444 !important;
  color: #B91C1C !important;
}

.feedback-banner {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.feedback-banner.correct {
  background: #DCFCE7;
  color: #15803D;
}

.feedback-banner.wrong {
  background: #FEE2E2;
  color: #B91C1C;
}

/* Flashcard 3D */
.flashcard-wrapper {
  perspective: 1000px;
  min-height: 260px;
  cursor: pointer;
  margin-bottom: 24px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  min-height: 260px;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
}

.flashcard-back {
  transform: rotateY(180deg);
  background: var(--primary-light);
}

/* ==========================================================================
   Kana 50-Sound Grid
   ========================================================================== */
.kana-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .kana-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
}

.kana-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 6px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kana-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  background: var(--primary-light);
}

.kana-char {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.kana-romaji {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.kana-korean {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kana-audio-icon {
  font-size: 0.7rem;
  color: var(--text-subtle);
  margin-top: 4px;
}

/* ==========================================================================
   Word Detail Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-bento);
  border: 1px solid var(--border-color);
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--bg-subtle);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border-hover);
  color: var(--text-main);
}

/* ==========================================================================
   Auth Container (로그인 / 회원가입 화면 완벽 중앙 정렬)
   ========================================================================== */
.auth-container {
  min-height: 100vh;
  width: 100vw;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-bento);
  text-align: center;
  margin: auto;
}

.auth-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.form-group {
  text-align: left;
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.input-with-eye {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-eye .form-input {
  padding-right: 42px;
}

.eye-toggle-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 4px;
}

.password-match-hint {
  font-size: 0.78rem;
  margin-top: 5px;
  font-weight: 700;
}

.password-match-hint.match { color: #10b981; }
.password-match-hint.mismatch { color: #ef4444; }

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary);
}

.btn-auth-submit {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  margin-top: 8px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: var(--text-subtle);
  font-size: 0.8rem;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
  padding: 0 10px;
}

.btn-guest {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

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

.auth-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #FEE2E2;
  color: #B91C1C;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text-main);
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-hover);
}
