/* ==========================================================================
   DEV_QUEST: Antigravity Lab // Enterprise High-Key Light Mode
   Clean, Professional, Anti-AI-Slop Design System + Sidebar & Mobile Layout
   ========================================================================== */
:root {
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --bg-panel: #F1F5F9;
  --bg-sidebar: #FFFFFF;
  --bg-muted: #E2E8F0;
  
  --border-color: #E2E8F0;
  --border-focus: #94A3B8;
  --border-active: #CBD5E1;
  
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  
  --color-brand: #4F46E5;
  --color-brand-hover: #4338CA;
  --color-brand-light: #EEF2FF;
  
  --color-success: #059669;
  --color-success-hover: #047857;
  --color-success-light: #ECFDF5;
  
  --color-warning: #D97706;
  --color-warning-light: #FFFBEB;
  
  --color-danger: #E11D48;
  --color-danger-light: #FFF1F2;
  
  --color-info: #0284C7;
  --color-info-light: #F0F9FF;

  --sidebar-width: 260px;
  --header-height: 56px;
  
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.07), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-float: 0 20px 25px -5px rgba(79, 70, 229, 0.16), 0 8px 10px -6px rgba(2, 132, 199, 0.12);
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
}

/* Background Canvas & Pattern */
#forcefield-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}

.bg-dot-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: radial-gradient(circle at 1px 1px, #CBD5E1 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   APP SIDEBAR NAVIGATION
   ========================================================================== */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--text-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand h1 {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand span {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: block;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 8px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  user-select: none;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-panel);
}

.sidebar-link.active {
  color: var(--color-brand);
  background: var(--color-brand-light);
  font-weight: 700;
}

.sidebar-link-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: #FAFAFD;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-brand-light);
  color: var(--color-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.76rem;
  flex-shrink: 0;
}

.user-info-text {
  overflow: hidden;
  line-height: 1.3;
}

.user-info-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-info-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 90;
}

/* ==========================================================================
   APP MAIN CONTENT WRAPPER
   ========================================================================== */
.app-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 2;
  transition: margin-left 0.25s ease;
}

.app-topbar {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-toggle-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-primary);
}

.page-title-crumb {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.page-title-crumb span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
@media (min-width: 480px) {
  .page-title-crumb span { max-width: 280px; }
}
@media (min-width: 768px) {
  .page-title-crumb span { max-width: 480px; }
}
@media (min-width: 1024px) {
  .page-title-crumb span { max-width: none; }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-playground-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.topbar-playground-btn:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #1E40AF;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15);
}

@media (max-width: 640px) {
  .topbar-playground-btn .playground-btn-text {
    display: none;
  }
  .topbar-playground-btn {
    padding: 6px 8px;
  }
}

.main-page-container {
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* ==========================================================================
   BUTTONS & COMMON UI
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
  font-family: var(--font-sans);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-brand);
  color: white;
}
.btn-primary:hover {
  background: var(--color-brand-hover);
}

.btn-success {
  background: var(--color-success);
  color: white;
}
.btn-success:hover {
  background: var(--color-success-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-focus);
}

