@font-face{
  font-family:"VelaSans";
  src:url("../assets/fonts/VelaSans-Regular.ttf") format("truetype");
  font-weight:400;
  font-style:normal;
  font-display:swap;
}

:root{
  --text:#0e0e0e;
  --muted:#6b7280;
  --border:#d6d8de;
  --border2:#e6e7eb;
  --radius:16px;
  --container:1180px;
  --black:#0e0e0e;
  --bg:#fff;
  --soft:#fafafa;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

[hidden]{
  display:none !important;
}

body{
  margin:0;
  font-family:"VelaSans",system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color:var(--text);
  background:var(--bg);
}

a{ color:inherit; }
button{ font:inherit; }
.muted{ color:var(--muted); }

/* Topbar */
.topbar{
  width:min(var(--container), calc(100% - 64px));
  margin:0 auto;
  padding:16px 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}

.topbar__left{
  display:flex;
  align-items:center;
  gap:18px;
}

.backBtn{
  width:36px;
  height:36px;
  border-radius:999px;
  border:1px solid var(--border2);
  background:#fff;
  cursor:pointer;
  font-weight:900;
  font-size:15px;
  flex-shrink:0;
}
.backBtn:hover{ background:var(--soft); }

.topbar__brand{
  display:flex;
  align-items:center;
  gap:16px;
}

.topbar__divider{
  width:1px;
  height:36px;
  background:var(--border2);
  display:block;
}

.topbar__title{
  font-size:22px;
  font-weight:700;
}

.logo{
  height:22px;
  display:block;
}

.nav{
  display:flex;
  gap:18px;
  align-items:center;
}

.nav__link{
  text-decoration:none;
  font-size:12.5px;
  font-weight:800;
  opacity:.9;
}

.nav__link:hover{
  opacity:1;
}

.nav__pill{
  border:1px solid var(--border2);
  border-radius:999px;
  padding:6px 12px;
  background:#fff;
  opacity:1;
}

.nav__pill.is-active{
  border-color:#cfd2da;
}

.topbar__right{
  display:flex;
  align-items:center;
  gap:14px;
}

.iconBtn{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  text-decoration:none;
  font-size:16px;
}

.iconBtn__label{
  font-size:10px;
  font-weight:900;
  opacity:.7;
}

.avatarBtn{
  width:30px;
  height:30px;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--border2);
  display:block;
  background:#f3f4f6;
}

.avatarBtn img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Page */
.page{
  width:min(var(--container), calc(100% - 64px));
  margin:0 auto;
  padding:18px 0 64px;
}

.titleRow{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
}

.title{
  margin:0;
  font-size:26px;
  font-weight:900;
  letter-spacing:-0.02em;
}

.subtitle{
  margin-top:6px;
  font-size:12.5px;
  font-weight:700;
}

.tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.tab{
  height:32px;
  border-radius:999px;
  border:1px solid var(--border2);
  background:#fff;
  font-size:12px;
  font-weight:900;
  padding:0 12px;
  cursor:pointer;
}

.tab:hover{
  background:var(--soft);
}

.tab.is-active{
  border-color:#cfd2da;
  box-shadow:0 0 0 3px rgba(2,2,2,.04);
}

/* Summary panel */
.panel{
  margin-top:18px;
  border:1px solid var(--border2);
  border-radius:16px;
  background:#fff;
  padding:12px;
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:10px;
}

.panel__item{
  border:1px solid var(--border2);
  border-radius:14px;
  padding:12px;
  background:#fff;
}

.panel__num{
  font-size:18px;
  font-weight:900;
}

.panel__label{
  margin-top:6px;
  font-size:11.5px;
  font-weight:800;
}

/* Grid */
.grid{
  margin-top:16px;
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:14px;
}

.card{
  border:1px solid var(--border2);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.card__cover{
  width:100%;
  aspect-ratio:3 / 4;
  background:#eee;
  border-bottom:1px solid var(--border2);
  cursor:pointer;
  overflow:hidden;
}

.card__cover img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.card__body{
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.card__title{
  font-size:12.5px;
  font-weight:900;
  margin:0;
  cursor:pointer;
  line-height:1.25;
}

.card__author{
  font-size:11.5px;
  font-weight:800;
  color:var(--muted);
  text-decoration:none;
  cursor:pointer;
}

.card__author:hover{
  color:#2f3746;
}

.progress{
  margin-top:2px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.progress__bar{
  height:8px;
  border-radius:999px;
  background:#f0f1f4;
  overflow:hidden;
  border:1px solid var(--border2);
}

.progress__fill{
  height:100%;
  width:0%;
  background:#0e0e0e;
}

.progress__meta{
  display:flex;
  justify-content:space-between;
  font-size:10.5px;
  font-weight:800;
  color:#4b5563;
}

.actions{
  margin-top:4px;
  display:flex;
  gap:8px;
}

.btn{
  height:36px;
  border-radius:12px;
  font-weight:900;
  font-size:12px;
  cursor:pointer;
  border:1px solid transparent;
  transition:transform .03s ease, opacity .15s ease, background .15s ease;
  flex:1 1 auto;
}

.btn:active{
  transform:translateY(1px);
}

.btn--dark{
  background:var(--black);
  color:#fff;
  border-color:var(--black);
}

.btn--dark:hover{
  opacity:.92;
}

.btn--light{
  background:#fff;
  border:1px solid var(--border);
  color:#111;
}

.btn--light:hover{
  background:var(--soft);
}

/* Hint */
.hint{
  margin:12px 0 0;
  font-size:12px;
  color:var(--muted);
  min-height:16px;
}

.hint.is-ok{
  color:#0b7a3b;
  font-weight:900;
}

/* Auth gate */
.emptyAuth{
  margin-top:22px;
  display:flex;
  justify-content:center;
}

.emptyAuth__box{
  width:min(520px, 100%);
  border:1px solid var(--border2);
  border-radius:18px;
  padding:18px;
  background:#fff;
}

.emptyAuth__title{
  font-weight:900;
  font-size:14px;
}

.emptyAuth__text{
  margin-top:8px;
  font-size:12.5px;
  font-weight:700;
}

.emptyAuth__box .btn{
  margin-top:14px;
  width:100%;
}

/* Empty library */
.emptyState{
  margin-top:16px;
  display:flex;
  justify-content:center;
}

.emptyState__box{
  width:min(560px, 100%);
  border:1px solid var(--border2);
  border-radius:18px;
  background:#fff;
  padding:20px;
  text-align:center;
}

.emptyState__title{
  font-size:16px;
  font-weight:900;
}

.emptyState__text{
  margin-top:8px;
  font-size:12.5px;
  font-weight:700;
}

.emptyState__box .btn{
  margin-top:14px;
  width:100%;
}

/* Responsive */
@media (max-width: 1100px){
  .grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px){
  .topbar,
  .page{
    width:calc(100% - 32px);
  }

  .titleRow{
    flex-direction:column;
    align-items:flex-start;
  }

  .panel{
    grid-template-columns:repeat(2, 1fr);
  }

  .grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px){
  .grid{
    grid-template-columns:1fr;
  }

  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }

  .topbar__right{
    width:100%;
    justify-content:space-between;
  }
}