/* ── aceJUPEB SHARED STYLES ── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600&display=swap');

:root {
  --gold: #E8950A;
  --gold-hover: #D4840A;
  --gold-light: rgba(232,149,10,0.1);
  --gold-border: rgba(232,149,10,0.25);
  --green: #10B981;
  --red: #EF4444;
  --blue: #3B82F6;

  --bg: #F7F5F0;
  --bg-2: #FFFFFF;
  --bg-3: #EDEAE3;
  --surface: #FFFFFF;
  --surface-2: #F3F0EB;
  --surface-3: #EAE7E0;
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.13);

  --text: #111827;
  --text-2: #374151;
  --text-3: #6B7280;
  --text-4: #9CA3AF;

  --shadow-xs: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.07), 0 14px 40px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.09), 0 28px 60px rgba(0,0,0,0.07);
}

[data-theme="dark"] {
  --bg: #0E1520;
  --bg-2: #111B2C;
  --bg-3: #090E18;
  --surface: #152030;
  --surface-2: #1B2A3E;
  --surface-3: #213348;
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);

  --text: #EDF0F4;
  --text-2: #94A3B8;
  --text-3: #64748B;
  --text-4: #475569;

  --shadow-xs: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 6px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { font-family: 'Plus Jakarta Sans', sans-serif; }
.sora, h1, h2, h3, h4, h5, .font-display { font-family: 'Sora', sans-serif !important; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); transition: background 0.25s, color 0.25s; overflow-x: hidden; min-height: 100vh; }

/* ── BUTTONS ── */
.btn-gold {
  background: linear-gradient(135deg, #F0A020, var(--gold));
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 12px rgba(232,149,10,0.3);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(232,149,10,0.45); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-light); }

.btn-danger {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.18);
  color: #EF4444;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.14); }

/* ── INPUTS ── */
.input {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.875rem;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,149,10,0.1); }
.input::placeholder { color: var(--text-4); }
select.input option { background: var(--surface); color: var(--text); }
textarea.input { resize: vertical; min-height: 80px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card-hover:hover { transform: translateY(-3px); border-color: var(--gold-border); }

/* ── NAV SHARED ── */
/* MODALS (shared) */
.ui-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  backdrop-filter: blur(3px);
}

.ui-modal-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 16px 16px;
}

.ui-confirm-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ui-confirm-ic {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  font-size: 1.15rem;
  flex-shrink: 0;
  user-select: none;
}

.ui-confirm-title {
  font-family: 'Sora', sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.ui-confirm-msg {
  color: var(--text-3);
  font-size: 0.9rem;
  line-height: 1.6;
}

.ui-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.ui-confirm-actions button {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.app-nav {
  background: rgba(247,245,240,0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.25s;
}
[data-theme="dark"] .app-nav { background: rgba(14,21,32,0.88); }
.app-nav-inner { max-width: 100%; padding: 0 20px; height: 60px; display: flex; align-items: center; justify-content: space-between; }

/* Logo */
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-name { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1rem; color: var(--text); }
.logo-name span { color: var(--gold); }

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); }

/* ── SIDEBAR ── */
.sidebar {
  width: 230px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 40;
  transition: transform 0.3s ease, background 0.25s;
  display: flex;
  flex-direction: column;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 35;
  backdrop-filter: blur(2px);
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-3);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
}
.sidebar-nav-item:hover { background: var(--surface-2); color: var(--text-2); }
.sidebar-nav-item.active { background: var(--gold-light); color: var(--gold); border: 1px solid var(--gold-border); font-weight: 600; }
.sidebar-nav-item.active svg { color: var(--gold); }

/* ── PROGRESS BAR ── */
.pbar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }

