/* === Base === */
a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }

/* === PDF viewer === */
.pdf-frame {
  background: var(--white);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: 900px;
}
.pdf-frame iframe { width: 100%; height: 80vh; border: 0; display: block; }

/* === Layout === */
.app-body { display: block; } /* mobile default */
.sidebar { display: none; }
.m-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }

@media (min-width: 900px) {
  .app-body { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; background: var(--teal); color: var(--cream); padding: 24px 18px 22px; }
  .m-header { display: none; }
  .drawer { display: none !important; }
}

/* === Sidebar decoration === */
.sidebar {
  position: relative;
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -40px;
  width: 170px; height: 170px;
  background-image: radial-gradient(circle at 30% 30%, rgba(244,196,66,0.22) 0 18%, transparent 19%),
                    radial-gradient(circle at 70% 60%, rgba(134,190,74,0.22) 0 22%, transparent 23%);
  pointer-events: none;
}

/* === Logo === */
.logo-wrap {
  padding: 6px 6px 2px;
  position: relative;
  z-index: 1;
}
.logo-word {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.5px;
  line-height: 1;
}
.logo-word .A { color: var(--yellow); }
.logo-word .N { color: var(--orange); }
.logo-word .T { color: var(--green); }
.logo-word .rest { color: var(--cream); margin-left: 8px; font-weight: 600; letter-spacing: -0.3px; }
.logo-sub {
  padding: 10px 6px 0;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(243,237,224,0.5);
  font-weight: 700;
  margin-bottom: 30px;
  position: relative; z-index: 1;
}

/* Mobile logo */
.m-logo {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.3px;
  line-height: 1;
}
.m-logo .A { color: var(--yellow); }
.m-logo .N { color: var(--orange); }
.m-logo .T { color: var(--green); }
.m-logo .rest { color: var(--teal); margin-left: 6px; font-weight: 700; }

/* === Sidebar nav === */
.nav { list-style: none; display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 1; }
.nav li {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--r-md);
  font-size: 15px;
  color: rgba(243,237,224,0.85);
  font-weight: 600;
}
.nav li a {
  display: block;
  padding: 13px 14px;
  border-radius: var(--r-md);
  font-size: 15px;
  color: rgba(243,237,224,0.85);
  text-decoration: none;
  font-weight: 600;
  width: 100%;
}
.nav li:hover { background: rgba(255,255,255,0.04); }
.nav li.active a { background: var(--cream); color: var(--teal); font-weight: 700; box-shadow: var(--shadow-sm); }
.nav li[data-color="orange"].active a { color: var(--orange-dark); }
.nav li[data-color="green"].active a { color: var(--green-dark); }
.nav li[data-color="yellow"].active a { color: #9A7B0F; }
.nav-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(243,237,224,0.5);
  font-weight: 700;
  padding: 14px 12px 10px;
  position: relative; z-index: 1;
}
.side-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative; z-index: 1;
}
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  border: 2px solid var(--cream);
}
.who { font-size: 15px; font-weight: 700; color: var(--cream); }

/* === Main content === */
.main {
  padding: 28px 40px 40px;
  position: relative;
  overflow-x: hidden;
}
.main::after {
  content: "";
  position: absolute;
  bottom: -30px;
  right: -40px;
  width: 320px; height: 160px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 200'><path d='M5,100 Q70,20 140,100 T270,100 T400,100' stroke='%23F4C442' stroke-width='6' fill='none' stroke-linecap='round'/><path d='M5,150 Q80,65 160,145 T290,145 T410,145' stroke='%2386BE4A' stroke-width='6' fill='none' stroke-linecap='round'/><path d='M20,60 Q100,15 170,60 T290,60 T395,55' stroke='%23E5733A' stroke-width='6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}
@media (max-width: 899px) { .main { padding: 18px 18px 32px; } }

