/* ============================================================================
   VISALINK HANA: TOPIK, EPS — DESIGN SYSTEM (B-LITE PRODUCTION PROTOTYPE)
   Primary: #248201 | Accent (Dojang Red): #C8102E | Surface Ivory: #FFFDF7
   ============================================================================ */

:root {
  --brand-green: #248201;
  --brand-green-dark: #195e00;
  --brand-green-light: #e9f6e5;
  --brand-red: #C8102E;
  --brand-red-light: #fde8ec;
  --brand-gold: #F59E0B;
  --bg-ivory: #FFFDF7;
  --bg-card: #FFFFFF;
  --text-main: #182215;
  --text-muted: #556452;
  --border-soft: #DCE6D8;
  --shadow-sm: 0 2px 8px rgba(24, 34, 21, 0.06);
  --shadow-md: 0 8px 24px rgba(24, 34, 21, 0.10);
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background-color: var(--bg-ivory);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
}

.ko-text {
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  letter-spacing: -0.01em;
}

/* TOP WORKSPACE SWITCHER BAR */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 2px solid var(--brand-green);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup img.app-icon-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--brand-green);
}

.brand-title-group h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-green);
  line-height: 1.2;
}

.brand-title-group h1 span.hana-red {
  color: var(--brand-red);
}

.brand-title-group p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.mode-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f0;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-btn.active {
  background: var(--brand-green);
  color: #fff;
  box-shadow: 0 2px 6px rgba(36, 130, 1, 0.25);
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pill-streak {
  background: #fff3e0;
  color: #d97706;
  border: 1px solid #fcd34d;
}

.pill-vip {
  background: var(--brand-red-light);
  color: var(--brand-red);
  border: 1px solid #f9a8b8;
}

.pill-vip.unlocked {
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
  border-color: var(--brand-green);
}

/* MAIN LAYOUT */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 90px;
}

.app-container.mobile-frame-mode {
  max-width: 440px;
  margin: 20px auto 90px;
  background: var(--bg-ivory);
  border: 8px solid #1e293b;
  border-radius: 38px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.22);
  padding: 16px 14px 86px;
  position: relative;
}

/* STUDENT NAVIGATION TABS (5 TABS) */
.student-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: #fff;
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.nav-tab {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s ease;
}

.nav-tab:hover {
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
}

.nav-tab.active {
  background: var(--brand-green);
  color: #fff;
}

