/* Laoshi HSK 3.0 - Korean UI + Level Selection + Full Screen */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Noto+Sans+KR:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
    --bg: #0B0E14;
    --bg-card: #151A25;
    --bg-card-hover: #1C2230;
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --text: #E8ECF1;
    --text-muted: #8B95A5;
    --text-dim: #5C6675;
    --primary: #818CF8;
    --success: #22C55E;
    --warning: #F59E0B;
    --error: #EF4444;
    --level-1: #22C55E;
    --level-2: #A78BFA;
    --level-3: #F472B6;
    --level-4: #FB923C;
    --level-5: #F472B6;
    --level-6: #FBBF24;
    --level-7: #22D3EE;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 150ms ease;
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Noto Sans KR', -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }
#laoshi-hsk-app { overflow-x: hidden; }
.chinese-text { font-family: 'Noto Sans SC', sans-serif; }

/* ===== APP CONTAINER - Full screen app takeover ===== */
/* ===== Override WordPress theme wrapper for full HSK app ===== */
.page-id-10815 #main.site-main,
.page-id-10815 #primary,
.page-id-10815 .site-main {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
}
.page-id-10815 #single-page.section {
  padding: 0 !important;
  margin: 0 !important;
}
.page-id-10815 .container {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}
.page-id-10815 .row.single-page-content {
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
}
.page-id-10815 #wrapper.hide-title-section {
  padding: 0 !important;
}

/* ===== APP CONTAINER ===== */
.hsk-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: calc(120px + env(safe-area-inset-top, 0px));
}

/* ===== CARD-STYLE HEADER ===== */
.hsk-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
  position: relative;
  padding: 0;
  width: 100%;
}
.hsk-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, #1C2230 0%, #151A25 100%);
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  transition: all 200ms ease;
}
.hsk-header h1:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

/* Mobile: ensure header card is visible */
@media (max-width: 768px) {
  .hsk-header h1 {
    background: linear-gradient(135deg, rgba(28,34,48,0.95) 0%, rgba(28,34,48,0.85) 100%);
    border: 1px solid rgba(129,140,248,0.25);
    box-shadow: 0 0 20px rgba(129,140,248,0.1);
  }
  .hsk-header {
    padding: 0 12px;
    box-sizing: border-box;
  }
}
/* Accent icon - Chinese character in a badge */
.hsk-header h1::before {
  content: '新';
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(129,140,248,0.2) 0%, rgba(129,140,248,0.05) 100%);
  border: 1px solid rgba(129,140,248,0.15);
  position: static;
  transform: none;
  letter-spacing: 0;
  opacity: 1;
  flex-shrink: 0;
}
.hsk-header h1,
.hsk-header h1 .hsk-title-accent,
.hsk-header h1 span:not(.hsk-title-accent) {
  color: #ffffff !important;
}
.hsk-header h1 .hsk-title-accent {
  font-weight: 700;
}
.app-header-title { color: #ffffff !important; }
.hsk-header-back {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none; font-size: 1rem;
  cursor: pointer; transition: color var(--transition);
  background: none; border: none;
}
.hsk-header-back:hover { color: var(--text); }

/* ===== LEVELS PAGE ===== */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
  width: 100%;
}
/* Mobile: varied sizes */
.levels-grid .level-card:nth-child(1) { grid-column: span 1; }
.levels-grid .level-card:nth-child(2) { grid-column: span 1; }
.levels-grid .level-card:nth-child(3) { grid-column: span 2; grid-row: span 1; }
.levels-grid .level-card:nth-child(4) { grid-column: span 1; }
.levels-grid .level-card:nth-child(5) { grid-column: span 2; grid-row: span 1; }
.levels-grid .level-card:nth-child(6) { grid-column: span 1; }
.levels-grid .level-card:nth-child(7) { grid-column: span 2; grid-row: span 1; }

