/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg:           #F0EBE0;
  --sidebar-bg:   #FFFFFF;
  --green:        #2D6A4F;
  --green-mid:    #40916C;
  --green-light:  #95D5B2;
  --green-pale:   #D8F3DC;
  --gold:         #C9A227;
  --gold-light:   #FEF3C7;
  --gold-dark:    #92740A;
  --beige:        #F5F0E8;
  --beige-dark:   #E8DFD0;
  --card-bg:      #FFFFFF;
  --text:         #1F2937;
  --text-muted:   #6B7280;
  --text-light:   #9CA3AF;
  --border:       #E5E7EB;
  --node-lock:    #B0B8C1;
  --node-lock-bg: #F3F4F6;
  --radius-lg:    18px;
  --radius-md:    12px;
  --radius-sm:    8px;
  --shadow:       0 2px 12px rgba(0,0,0,.09);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.13);
  --sidebar-w:    236px;
  --right-w:      300px;
  --transition:   all .22s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; overflow-y: auto; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* ============================================================
   ISLAMIC GEOMETRIC BACKGROUND PATTERN
   ============================================================ */
.at-geo-bg {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(45,106,79,.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(201,162,39,.04) 0%, transparent 50%);
}
.at-geo-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232D6A4F' fill-opacity='0.03'%3E%3Cpath d='M30 0l8.66 15H21.34L30 0zm0 60l-8.66-15h17.32L30 60zM0 30l15-8.66V38.66L0 30zm60 0l-15 8.66V21.34L60 30zM30 22l8 13.86H22L30 22z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: .5;
}

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.at-shell {
  display: block;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.at-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,.05);
  transition: transform .28s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--beige-dark) transparent;
  padding-bottom: 20px;
}
.at-sidebar::-webkit-scrollbar { width: 4px; }
.at-sidebar::-webkit-scrollbar-track { background: transparent; }
.at-sidebar::-webkit-scrollbar-thumb { background: var(--beige-dark); border-radius: 99px; }

.at-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--green-pale);
}
.at-logo-mark {
  width: 40px; height: 40px;
  background: var(--green-pale);
  border: 1.5px solid var(--green-light);
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(45,106,79,.15);
  overflow: hidden;
}
.at-logo-text { line-height: 1.2; }
.at-logo-text strong { display: block; font-size: 11px; font-weight: 700; color: var(--green); letter-spacing: .5px; }
.at-logo-text small { font-size: 9.5px; color: var(--text-muted); }

.at-nav { padding: 12px 10px; flex: 0 0 auto; }
.at-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
  transition: var(--transition);
  cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.at-nav-item i { width: 18px; font-size: 15px; }
.at-nav-item:hover { background: var(--green-pale); color: var(--green); }
.at-nav-item.active {
  background: var(--green);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(45,106,79,.25);
}
.at-nav-item.active i { color: #fff; }

.at-sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }
.at-sidebar-spacer { flex-shrink: 0; height: 24px; }

.at-user-card {
  margin: 12px 10px;
  background: linear-gradient(135deg, var(--green-pale) 0%, #fff 100%);
  border: 1px solid var(--green-light);
  border-radius: var(--radius-md);
  padding: 14px;
}
.at-user-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.at-avatar {
  width: 40px; height: 40px;
  background: var(--green);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--green-light);
}
.at-user-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.at-user-level {
  display: inline-block;
  background: var(--green-pale);
  color: var(--green);
  font-size: 10px; font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  margin-top: 2px;
  border: 1px solid var(--green-light);
}

.at-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
}
.at-stat {
  background: #fff;
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid var(--border);
}
.at-stat-val { font-size: 13px; font-weight: 700; display: block; }
.at-stat-key { font-size: 9px; color: var(--text-muted); }
.at-stat-val.fire { color: #E25822; }
.at-stat-val.xp { color: var(--gold-dark); }
.at-stat-val.coin { color: #B45309; }

.at-quote {
  margin: 6px 10px 0;
  background: linear-gradient(135deg, #1A3C2E 0%, #2D6A4F 100%);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: rgba(255,255,255,.9);
  font-size: 11.5px;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
}
.at-quote::before {
  content: '"';
  position: absolute; top: -4px; left: 10px;
  font-size: 48px; opacity: .12;
  font-family: serif;
}
.at-quote cite { display: block; margin-top: 6px; font-size: 10px; opacity: .7; font-style: normal; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.at-main {
  margin-left: var(--sidebar-w);
  margin-right: var(--right-w);
  min-height: 100vh;
  padding: 0;
  display: block;
}

.at-topbar {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.at-greeting-main { font-size: 26px; font-weight: 700; color: var(--green); font-family: 'Playfair Display', serif; }
.at-greeting-sub { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.at-topbar-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.at-btn-guide {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  background: #fff;
  transition: var(--transition);
}
.at-btn-guide:hover { border-color: var(--green); color: var(--green); }

.at-content-body { padding: 24px 28px; flex: none; overflow: visible; }

/* ============================================================
   LEARNING PATH SECTION
   ============================================================ */
.at-path-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.at-path-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.at-path-title { font-size: 16px; font-weight: 700; }
.at-path-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.at-chapter-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-pale);
  border: 1px solid var(--green-light);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 12px;
}
.at-chapter-badge strong { color: var(--green); font-weight: 700; }
.at-chapter-badge span { color: var(--text-muted); }

/* Islamic scenery background for the learning path map */
.at-path-map {
  position: relative;
  background: linear-gradient(180deg,
    #EAE0D0 0%,
    #E5D9C5 40%,
    #D5C8B0 70%,
    #C8BAA0 100%
  );
  min-height: 1200px;
  overflow: visible;
}

/* Subtle mosque silhouette background art */
.at-path-map::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 200px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 200'%3E%3Crect width='900' height='200' fill='%23C4B4A0' opacity='.4'/%3E%3C!-- Mosque silhouette --%3E%3Cg fill='%23A09080' opacity='.35'%3E%3Crect x='60' y='100' width='80' height='100'/%3E%3Crect x='90' y='60' width='20' height='40'/%3E%3Cellipse cx='100' cy='60' rx='12' ry='16'/%3E%3Crect x='56' y='90' width='8' height='20'/%3E%3Crect x='136' y='90' width='8' height='20'/%3E%3Crect x='700' y='90' width='100' height='110'/%3E%3Crect x='738' y='50' width='24' height='40'/%3E%3Cellipse cx='750' cy='50' rx='14' ry='18'/%3E%3Crect x='694' y='78' width='10' height='22'/%3E%3Crect x='796' y='78' width='10' height='22'/%3E%3Crect x='380' y='80' width='140' height='120'/%3E%3Crect x='435' y='30' width='30' height='50'/%3E%3Cellipse cx='450' cy='30' rx='18' ry='22'/%3E%3Crect x='372' y='66' width='12' height='26'/%3E%3Crect x='516' y='66' width='12' height='26'/%3E%3C/g%3E%3C/svg%3E") center bottom / cover no-repeat;
  pointer-events: none;
}

/* Decorative palm trees and desert elements */
.at-path-map::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,162,39,.08) 0%, transparent 60%),
    radial-gradient(ellipse at 15% 50%, rgba(45,106,79,.06) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 50%, rgba(45,106,79,.06) 0%, transparent 40%);
  pointer-events: none;
}

/* SVG connecting paths */
.at-path-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Node container grid */
.at-nodes-container {
  position: relative;
  width: 100%;
  height: 900px;
  z-index: 2;
}

.at-node-wrap {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.at-node {
  width: 76px; height: 76px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 26px;
  border: 4px solid transparent;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow);
}
.at-node-label {
  font-size: 12px; font-weight: 600;
  text-align: center;
  max-width: 90px;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(255,255,255,.8);
}
.at-node-badge {
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 99px;
  font-weight: 600;
  text-align: center;
}