/* === Top row (greet pill + tests meter) === */
.top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; position: relative; z-index: 2; }
.greet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green-light);
  color: var(--green-dark);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.greet-pill::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(134,190,74,0.25);
}
.tests-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 700;
  color: var(--teal);
  box-shadow: var(--shadow-sm);
}
.tests-left .bar { width: 68px; height: 8px; border-radius: var(--r-pill); background: var(--cream); overflow: hidden; position: relative; }
.tests-left .fill { position: absolute; inset: 0; background: linear-gradient(90deg, var(--green), var(--green-dark)); border-radius: var(--r-pill); }

/* === Hamburger button (mobile header) === */
.hamburger {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  padding: 0;
}
.hamburger span { width: 18px; height: 2px; background: var(--teal); border-radius: 2px; }
.avatar-m {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  box-shadow: var(--shadow-sm);
}

/* === Drawer (mobile only) === */
.drawer {
  position: fixed; inset: 0;
  background: var(--teal);
  color: var(--cream);
  padding: 22px 18px 20px;
  display: flex; flex-direction: column;
  z-index: 21;
}
.drawer[hidden] { display: none; }
.drawer-close {
  position: absolute; right: 14px; top: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--cream);
  font-size: 22px;
  border: 0;
}
.drawer-sub { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: rgba(243,237,224,0.5); font-weight: 700; margin: 6px 0 24px; padding: 0 6px; }
.d-group { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: rgba(243,237,224,0.5); font-weight: 700; padding: 12px 10px 6px; }
.d-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.d-nav a, .d-nav .d-logout {
  display: block; padding: 12px; border-radius: var(--r-md);
  font-size: 15px; color: rgba(243,237,224,0.88); text-decoration: none; font-weight: 600;
  background: transparent; border: 0; width: 100%; text-align: left;
}

/* === Hero section === */
.hero {
  position: relative; z-index: 2;
  max-width: 620px;
  margin-bottom: 30px;
}
.hero h1 {
  font-size: 44px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -0.5px;
}
.hero h1 .accent { color: var(--orange); }
.hero p {
  margin-top: 14px;
  font-size: 16px;
  color: var(--ink-light);
  max-width: 520px;
  line-height: 1.55;
}
@media (max-width: 899px) {
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 13px; }
}

/* === Quick-row tiles === */
.quick-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
  position: relative; z-index: 2;
}
@media (max-width: 899px) {
  .quick-row { grid-template-columns: 1fr; }
}
.tile {
  border-radius: var(--r-lg);
  padding: 26px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 170px;
}
.tile.primary {
  background: linear-gradient(135deg, var(--orange) 0%, #EE8A4D 100%);
  color: var(--white);
  box-shadow: var(--shadow-md);
}
.tile.primary h3 { color: var(--white); }
.tile.secondary {
  background: var(--white);
  border: 1px solid var(--line-soft);
  color: var(--teal);
  box-shadow: var(--shadow-sm);
}
.tile h3 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.15;
  margin-bottom: 8px;
}
.tile p {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.95;
  max-width: 300px;
}
.tile.secondary p { color: var(--ink-light); opacity: 1; }
.tile .subject-chips { display: flex; gap: 6px; margin-top: 14px; }
.tile.primary::after {
  content: "";
  position: absolute;
  left: -30px; bottom: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.tile .chev {
  position: absolute; right: 24px; bottom: 22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--white);
  color: var(--orange);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}
.tile.secondary .chev { background: var(--green); color: var(--white); box-shadow: 0 6px 14px rgba(134,190,74,0.4); }

/* === Chips === */
.chip {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--r-pill);
}
.tile.secondary .chip { background: var(--cream); border-color: var(--line); color: var(--teal); }

/* === Section header === */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  position: relative; z-index: 2;
}
.section-head h2 { font-size: 22px; font-weight: 800; color: var(--teal); letter-spacing: -0.3px; }
.section-head a { font-size: 13px; color: var(--orange-dark); font-weight: 700; text-decoration: none; }