@media (min-width: 769px) {
    .levels-grid {
      grid-template-columns: repeat(4, 1fr);
      grid-auto-rows: minmax(auto, 1fr);
    }
    .levels-grid .level-card:nth-child(1) { grid-column: span 2; grid-row: span 1; }
    .levels-grid .level-card:nth-child(2) { grid-column: span 1; grid-row: span 1; }
    .levels-grid .level-card:nth-child(3) { grid-column: span 1; grid-row: span 1; }
    .levels-grid .level-card:nth-child(4) { grid-column: span 2; grid-row: span 1; }
    .levels-grid .level-card:nth-child(5) { grid-column: span 1; grid-row: span 1; }
    .levels-grid .level-card:nth-child(6) { grid-column: span 1; grid-row: span 1; }
    .levels-grid .level-card:nth-child(7) { grid-column: span 2; grid-row: span 1; }
}
.level-card {
    background: linear-gradient(135deg, rgba(21,26,37,0.95) 0%, rgba(21,26,37,0.85) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1;
}
/* Subtle glow on top accent bar */
.level-card::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    background: inherit;
    filter: blur(4px);
    opacity: 0.5;
}
.level-card:hover {
    background: linear-gradient(135deg, rgba(28,34,48,0.95) 0%, rgba(28,34,48,0.85) 100%);
    border-color: var(--border-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.level-card[data-level="1"]::before { background: var(--level-1); }
.level-card[data-level="2"]::before { background: var(--level-2); }
.level-card[data-level="3"]::before { background: var(--level-3); }
.level-card[data-level="4"]::before { background: var(--level-4); }
.level-card[data-level="5"]::before { background: var(--level-5); }
.level-card[data-level="6"]::before { background: var(--level-6); }
.level-card[data-level="7"]::before { background: var(--level-7); }

.level-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.level-card-tag { font-size: 1rem; font-weight: 700; }
.level-card-tag[data-level="1"] { color: var(--level-1); }
.level-card-tag[data-level="2"] { color: var(--level-2); }
.level-card-tag[data-level="3"] { color: var(--level-3); }
.level-card-tag[data-level="4"] { color: var(--level-4); }
.level-card-tag[data-level="5"] { color: var(--level-5); }
.level-card-tag[data-level="6"] { color: var(--level-6); }
.level-card-tag[data-level="7"] { color: var(--level-7); }
.level-card-pct { font-size: 1.05rem; color: var(--text-muted); font-weight: 600; }

.level-card-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 2px; }
.level-card-count { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 8px; }

.level-card-bar { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.level-card-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.level-card-bar-fill[data-level="1"] { background: var(--level-1); }
.level-card-bar-fill[data-level="2"] { background: var(--level-2); }
.level-card-bar-fill[data-level="3"] { background: var(--level-3); }
.level-card-bar-fill[data-level="4"] { background: var(--level-4); }
.level-card-bar-fill[data-level="5"] { background: var(--level-5); }
.level-card-bar-fill[data-level="6"] { background: var(--level-6); }
.level-card-bar-fill[data-level="7"] { background: var(--level-7); }

.level-card-known { font-size: 1rem; color: var(--text-dim); }

/* ===== FEATURE CARDS ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
  flex-shrink: 0;
  width: 100%;
}
.feature-card-lg { grid-column: span 2; }
.feature-card-sm { grid-column: span 1; }

.feature-card {
    background: linear-gradient(135deg, rgba(21,26,37,0.95) 0%, rgba(21,26,37,0.85) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.feature-card:hover {
    background: linear-gradient(135deg, rgba(28,34,48,0.95) 0%, rgba(28,34,48,0.85) 100%);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(129,140,248,0.15) 0%, rgba(129,140,248,0.05) 100%);
    border: 1px solid rgba(129,140,248,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.feature-icon svg { width: 20px; height: 20px; }

.feature-title { font-size: 1rem; font-weight: 700; }
.feature-desc { font-size: 1rem; color: var(--text-dim); line-height: 1.4; }

/* ===== STUDY PAGE ===== */
.study-container {
  display: flex; flex-direction: column;
  min-height: 100vh;
  align-items: center;
  padding: 12px 20px;
  padding-top: calc(100px + env(safe-area-inset-top, 0px));
  max-width: 900px; margin: 0 auto;
}
.study-container .study-header { width: 100%; flex-shrink: 0; }
.study-container .study-tabs { width: 100%; flex-shrink: 0; }
.study-container .study-content { width: 100%; }

/* Flashcard wrap: grow naturally, page scrolls if content overflows */
.flashcard-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
}
.flashcard {
  width: 100%;
  max-width: 600px;
  perspective: 1200px;
  cursor: pointer;
}

.study-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-shrink: 0; }
.study-header-info { flex: 1; }
.study-header-level { font-size: 1.4rem; font-weight: 700; color: #000000; letter-spacing: -0.3px; }
.study-header-stats { display: flex; gap: 14px; font-size: 1rem; margin-top: 3px; color: #000000; }
.study-header-stat { color: #333333; font-weight: 500; }
.study-header-stat span { color: #000000; font-weight: 700; font-size: 1.1rem; }
.hsk-header-back { color: #333333; font-weight: 500; }
.hsk-header-back:hover { color: #818CF8; }

.study-tabs {
  display: flex; gap: 4px;
  background: linear-gradient(135deg, rgba(21,26,37,0.9) 0%, rgba(21,26,37,0.7) 100%);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.study-tab {
  flex: 1; padding: 10px 12px; font-size: 1.05rem; font-weight: 600;
  color: var(--text-muted); background: transparent; border: none;
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
  font-family: inherit; position: relative;
}
.study-tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.study-tab.active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(0,0,0,0.2);
}

.study-content { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 10px; }

/* ===== FLASHCARD ===== */

.flashcard-inner {
    width: 100%;
    position: relative;
}
.flashcard-face {
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    display: flex; flex-direction: column; align-items: center;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}
.flashcard-front {
    justify-content: center;
    padding-top: 56px;
}
.flashcard-back {
    display: none;
    justify-content: flex-start;
    padding: 16px 20px 20px;
}
.flashcard.flipped .flashcard-front { display: none; }
.flashcard.flipped .flashcard-back { display: flex; }

.flashcard-badge {
    position: absolute; top: 16px; left: 16px;
    padding: 4px 10px; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700;
}
.flashcard-badge.known { background: rgba(34,197,94,0.15); color: var(--success); }
.flashcard-badge.review { background: rgba(245,158,11,0.15); color: var(--warning); }

.flashcard-counter { position: absolute; top: 16px; right: 16px; font-size: 1rem; color: var(--text-muted); }

.flashcard-audio {
    position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    color: var(--text); display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all var(--transition);
}
.flashcard-audio:hover { background: rgba(255,255,255,0.1); }
.flashcard-audio svg { width: 18px; height: 18px; }

.flashcard-char { font-size: 6rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.flashcard-pinyin { font-size: 1.8rem; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.flashcard-hint { font-size: 1.05rem; color: var(--text-dim); }

.flashcard-meaning { font-size: 2.4rem; font-weight: 700; margin-bottom: 8px; text-align: center; }
.flashcard-pos { font-size: 1rem; color: var(--text-muted); background: rgba(255,255,255,0.05); padding: 4px 12px; border-radius: var(--radius-sm); }

/* Controls */
.flashcard-controls { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; margin-top: 6px; }
.ctrl-btn {
    padding: 10px 18px; border-radius: var(--radius-sm); font-size: 1.05rem; font-weight: 600;
    border: 1px solid var(--border); cursor: pointer; transition: all var(--transition);
    font-family: inherit; display: flex; align-items: center; gap: 6px;
}
.ctrl-btn-nav { background: var(--bg-card); color: var(--text); }
.ctrl-btn-nav:hover { background: var(--bg-card-hover); }
.ctrl-btn-know { background: var(--success); color: white; border-color: var(--success); }
.ctrl-btn-know:hover { opacity: 0.9; }
.ctrl-btn-review { background: var(--warning); color: white; border-color: var(--warning); }
.ctrl-btn-review:hover { opacity: 0.9; }
.ctrl-btn-util { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.ctrl-btn-util:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.flashcard-util { display: flex; justify-content: center; gap: 8px; margin-top: 6px; flex-shrink: 0; }

.flashcard-nav { display: flex; justify-content: center; gap: 10px; margin-top: 8px; flex-shrink: 0; }

/* ===== QUIZ ===== */
.quiz-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; margin-top: 30px; }
.quiz-card { width: 100%; max-width: 600px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 32px; }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.quiz-progress-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; }
.quiz-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.quiz-progress-text { font-size: 1rem; color: var(--text-muted); font-weight: 600; }

.quiz-question { text-align: center; margin-bottom: 24px; }
.quiz-char { font-size: 5rem; font-weight: 700; }
.quiz-pinyin { font-size: 1.5rem; color: var(--primary); font-weight: 600; }

.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-option {
    padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all var(--transition); font-size: 1.1rem; font-weight: 500; text-align: center;
}
.quiz-option:hover { border-color: var(--primary); }
.quiz-option.correct { border-color: var(--success); background: rgba(34,197,94,0.1); }
.quiz-option.wrong { border-color: var(--error); background: rgba(239,68,68,0.1); }

.quiz-feedback { text-align: center; margin-top: 16px; min-height: 24px; font-size: 1.05rem; font-weight: 600; }
.quiz-feedback.correct { color: var(--success); }
.quiz-feedback.wrong { color: var(--error); }
.quiz-next { margin-top: 12px; padding: 10px 24px; background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); font-size: 1.05rem; font-weight: 600; cursor: pointer; display: none; font-family: inherit; }
.quiz-next.visible { display: block; }

/* ===== BROWSE ===== */
.browse-wrap { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.browse-filters { display: flex; gap: 10px; flex-shrink: 0; }
.browse-search {
    flex: 1; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 1.05rem; color: var(--text); outline: none; font-family: inherit;
}
.browse-search::placeholder { color: var(--text-dim); }
.browse-filter-btn {
    padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 1rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.browse-filter-btn.active { background: rgba(255,255,255,0.08); color: var(--text); }

.browse-list { flex: 1; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); }
.browse-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 16px; }
.browse-item:last-child { border-bottom: none; }
.browse-word { font-size: 1.6rem; font-weight: 700; width: 100px; flex-shrink: 0; }
.browse-meta { display: flex; flex-direction: column; gap: 2px; width: 120px; flex-shrink: 0; }
.browse-pinyin { color: var(--primary); font-size: 1.05rem; font-weight: 500; }
.browse-pos { font-size: 1rem; color: var(--text-dim); }
.browse-meaning { flex: 1; text-align: right; color: var(--text-muted); font-size: 1rem; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 40px; text-align: center; max-width: 360px; width: 90%; }
.modal-emoji { font-size: 3rem; margin-bottom: 16px; }
.modal-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.modal-score { font-size: 3rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.modal-msg { color: var(--text-muted); margin-bottom: 24px; font-size: 1.1rem; }
.modal-btn { padding: 12px 28px; background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ===== LEVEL PICKER MODAL ===== */
.hsk-picker-modal {
  background: linear-gradient(135deg, rgba(21,26,37,0.96) 0%, rgba(15,18,25,0.96) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  max-width: 420px;
  width: 92%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.hsk-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
}
.hsk-picker-btn {
  background: linear-gradient(135deg, rgba(21,26,37,0.9) 0%, rgba(21,26,37,0.7) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hsk-picker-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--clr);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.hsk-picker-tag {
  font-size: 1.05rem;
  font-weight: 700;
}
.hsk-picker-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.hsk-picker-close {
  margin-top: 4px;
}

/* ===== PROGRESS MODAL ===== */
.hsk-progress-modal {
  background: linear-gradient(135deg, rgba(21,26,37,0.96) 0%, rgba(15,18,25,0.96) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  max-width: 420px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.hsk-progress-total {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
}
.hsk-progress-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.hsk-progress-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.hsk-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.hsk-progress-level {
  font-size: 1rem;
  font-weight: 700;
}
.hsk-progress-pct {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}
.hsk-progress-detail {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== EXAMPLE SENTENCES ===== */
.flashcard-examples { margin-top: 16px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.example-sentence {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    text-align: left;
}
.example-cn { font-size: 1.1rem; color: var(--text); font-weight: 500; margin-bottom: 2px; }
.example-py { font-size: 0.95rem; color: var(--primary); margin-bottom: 2px; }
.example-kr { font-size: 1rem; color: var(--text-muted); }

/* ===== LOADING ===== */
.hsk-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); gap: 12px; }
.hsk-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE - Mobile First Enhancements ===== */

/* Small tablets & large phones (768px and below) */
@media (max-width: 768px) {
    html { font-size: 16px; }
    .page-id-10815 .container,
    .page-id-10815 .row.single-page-content,
    .page-id-10815 #single-page.section { padding: 0 !important; margin: 0 !important; }
    .hsk-app { padding: 0; max-width: 100%; padding-top: calc(70px + env(safe-area-inset-top, 0px)); }
    .hsk-header { padding: 0 16px; margin: 0 0 12px; }
    .hsk-header h1 { font-size: 1.35rem; padding: 12px 16px; gap: 8px; border-radius: 14px; }
    .hsk-header h1::before { width: 28px; height: 28px; font-size: 0.8rem; }
    .hsk-header-back { font-size: 1rem; }

    /* Levels - Mobile card style: one card per full row */
    .levels-grid { grid-template-columns: 1fr; gap: 10px; padding: 0 12px; }
    .levels-grid .level-card { grid-column: 1 !important; grid-row: auto !important; padding: 20px 16px; border: 1px solid var(--border); border-radius: 14px; margin: 0; box-shadow: 0 2px 12px rgba(0,0,0,0.15); }
    .level-card::before { height: 3px; left: 0; right: 0; }
    .level-card-top { margin-bottom: 12px; }
    .level-card-tag { font-size: 1.25rem; }
    .level-card-pct { font-size: 1.1rem; }
    .level-card-name { font-size: 1.5rem; margin-bottom: 4px; }
    .level-card-count { font-size: 1.05rem; margin-bottom: 12px; }
    .level-card-bar { height: 10px; margin-bottom: 12px; }
    .level-card-known { font-size: 1rem; }

    /* Features - Vertical stacked cards */
    .features-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 12px; padding: 0 12px; }
    .feature-card { padding: 16px; gap: 10px; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.15); flex-direction: column; align-items: flex-start; }
    .feature-card:hover { transform: none; background: linear-gradient(135deg, rgba(28,34,48,0.95) 0%, rgba(28,34,48,0.85) 100%); }
    .feature-icon { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
    .feature-icon svg { width: 20px; height: 20px; }
    .feature-title { font-size: 1.1rem; }
    .feature-desc { font-size: 0.95rem; }

    /* Study page - App style */
    .study-container { padding: 0; max-width: 100%; padding-top: calc(70px + env(safe-area-inset-top, 0px)); }
    .study-header { padding: 12px 16px 0; gap: 8px; }
    .study-header-level { font-size: 1.2rem; }
    .study-header-stats { font-size: 0.9rem; gap: 8px; flex-wrap: wrap; }
    .study-header-stat span { font-size: 1rem; }
    .study-tabs { margin: 8px 16px 4px; gap: 0; padding: 3px; border-radius: var(--radius-lg); }
    .study-tab { padding: 10px 8px; font-size: 1rem; min-height: 44px; border-radius: var(--radius-md); }
    .study-content { padding: 0 16px; }

    /* Flashcard */
    .flashcard { max-width: 100%; }
    .flashcard-face { padding: 14px; }
    .flashcard-front { padding-top: 46px; }
    .flashcard-back { padding: 12px 14px 14px; }
    .flashcard-char { font-size: 3.5rem; }
    .flashcard-pinyin { font-size: 1.4rem; }
    .flashcard-hint { font-size: 0.95rem; }
    .flashcard-meaning { font-size: 1.8rem; }
    .flashcard-examples { margin-top: 12px; gap: 8px; }
    .example-sentence { padding: 8px 12px; }
    .example-cn { font-size: 1rem; }
    .example-py { font-size: 0.9rem; }
    .example-kr { font-size: 0.95rem; }
    .flashcard-controls { gap: 6px; }
    .ctrl-btn { padding: 8px 14px; font-size: 0.95rem; min-height: 44px; }
    .flashcard-util { gap: 6px; flex-wrap: wrap; }
    .flashcard-nav { gap: 8px; flex-wrap: wrap; }

    /* Quiz */
    .quiz-card { padding: 20px; }
    .quiz-char { font-size: 3.5rem; }
    .quiz-pinyin { font-size: 1.2rem; }
    .quiz-options { grid-template-columns: 1fr; gap: 8px; }
    .quiz-option { padding: 14px; font-size: 1rem; min-height: 44px; }
    .quiz-progress { margin-bottom: 16px; }

    /* Browse */
    .browse-filters { gap: 6px; flex-wrap: wrap; }
    .browse-search { padding: 8px 12px; font-size: 0.95rem; }
    .browse-filter-btn { padding: 8px 12px; font-size: 0.9rem; }
    .browse-item { padding: 10px 12px; gap: 10px; }
    .browse-word { width: 60px; font-size: 1.3rem; }
    .browse-meta { width: 80px; }
    .browse-pinyin { font-size: 0.95rem; }
    .browse-meaning { font-size: 0.9rem; }

    /* Modal */
    .modal { padding: 28px 20px; max-width: 320px; }
    .modal-emoji { font-size: 2.5rem; }
    .modal-title { font-size: 1.3rem; }
    .modal-score { font-size: 2.5rem; }
    .modal-msg { font-size: 1rem; }
    .modal-btn { padding: 10px 24px; font-size: 0.95rem; }
}

/* Extra small phones (480px and below) */
@media (max-width: 480px) {
    html { font-size: 16px; }
    .hsk-app { padding: 0; }
    .hsk-header { padding: 0 12px; }
    .hsk-header h1 { font-size: 1.2rem; padding: 10px 14px; }
    .hsk-header h1::before { width: 24px; height: 24px; font-size: 0.75rem; }
    .level-card { padding: 20px 12px; }
    .level-card-name { font-size: 1.4rem; }
    .level-card-tag { font-size: 1.15rem; }
    .level-card-count { font-size: 1rem; }
    .feature-card { padding: 16px 12px; }

    /* Features single column (inherits 1fr from 768px) */

    /* Flashcard even smaller */

    .flashcard-face { padding: 10px; }
    .flashcard-front { padding-top: 40px; }
    .flashcard-back { padding: 8px 10px 12px; }
    .flashcard-char { font-size: 2.8rem; }
    .flashcard-pinyin { font-size: 1.2rem; }
    .flashcard-meaning { font-size: 1.5rem; }
    .flashcard-badge { font-size: 0.85rem; padding: 3px 8px; }
    .flashcard-counter { font-size: 0.85rem; }
    .ctrl-btn { padding: 8px 12px; font-size: 0.9rem; min-height: 44px; }

    /* Quiz */
    .quiz-card { padding: 16px; }
    .quiz-char { font-size: 2.8rem; }
    .quiz-pinyin { font-size: 1.1rem; }
    .quiz-option { padding: 12px; font-size: 0.95rem; }

    /* Browse */
    .browse-item { flex-wrap: wrap; gap: 6px; }
    .browse-word { width: 100%; font-size: 1.4rem; }
    .browse-meta { width: auto; flex-direction: row; gap: 8px; }
    .browse-meaning { width: 100%; text-align: left; font-size: 0.95rem; }

    /* Study tabs */
    .study-tab { padding: 8px 4px; font-size: 0.9rem; }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
    html { font-size: 13px; }
    .features-grid { grid-template-columns: 1fr; }
    .ctrl-btn { padding: 8px 10px; font-size: 0.85rem; }
    .flashcard-char { font-size: 2.4rem; }
    .quiz-char { font-size: 2.4rem; }
    .browse-filters { flex-direction: column; }
    .browse-filter-btn { width: 100%; text-align: center; }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
    .hsk-app { padding: 8px 16px; }

    .flashcard-char { font-size: 2.5rem; }
    .flashcard-meaning { font-size: 1.4rem; }
    .levels-grid { grid-template-columns: repeat(3, 1fr); }
    .levels-grid .level-card:nth-child(1),
    .levels-grid .level-card:nth-child(4),
    .levels-grid .level-card:nth-child(7) { grid-column: span 2 !important; }
    .levels-grid .level-card:nth-child(2),
    .levels-grid .level-card:nth-child(3),
    .levels-grid .level-card:nth-child(5),
    .levels-grid .level-card:nth-child(6) { grid-column: span 1 !important; }
}

/* Touch device enhancements */
@media (hover: none) and (pointer: coarse) {
    .level-card:hover { transform: none; }
    .feature-card:hover { transform: none; }
    .quiz-option:hover { border-color: var(--border); }
    .ctrl-btn { min-height: 44px; min-width: 44px; }
    .browse-item { min-height: 44px; }
}