/* HERO BANNER */
.hero-card {
  background: linear-gradient(135deg, #1b6501 0%, #248201 65%, #2f9e06 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 22px;
  border: 2px solid #165200;
}

.app-container.mobile-frame-mode .hero-card {
  grid-template-columns: 1fr;
  padding: 18px;
}

.hero-badge {
  display: inline-block;
  background: var(--brand-red);
  color: #fff;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.hero-card h2 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.hero-card p {
  font-size: 0.92rem;
  opacity: 0.94;
  margin-bottom: 16px;
}

.hero-art {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.hero-art img {
  max-height: 150px;
  border-radius: 16px;
  border: 3px solid rgba(255,255,255,0.85);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  background: #fff;
}

/* GRID & CARDS */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 22px;
}

.app-container.mobile-frame-mode .grid-3,
.app-container.mobile-frame-mode .grid-2 {
  grid-template-columns: 1fr;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
}

.tag-eps { background: #e0f2fe; color: #0369a1; }
.tag-topik1 { background: var(--brand-green-light); color: var(--brand-green-dark); }
.tag-topik2 { background: var(--brand-red-light); color: var(--brand-red); }
.tag-free { background: #dcfce7; color: #15803d; }
.tag-vip { background: #fef3c7; color: #b45309; }

/* BUTTONS */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.16s ease;
}

.btn-primary {
  background: var(--brand-green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-green-dark);
}

.btn-red {
  background: var(--brand-red);
  color: #fff;
}
.btn-red:hover {
  background: #a30b24;
}

.btn-outline {
  background: #fff;
  color: var(--brand-green);
  border: 1.5px solid var(--brand-green);
}
.btn-outline:hover {
  background: var(--brand-green-light);
}

/* EXAM ROOM & INTERACTIVE TOKENS */
.exam-room-layout {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 20px;
  align-items: start;
}

.app-container.mobile-frame-mode .exam-room-layout {
  grid-template-columns: 1fr;
}

.timer-banner {
  background: #182215;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.timer-clock {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
}

.audio-box {
  background: #f4f9f2;
  border: 1.5px solid var(--brand-green);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.passage-box {
  background: #fffdf9;
  border: 1.5px solid #d6decb;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  font-size: 1.08rem;
  line-height: 1.85;
}

.dict-word {
  background: #e9f6e5;
  color: var(--brand-green-dark);
  border-bottom: 2px dashed var(--brand-green);
  padding: 1px 5px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s;
}

.dict-word:hover {
  background: var(--brand-green);
  color: #fff;
}

.option-item {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--border-soft);
  border-radius: 11px;
  padding: 13px 16px;
  margin-bottom: 10px;
  font-size: 0.96rem;
  cursor: pointer;
  transition: all 0.15s;
  display: block;
}

.option-item:hover {
  border-color: var(--brand-green);
  background: #f8fcf7;
}

.option-item.selected {
  border-color: var(--brand-green);
  background: var(--brand-green-light);
  font-weight: 700;
}

.option-item.correct {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
  font-weight: 700;
}

.option-item.wrong {
  border-color: var(--brand-red);
  background: var(--brand-red-light);
  color: #7f1d1d;
}

.omr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.omr-cell {
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  background: #fff;
}

.omr-cell.answered {
  background: var(--brand-green);
  color: #fff;
  border-color: var(--brand-green);
}

.omr-cell.current {
  outline: 2px solid var(--brand-red);
}

/* DOJANG STAMP RESULT */
.dojang-stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 110px;
  border: 4px double var(--brand-red);
  border-radius: 50%;
  color: var(--brand-red);
  font-weight: 900;
  transform: rotate(-10deg);
  background: rgba(200, 16, 46, 0.06);
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.18);
}

.dojang-stamp .ko-big {
  font-size: 1.5rem;
  line-height: 1.1;
}

.dojang-stamp .vi-sub {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* POPUP DICTIONARY MODAL */
.dict-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 2px solid var(--brand-green);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
  z-index: 2000;
  display: none;
}

.dict-popup.show {
  display: block;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* WONGOJI (원고지) KOREAN SQUARED WRITING PAPER */
.wongoji-grid {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 2px;
  background: #e5a9a9;
  padding: 6px;
  border: 2px solid #c55a5a;
  border-radius: 8px;
  margin-top: 12px;
  max-height: 310px;
  overflow-y: auto;
}

.wongoji-cell {
  aspect-ratio: 1 / 1;
  background: #fffdf9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  font-family: "Pretendard", "Noto Sans KR", monospace;
}

/* FLASHCARD 3D */
.flashcard-stage {
  background: linear-gradient(145deg, #ffffff, #f3f9f0);
  border: 2px solid var(--brand-green);
  border-radius: 20px;
  padding: 36px 24px;
  text-align: center;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.flashcard-ko {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--brand-green-dark);
  margin-bottom: 8px;
}

.srs-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ADMIN CMS TABLE */
.cms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.cms-table th, .cms-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}

.cms-table th {
  background: #f4f7f3;
  color: var(--text-muted);
  font-weight: 700;
}

.input-field, textarea.input-field, select.input-field {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}

.input-field:focus {
  outline: none;
  border-color: var(--brand-green);
}

/* FLOATING STICKY AUDIO PLAYER DOCK (CHUẨN UX EDTECH) */
.haru-audio-dock {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(880px, calc(100vw - 32px));
  background: #182215;
  color: #fff;
  border: 2px solid var(--brand-green);
  border-radius: 16px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  z-index: 1500;
  flex-wrap: wrap;
}

.kbd-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-family: monospace;
}

.stat-kpi {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.stat-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}


/* ============================================================================
   NATIVE-GRADE MOBILE FRAME & RESPONSIVE DESIGN (iOS / ANDROID / <=768px)
   FIXED: ZERO OVERLAP, 100% VISIBLE VOCABULARY TAB, CARDS & CENTERED POPUP
   ============================================================================ */

/* Prevent any grid blowout on mobile */
.grid-2 > *,
.grid-3 > *,
.exam-room-layout > *,
.card {
  min-width: 0;
  max-width: 100%;
}

.card-header,
.timer-banner {
  flex-wrap: wrap;
}

/* Vocabulary Responsive Card List (replaces cut-off 4-col table on mobile) */
.vocab-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vocab-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-soft);
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.vocab-item-row:hover {
  border-color: var(--brand-green);
  background: #f8fcf7;
}

