/* Reusable components ----------------------------------------------------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; border:none; border-radius: var(--radius-sm); padding: 11px 20px; font-weight:700; font-size: 14.5px; background: var(--blue); color:#fff; transition: transform .08s ease, opacity .15s ease; }
.btn:hover{ opacity:.92; }
.btn:active{ transform: translateY(1px); }
.btn.secondary{ background: var(--surface-2); color: var(--ink); }
.btn.ghost{ background: transparent; color: var(--blue); padding: 11px 14px; }
.btn.danger{ background: var(--coral-dim); color: var(--coral); }
.btn.small{ padding: 7px 14px; font-size: 13px; }
.btn:disabled{ opacity:.55; cursor:not-allowed; }
.btn.full{ width:100%; }

.field{ display:flex; flex-direction:column; gap:6px; margin-bottom: 14px; }
.field label{ font-size: 13px; font-weight:700; color: var(--ink-soft); }
.field input, .field select, .field textarea{
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; background: var(--surface);
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color: var(--blue); }
.field textarea{ resize: vertical; min-height: 84px; }

.pill{ display:inline-flex; align-items:center; gap:6px; padding: 5px 12px; border-radius:999px; font-size:12.5px; font-weight:700; background: #fff; border:1px solid var(--line); color: var(--ink-soft); }
.pill.amber{ background: #fff; border-color:#E8D8B8; color:#95600D; }
.pill.mint{ background: var(--mint-dim); color: var(--mint); }

.stat{ display:flex; align-items:center; gap:14px; }
.stat-icon{ width:44px; height:44px; border-radius: 13px; display:grid; place-items:center; flex:none; }
.stat h3{ font-size: 24px; }
.stat .label{ color: var(--ink-soft); font-size: 12.5px; font-weight:600; }

.progress-track{ height:9px; background: var(--surface-2); border-radius:999px; overflow:hidden; }
.progress-fill{ height:100%; background: var(--blue); border-radius:999px; transition: width .4s ease; }

.list-row{ display:flex; align-items:center; gap:14px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.list-row:last-child{ border-bottom:none; }
.list-row .grow{ flex:1; min-width:0; }
.list-row b{ display:block; font-size:14.5px; }
.list-row .muted{ color: var(--ink-soft); font-size:12.5px; margin-top:2px; }

.badge-icon{ width:40px; height:40px; border-radius:12px; display:grid; place-items:center; flex:none; }

.empty{ text-align:center; padding: 40px 20px; color: var(--ink-soft); }
.empty img{ width:96px; margin: 0 auto 14px; opacity:.9; }

.toast-stack{ position:fixed; right:18px; bottom:18px; display:flex; flex-direction:column; gap:8px; z-index:50; }
.toast{ background: var(--ink); color:#fff; padding: 12px 16px; border-radius: var(--radius-sm); font-size:13.5px; font-weight:600; box-shadow: var(--shadow-card); animation: toast-in .18s ease; max-width: 280px; }
.toast.xp{ background: var(--blue); }
.toast.achievement{ background: var(--amber); color:#3b2a02; }
@keyframes toast-in{ from{ opacity:0; transform: translateY(6px);} to{ opacity:1; transform:none;} }

.error-banner{ background: var(--coral-dim); color:#9B2C2C; border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; font-weight:600; margin-bottom: 14px; display:none; }
.error-banner.show{ display:block; }

/* Skeleton loaders (see js/skeleton.js) ---------------------------------- */
.skeleton, .sk{ display:block; background: linear-gradient(90deg, #ECEFED 25%, #F7F9F8 40%, #ECEFED 60%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes shimmer{ 0%{background-position:100% 50%} 100%{background-position:0 50%} }
.sk-page{ width:100%; }
.sk-card{ overflow:hidden; }
.sk-stack{ display:flex; flex-direction:column; gap:10px; min-width:0; }
.sk-inline{ display:flex; align-items:center; gap:14px; min-width:0; }
.sk-wrapable{ flex-wrap:wrap; }
.sk-list-row{ padding:10px 0; border-bottom:1px solid var(--line); }
.sk-list-row:last-child{ border-bottom:none; }
.sk-heading{ margin:0 0 12px; }
.sk-toolbar{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:18px; }
.sk-row{ display:grid; gap:18px; }
.sk-row-2{ grid-template-columns:repeat(2, minmax(0,1fr)); }
.sk-row-4{ grid-template-columns:repeat(4, minmax(0,1fr)); }
.sk-row-7{ grid-template-columns:repeat(7, minmax(0,1fr)); gap:8px; }
.sk-grid{ display:grid; gap:18px; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); }
.sk-dash{ display:grid; grid-template-columns:minmax(0,1fr) minmax(270px,304px); gap:24px; margin-top:24px; align-items:start; }
.sk-col{ display:flex; flex-direction:column; gap:24px; min-width:0; }
.sk-bars{ display:flex; align-items:flex-end; gap:12px; height:150px; }
.sk-bars .sk{ flex:1; }
@media (max-width: 980px){
  .sk-dash{ grid-template-columns:minmax(0,1fr); }
  .sk-row-4{ grid-template-columns:repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px){
  .sk-row-2, .sk-row-4{ grid-template-columns:minmax(0,1fr); }
}

.tabs{ display:flex; gap:4px; background: #fff; padding:0; border-bottom:1px solid var(--line); border-radius:0; width:fit-content; }
.tabs button{ border:none; border-bottom:2px solid transparent; margin-bottom:-1px; background:#fff; padding: 10px 15px; border-radius:0; font-weight:700; font-size:13px; color: var(--ink-soft); white-space:nowrap; }
.tabs button.active{ border-bottom-color:var(--blue); color:var(--ink); box-shadow:none; }

.modal-backdrop{ position:fixed; inset:0; background: rgba(19,27,51,.45); display:flex; align-items:center; justify-content:center; padding:20px; z-index:40; }
.modal{ background:var(--surface); border-radius: var(--radius-lg); padding: 26px; max-width: 480px; width:100%; max-height: 86vh; overflow:auto; }

.scroll-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-to-top:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  background: #f8fafc;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}
.scroll-to-top:active {
  transform: translateY(0);
}
@media (max-width: 980px) {
  .scroll-to-top {
    right: 16px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce){ *{ animation-duration: .001ms !important; transition-duration: .001ms !important; } }