.btn-antigravity-trigger {
  background: var(--text-primary);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-antigravity-trigger:hover {
  background: #1E293B;
  box-shadow: var(--shadow-sm);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.status-pill.stable .dot {
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.4);
}

.status-pill.breached {
  background: var(--color-brand-light);
  color: var(--color-brand);
  border-color: rgba(79, 70, 229, 0.3);
  animation: pulse 1.8s infinite;
}

.status-pill.breached .dot {
  background: var(--color-info);
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.6);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.badge-chip {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-chip.php { background: #EDE9FE; color: #6D28D9; }
.badge-chip.sql { background: #E0F2FE; color: #0369A1; }
.badge-chip.novice { background: #F1F5F9; color: #475569; }
.badge-chip.adept { background: #FEF3C7; color: #B45309; }
.badge-chip.master { background: #FEE2E2; color: #B91C1C; }
.badge-chip.passed { background: var(--color-success-light); color: var(--color-success); }
.badge-chip.locked { background: #F1F5F9; color: #94A3B8; }

/* Interactive Cards & Detachment */
.interactive-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #FAFAFD;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.interactive-card.is-floating {
  cursor: grab !important;
  user-select: none;
  box-shadow: var(--shadow-float) !important;
  border-color: rgba(79, 70, 229, 0.35) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.96);
  z-index: 1000 !important;
}

.interactive-card.is-floating:active,
.interactive-card.is-dragging {
  cursor: grabbing !important;
  border-color: var(--color-info) !important;
  box-shadow: 0 25px 35px -10px rgba(2, 132, 199, 0.35) !important;
}

.drag-handle-badge {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  background: var(--color-brand-light);
  color: var(--color-brand);
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
}

.interactive-card.is-floating .drag-handle-badge {
  display: inline-flex;
}

/* ==========================================================================
   ARENA GRID, TABS, HINTS & EDITOR
   ========================================================================== */
.arena-grid {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.arena-spec-body {
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  padding-top: 14px;
}

.mobile-arena-switcher {
  display: none;
}

.mobile-editor-top-nav {
  display: none;
}

.mobile-cta-to-editor {
  display: none;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.arena-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: #F8FAFC;
  padding: 4px 8px 0;
  gap: 4px;
}

.arena-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.arena-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
}

.arena-tab-btn.active {
  background: #FFFFFF;
  color: var(--color-brand);
  border-color: var(--border-color);
  border-bottom-color: #FFFFFF;
  margin-bottom: -1px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-pane.active {
  display: flex;
}

.hint-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.hint-item:hover { border-color: var(--border-focus); }

.hint-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFAFD;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
}

.hint-body {
  padding: 12px 14px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  display: none;
  background: #FFFFFF;
}

.hint-item.open .hint-body { display: block; }
.hint-item.open .hint-icon-arrow { transform: rotate(180deg); }
.hint-icon-arrow { transition: transform 0.2s ease; }

/* Learning Material Panel & Rich Educational Components */
.material-content {
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.material-content h3 {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 6px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.material-content h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 10px;
  margin-bottom: 4px;
}

.material-content p {
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

/* Educational Hero Banner */
.edu-hero-banner {
  background: linear-gradient(135deg, #EEF2FF 0%, #F8FAFC 100%);
  border: 1px solid #E0E7FF;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.edu-hero-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-brand);
}

.edu-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.edu-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.edu-pill-brand { background: #E0E7FF; color: #3730A3; border: 1px solid #C7D2FE; }
.edu-pill-emerald { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.edu-pill-amber { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.edu-pill-time { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }

.edu-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 6px 0;
}

.edu-section-title svg {
  color: var(--color-brand);
  flex-shrink: 0;
}

/* Callout Box System (Info, Tip, Warning, Concept) */
.callout-box {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.8rem;
  line-height: 1.6;
}

.callout-box.concept {
  background: var(--color-brand-light);
  border: 1px solid rgba(79, 70, 229, 0.25);
  color: #312E81;
}

.callout-box.tip {
  background: var(--color-success-light);
  border: 1px solid rgba(5, 150, 105, 0.25);
  color: #064E3B;
}

.callout-box.warning {
  background: var(--color-warning-light);
  border: 1px solid rgba(217, 119, 6, 0.25);
  color: #78350F;
}

.callout-box.danger {
  background: #FFF1F2;
  border: 1px solid rgba(225, 29, 72, 0.25);
  color: #881337;
}

.callout-box.info {
  background: var(--color-info-light);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #0C4A6E;
}

.callout-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 3px;
  display: block;
}

/* Formula & Math Card */
.edu-formula-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--color-brand);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
  margin: 6px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.edu-formula-math {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: #1E1B4B;
  display: inline-block;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.edu-formula-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Code Snippet Display with Header */
.edu-code-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 8px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.edu-code-header {
  padding: 6px 12px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edu-code-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: #475569;
}

.edu-code-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--color-brand);
  background: var(--color-brand-light);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.edu-code-card pre {
  margin: 0;
  padding: 12px 14px;
  background: #FAFAFD;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  color: #1E293B;
  overflow-x: auto;
}

/* Syntax Highlight Helpers */
.edu-kw { color: #7C3AED; font-weight: 600; }
.edu-fn { color: #2563EB; font-weight: 600; }
.edu-var { color: #0284C7; font-weight: 500; }
.edu-str { color: #059669; }
.edu-num { color: #D97706; }
.edu-cm { color: #94A3B8; font-style: italic; }
.edu-sql { color: #4F46E5; font-weight: 700; }

/* Grid Comparisons & Flow Steps */
.edu-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 6px 0;
}

.edu-card-mini {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edu-card-mini-title {
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.edu-steps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
}

.edu-step-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.77rem;
}

.edu-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.edu-checklist-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.edu-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.77rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.edu-check-item:last-child {
  margin-bottom: 0;
}

.edu-check-icon {
  width: 15px;
  height: 15px;
  color: #059669;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Visual Step Flowchart */
.visual-flowchart {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 6px 0;
}

.flow-step-node {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-xs);
}

.flow-step-node.highlight {
  border-color: var(--color-brand);
  color: var(--color-brand);
  background: var(--color-brand-light);
}

.flow-arrow {
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
}

.test-check-list { display: flex; flex-direction: column; gap: 8px; }

.test-item {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.test-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
}

.test-item-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #F1F5F9;
  color: #64748B;
}

.test-item.passed {
  border-color: rgba(5, 150, 105, 0.4);
  background: #F0FDF4;
}
.test-item.passed .test-item-badge {
  background: #DCFCE7;
  color: #15803D;
}

.test-item.failed {
  border-color: rgba(225, 29, 72, 0.4);
  background: #FFF1F2;
}
.test-item.failed .test-item-badge {
  background: #FFE4E6;
  color: #BE123C;
}

.test-item-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.test-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.test-detail-label {
  min-width: 78px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.test-detail-val {
  flex: 1;
  word-break: break-all;
  color: #1E293B;
  background: rgba(0, 0, 0, 0.03);
  padding: 2px 6px;
  border-radius: 4px;
}

.test-detail-val.expected {
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
}

.test-detail-val.actual-fail {
  color: #BE123C;
  background: rgba(244, 63, 94, 0.08);
  font-weight: 600;
}

.test-detail-val.actual-pass {
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
  font-weight: 600;
}

.test-detail-error {
  margin-top: 4px;
  padding: 6px 8px;
  background: #FFF1F2;
  border-left: 3px solid #E11D48;
  color: #9F1239;
  font-size: 0.72rem;
  border-radius: 2px;
}

.editor-wrapper { display: flex; flex-direction: column; height: 560px; }

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
}

.editor-tabs { display: flex; gap: 4px; }

.editor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-bottom: 1px solid var(--bg-surface);
  border-radius: 6px 6px 0 0;
  margin-bottom: -9px;
  color: var(--text-primary);
  font-weight: 600;
}

.editor-area { flex: 1; display: flex; position: relative; background: #FFFFFF; overflow: hidden; }

.line-numbers {
  width: 44px;
  padding: 14px 8px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #94A3B8;
  background: #FAFAFD;
  border-right: 1px solid var(--border-color);
  user-select: none;
}

.code-input {
  flex: 1;
  padding: 14px 16px;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  color: #0F172A;
  background: transparent;
  resize: none;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
}

.terminal-wrapper {
  min-height: 190px;
  background: #090D16;
  color: #E2E8F0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  padding: 10px 16px;
  background: #0F172A;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.terminal-logs {
  flex: 1;
  padding: 12px 16px;
  height: 150px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.term-line.info { color: #94A3B8; }
.term-line.success { color: #10B981; }
.term-line.warn { color: #F59E0B; }
.term-line.error { color: #F43F5E; }
.term-line.prompt { color: #0284C7; }

/* Level Stepper Progression Bar */
.level-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.step-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.2s ease;
}

.step-card.active {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 1px var(--color-brand), var(--shadow-sm);
}

.step-card.completed {
  border-color: rgba(5, 150, 105, 0.3);
  background: #FDFEFE;
}

.step-card.locked {
  background: #F8FAFC;
  opacity: 0.75;
  border-style: dashed;
}

.step-header { display: flex; align-items: center; justify-content: space-between; }
.step-number { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; color: var(--text-muted); }
.step-card.active .step-number { color: var(--color-brand); }
.step-title { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); line-height: 1.4; }

/* ==========================================================================
   HALL OF FAME & LEADERBOARD PODIUM
   ========================================================================== */
.podium-container {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.podium-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-xs);
  position: relative;
}

.podium-card.first {
  border-color: #F59E0B;
  box-shadow: 0 8px 25px -4px rgba(245, 158, 11, 0.2);
  transform: translateY(-8px);
}

.podium-card.second { border-color: #94A3B8; }
.podium-card.third { border-color: #D97706; }

.podium-crown {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.podium-card.first .podium-crown { background: #FEF3C7; color: #B45309; }
.podium-card.second .podium-crown { background: #F1F5F9; color: #475569; }
.podium-card.third .podium-crown { background: #FFEDD5; color: #C2410C; }

/* Badges Showcase Grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.badge-item-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.badge-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.badge-item-card.bronze .badge-icon-box { background: #FFF7ED; color: #C2410C; }
.badge-item-card.silver .badge-icon-box { background: #F1F5F9; color: #475569; }
.badge-item-card.gold .badge-icon-box { background: #FEF3C7; color: #B45309; }
.badge-item-card.platinum .badge-icon-box { background: #EDE9FE; color: #6D28D9; }

/* ==========================================================================
   ALGORITHM VISUALIZER MINI-GAME
   ========================================================================== */
.algo-visualizer-container {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.algo-bars-stage {
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.algo-bar-item {
  width: 36px;
  background: var(--color-brand);
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: white;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding-top: 4px;
  transition: all 0.25s ease;
}

.algo-bar-item.comparing { background: #F59E0B; transform: scale(1.05); }
.algo-bar-item.sorted { background: var(--color-success); }
.algo-bar-item.target { background: #E11D48; }

/* ==========================================================================
   MANUAL BOOK STYLES
   ========================================================================== */
.manual-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

.manual-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manual-nav-link {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
}

.manual-nav-link.active,
.manual-nav-link:hover {
  background: var(--bg-panel);
  color: var(--color-brand);
  border-left-color: var(--color-brand);
}

/* ==========================================================================
   HUD & TOAST
   ========================================================================== */
.hud-restore-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-restore-dock.is-active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.btn-restore-hud {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 26px;
  border-radius: 9999px;
  background: #0F172A;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(2, 132, 199, 0.3);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.pulse-ring {
  width: 9px;
  height: 9px;
  background: var(--color-info);
  border-radius: 50%;
  position: relative;
}

.pulse-ring::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--color-info);
  animation: pulse-ring 1.5s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.toast-banner {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-banner.is-visible { transform: translateX(0); }
.toast-banner.toast-success { border-left: 4px solid var(--color-success); }
.toast-banner.toast-error { border-left: 4px solid var(--color-danger); }

/* ==========================================================================
   MOBILE WEBAPP RESPONSIVE ADAPTATIONS (< 900px & < 640px)
   ========================================================================== */
@media (max-width: 960px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.mobile-open {
    display: block;
  }

  .app-content {
    margin-left: 0;
  }

  .mobile-toggle-btn {
    display: flex;
  }

  /* Arena Responsive Grid & Mobile WebApp Switcher */
  .arena-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    min-height: auto !important;
  }

  .mobile-arena-switcher {
    display: block !important;
    position: sticky !important;
    top: 56px !important;
    z-index: 40 !important;
    background: rgba(248, 250, 252, 0.96) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    padding: 8px 0 !important;
    margin: -8px 0 14px 0 !important;
  }

  .mobile-switcher-track {
    display: flex !important;
    background: #E2E8F0 !important;
    padding: 3px !important;
    border-radius: 9999px !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    gap: 3px !important;
  }

  .mobile-switcher-btn {
    flex: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 9px 12px !important;
    border: none !important;
    background: transparent !important;
    border-radius: 9999px !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .mobile-switcher-btn.active {
    background: #FFFFFF !important;
    color: var(--color-brand) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08) !important;
  }

  .arena-spec-card {
    width: 100% !important;
  }

  .arena-spec-body {
    max-height: none !important;
    overflow-y: visible !important;
    overflow: visible !important;
  }

  .arena-editor-section {
    width: 100% !important;
  }

  .mobile-editor-top-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 8px 12px !important;
    margin-bottom: 2px !important;
  }

  .mobile-cta-to-editor {
    display: block !important;
    margin-top: 14px !important;
    padding-top: 10px !important;
  }

  .level-stepper {
    grid-template-columns: 1fr;
  }

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

  .podium-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .podium-card.first {
    order: -1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .app-topbar {
    padding: 0 14px;
  }

  .main-page-container {
    padding: 16px 12px;
  }

  .editor-wrapper {
    height: 440px;
  }

  .status-pill span#gravity-status-text {
    display: none;
  }
}

/* ==========================================================================
   MOBILE WEBAPP BOTTOM NAVIGATION DOCK (PWA STYLE)
   ========================================================================== */
.mobile-bottom-dock {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-dock {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 99999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
  }

  .dock-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748B;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 3px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .dock-btn-trigger {
    background: transparent;
    border: none;
    outline: none;
  }

  .dock-item:active {
    transform: scale(0.92);
  }

  .dock-item.active {
    color: #2563EB;
  }

  .dock-item.active .dock-label {
    font-weight: 800;
    color: #2563EB;
  }

  .dock-item.active .dock-icon svg {
    stroke: #2563EB;
    stroke-width: 2.5;
  }

  .dock-item-highlight {
    position: relative;
    color: #1D4ED8;
  }

  .dock-item-highlight .dock-icon svg {
    stroke: #1D4ED8;
  }

  .dock-item-highlight .dock-label {
    color: #1D4ED8;
    font-weight: 700;
  }

  .dock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
  }

  .dock-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 60px;
    text-align: center;
  }

  /* Berikan padding bawah pada body dan container agar tidak tertutup dock */
  body {
    padding-bottom: 74px !important;
  }

  .main-page-container {
    padding-bottom: 96px !important;
  }

  .hud-restore-dock {
    bottom: 70px !important;
  }

  .app-content {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  /* Optimasi responsif untuk form, grid, dan tabel pada layar mobile */
  .manual-grid, .podium-container {
    grid-template-columns: 1fr !important;
  }

  .arena-card .card-body,
  .arena-spec-body {
    max-height: none !important;
    overflow-y: visible !important;
    overflow: visible !important;
  }

  /* Mobile Editor Layout & Actions */
  .editor-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 10px 12px !important;
  }

  .editor-toolbar .editor-tabs {
    justify-content: space-between !important;
    width: 100% !important;
  }

  .editor-actions {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .editor-actions .btn-run-code {
    grid-column: 1 / -1 !important;
    order: -1 !important;
    padding: 11px 16px !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25) !important;
    min-height: 44px !important;
  }

  .editor-actions .btn-copy-pg,
  .editor-actions .btn-link-pg,
  .editor-actions .btn-reset-code {
    padding: 7px 4px !important;
    font-size: 0.72rem !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 38px !important;
  }

  .editor-wrapper {
    height: 400px !important;
  }

  .terminal-wrapper {
    min-height: 240px !important;
    max-height: 380px !important;
  }

  /* Responsive swipe horisontal untuk tabs, level stepper, dan memory blocks */
  .level-stepper {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
    gap: 10px !important;
    padding-bottom: 8px !important;
    grid-template-columns: none !important;
  }

  .level-stepper .step-card {
    min-width: 145px !important;
    flex: 0 0 auto !important;
    scroll-snap-align: start !important;
  }

  .algo-step-tab {
    min-width: 135px;
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   USER PROFILE & SECURITY DASHBOARD (MODERN LIGHT THEME & MOBILE WEBAPP)
   ========================================================================== */

.profile-dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

/* 1. Hero Profile Card */
.profile-hero-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-wrapper .avatar-svg {
  border: 3px solid #FFFFFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

.btn-change-avatar-floating {
  position: absolute;
  bottom: 0;
  right: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-brand);
  color: #FFFFFF;
  border: 2px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-change-avatar-floating:hover {
  transform: scale(1.1);
  background: var(--color-brand-hover);
}

.profile-hero-info {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-badges-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.role-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.role-admin {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.role-user {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.rank-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.leaderboard-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.profile-username {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  letter-spacing: -0.01em;
}

.profile-meta-text {
  font-size: 0.78rem;
  color: #64748B;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-xp-progress-bar-wrap {
  margin-top: 6px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.profile-xp-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 6px;
}

.xp-track-bar {
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}

.xp-fill-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-brand) 0%, #4F46E5 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Navigasi Tab Profil Segmented */
.profile-tabs-dock {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #F1F5F9;
  overflow-x: auto;
  scrollbar-width: none;
}

.profile-tabs-dock::-webkit-scrollbar {
  display: none;
}

.profile-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748B;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.profile-tab-btn:hover {
  color: #0F172A;
  background: #F8FAFC;
}

.profile-tab-btn.active {
  color: var(--color-brand);
  background: #EFF6FF;
  border-color: #BFDBFE;
  font-weight: 700;
}

/* Tab Panes */
.profile-tab-pane {
  display: none;
}

.profile-tab-pane.active {
  display: block;
}

/* 2. Grid Statistik Metrik */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.stat-box-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.stat-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-box-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748B;
}

.stat-box-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-box-val {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.2;
}

.stat-box-sub {
  font-size: 0.73rem;
  color: #64748B;
  margin-top: 4px;
}

/* Profile Card Umum */
.profile-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.profile-card-header {
  padding: 14px 18px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Riwayat Aktivitas Submisi */
.profile-activity-list {
  display: flex;
  flex-direction: column;
}

.profile-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #F1F5F9;
  gap: 12px;
  flex-wrap: wrap;
}

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

.profile-activity-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.activity-lang-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  background: #EEF2FF;
  color: #4338CA;
  border: 1px solid #C7D2FE;
  padding: 2px 6px;
  border-radius: 4px;
}

.activity-title-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0F172A;
  text-decoration: none;
}

.activity-title-link:hover {
  color: var(--color-brand);
}

.profile-activity-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
}

.activity-metrics {
  color: #64748B;
  font-family: var(--font-mono);
}

.activity-status-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.status-pill-passed {
  background: #DCFCE7;
  color: #15803D;
}

.status-pill-failed {
  background: #FFE4E6;
  color: #BE123C;
}

.status-pill-violation {
  background: #FEF3C7;
  color: #92400E;
}

.activity-time {
  color: #94A3B8;
  font-size: 0.72rem;
}

/* 3. Selector Avatar Preset */
.avatar-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid #F1F5F9;
  overflow-x: auto;
  scrollbar-width: none;
}

.avatar-filter-chip {
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.avatar-filter-chip:hover {
  background: #E2E8F0;
  color: #0F172A;
}

.avatar-filter-chip.active {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: var(--color-brand);
  font-weight: 700;
}

.avatar-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 18px;
  max-height: 480px;
  overflow-y: auto;
}

.avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px;
  background: #FAFAFD;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.avatar-card:hover {
  border-color: #93C5FD;
  background: #F0FDF4;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.avatar-card.is-selected {
  border-color: var(--color-brand);
  background: #EFF6FF;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.avatar-preview-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.avatar-check-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 2px solid #FFFFFF;
  display: none;
  align-items: center;
  justify-content: center;
}

.avatar-card.is-selected .avatar-check-badge {
  display: flex;
}

.avatar-label-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0F172A;
  text-align: center;
  margin-bottom: 2px;
}

.avatar-category-tag {
  font-size: 0.65rem;
  color: #64748B;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

.avatar-action-bar {
  padding: 14px 18px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.avatar-current-hint {
  font-size: 0.8rem;
  color: #334155;
}

/* 4. Showcase Lencana (Badges Grid) */
.badges-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 18px;
}

.badge-item-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  transition: all 0.2s ease;
}

.badge-item-card.is-unlocked {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.badge-item-card.is-unlocked.tier-bronze {
  border-left: 4px solid #D97706;
}
.badge-item-card.is-unlocked.tier-bronze .badge-icon-shield {
  background: #FEF3C7;
  color: #B45309;
}

.badge-item-card.is-unlocked.tier-silver {
  border-left: 4px solid #64748B;
}
.badge-item-card.is-unlocked.tier-silver .badge-icon-shield {
  background: #F1F5F9;
  color: #475569;
}

.badge-item-card.is-unlocked.tier-gold {
  border-left: 4px solid #EAB308;
}
.badge-item-card.is-unlocked.tier-gold .badge-icon-shield {
  background: #FEF9C3;
  color: #A16207;
}

.badge-item-card.is-unlocked.tier-platinum {
  border-left: 4px solid #6366F1;
}
.badge-item-card.is-unlocked.tier-platinum .badge-icon-shield {
  background: #EEF2FF;
  color: #4338CA;
}

.badge-item-card.is-locked {
  background: #F8FAFC;
  opacity: 0.65;
  border-style: dashed;
}

.badge-item-card.is-locked .badge-icon-shield {
  background: #E2E8F0;
  color: #94A3B8;
}

.badge-icon-shield {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-item-content {
  flex: 1;
  min-width: 0;
}

.badge-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.badge-title-text {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0F172A;
}

.badge-status-pill {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.pill-unlocked {
  background: #DCFCE7;
  color: #15803D;
}

.pill-locked {
  background: #F1F5F9;
  color: #64748B;
}

.badge-desc-text {
  font-size: 0.75rem;
  color: #475569;
  line-height: 1.45;
  margin: 0 0 6px 0;
}

.badge-req-hint {
  font-size: 0.7rem;
  color: #64748B;
  background: rgba(0, 0, 0, 0.02);
  padding: 3px 6px;
  border-radius: 4px;
}

/* 5. Form Keamanan & Ganti Password */
.form-group-security {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.security-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0F172A;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.security-input {
  width: 100%;
  padding: 10px 38px 10px 12px;
  font-size: 0.84rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #FAFAFD;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.security-input:focus {
  border-color: var(--color-brand);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #64748B;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-eye:hover {
  color: #0F172A;
}

.security-tips-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.75rem;
}

/* Topbar User Badge Chip */
.topbar-user-badge-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 4px;
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  text-decoration: none;
  color: #1E293B;
  font-size: 0.76rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.topbar-user-badge-link:hover {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: var(--color-brand);
}

.topbar-user-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   RESPONSIVE MOBILE & WEBAPP TUNING (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .profile-hero-card {
    padding: 16px;
  }

  .profile-hero-main {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  .profile-badges-strip {
    justify-content: center;
  }

  .profile-meta-text {
    justify-content: center;
  }

  .profile-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-box-card {
    padding: 12px;
  }

  .stat-box-val {
    font-size: 1.3rem;
  }

  .avatar-selector-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    padding: 12px;
  }

  .avatar-card {
    padding: 10px 6px;
  }

  .avatar-card .avatar-svg {
    width: 48px !important;
    height: 48px !important;
  }

  .badges-showcase-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .topbar-user-name {
    display: none;
  }

  .topbar-user-badge-link {
    padding: 2px;
    border-radius: 50%;
  }
}

@media (max-width: 480px) {
  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-tab-btn span {
    font-size: 0.74rem;
  }

  .profile-tab-btn {
    padding: 6px 10px;
  }
}