/* Node states */
.at-node.completed {
  background: var(--green);
  border-color: #1A4A34;
  color: #fff;
}
.at-node.completed .at-node-label { color: var(--green); }
.at-node.completed .at-node-badge { background: var(--green); color: #fff; }
.at-node.completed::after {
  content: '✓';
  position: absolute;
  bottom: -2px; right: -2px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  font-size: 11px;
  display: grid; place-items: center;
  color: var(--green);
  font-weight: 900;
  border: 2px solid var(--green);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.at-node.current {
  background: #fff;
  border-color: var(--gold);
  border-width: 5px;
  color: var(--text);
  animation: pulse-node 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(201,162,39,.4);
}
.at-node.current .at-node-label { color: var(--green); font-weight: 700; }
.at-node.current .at-node-badge { background: var(--gold); color: #fff; }

.at-node.locked {
  background: var(--node-lock-bg);
  border-color: var(--node-lock);
  color: var(--node-lock);
  cursor: not-allowed;
  opacity: .85;
}
.at-node.locked .at-node-label { color: var(--node-lock); }
.at-node.locked .at-node-badge { background: var(--node-lock); color: #fff; }

.at-node.exam {
  background: linear-gradient(135deg, var(--gold) 0%, #E8B800 100%);
  border-color: var(--gold-dark);
  color: #fff;
}
.at-node.exam.locked { background: var(--node-lock-bg); color: var(--node-lock); border-color: var(--node-lock); }
.at-node.exam .at-node-label { color: var(--text); }
.at-node.exam.locked .at-node-badge { background: var(--node-lock); color: #fff; }
.at-node.exam:not(.locked) .at-node-badge { background: var(--gold-dark); color: #fff; }

@keyframes pulse-node {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,162,39,.4), var(--shadow); }
  50%       { box-shadow: 0 0 0 12px rgba(201,162,39,.0), var(--shadow); }
}

.at-path-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.at-btn-materi {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  color: var(--text);
  background: #fff;
  transition: var(--transition);
}
.at-btn-materi:hover { border-color: var(--green); color: var(--green); background: var(--green-pale); }

/* ============================================================
   RIGHT PANEL
   ============================================================ */
.at-right {
  width: var(--right-w);
  position: fixed;
  right: 0; top: 0; bottom: 0;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.at-right::-webkit-scrollbar { display: none; }
.at-right-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--beige);
}
.at-right-chapter {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.at-right-chapter-num {
  width: 28px; height: 28px;
  background: var(--green);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: #fff;
}
.at-right-chapter-title { font-size: 16px; font-weight: 700; }
.at-right-chapter-sub { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Arabic word card */
.at-word-card {
  margin: 14px 16px;
  background: var(--beige);
  border: 1px solid var(--beige-dark);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.at-word-ar {
  font-family: 'Amiri', serif;
  font-size: 32px;
  color: var(--text);
  text-align: center;
  flex: 1;
  direction: rtl;
  line-height: 1.3;
}
.at-word-roman { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.at-word-meaning { font-size: 11.5px; color: var(--text-muted); text-align: center; }
.at-audio-btn {
  width: 38px; height: 38px;
  background: var(--green);
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  box-shadow: 0 3px 8px rgba(45,106,79,.3);
}
.at-audio-btn:hover { background: var(--green-mid); transform: scale(1.08); }
.at-audio-btn.playing { animation: audio-pulse .4s ease alternate infinite; }

@keyframes audio-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

/* Start button */
.at-start-row {
  padding: 0 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.at-btn-start {
  flex: 1;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(45,106,79,.3);
  border: none; cursor: pointer;
}
.at-btn-start:hover { background: var(--green-mid); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(45,106,79,.35); }
.at-btn-start:active { transform: translateY(0); }
.at-xp-badge {
  background: var(--gold-light);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px; font-weight: 700;
  color: var(--gold-dark);
  display: flex; align-items: center; gap: 4px;
  white-space: nowrap;
}

/* Progress */
.at-progress-section {
  padding: 0 16px 14px;
}
.at-progress-label {
  font-size: 12px; font-weight: 600; margin-bottom: 4px;
  display: flex; justify-content: space-between;
}
.at-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}
.at-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-mid));
  border-radius: 99px;
  transition: width .6s ease;
  position: relative;
}
.at-progress-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35));
}
.at-progress-reward {
  display: flex; align-items: center; gap: 4px;
  font-size: 20px;
}

/* Vocab section */
.at-vocab-section { padding: 0 16px 14px; }
.at-vocab-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.at-vocab-title { font-size: 13px; font-weight: 700; }
.at-vocab-see-all { font-size: 11.5px; color: var(--green); font-weight: 500; cursor: pointer; }
.at-vocab-see-all:hover { text-decoration: underline; }
.at-vocab-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.at-vocab-card {
  background: var(--beige);
  border: 1px solid var(--beige-dark);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.at-vocab-card:hover { border-color: var(--green-light); background: var(--green-pale); }
.at-vocab-ar {
  font-family: 'Amiri', serif;
  font-size: 20px;
  direction: rtl;
  display: block;
  margin-bottom: 2px;
}
.at-vocab-roman { font-size: 9.5px; color: var(--text-muted); display: block; }
.at-vocab-id { font-size: 10px; color: var(--text); font-weight: 500; display: block; margin-top: 1px; }

/* Tips section */
.at-tips-section { padding: 0 16px 18px; }
.at-tips-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--gold-light);
  border: 1px solid rgba(201,162,39,.3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.at-tips-card:hover { background: #FDEEA0; }
.at-tips-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.at-tips-body { flex: 1; }
.at-tips-label { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.at-tips-text { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.at-tips-arrow { color: var(--text-muted); align-self: center; font-size: 14px; }

/* ============================================================
   OTHER VIEWS (Kamus, Kelas, etc.)
   ============================================================ */
.at-page-view {
  display: none;
  margin-left: var(--sidebar-w);
  margin-right: 0;
  min-height: 100vh;
  padding: 28px;
}
.at-page-view.active { display: block; }
.at-page-header {
  margin-bottom: 24px;
}
.at-page-title {
  font-size: 22px; font-weight: 700;
  font-family: 'Playfair Display', serif;
  color: var(--green);
  margin-bottom: 4px;
}
.at-page-sub { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   LESSON VIEW
   ============================================================ */
.at-lesson-view {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 200;
  flex-direction: column;
  overflow-y: auto;
}
.at-lesson-view.active { display: flex; }

.at-lesson-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: sticky; top: 0; z-index: 10;
}
.at-lesson-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: var(--transition);
  cursor: pointer;
  border: none; background: none;
  flex-shrink: 0;
}
.at-lesson-close:hover { background: var(--border); color: var(--text); }
.at-lesson-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.at-lesson-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-mid));
  border-radius: 99px;
  transition: width .4s ease;
}
.at-lesson-hearts {
  display: flex; gap: 4px;
  font-size: 16px;
}

.at-lesson-body {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
}
.at-exercise-type {
  font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.at-exercise-question {
  font-size: 20px; font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.4;
}
.at-exercise-question.ar {
  font-family: 'Amiri', serif;
  font-size: 36px;
  direction: rtl;
  text-align: center;
  color: var(--text);
  padding: 16px;
  background: var(--beige);
  border-radius: var(--radius-md);
  margin-bottom: 28px;
}

/* Multiple choice */
.at-choices {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 24px;
}
.at-choice {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  background: #fff;
  text-align: left;
  width: 100%;
}
.at-choice:hover { border-color: var(--green-light); background: var(--green-pale); }
.at-choice.selected { border-color: #3B82F6; background: #EFF6FF; }
.at-choice.correct  { border-color: var(--green); background: var(--green-pale); color: var(--green); }
.at-choice.wrong    { border-color: #EF4444; background: #FEF2F2; color: #DC2626; }
.at-choice-letter {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

/* Sentence arrange */
.at-arrange-pool {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px;
  background: var(--beige);
  border-radius: var(--radius-md);
  min-height: 60px;
  margin-bottom: 16px;
}
.at-arrange-answer {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  min-height: 60px;
  margin-bottom: 24px;
}
.at-word-chip {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.at-word-chip.pool { background: #fff; border: 2px solid var(--border); }
.at-word-chip.pool:hover { border-color: var(--green); background: var(--green-pale); }
.at-word-chip.placed { background: var(--green); color: #fff; border: 2px solid var(--green-mid); }
.at-word-chip.ar { font-family: 'Amiri', serif; font-size: 18px; direction: rtl; }

/* Translate input */
.at-translate-input {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  transition: var(--transition);
  margin-bottom: 24px;
  outline: none;
  background: #fff;
}
.at-translate-input:focus { border-color: var(--green); }
.at-translate-input.ar-input { font-family: 'Amiri', serif; font-size: 24px; direction: rtl; text-align: right; }

/* Listening exercise */
.at-listen-card {
  background: var(--beige);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  margin-bottom: 28px;
}
.at-listen-btn {
  width: 80px; height: 80px;
  background: var(--green);
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 32px;
  margin: 0 auto 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  box-shadow: 0 6px 20px rgba(45,106,79,.3);
}
.at-listen-btn:hover { background: var(--green-mid); transform: scale(1.05); }
.at-listen-hint { font-size: 14px; color: var(--text-muted); }

/* Feedback bar */
.at-feedback {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  transform: translateY(100%);
  transition: transform .28s ease;
  z-index: 300;
}
.at-feedback.show { transform: translateY(0); }
.at-feedback.correct { background: var(--green); }
.at-feedback.wrong   { background: #EF4444; }
.at-feedback-msg {
  display: flex; align-items: center; gap: 12px;
  color: #fff;
}
.at-feedback-icon { font-size: 28px; }
.at-feedback-title { font-size: 16px; font-weight: 700; }
.at-feedback-sub { font-size: 13px; opacity: .9; }
.at-feedback-btn {
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  background: rgba(255,255,255,.25);
  color: #fff;
  border: 2px solid rgba(255,255,255,.5);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}
.at-feedback-btn:hover { background: rgba(255,255,255,.4); }

/* Check button */
.at-check-btn {
  width: 100%;
  padding: 16px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  margin-top: auto;
}
.at-check-btn:hover { background: var(--green-mid); }
.at-check-btn:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

/* ============================================================
   KAMUS (DICTIONARY)
   ============================================================ */
.at-kamus-search {
  display: flex; gap: 10px; margin-bottom: 20px;
}
.at-kamus-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px; font-family: inherit;
  outline: none; transition: var(--transition);
}
.at-kamus-input:focus { border-color: var(--green); }
.at-kamus-btn {
  padding: 12px 20px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600; font-size: 14px;
  border: none; cursor: pointer;
  transition: var(--transition);
}
.at-kamus-btn:hover { background: var(--green-mid); }
.at-kamus-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.at-kamus-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
  cursor: pointer;
}
.at-kamus-entry:hover { border-color: var(--green-light); box-shadow: var(--shadow); }
.at-kamus-entry-ar {
  font-family: 'Amiri', serif;
  font-size: 26px;
  direction: rtl;
  display: block;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}
.at-kamus-entry-roman { font-size: 11px; color: var(--text-muted); text-align: center; display: block; }
.at-kamus-entry-id { font-size: 13px; font-weight: 600; text-align: center; display: block; margin-top: 4px; }
.at-kamus-entry-cat {
  display: inline-block;
  background: var(--green-pale);
  color: var(--green);
  font-size: 10px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  margin: 6px auto 0;
  display: block; text-align: center;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.at-leader-table {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.at-leader-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.at-leader-row:last-child { border-bottom: none; }
.at-leader-row:hover { background: var(--beige); }
.at-leader-row.me { background: var(--green-pale); border-left: 3px solid var(--green); }
.at-leader-rank {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
  background: var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}
.at-leader-rank.gold   { background: var(--gold); color: #fff; }
.at-leader-rank.silver { background: #94A3B8; color: #fff; }
.at-leader-rank.bronze { background: #B08060; color: #fff; }
.at-leader-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green);
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.at-leader-name { flex: 1; font-size: 14px; font-weight: 600; }
.at-leader-sub { font-size: 11px; color: var(--text-muted); }
.at-leader-xp { font-size: 15px; font-weight: 700; color: var(--gold-dark); }

/* ============================================================
   TOKO (SHOP)
   ============================================================ */
.at-shop-tabs {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.at-shop-tab {
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.at-shop-tab.active { background: var(--green); color: #fff; border-color: var(--green); }
.at-shop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.at-shop-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.at-shop-item:hover { border-color: var(--green-light); box-shadow: var(--shadow); transform: translateY(-2px); }
.at-shop-item-icon { font-size: 36px; display: block; margin-bottom: 10px; }
.at-shop-item-name { font-size: 13px; font-weight: 700; display: block; margin-bottom: 4px; }
.at-shop-item-desc { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 10px; line-height: 1.4; }
.at-shop-item-price {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gold-light);
  border: 1.5px solid var(--gold);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px; font-weight: 700;
  color: var(--gold-dark);
}

/* ============================================================
   PROFIL
   ============================================================ */
.at-profil-hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.at-profil-hero::after {
  content: '﷽';
  position: absolute;
  right: 20px; top: 50%;
  transform: translateY(-50%);
  font-family: 'Amiri', serif;
  font-size: 36px;
  opacity: .12;
}
.at-profil-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: grid; place-items: center;
  font-size: 32px;
  border: 3px solid rgba(255,255,255,.4);
  flex-shrink: 0;
}
.at-profil-name { font-size: 22px; font-weight: 700; }
.at-profil-level { font-size: 13px; opacity: .85; margin-top: 2px; }

.at-profil-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 24px;
}
.at-profil-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}
.at-profil-stat-val { font-size: 24px; font-weight: 700; display: block; color: var(--green); }
.at-profil-stat-label { font-size: 12px; color: var(--text-muted); }

.at-badges-section { margin-bottom: 24px; }
.at-badges-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.at-badges-grid {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.at-badge-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
  min-width: 90px;
}
.at-badge-icon { font-size: 28px; display: block; }
.at-badge-name { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }

/* ============================================================
   KELAS SAYA
   ============================================================ */
.at-kelas-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.at-kelas-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.at-kelas-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.at-kelas-header { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.at-kelas-body { padding: 16px; }
.at-kelas-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.at-kelas-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.at-kelas-progress-bar { height: 6px; background: var(--border); border-radius: 99px; margin-bottom: 6px; overflow: hidden; }
.at-kelas-progress-fill { height: 100%; background: var(--green); border-radius: 99px; }
.at-kelas-progress-text { font-size: 11px; color: var(--text-muted); }
.at-kelas-btn {
  display: block; width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700;
  text-align: center;
  border: none; cursor: pointer;
  transition: var(--transition);
}
.at-kelas-btn:hover { background: var(--green-mid); }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.at-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 150;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.at-bottom-nav-inner { display: flex; }
.at-bnav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border: none; background: none;
}
.at-bnav-item i { font-size: 20px; }
.at-bnav-item.active { color: var(--green); }
.at-bnav-item.active i { color: var(--green); }

/* ── Close button inside right-panel header ── */
.at-right-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  flex-shrink: 0;
}
.at-right-close:hover { background: #FECACA; color: #DC2626; }

/* ── "Pelajaran" reopen button in topbar ── */
.at-btn-panel-reopen {
  display: none;               /* shown via JS when panel is closed */
  align-items: center; gap: 7px;
  padding: 9px 14px;
  border: 1.5px solid var(--green-light);
  border-radius: 99px;
  font-size: 12.5px; font-weight: 600;
  color: var(--green);
  background: var(--green-pale);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.at-btn-panel-reopen:hover { background: var(--green-light); }
.at-btn-panel-reopen.visible { display: inline-flex; }

/* ── Persistent drawer-tab toggle (always visible on right edge) ── */
.at-panel-tab {
  position: fixed;
  right: var(--right-w);
  top: 50%;
  transform: translateY(-50%);
  z-index: 105;
  background: #ffffff;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  padding: 14px 7px;
  cursor: pointer;
  box-shadow: -3px 0 12px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: right .3s cubic-bezier(.4,0,.2,1), background .2s, color .2s;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  user-select: none;
}
.at-panel-tab:hover { background: var(--green-pale); color: var(--green); border-color: var(--green-light); }
.at-panel-tab .at-tab-icon { writing-mode: horizontal-tb; font-size: 15px; margin-bottom: 2px; }
/* When panel is closed: tab slides to viewport right edge */
.at-panel-tab.closed {
  right: 0;
  border-right: 1px solid var(--border);
  border-left: none;
  border-radius: 0 10px 10px 0;
  box-shadow: 3px 0 12px rgba(0,0,0,.10);
}
/* panel-tab visibility at ≤900px handled in the 900px block above */

/* Back to portal */
.at-back-btn {
  position: fixed;
  top: 14px; right: calc(var(--right-w) + 14px);
  z-index: 120;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow);
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.at-back-btn:hover { color: var(--green); border-color: var(--green-light); background: var(--green-pale); }

/* Lesson complete screen */
.at-lesson-complete {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 400;
  place-items: center;
}
.at-lesson-complete.show { display: grid; }
.at-lesson-complete-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: pop-in .35s cubic-bezier(.17,.67,.41,1.4);
}
@keyframes pop-in {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.at-complete-emoji { font-size: 64px; margin-bottom: 16px; }
.at-complete-title { font-size: 26px; font-weight: 700; color: var(--green); margin-bottom: 8px; font-family: 'Playfair Display', serif; }
.at-complete-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.at-complete-rewards {
  display: flex; justify-content: center; gap: 20px;
  margin-bottom: 28px;
}
.at-complete-reward {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--beige);
  border-radius: var(--radius-md);
  padding: 12px 20px;
}
.at-complete-reward-val { font-size: 20px; font-weight: 700; color: var(--text); }
.at-complete-reward-label { font-size: 11px; color: var(--text-muted); }
.at-complete-btn {
  display: block; width: 100%;
  padding: 14px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 700;
  border: none; cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(45,106,79,.3);
}
.at-complete-btn:hover { background: var(--green-mid); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.at-toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.at-toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slide-in .25s ease forwards;
  max-width: 280px;
}
@keyframes slide-in {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.at-toast.success { background: var(--green); }
.at-toast.error   { background: #EF4444; }
.at-toast.info    { background: #3B82F6; }

/* ============================================================
   OVERLAY (mobile sidebar backdrop)
   ============================================================ */
.at-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.at-overlay.show { display: block; }

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.at-hamburger {
  display: none;
  position: fixed; top: 14px; left: 14px;
  z-index: 201;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  border: none; cursor: pointer;
  font-size: 16px;
  place-items: center;
  box-shadow: 0 3px 10px rgba(45,106,79,.35);
}

/* ============================================================
   TABLET  ≤ 900px  — hide right panel & toggle
   ============================================================ */
@media (max-width: 900px) {
  .at-right {
    display: flex !important;
    transform: translateX(100%);
    width: min(340px, 100vw);
    z-index: 150;
    box-shadow: -4px 0 24px rgba(0,0,0,.18);
  }
  .at-btn-panel-reopen   { display: none !important; }
  /* panel tab: reposition for mobile — horizontal at bottom of screen */
  .at-panel-tab {
    top: auto !important;
    bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    right: 0 !important;
    transform: none !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    flex-direction: row !important;
    padding: 10px 16px !important;
    border-radius: 10px 0 0 10px !important;
    font-size: 11px !important;
    display: flex !important;
    gap: 6px !important;
    z-index: 160 !important;
  }
  .at-panel-tab .at-tab-icon { margin-bottom: 0 !important; }
  .at-panel-tab.closed { border-right: 1px solid var(--border) !important; }
  .at-main               { margin-right: 0 !important; }
  .at-page-view          { margin-right: 0; }
  .at-back-btn           { right: 16px; }
}

/* Right panel mobile backdrop */
.at-right-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 149;
  backdrop-filter: blur(2px);
}
.at-right-backdrop.show { display: block; }

/* Mobile FAB — open right panel */
.at-panel-fab {
  display: none;
  position: fixed;
  bottom: max(82px, calc(82px + env(safe-area-inset-bottom)));
  right: 16px;
  z-index: 160;
  background: var(--green);
  color: #fff;
  border: none; cursor: pointer;
  padding: 11px 18px;
  border-radius: 99px;
  font-size: 13px; font-weight: 700;
  align-items: center; gap: 7px;
  box-shadow: 0 4px 16px rgba(45,106,79,.4);
  transition: var(--transition);
}
.at-panel-fab:hover { background: var(--green-mid); transform: translateY(-2px); }
/* FAB hidden — panel tab handles mobile open/close instead */

/* ============================================================
   MOBILE  ≤ 768px
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --right-w:   0px;
  }

  /* --- Hamburger visible --- */
  .at-hamburger { display: grid; }

  /* --- Sidebar: off-canvas drawer --- */
  .at-sidebar {
    width: 270px;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .at-sidebar.open { transform: translateX(0); }

  /* --- Back button: bottom-right, above bottom-nav --- */
  .at-back-btn {
    top: auto !important;
    bottom: max(76px, calc(76px + env(safe-area-inset-bottom)));
    right: 14px;
    left: auto;
    font-size: 11px;
    padding: 7px 14px;
  }

  /* --- Main layout --- */
  .at-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
  }

  /* --- Topbar: left padding clears hamburger (40px + 14px + 8px gap) --- */
  .at-topbar {
    padding: 14px 14px 12px 66px;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
  }
  .at-greeting-main { font-size: 17px; line-height: 1.3; }
  .at-greeting-sub  { font-size: 11.5px; margin-top: 1px; }
  .at-btn-guide     { padding: 7px 11px; font-size: 11.5px; }

  /* --- Content body --- */
  .at-content-body {
    padding: 12px;
    padding-bottom: max(88px, calc(88px + env(safe-area-inset-bottom)));
  }

  /* --- Path section --- */
  .at-path-header {
    padding: 12px 14px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .at-path-title { font-size: 14px; }
  .at-path-sub   { font-size: 11px; }
  .at-chapter-badge { font-size: 11px; padding: 4px 10px; gap: 5px; }

  /* --- Smaller nodes on mobile --- */
  .at-node {
    width: 60px;
    height: 60px;
    border-width: 3px;
    font-size: 22px;
  }
  .at-node.current { border-width: 4px; }
  .at-node-label   { font-size: 10.5px; max-width: 80px; line-height: 1.25; }
  .at-node-badge   { font-size: 9px; padding: 2px 8px; }
  .at-node-wrap    { gap: 6px; }
  .at-node.completed::after {
    width: 18px; height: 18px; font-size: 9px;
  }

  /* --- Path footer --- */
  .at-path-footer {
    padding: 10px 14px;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }
  .at-btn-materi    { font-size: 12px; padding: 8px 14px; }
  .at-path-footer > div { font-size: 10.5px; }

  /* --- Page views --- */
  .at-page-view {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 14px 14px max(88px, calc(88px + env(safe-area-inset-bottom)));
  }
  .at-page-title { font-size: 19px; }
  .at-page-sub   { font-size: 12px; }

  /* --- Kelas: single column --- */
  .at-kelas-grid { grid-template-columns: 1fr; gap: 12px; }

  /* --- Kamus: 2 columns --- */
  .at-kamus-search { flex-direction: column; }
  .at-kamus-grid   { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .at-kamus-entry-ar { font-size: 22px; }

  /* --- Profil --- */
  .at-profil-hero  { padding: 18px 14px; gap: 12px; }
  .at-profil-name  { font-size: 18px; }
  .at-profil-level { font-size: 11px; }
  .at-profil-avatar { width: 56px; height: 56px; font-size: 26px; }
  .at-profil-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .at-profil-stat-val   { font-size: 20px; }
  .at-profil-stat-label { font-size: 10.5px; }
  .at-profil-stat-card  { padding: 12px 8px; }
  .at-badges-grid { gap: 8px; }
  .at-badge-item  { min-width: 72px; padding: 10px 10px; }
  .at-badge-icon  { font-size: 24px; }
  .at-badge-name  { font-size: 10px; }

  /* --- Leaderboard --- */
  .at-leader-row    { padding: 10px 12px; gap: 8px; }
  .at-leader-name   { font-size: 13px; }
  .at-leader-sub    { font-size: 10px; }
  .at-leader-xp     { font-size: 13px; white-space: nowrap; }
  .at-leader-avatar { width: 32px; height: 32px; font-size: 14px; }
  .at-leader-rank   { width: 28px; height: 28px; font-size: 12px; }

  /* --- Shop: 2 columns --- */
  .at-shop-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .at-shop-item { padding: 14px 10px; }
  .at-shop-item-icon { font-size: 28px; }
  .at-shop-item-name { font-size: 12px; }
  .at-shop-item-desc { font-size: 10.5px; }

  /* --- Lesson room --- */
  .at-lesson-header { padding: 12px 16px; }
  .at-lesson-body   { padding: 24px 16px; }
  .at-exercise-question { font-size: 17px; }
  .at-exercise-question.ar { font-size: 26px; padding: 12px; }
  .at-choice { padding: 12px 14px; font-size: 14px; }

  /* --- Bottom nav --- */
  .at-bottom-nav { display: flex; }
  .at-bnav-item  { font-size: 9.5px; padding: 5px 2px; }
  .at-bnav-item i { font-size: 19px; }

  /* --- User card --- */
  .at-user-card { margin: 8px 8px 4px; padding: 12px; }
  .at-stat-val  { font-size: 12px; }

  /* --- Complete card --- */
  .at-lesson-complete-card { padding: 28px 20px; }
  .at-complete-emoji       { font-size: 48px; }
  .at-complete-title       { font-size: 22px; }
  .at-complete-rewards     { gap: 12px; }
  .at-complete-reward      { padding: 10px 14px; }
}

/* ============================================================
   VERY SMALL  ≤ 380px
   ============================================================ */
@media (max-width: 380px) {
  .at-node         { width: 52px; height: 52px; font-size: 19px; }
  .at-node-label   { font-size: 9.5px; max-width: 70px; }
  .at-node-badge   { font-size: 8px; padding: 1px 6px; }
  .at-greeting-main { font-size: 15px; }
  .at-kamus-grid   { grid-template-columns: 1fr; }
  .at-shop-grid    { grid-template-columns: 1fr; }
  .at-profil-stats { grid-template-columns: repeat(3, 1fr); }
  .at-topbar       { padding-left: 60px; }
}

/* ============================================================
   NAV BADGE
   ============================================================ */
.at-nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #DC2626; color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 99px; padding: 0 4px;
  margin-left: auto;
}

/* ============================================================
   LIVE CLASSROOM (TUTOR ROOM) VIEW
   ============================================================ */
#view-tutor.active {
  display: flex; flex-direction: column;
  padding: 0; height: 100vh; overflow: hidden;
}
.room-header {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 12px; z-index: 10;
}
.room-title  { font-size: 17px; font-weight: 700; color: var(--text); }
.room-meta   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.room-controls { display: flex; align-items: center; gap: 8px; }
.room-rec {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #92400E;
  background: #FEF3C7; padding: 5px 11px; border-radius: 99px; border: 1px solid #FDE68A;
}
.rec-dot { width: 8px; height: 8px; background: #DC2626; border-radius: 50%; animation: recpulse 1.5s infinite; }
@keyframes recpulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.room-btn-settings {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted); cursor: pointer;
  transition: var(--transition);
}
.room-btn-settings:hover { border-color: var(--green); color: var(--green); }
.room-btn-exit {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 8px; font-size: 12px; font-weight: 600;
  border: 1.5px solid #FCA5A5; background: #FEF2F2; color: #DC2626; cursor: pointer;
  transition: var(--transition);
}
.room-btn-exit:hover { background: #DC2626; color: #fff; border-color: #DC2626; }

/* Room Body */
.room-body { display: flex; flex: 1; overflow: hidden; position: relative; }

/* Left Tool Palette */
.room-tools {
  width: 50px; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; gap: 2px; overflow-y: auto; scrollbar-width: none; flex-shrink: 0;
}
.room-tool {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 14px; color: var(--text-muted); cursor: pointer;
  transition: var(--transition); border: none; background: none;
}
.room-tool:hover { background: var(--green-pale); color: var(--green); }
.room-tool.active { background: var(--green); color: #fff; }
.room-tool-divider { width: 22px; height: 1px; background: var(--border); margin: 3px 0; flex-shrink: 0; }
.room-color-pick { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 2px 0; }
.room-color {
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: var(--transition);
}
.room-color:hover, .room-color.active { border-color: #374151; transform: scale(1.15); }

/* Center Content */
.room-content {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #F8F6F0;
}
.room-tabs {
  display: flex; align-items: center; background: #fff;
  border-bottom: 1px solid var(--border); padding: 0 10px;
  flex-shrink: 0; height: 42px; gap: 0;
  overflow-x: auto; scrollbar-width: none;
}
.room-tabs::-webkit-scrollbar { display: none; }
.room-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px; height: 100%; font-size: 12.5px; font-weight: 500;
  color: var(--text-muted); border: none; background: none; cursor: pointer;
  border-bottom: 2.5px solid transparent; transition: color .2s, border-color .2s; white-space: nowrap;
}
.room-tab:hover { color: var(--green); }
.room-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.room-tab-actions {
  margin-left: auto; display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted); flex-shrink: 0;
}
.room-tab-zoom {
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; font-size: 11px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text-muted);
}
.room-tab-zoom:hover { background: var(--green-pale); color: var(--green); border-color: var(--green-light); }
#wbZoomPct { font-size: 11px; min-width: 32px; text-align: center; }

.room-tab-panel { display: none; flex: 1; overflow: auto; }
.room-tab-panel.active { display: flex; flex-direction: column; }
#rtab-whiteboard.active { display: flex; position: relative; overflow: hidden; }

/* Whiteboard zoom viewport */
.wb-viewport {
  flex: 1; overflow: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--beige-dark) transparent;
}
.wb-spacer { position: relative; min-width: 100%; min-height: 100%; }
.wb-canvas {
  display: block; touch-action: none;
  background: #fff;
  position: absolute; top: 0; left: 0;
  transform-origin: top left;
}
.room-file-canvas-viewer {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 3vw, 32px);
  background: rgba(248,246,240,.72);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.room-file-canvas-viewer.show { display: flex; }
.room-file-viewer-card {
  width: min(820px, 100%);
  height: min(560px, 100%);
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(31,41,55,.26);
}
.room-file-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.room-file-viewer-kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
}
.room-file-viewer-title {
  max-width: min(560px, 68vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.room-file-viewer-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  background: #fff;
  cursor: pointer;
}
.room-file-viewer-close:hover {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}
.room-file-viewer-body {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: #F8F6F0;
}
.room-file-preview-media {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}
.room-file-preview-fallback {
  width: min(360px, 88%);
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--green-light);
  border-radius: 8px;
  background: #fff;
}
.room-file-preview-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.room-file-preview-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}
.room-file-preview-meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}
.room-file-preview-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.room-file-preview-action:hover {
  background: var(--green-mid);
  color: #fff;
}

/* Mobile tools FAB (hidden on desktop) */
.wb-tools-fab {
  display: none;
  position: absolute;
  top: 10px; left: 10px;
  z-index: 13;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  border: none; cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(45,106,79,.4);
  transition: var(--transition);
}
.wb-tools-fab:hover { background: var(--green-mid); }

/* Tools backdrop (desktop: never shown) */
.room-tools-backdrop { display: none; }

/* PiP Camera */
.wb-pip-cam {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 120px; height: 78px;
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
  z-index: 20;
  box-shadow: 0 4px 20px rgba(0,0,0,.45);
  border: 2px solid rgba(255,255,255,.25);
  background: #1F2937;
  touch-action: none;
  user-select: none;
}
.wb-pip-cam:active { cursor: grabbing; }
.wb-pip-cam__video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.wb-pip-cam__placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(255,255,255,.35); font-size: 26px;
}
.wb-pip-cam__label {
  position: absolute; bottom: 4px; left: 6px;
  font-size: 9px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,.55);
  padding: 1px 5px; border-radius: 4px;
  pointer-events: none;
}
.wb-pip-cam__btns {
  position: absolute; top: 3px; right: 4px;
  display: flex; gap: 3px; align-items: center;
}
.wb-pip-cam__btn {
  background: rgba(0,0,0,.55); color: #fff;
  border: none; border-radius: 50%;
  width: 18px; height: 18px;
  font-size: 9px; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s; flex-shrink: 0;
}
.wb-pip-cam__btn:hover { background: rgba(45,106,79,.85); }

/* PiP expanded — fills whiteboard like YouTube expanded PiP */
.wb-pip-cam--expanded {
  left: 8px !important; top: 8px !important;
  right: 8px; bottom: 8px;
  width: calc(100% - 16px) !important;
  height: calc(100% - 16px) !important;
  border-radius: 14px;
  cursor: default;
  z-index: 25;
}
.wb-pip-cam--expanded .wb-pip-cam__label { font-size: 13px; padding: 3px 10px; }
.wb-pip-cam--expanded .wb-pip-cam__btns { top: 8px; right: 10px; gap: 6px; }
.wb-pip-cam--expanded .wb-pip-cam__btn { width: 28px; height: 28px; font-size: 13px; }

/* Files Tab */
.room-files-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fff; flex-shrink: 0;
}
.room-files-header span { font-size: 14px; font-weight: 600; }
.room-upload-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 8px;
  background: var(--green-pale); color: var(--green);
  border: 1.5px solid var(--green-light); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.room-upload-btn:hover { background: var(--green); color: #fff; }
.room-file-list { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.room-file-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 10px; padding: 10px 12px; border: 1px solid var(--border);
  transition: var(--transition); cursor: pointer;
}
.room-file-item:hover,
.room-file-item:focus-visible { border-color: var(--green-light); box-shadow: var(--shadow); outline: none; }
.room-file-icon {
  width: 38px; height: 38px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.room-file-icon.pdf { background: #DC2626; }
.room-file-icon.xls { background: #16A34A; }
.room-file-icon.doc { background: #2563EB; }
.room-file-name { font-size: 13px; font-weight: 600; color: var(--text); }
.room-file-size { font-size: 11px; color: var(--text-muted); }
.room-file-info { flex: 1; }
.room-file-dl {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; background: var(--green-pale); color: var(--green);
  border: 1px solid var(--green-light); cursor: pointer; font-size: 12px;
}
.room-file-dl:hover { background: var(--green); color: #fff; }

/* Assignments in room */
.room-assign-list { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.room-assign-card {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 10px; padding: 12px 14px; border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.room-assign-card:hover { border-color: var(--green-light); box-shadow: var(--shadow); }
.room-assign-icon { font-size: 22px; flex-shrink: 0; }
.room-assign-title { font-size: 13px; font-weight: 600; }
.room-assign-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.room-assign-info { flex: 1; }
.room-assign-badge {
  font-size: 10.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
}
.room-assign-badge.pending   { background: #FEF3C7; color: #92400E; }
.room-assign-badge.submitted { background: #DBEAFE; color: #1E40AF; }
.room-assign-badge.graded    { background: #D1FAE5; color: #065F46; }

/* In-room chat tab */
.room-inchat-msgs {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin;
}
.room-chat-msg { display: flex; flex-direction: column; gap: 2px; max-width: 78%; }
.room-chat-msg.me { align-self: flex-end; align-items: flex-end; }
.room-chat-msg.tutor .room-chat-bubble { background: var(--green); color: #fff; border-color: var(--green); }
.room-chat-bubble {
  background: #fff; color: var(--text); padding: 8px 12px; border-radius: 12px;
  font-size: 12.5px; border: 1px solid var(--border); line-height: 1.5;
}
.room-chat-msg.me .room-chat-bubble { background: var(--green-pale); border-color: var(--green-light); }
.room-chat-time { font-size: 10px; color: var(--text-light); }
.room-chat-name { font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.room-inchat-input {
  display: flex; gap: 7px; padding: 9px 12px;
  border-top: 1px solid var(--border); background: #fff; flex-shrink: 0;
}
.room-inchat-input input {
  flex: 1; padding: 7px 11px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 12.5px; outline: none; font-family: inherit;
}
.room-inchat-input input:focus { border-color: var(--green); }
.room-inchat-input button {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--green); color: #fff;
  display: grid; place-items: center; cursor: pointer; font-size: 13px; border: none;
}

/* Right Panel: Video + Participants + Chat */
.room-right {
  width: 270px; background: #fff; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
}
.room-video-box {
  position: relative; background: #111827;
  width: 100%; aspect-ratio: 16/9; flex-shrink: 0;
}
.room-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.room-video-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #1F2937; color: rgba(255,255,255,.35); font-size: 30px; flex-direction: column; gap: 8px;
}
.room-video-label {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px;
}
.room-video-menu {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.5); color: #fff;
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; cursor: pointer; font-size: 13px; border: none;
}
.room-participants { border-bottom: 1px solid var(--border); padding: 9px 12px; flex-shrink: 0; }
.room-part-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; margin-bottom: 7px;
}
.room-part-header a { font-size: 11px; color: var(--green); }
.room-part-list { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; scrollbar-width: none; }
.room-part-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.room-part-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--green-light); color: var(--green);
  display: grid; place-items: center; font-size: 9px; font-weight: 700; flex-shrink: 0;
}
.room-part-name { font-size: 12px; font-weight: 500; flex: 1; }
.room-part-badge {
  display: inline-block; background: var(--green); color: #fff;
  font-size: 8.5px; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}
.room-part-mic { color: var(--text-light); font-size: 11px; flex-shrink: 0; }
.room-part-mic.on { color: var(--green); }
.room-part-hand { color: #F59E0B; font-size: 11px; flex-shrink: 0; }

/* Live chat in right panel */
.room-live-chat { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.room-live-chat-title {
  padding: 9px 12px 6px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.room-live-msgs {
  flex: 1; overflow-y: auto; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 5px; scrollbar-width: none;
}
.room-live-msg { font-size: 11.5px; line-height: 1.4; }
.room-live-msg.me .room-live-text { color: var(--green); }
.room-live-user { font-weight: 600; color: var(--green); margin-right: 4px; }
.room-live-time { font-size: 9.5px; color: var(--text-light); }
.room-live-text { color: var(--text); }
.room-live-input {
  display: flex; gap: 5px; padding: 8px 9px;
  border-top: 1px solid var(--border); background: var(--beige); flex-shrink: 0;
}
.room-live-input input {
  flex: 1; padding: 6px 9px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 12px; outline: none; font-family: inherit; background: #fff;
}
.room-live-input input:focus { border-color: var(--green); }
.room-live-input button {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--green); color: #fff;
  display: grid; place-items: center; cursor: pointer; font-size: 12px; border: none;
}

/* Bottom Toolbar */
.room-toolbar {
  height: 70px; background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  gap: 2px; padding: 0 12px; flex-shrink: 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.room-tb-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 8px; border-radius: 10px; cursor: pointer;
  border: none; background: none;
  font-size: 9.5px; color: var(--text-muted); transition: var(--transition);
  min-width: 52px;
}
.room-tb-btn:hover { background: var(--green-pale); color: var(--green); }
.room-tb-btn.muted, .room-tb-btn.cam-off { background: #FEF2F2; color: #DC2626; }
.room-tb-btn.muted .room-tb-icon, .room-tb-btn.cam-off .room-tb-icon { background: #FECACA; color: #DC2626; }
.room-tb-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--green-pale); color: var(--green);
  display: grid; place-items: center; font-size: 14px;
}
.room-tb-btn.recording .room-tb-icon { background: #FEF2F2; }
.room-tb-sep { width: 1px; height: 38px; background: var(--border); margin: 0 2px; flex-shrink: 0; }
.room-reactions-popup {
  position: fixed; bottom: 80px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; box-shadow: var(--shadow-lg);
  display: none; gap: 8px; z-index: 210; font-size: 22px; cursor: default;
}
.room-reactions-popup.show { display: flex; }
.room-reactions-popup span { cursor: pointer; transition: transform .15s; }
.room-reactions-popup span:hover { transform: scale(1.3); }
.room-floating-reaction {
  position: fixed; bottom: 80px; pointer-events: none;
  font-size: 28px; animation: floatUp 2s ease-out forwards; z-index: 300;
}
@keyframes floatUp { 0%{transform:translateY(0);opacity:1} 100%{transform:translateY(-150px);opacity:0} }

/* Mobile room-right backdrop */
.room-right-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 198;
}
.room-right-backdrop.show { display: block; }

/* Close button inside room-right (mobile only) */
.room-tb-participants-btn { display: none; }

.room-right-close-btn {
  display: none;
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted);
  padding: 4px; z-index: 2;
}

/* Mobile tutor room */
@media (max-width: 900px) {
  .room-right {
    display: flex !important;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 92vw);
    z-index: 199;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(0,0,0,.2);
    flex-direction: column;
    overflow-y: auto;
  }
  .room-right.open { transform: translateX(0); }
  /* Panel scroll: override flex so whole column scrolls naturally */
  .room-right .room-live-chat { flex: none; min-height: 0; }
  .room-right .room-live-msgs { flex: none; height: 220px; overflow-y: auto; }
  .room-right-close-btn { display: block; }
  .room-tb-participants-btn { display: flex !important; }
  /* Tools popup on mobile */
  .room-tools {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    z-index: 15;
    width: 56px;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 3px 0 16px rgba(0,0,0,.15);
    border-right: 1px solid var(--border);
  }
  .room-tools.open { transform: translateX(0); }
  .room-tools-backdrop {
    display: none;
    position: absolute; inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 14;
  }
  .room-tools-backdrop.show { display: block; }
  /* FAB to open tools */
  .wb-tools-fab {
    display: flex;
  }
  .room-toolbar {
    gap: 0; padding: 0 4px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .room-toolbar::-webkit-scrollbar { display: none; }
  .room-tb-sep  { display: none; }
  .room-tb-btn  { min-width: 52px; flex-shrink: 0; padding: 4px 6px; font-size: 8px; }
  .room-tb-icon { width: 28px; height: 28px; font-size: 12px; }
  .room-header  { padding: 0 10px; height: 50px; overflow: hidden; }
  .room-title   { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
  .room-meta    { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
  .room-rec     { font-size: 10px; padding: 3px 7px; }
  .room-btn-settings span, .room-btn-exit span { display: none; }
}
@media (max-width: 900px) {
  body.in-tutor-room #view-tutor.active {
    position: fixed;
    inset: 0;
    z-index: 200;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.in-tutor-room .at-hamburger  { display: none !important; }
  body.in-tutor-room .at-bottom-nav { display: none !important; }
  body.in-tutor-room .at-back-btn   { display: none !important; }
  body.in-tutor-room .at-panel-fab  { display: none !important; }
  .room-toolbar { height: 56px; }
}

/* ============================================================
   TUGAS VIEW
   ============================================================ */
.tugas-top-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.tugas-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tugas-filter-tab {
  padding: 7px 16px; border-radius: 99px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; border: 1.5px solid var(--border); background: #fff; color: var(--text-muted);
  transition: var(--transition);
}
.tugas-filter-tab.active { background: var(--green); color: #fff; border-color: var(--green); }
.tugas-create-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 10px;
  background: var(--green); color: #fff;
  border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.tugas-create-btn:hover { background: var(--green-mid); }
.tugas-section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }
.tugas-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 15px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
  transition: var(--transition); cursor: pointer;
}
.tugas-card:hover { border-color: var(--green-light); box-shadow: var(--shadow); }
.tugas-card-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--green-pale); color: var(--green);
  display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
}
.tugas-card-icon.red   { background: #FEF2F2; color: #DC2626; }
.tugas-card-icon.blue  { background: #EFF6FF; color: #2563EB; }
.tugas-card-icon.gold  { background: #FFFBEB; color: #D97706; }
.tugas-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.tugas-card-meta  { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.tugas-card-info  { flex: 1; }
.tugas-card-right { text-align: right; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; flex-shrink: 0; }
.tugas-status {
  font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 99px; white-space: nowrap;
}
.tugas-status.pending   { background: #FEF3C7; color: #92400E; }
.tugas-status.submitted { background: #DBEAFE; color: #1E40AF; }
.tugas-status.graded    { background: #D1FAE5; color: #065F46; }
.tugas-deadline { font-size: 11px; color: var(--text-light); }
.tugas-score-big { font-size: 24px; font-weight: 700; color: var(--green); }
.tugas-prog-wrap { width: 80px; }
.tugas-prog-bar  { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 2px; }
.tugas-prog-fill { height: 100%; background: var(--green); border-radius: 99px; }
.tugas-stats-row {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 24px;
}
.tugas-stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  text-align: center;
}
.tugas-stat-val { font-size: 26px; font-weight: 700; color: var(--green); }
.tugas-stat-lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* Tugas modal */
.tugas-modal-bg {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.5); place-items: center;
}
.tugas-modal-bg.show { display: grid; }
.tugas-modal {
  background: #fff; border-radius: 18px; padding: 28px;
  width: min(540px, 92vw); box-shadow: var(--shadow-lg);
  max-height: 88vh; overflow-y: auto;
}
.tugas-modal-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.tugas-form-group { margin-bottom: 14px; }
.tugas-form-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; }
.tugas-form-input {
  width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 13px; font-family: inherit; outline: none;
}
.tugas-form-input:focus { border-color: var(--green); }
.tugas-form-select {
  width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 13px; font-family: inherit; background: #fff; outline: none; cursor: pointer;
}
.tugas-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.tugas-modal-cancel {
  padding: 9px 20px; border-radius: 9px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; cursor: pointer; color: var(--text-muted);
}
.tugas-modal-submit {
  padding: 9px 20px; border-radius: 9px; background: var(--green); color: #fff;
  border: none; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ============================================================
   PESAN (MESSAGING) VIEW
   ============================================================ */
#view-pesan.active { padding: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.pesan-layout {
  display: flex; flex: 1; overflow: hidden;
  background: #fff;
}
.pesan-sidebar {
  width: 290px; flex-shrink: 0; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; background: #fff;
}
.pesan-sidebar-header {
  padding: 16px 14px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.pesan-sidebar-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.pesan-search {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg); border-radius: 9px; padding: 7px 11px; border: 1px solid var(--border);
}
.pesan-search input {
  flex: 1; border: none; background: none; outline: none; font-size: 12.5px; font-family: inherit;
}
.pesan-search i { color: var(--text-light); font-size: 13px; }
.pesan-conv-list { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.pesan-conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background .18s;
}
.pesan-conv-item:hover  { background: var(--green-pale); }
.pesan-conv-item.active { background: var(--green-pale); border-left: 3px solid var(--green); }
.pesan-conv-av {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; color: #fff; position: relative;
}
.pesan-online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; background: #22C55E; border-radius: 50%; border: 2px solid #fff;
}
.pesan-conv-name    { font-size: 13px; font-weight: 600; }
.pesan-conv-preview { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; margin-top: 2px; }
.pesan-conv-info    { flex: 1; min-width: 0; }
.pesan-conv-meta    { text-align: right; flex-shrink: 0; }
.pesan-conv-time    { font-size: 10px; color: var(--text-light); }
.pesan-unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff;
  font-size: 9px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 99px; padding: 0 4px; margin-top: 4px;
}

/* Active Conversation */
.pesan-chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.pesan-chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: #fff;
}
.pesan-chat-av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.pesan-chat-name   { font-size: 14px; font-weight: 700; }
.pesan-chat-status { font-size: 11px; color: #22C55E; font-weight: 500; }
.pesan-chat-actions { margin-left: auto; display: flex; gap: 6px; }
.pesan-act-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 14px; color: var(--text-muted);
}
.pesan-act-btn:hover { background: var(--green-pale); color: var(--green); border-color: var(--green-light); }
.pesan-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin;
  background: var(--bg);
}
.pesan-msg { display: flex; gap: 8px; max-width: 72%; }
.pesan-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.pesan-msg-av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex-shrink: 0; color: #fff; align-self: flex-end; }
.pesan-bubble-wrap { display: flex; flex-direction: column; gap: 2px; }
.pesan-bubble {
  background: #fff; border: 1px solid var(--border);
  padding: 9px 13px; border-radius: 14px 14px 14px 4px;
  font-size: 13px; line-height: 1.55; color: var(--text);
}
.pesan-msg.me .pesan-bubble {
  background: var(--green); color: #fff; border-color: var(--green);
  border-radius: 14px 14px 4px 14px;
}
.pesan-bubble-file {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px; padding: 7px 10px; display: flex; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 11.5px; cursor: pointer;
}
.pesan-msg:not(.me) .pesan-bubble-file { background: var(--green-pale); border-color: var(--green-light); color: var(--green); }
.pesan-msg-meta { font-size: 10px; color: var(--text-light); display: flex; align-items: center; gap: 4px; }
.pesan-msg.me .pesan-msg-meta { justify-content: flex-end; }
.pesan-msg.me .pesan-msg-meta { color: var(--text-light); }
.pesan-check { color: var(--green); font-size: 11px; }
.pesan-date-divider {
  text-align: center; font-size: 11px; color: var(--text-light); padding: 4px 12px;
  background: rgba(0,0,0,.06); border-radius: 99px; align-self: center; margin: 4px 0;
}
.pesan-input-area {
  border-top: 1px solid var(--border); padding: 9px 12px;
  display: flex; align-items: center; gap: 7px; flex-shrink: 0; background: #fff;
}
.pesan-input-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 15px; color: var(--text-muted); flex-shrink: 0;
}
.pesan-input-btn:hover { background: var(--green-pale); color: var(--green); border-color: var(--green-light); }
.pesan-text-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 9px 13px; font-size: 13px; font-family: inherit; outline: none; background: var(--bg);
}
.pesan-text-input:focus { border-color: var(--green); background: #fff; }
.pesan-send-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 16px; cursor: pointer;
  border: none; flex-shrink: 0; transition: var(--transition);
}
.pesan-send-btn:hover { background: var(--green-mid); }
.pesan-voice-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--green-light); background: var(--green-pale); cursor: pointer; font-size: 14px; color: var(--green); flex-shrink: 0;
}
.pesan-voice-btn:hover { background: var(--green); color: #fff; }
.pesan-empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted); gap: 10px;
}
.pesan-empty-icon { font-size: 48px; opacity: .3; }

/* Emoji picker popup */
.emoji-popup {
  position: absolute; bottom: 74px; left: 12px; z-index: 250;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  box-shadow: var(--shadow-lg); display: none; flex-wrap: wrap; gap: 6px; max-width: 260px;
  font-size: 20px; cursor: default;
}
.emoji-popup.show { display: flex; }
.emoji-popup span { cursor: pointer; transition: transform .12s; }
.emoji-popup span:hover { transform: scale(1.3); }

/* Mobile messaging */
@media (max-width: 768px) {
  .pesan-sidebar { width: 100%; border-right: none; }
  .pesan-chat-area { display: none; }
  .pesan-chat-area.mobile-show { display: flex; position: fixed; inset: 0; z-index: 250; background: #fff; }
}

/* ============================================================
   SIDEBAR MOBILE CLOSE BUTTON
   ============================================================ */
.at-sb-close {
  display: none;
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  border: none; cursor: pointer;
  font-size: 15px;
  place-items: center;
  transition: var(--transition);
  z-index: 1;
  flex-shrink: 0;
}
.at-sb-close:hover { background: #FECACA; color: #DC2626; }
@media (max-width: 768px) { .at-sb-close { display: grid; } }

/* ============================================================
   PELAJARAN HARI INI — in-page grid
   ============================================================ */
.at-today-section { margin-top: 22px; }
.at-today-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.at-today-title {
  font-size: 16px; font-weight: 700;
  font-family: 'Playfair Display', serif;
  color: var(--text);
}
.at-today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.at-today-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.at-today-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--green-light); }
.at-today-card-top { display: flex; align-items: center; gap: 12px; }
.at-today-num {
  width: 36px; height: 36px;
  background: var(--green); color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.at-today-card-name { font-size: 15px; font-weight: 700; }
.at-today-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.at-today-card-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.at-today-btn {
  flex: 1;
  background: var(--green); color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700;
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: none; cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(45,106,79,.25);
}
.at-today-btn:hover { background: var(--green-mid); }
.at-today-xp {
  background: var(--gold-light); border: 1.5px solid var(--gold);
  color: var(--gold-dark); font-size: 12px; font-weight: 700;
  padding: 9px 12px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
@media (max-width: 768px) {
  .at-today-grid { grid-template-columns: 1fr; }
}

/* Language Switcher */
.at-lang-switcher {
  display: flex;
  gap: 4px;
  background: var(--beige);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
}
.at-lang-btn {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: .5px;
}
.at-lang-btn.active,
.at-lang-btn:hover {
  background: var(--green);
  color: #fff;
}