/* ── TAGS ── */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tag-gold { background: var(--gold-light); border: 1px solid var(--gold-border); color: var(--gold); }
.tag-blue { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #3B82F6; }
.tag-green { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: #10B981; }
.tag-red { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #EF4444; }

/* ── STREAK BADGE ── */
.streak-badge { background: rgba(232,149,10,0.1); border: 1.5px solid var(--gold-border); border-radius: 100px; padding: 4px 12px; display: inline-flex; align-items: center; gap: 5px; color: var(--gold); font-weight: 700; font-size: 0.875rem; }

/* ── STAT CARD ── */
.stat-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-xs); }
.stat-num { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 1.75rem; color: var(--text); letter-spacing: -0.03em; }
.stat-label { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.fade-up { animation: fadeUp 0.5s ease both; }
.d1 { animation-delay: 0.08s; }
.d2 { animation-delay: 0.18s; }
.d3 { animation-delay: 0.28s; }
.d4 { animation-delay: 0.38s; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ── ACE AI WIDGET ── */
body.ace-ai-open { overflow: hidden; }
.ace-ai-fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  background: linear-gradient(135deg, rgba(232,149,10,0.16), rgba(232,149,10,0.06));
  box-shadow: var(--shadow-md);
  cursor: pointer;
  color: var(--text);
  display: grid;
  place-items: center;
  z-index: 99998;
  user-select: none;
  touch-action: none;
}
.ace-ai-fab:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.ace-ai-fab-ic { font-size: 1.15rem; }
.ace-ai-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
  background: rgba(0,0,0,0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 99997;
}
.ace-ai-overlay.open { display: flex; }
.ace-ai-panel{
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 32px);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ace-ai-head{
  padding: 14px 14px 12px;
  border-bottom: 1.5px solid var(--border);
  background: linear-gradient(135deg, rgba(232,149,10,0.10), transparent);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.ace-ai-title{ font-family:'Sora',sans-serif; font-weight: 900; letter-spacing:-0.02em; font-size: 1rem; }
.ace-ai-sub{ font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }
.ace-ai-head-btns{ display:flex; gap:8px; }
.ace-ai-ghost{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-2);
}
.ace-ai-ghost:hover{ border-color: var(--gold); color: var(--gold); background: var(--gold-light); }
.ace-ai-msgs{
  flex: 1;
  padding: 14px;
  overflow: auto;
  background: var(--bg-2);
}
.ace-ai-msg{ display:flex; margin-bottom: 10px; }
.ace-ai-user{ justify-content: flex-end; }
.ace-ai-assistant{ justify-content: flex-start; }
.ace-ai-bubble{
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: normal;
  word-break: break-word;
}
.ace-ai-user .ace-ai-bubble{
  background: linear-gradient(135deg, rgba(232,149,10,0.18), rgba(232,149,10,0.06));
  border-color: rgba(232,149,10,0.22);
}
.ace-ai-typing{ color: var(--text-3); font-style: italic; }
.ace-ai-foot{
  padding: 12px;
  border-top: 1.5px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ace-ai-in{
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 38px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  padding: 9px 10px;
  font-size: 0.9rem;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.ace-ai-in:focus{ border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,149,10,0.10); }
.ace-ai-send{
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #F0A020, var(--gold));
  color: #fff;
  font-weight: 800;
  font-family:'Sora',sans-serif;
}
.ace-ai-send:disabled{ opacity: 0.6; cursor: not-allowed; }
.ace-ai-note{
  padding: 8px 12px 12px;
  font-size: 0.72rem;
  color: var(--text-4);
  background: var(--surface);
}
@media(max-width:640px){
  .ace-ai-overlay{ align-items: flex-end; justify-content: stretch; padding: 10px; }
  .ace-ai-panel{
    width: 100%;
    height: min(560px, calc(100vh - 20px));
    border-radius: 18px;
  }
  .ace-ai-fab{ right: 14px; bottom: 14px; border-radius: 16px; }
}

/* ── ACHIEVEMENTS ── */
.ace-ach-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-top:12px; }
@media(max-width:640px){ .ace-ach-grid{ grid-template-columns:1fr; } }
.ace-ach-badge{
  display:flex; gap:10px; align-items:flex-start;
  border:1.5px solid var(--border);
  border-radius:14px;
  padding:12px 12px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.ace-ach-badge-ic{
  width:36px;height:36px;border-radius:14px;
  display:grid;place-items:center;
  background: rgba(232,149,10,0.10);
  border:1.5px solid rgba(232,149,10,0.22);
  color: var(--gold);
  flex-shrink:0;
  font-size:1.05rem;
}
.ace-ach-badge-title{ font-family:'Sora',sans-serif; font-weight:900; letter-spacing:-0.02em; font-size:0.92rem; color:var(--text); }
.ace-ach-badge-desc{ margin-top:3px; font-size:0.78rem; color:var(--text-3); line-height:1.45; }
.ace-ach-badge-ok,.ace-ach-badge-lock{
  margin-left:auto; flex-shrink:0;
  width:26px;height:26px;border-radius:10px;
  display:grid;place-items:center;
  font-weight:900;
  border:1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-3);
}
.ace-ach-badge.unlocked .ace-ach-badge-ok{
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.22);
  color: #059669;
}
.ace-ach-badge.locked{ opacity:0.72; }

.ace-ach-overlay{
  position:fixed; inset:0;
  display:none; align-items:flex-start; justify-content:center;
  padding:22px;
  z-index: 99996;
  background: rgba(0,0,0,0.22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.ace-ach-overlay.open{ display:flex; animation: aceAchFade 0.18s ease both; }
.ace-ach-card{
  width: min(560px, calc(100vw - 44px));
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(232,149,10,0.16), rgba(232,149,10,0.06));
  border: 1.5px solid rgba(232,149,10,0.25);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 14px 14px;
  display:flex; gap:12px; align-items:flex-start;
  position: relative;
  transform-origin: top center;
  animation: aceAchPop 0.22s ease both;
}
.ace-ach-ic{
  width:44px;height:44px;border-radius:16px;
  display:grid; place-items:center;
  background: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(0,0,0,0.06);
  font-size: 1.3rem;
  flex-shrink:0;
}
[data-theme="dark"] .ace-ach-ic{
  background: rgba(21,32,48,0.6);
  border-color: rgba(255,255,255,0.10);
}
.ace-ach-kicker{ font-size:0.72rem; font-weight:900; letter-spacing:0.08em; text-transform:uppercase; color: var(--gold); }
.ace-ach-title{ font-family:'Sora',sans-serif; font-weight:900; font-size:1.05rem; letter-spacing:-0.02em; color: var(--text); margin-top:2px; }
.ace-ach-desc{ margin-top:6px; color: var(--text-2); font-size:0.9rem; line-height:1.55; }
.ace-ach-x{
  position:absolute; top:10px; right:10px;
  width:34px;height:34px;border-radius:12px;
  border:1.5px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.65);
  cursor:pointer;
  color: var(--text-2);
}
[data-theme="dark"] .ace-ach-x{ border-color: rgba(255,255,255,0.10); background: rgba(21,32,48,0.55); }
.ace-ach-x:hover{ border-color: rgba(232,149,10,0.35); color: var(--gold); }
@keyframes aceAchPop{ from{ transform: translateY(-8px) scale(0.98); opacity:0.0; } to{ transform: translateY(0) scale(1); opacity:1; } }
@keyframes aceAchFade{ from{ opacity:0; } to{ opacity:1; } }