/* === Card list (recent papers) === */
.card-list {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 2;
}
.row {
  display: grid;
  grid-template-columns: 52px 1.8fr auto auto auto;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.row:last-child { border-bottom: 0; }
@media (max-width: 899px) {
  .row { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 14px 16px; }
  .row .meta, .row .tag { display: none; }
}
.row .blob {
  width: 48px; height: 48px;
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--white); font-size: 18px;
}
.row .blob.o, .row .blob.m { background: var(--orange); }
.row .blob.g, .row .blob.e { background: var(--green); }
.row .blob.y, .row .blob.r { background: var(--yellow); color: var(--teal); }
.row .ti { font-weight: 800; color: var(--teal); font-size: 17px; letter-spacing: -0.2px; }
.row .sub { color: var(--ink-light); font-size: 13px; margin-top: 3px; }
.row .meta { color: var(--ink-light); font-size: 13px; font-weight: 600; }

/* === Tags === */
.tag {
  font-size: 11px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  letter-spacing: 0.3px;
}
.tag.five { background: var(--yellow-light); color: #9A7B0F; }
.tag.eleven { background: var(--teal); color: var(--cream); }

/* === Small button === */
.btn-sm {
  background: var(--cream);
  color: var(--teal);
  border: 1.5px solid var(--line);
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-sm:hover { background: var(--cream-warm); }

/* === Ghost button === */
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  cursor: pointer;
}

/* === Mobile list (m-list) === */
.m-list {
  background: var(--white);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 2;
}
.m-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.m-row:last-child { border-bottom: 0; }

/* === Auth pages === */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--cream);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: "";
  position: absolute;
  right: -60px; bottom: -60px;
  width: 420px; height: 200px;
  background: url("/static/img/squiggle.svg") no-repeat;
  opacity: 0.25;
}
.auth-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  width: 100%;
}
.auth-card h1 { font-size: 26px; font-weight: 800; color: var(--teal); margin: 20px 0 18px; }
.auth-card label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-light); margin-bottom: 12px; }
.auth-card input {
  width: 100%;
  padding: 12px 14px;
  margin-top: 4px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--cream-warm);
  font-size: 16px;
}
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--orange), #EE8A4D);
  color: var(--white);
  border: 0;
  border-radius: var(--r-md);
  padding: 14px;
  font-weight: 800;
  font-size: 16px;
  margin-top: 8px;
}
.auth-foot { text-align: center; margin-top: 20px; }
.auth-foot a { color: var(--orange-dark); font-weight: 700; text-decoration: none; }
.error { background: #FEF2F2; color: #B91C1C; padding: 10px 14px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 14px; }

/* === Make-a-test form === */
.make-form fieldset { border: 0; margin-bottom: 22px; }
.make-form legend { font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.6px; color: var(--ink-light); margin-bottom: 10px; }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 10px 18px; border: 1.5px solid var(--line); background: var(--white); color: var(--teal); border-radius: var(--r-pill); font-size: 16px; font-weight: 700; cursor: pointer; }
.pill input { display: none; }
.pill:has(input:checked) { border-color: var(--orange); background: var(--orange-light); color: var(--orange-dark); border-width: 2px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt { padding: 6px 11px; border-radius: var(--r-pill); background: var(--cream-warm); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--teal); cursor: pointer; }
.chip-opt input { display: none; }
.chip-opt:has(input:checked) { background: var(--green-light); color: var(--green-dark); border-color: var(--green); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--cream); border-top-color: var(--orange); border-radius: 50%; display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Settings page === */
.form-card { background: var(--white); border-radius: var(--r-lg); padding: 28px; border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); max-width: 560px; }
.form-card h2 { font-size: 18px; font-weight: 800; color: var(--teal); margin-bottom: 14px; }
.form-card label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-light); margin-bottom: 14px; }
.form-card input { width: 100%; padding: 12px 14px; margin-top: 4px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--cream-warm); font-size: 16px; }
.success { background: var(--green-light); color: var(--green-dark); padding: 10px 14px; border-radius: var(--r-md); font-weight: 700; font-size: 14px; }

/* === Help & FAQ === */
.faq h3 { font-size: 18px; font-weight: 800; color: var(--teal); margin: 24px 0 8px; }
.faq p { color: var(--ink); max-width: 620px; margin-bottom: 6px; }
