:root {
  --amber: #f59e0b; --amber-d: #d97706; --cream: #fffbeb; --card: #ffffff;
  --ink: #292524; --muted: #78716c; --green: #16a34a; --red: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', system-ui, sans-serif;
  background: var(--cream); color: var(--ink);
  background-image: radial-gradient(#fde68a44 1px, transparent 1px); background-size: 22px 22px;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px; background: linear-gradient(90deg, var(--amber), var(--amber-d));
  color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 8px #0002;
}
.brand { font-size: 22px; font-weight: bold; }
.logo { font-size: 28px; }
.top-stats { display: flex; gap: 8px; }
.pill { background: #ffffff33; border-radius: 999px; padding: 4px 12px; font-weight: bold; font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; flex-wrap: wrap; }
.tab {
  border: none; background: #fde68a; padding: 10px 16px; border-radius: 14px 14px 0 0;
  font-family: inherit; font-weight: bold; font-size: 15px; cursor: pointer; color: #92400e;
}
.tab.active { background: #fff; color: var(--ink); }
main { max-width: 860px; margin: 0 auto; padding: 14px; }
.view { display: none; }
.view.active { display: block; }
.card {
  background: var(--card); border-radius: 18px; padding: 16px 20px; margin-bottom: 14px;
  box-shadow: 0 3px 10px #00000012; border: 2px solid #fde68a;
}
.card h3 { margin-top: 0; }
.hero { display: flex; gap: 16px; align-items: center; background: linear-gradient(120deg, #fff, #fef3c7); }
.hero-mascot { font-size: 56px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.big-num { font-size: 44px; font-weight: bold; color: var(--amber-d); }
.progress { background: #fde68a; border-radius: 999px; height: 22px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--amber), var(--amber-d)); height: 100%; width: 0%; transition: width .6s; border-radius: 999px; }
.btn {
  background: linear-gradient(180deg, var(--amber), var(--amber-d)); color: #fff; border: none;
  padding: 10px 18px; border-radius: 12px; font-family: inherit; font-weight: bold; font-size: 15px;
  cursor: pointer; box-shadow: 0 2px 0 #92400e;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.big { font-size: 18px; padding: 14px 22px; width: 100%; margin-top: 10px; }
.btn.secondary { background: linear-gradient(180deg, #a8a29e, #78716c); box-shadow: 0 2px 0 #57534c; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  background: #fef3c7; border: 2px solid var(--amber); border-radius: 12px; padding: 6px 10px;
  font-size: 13px; text-align: center; min-width: 76px;
}
.badge .b-emoji { font-size: 24px; display: block; }
.badge.locked { opacity: .35; filter: grayscale(1); }
.ws-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border: 2px solid #fde68a;
  border-radius: 14px; margin: 10px 0; flex-wrap: wrap; background: #fffdf5;
}
.ws-item .grow { flex: 1; min-width: 180px; }
.status-chip { border-radius: 999px; padding: 3px 12px; font-size: 12.5px; font-weight: bold; }
.status-ready { background: #dcfce7; color: #166534; }
.status-graded { background: #dbeafe; color: #1e40af; }
.score-chip { background: #fef9c3; color: #854d0e; border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: bold; }
.agent-feed { max-height: 260px; overflow-y: auto; font-size: 13.5px; }
.feed-row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #fde68a; }
.feed-row .t { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
select, input {
  font-family: inherit; font-size: 15px; padding: 8px 10px; border-radius: 10px;
  border: 2px solid #fde68a; background: #fffdf5; width: 100%; margin-top: 4px;
}
.form label { display: block; margin-bottom: 12px; font-weight: bold; font-size: 14.5px; }
.ok-note { color: var(--green); font-weight: bold; margin-left: 10px; }
.how li { margin: 6px 0; }
.upload-area {
  border: 3px dashed var(--amber); border-radius: 16px; padding: 18px; text-align: center;
  margin: 12px 0; background: #fffdf5; cursor: pointer; position: relative;
}
.upload-area input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-hint { font-size: 16px; }
.thumbs { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.thumbs img { height: 90px; border-radius: 10px; border: 2px solid var(--amber); }
.modal {
  position: fixed; inset: 0; background: #00000088; display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 20px; padding: 22px 26px; max-width: 560px; width: 100%;
  max-height: 85vh; overflow-y: auto; border: 3px solid var(--amber);
}
.job-steps { font-size: 14px; margin: 10px 0; }
.job-step { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #fde68a; animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.spinner {
  width: 34px; height: 34px; border: 4px solid #fde68a; border-top-color: var(--amber-d);
  border-radius: 50%; margin: 10px auto; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.done { display: none; }
.result-hero { text-align: center; }
.result-hero .stars { font-size: 44px; letter-spacing: 6px; }
.result-hero .score { font-size: 52px; font-weight: bold; color: var(--amber-d); }
.encouragement { background: #fef3c7; border-radius: 14px; padding: 12px 16px; font-size: 16px; border: 2px solid var(--amber); }
table.items { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.items td, table.items th { padding: 6px 8px; border-bottom: 1px solid #fde68a; text-align: left; vertical-align: top; }
.v-correct { color: var(--green); font-weight: bold; }
.v-partial { color: #ca8a04; font-weight: bold; }
.v-wrong, .v-blank { color: var(--red); font-weight: bold; }
.skill-row { margin: 8px 0; }
.skill-row .bar { background: #f5f5f4; border-radius: 8px; height: 16px; overflow: hidden; }
.skill-row .bar > div { height: 100%; border-radius: 8px; }
.vocab-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #fde68a; font-size: 14px; flex-wrap: wrap; }
.vocab-row .word { font-weight: bold; min-width: 110px; }
.vocab-row .mastery { flex: 1; min-width: 100px; background: #f5f5f4; border-radius: 8px; height: 12px; overflow: hidden; }
.vocab-row .mastery > div { height: 100%; }
.mastery-chip { font-size: 11.5px; border-radius: 999px; padding: 2px 8px; font-weight: bold; }
.m-mastered { background: #dcfce7; color: #166534; }
.m-review { background: #dbeafe; color: #1e40af; }
.m-learning { background: #fef9c3; color: #854d0e; }
.m-new { background: #f5f5f4; color: #57534e; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; }
.stat-card { text-align: center; }
.stat-card .big-num { font-size: 34px; }
.day-dots { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.day-dot { width: 18px; height: 18px; border-radius: 5px; background: #f5f5f4; font-size: 9px; display: flex; align-items: center; justify-content: center; color: #a8a29e; }
.day-dot.active { background: var(--amber); color: #fff; }