.vocab-item-main {
  min-width: 0;
  flex: 1;
}

.vocab-item-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.vocab-item-ko {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--brand-green-dark);
}

.vocab-item-pron {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.vocab-item-vi {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--brand-red);
  margin-bottom: 2px;
  word-break: break-word;
}

.vocab-item-ex {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-word;
}

/* Centered Dictionary Popup with Backdrop so it NEVER gets covered at bottom */
.dict-popup.show {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100vw - 28px));
  z-index: 9999;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.35),
    0 0 0 9999px rgba(15, 23, 42, 0.45);
  animation: popCenter 0.18s ease-out;
}

@keyframes popCenter {
  from { transform: translate(-50%, -46%) scale(0.96); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Native iPhone 16 Pro Simulator Frame on Desktop */
.app-container.mobile-frame-mode {
  max-width: 420px;
  margin: 18px auto 48px;
  background: #F6F8F5;
  border: 11px solid #18181b;
  border-radius: 46px;
  box-shadow:
    0 0 0 2px #3f3f46,
    0 28px 65px rgba(15, 23, 42, 0.32);
  padding: 0 0 28px 0;
  position: relative;
}

/* iOS Status Bar + Dynamic Island inside Mobile Frame */
.mobile-status-bar {
  display: none;
}

.app-container.mobile-frame-mode .mobile-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px 8px;
  background: #1b6501;
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  position: relative;
  border-radius: 34px 34px 0 0;
}

.mobile-dynamic-island {
  width: 96px;
  height: 22px;
  background: #09090b;
  border-radius: 999px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 7px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.mobile-dynamic-island::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid #334155;
}

/* Native Mobile Top App Bar inside phone frame */
.mobile-app-header {
  display: none;
}

.app-container.mobile-frame-mode .mobile-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1b6501 0%, #248201 100%);
  color: #fff;
  padding: 10px 16px 14px;
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 22px;
  box-shadow: 0 6px 18px rgba(36, 130, 1, 0.18);
  margin-bottom: 12px;
}

.mobile-app-header .m-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-app-header .m-brand img {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 2px solid #fff;
  object-fit: cover;
  background: #fff;
}

.mobile-app-header .m-title {
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.15;
}

.mobile-app-header .m-sub {
  font-size: 0.7rem;
  opacity: 0.9;
}

.mobile-app-header .m-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-app-header .m-pill {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

/* Inner content padding in mobile frame */
.app-container.mobile-frame-mode .mobile-inner-body {
  padding: 0 12px;
}

/* 3x2 TOP NAVIGATION GRID IN MOBILE FRAME (100% VISIBLE, NEVER COVERS CONTENT) */
.app-container.mobile-frame-mode .student-nav {
  position: static;
  margin: 0 12px 12px;
  padding: 8px;
  border-radius: 16px;
  background: #ffffff;
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  overflow: visible;
}

.app-container.mobile-frame-mode .nav-tab {
  min-width: 0;
  padding: 8px 4px;
  border-radius: 10px;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  background: #f8faf7;
  border: 1px solid #e2e8f0;
}

.app-container.mobile-frame-mode .nav-tab.active {
  background: var(--brand-green);
  color: #fff;
  border-color: var(--brand-green);
}

.app-container.mobile-frame-mode .nav-tab .nav-ico {
  font-size: 1.15rem;
  line-height: 1;
}

/* Compact Hero Card in Mobile Frame */
.app-container.mobile-frame-mode .hero-card {
  grid-template-columns: 1fr;
  padding: 16px;
  border-radius: 18px;
  margin-bottom: 14px;
  gap: 12px;
}

.app-container.mobile-frame-mode .hero-card h2 {
  font-size: 1.18rem;
  line-height: 1.28;
  margin-bottom: 4px;
}

.app-container.mobile-frame-mode .hero-card p {
  font-size: 0.8rem;
  line-height: 1.45;
  margin-bottom: 10px;
}

.app-container.mobile-frame-mode .hero-art {
  display: none;
}

.app-container.mobile-frame-mode .hero-cta-group {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}

.app-container.mobile-frame-mode .hero-cta-group .btn {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.8rem;
  justify-content: center;
}

/* Cards & Grids inside Mobile Frame */
.app-container.mobile-frame-mode .card {
  padding: 14px;
  border-radius: 16px;
  margin-bottom: 12px !important;
}

.app-container.mobile-frame-mode .card-title {
  font-size: 0.92rem;
  line-height: 1.35;
}

.app-container.mobile-frame-mode .grid-3,
.app-container.mobile-frame-mode .grid-2,
.app-container.mobile-frame-mode .custom-vocab-grid {
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  margin-bottom: 12px !important;
}

.app-container.mobile-frame-mode .kbd-hint-desktop {
  display: none !important;
}

.app-container.mobile-frame-mode .wongoji-grid {
  grid-template-columns: repeat(10, 1fr);
}

.app-container.mobile-frame-mode .srs-buttons {
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.app-container.mobile-frame-mode .audio-chip-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
}

.app-container.mobile-frame-mode .audio-chip-grid .btn {
  width: 100%;
  font-size: 0.74rem !important;
  padding: 8px 8px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-container.mobile-frame-mode .bilingual-chip-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 6px !important;
}

.app-container.mobile-frame-mode .bilingual-chip-grid .btn {
  width: 100%;
  justify-content: flex-start;
  font-size: 0.75rem !important;
  padding: 8px 10px !important;
}

.app-container.mobile-frame-mode .vip-input-row,
.app-container.mobile-frame-mode .custom-vocab-ex-row {
  flex-direction: column !important;
}

.app-container.mobile-frame-mode .vip-input-row .btn,
.app-container.mobile-frame-mode .custom-vocab-ex-row .btn {
  width: 100%;
}

/* ============================================================================
   REAL SMARTPHONE SCREENS (@media max-width: 768px)
   ============================================================================ */
@media (max-width: 768px) {
  .top-bar {
    padding: 8px 12px;
    gap: 8px;
  }

  .brand-lockup img.app-icon-img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .brand-title-group h1 {
    font-size: 0.96rem;
  }

  .brand-title-group p {
    display: none;
  }

  .mode-switcher {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .mode-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .status-pills {
    width: 100%;
    justify-content: space-between;
  }

  .pill {
    font-size: 0.72rem;
    padding: 4px 10px;
  }

  .app-container {
    padding: 12px 12px 40px;
  }

  .app-container.mobile-frame-mode {
    max-width: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  /* 3x2 Grid Navigation at Top on Real Phones — All 6 Tabs 100% Visible, Never Covers Content! */
  .student-nav {
    position: static !important;
    margin: 0 0 14px 0 !important;
    padding: 8px !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1.5px solid var(--border-soft) !important;
    box-shadow: var(--shadow-sm) !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .nav-tab {
    min-width: 0 !important;
    padding: 9px 4px !important;
    border-radius: 10px !important;
    flex-direction: column !important;
    gap: 4px !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    text-align: center !important;
    background: #f8faf7;
    border: 1px solid #e2e8f0;
  }

  .nav-tab.active {
    background: var(--brand-green) !important;
    color: #fff !important;
    border-color: var(--brand-green) !important;
  }

  .nav-tab .nav-ico {
    font-size: 1.2rem;
    line-height: 1;
  }

  .hero-card {
    grid-template-columns: 1fr;
    padding: 16px;
    border-radius: 18px;
    gap: 12px;
    margin-bottom: 14px;
  }

  .hero-card h2 {
    font-size: 1.22rem;
    line-height: 1.28;
  }

  .hero-card p {
    font-size: 0.82rem;
    margin-bottom: 10px;
  }

  .hero-art {
    display: none;
  }

  .hero-cta-group {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .hero-cta-group .btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .grid-3,
  .grid-2,
  .exam-room-layout,
  .custom-vocab-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .card {
    padding: 14px;
    border-radius: 16px;
  }

  .card-title {
    font-size: 0.94rem;
  }

  .kbd-hint-desktop {
    display: none !important;
  }

  .wongoji-grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .srs-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .audio-chip-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .audio-chip-grid .btn {
    width: 100%;
    font-size: 0.75rem !important;
    padding: 8px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bilingual-chip-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .bilingual-chip-grid .btn {
    width: 100%;
    justify-content: flex-start;
    font-size: 0.76rem !important;
  }

  .vip-input-row,
  .custom-vocab-ex-row {
    flex-direction: column !important;
  }

  .vip-input-row .btn,
  .custom-vocab-ex-row .btn {
    width: 100%;
  }
}
