:root {
  --bg: #eefaf2;
  --card: #ffffff;
  --ink: #18332b;
  --text: #263d35;
  --muted: #5d7168;
  --primary: #159947;
  --primary-hover: #0f7837;
  --accent: #f5b84b;
  --aqua: #2aa7a5;
  --border: #cce7d6;
  --danger: #b42318;
  --cream: #f7f0dd;
  --sky: #d8f1f2;
  --teal: #109f9b;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Trebuchet MS", "Avenir Next", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body[data-auth-state="signed-in"] {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.38) 0 18%, transparent 18% 100%),
    radial-gradient(circle at 85% 10%, rgba(216, 241, 242, 0.82), transparent 34%),
    linear-gradient(135deg, #68d18f 0%, #9fe1c5 52%, #7bd5b3 100%);
}

body[data-auth-state="signed-in"]::before {
  content: "";
  position: fixed;
  inset: 0 0 auto auto;
  width: min(46vw, 680px);
  height: min(42vw, 560px);
  pointer-events: none;
  opacity: 0.32;
  background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(42, 167, 165, 0.55) 23px 25px, transparent 26px 44px);
}

.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(0, 0.58fr);
  background: #ffffff;
}

.login-panel {
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 4rem);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2rem;
  text-align: center;
}

.login-brand h1,
.topbar h1,
.dashboard h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.05;
}

.login-brand h1 {
  max-width: 7.5em;
  font-size: clamp(3rem, 6vw, 5.6rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: #0f7a3a;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-art {
  min-height: 100vh;
  background: url("https://67913fd0.legacybiology.pages.dev/assets/biology-login-lab.png") center / cover;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.95rem 1.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  background: var(--primary);
  color: white;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: var(--primary-hover);
}

#student-login-btn {
  width: min(100%, 420px);
  justify-self: center;
  font-size: 1.05rem;
}

.secondary-action {
  border: 2px solid rgba(24, 51, 43, 0.12);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.secondary-action:hover,
.secondary-action:focus-visible {
  background: #e3f8ea;
}

.status-message {
  width: min(100%, 420px);
  margin: 0;
  padding: 0.85rem 1rem;
  border-left: 5px solid var(--accent);
  background: #fff9eb;
  text-align: left;
  font-weight: 700;
}

.status-message.error {
  border-color: var(--danger);
  background: #fff4f2;
  color: var(--danger);
}

.topbar {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

body[data-auth-state="signed-in"] .topbar {
  justify-content: flex-end;
}

body[data-auth-state="signed-in"] .topbar h1 {
  display: none;
}

.topbar h1 { font-size: clamp(1.6rem, 2.4vw, 2.5rem); }

main {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

.student-dashboard-page {
  min-height: calc(100vh - 7rem);
}

.dashboard-shell {
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.grade-card {
  justify-self: stretch;
  width: 100%;
  min-width: min(100%, 360px);
  padding: 1.25rem 1.35rem;
  display: grid;
  gap: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(247, 240, 221, 0.88);
  box-shadow: 0 18px 38px rgba(24, 51, 43, 0.14);
}

.grade-label,
.welcome-kicker,
.recommendation-card span,
.skill-list span,
.lesson-label,
.score-summary summary span {
  color: #0c6d48;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grade-value {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  color: var(--ink);
}

.grade-value strong {
  font-size: clamp(4rem, 8vw, 6.8rem);
  line-height: 0.9;
}

.grade-value span {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
}

.score-summary {
  margin-top: 0.7rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(24, 51, 43, 0.14);
}

.score-summary summary {
  min-height: 2.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
  border: 1px solid #d6eee8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.score-summary summary::-webkit-details-marker {
  display: none;
}

.score-summary summary::before {
  content: "+";
  width: 1.45rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  grid-column: 1;
  grid-row: 1;
  border-radius: 999px;
  background: var(--sky);
  color: #075b63;
  font-weight: 900;
}

.score-summary[open] summary::before {
  content: "−";
}

.score-summary summary span {
  grid-column: 1;
  grid-row: 1;
  padding-left: 2rem;
}

.score-summary summary strong {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--sky);
  color: #075b63;
  font-size: 0.85rem;
  white-space: nowrap;
}

.score-list,
.retake-list {
  display: grid;
  gap: 0.75rem;
}

.score-list {
  margin-top: 0.75rem;
}

.score-row {
  padding: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #d6eee8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.score-row-copy,
.score-row div:not(.score-row-metrics) {
  display: grid;
  gap: 0.25rem;
}

.score-row strong {
  color: var(--ink);
}

.score-row span,
.score-empty {
  color: var(--muted);
  line-height: 1.4;
}

.score-row-metrics {
  flex: 0 0 auto;
  min-width: 5.8rem;
  display: grid;
  justify-items: end;
  gap: 0.35rem;
}

.weighted-score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.9rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff !important;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(21, 153, 71, 0.22);
}

.score-row em,
.score-time-pill {
  flex: 0 0 auto;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  background: rgba(216, 241, 242, 0.62);
  color: #487177;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.retake-row em {
  background: #dcfce7;
  color: #126334;
}

.student-welcome {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  color: #ffffff;
}

.student-welcome > div {
  min-width: 0;
  width: 100%;
}

.student-avatar {
  width: clamp(4.25rem, 8vw, 5.75rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 10px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: #b3ee56;
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(24, 51, 43, 0.12);
}

.student-welcome h2 {
  max-width: none;
  font-size: clamp(2.55rem, 4.08vw, 4.25rem);
  line-height: 0.98;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(24, 51, 43, 0.18);
}

.welcome-kicker {
  margin: 0 0 0.35rem;
  color: rgba(255, 255, 255, 0.86);
}

.work-panel {
  display: grid;
  gap: 1.1rem;
}

.work-panel-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #ffffff;
}

.section-marker {
  width: 0.8rem;
  height: 3.1rem;
  background: rgba(255, 255, 255, 0.84);
}

.work-panel h3 {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3rem);
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(24, 51, 43, 0.16);
}

.work-tabs {
  display: grid;
  grid-template-columns: repeat(8, minmax(7.5rem, 1fr));
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.work-tab {
  min-height: 4.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border-radius: 0;
  border-right: 2px solid rgba(255, 255, 255, 0.32);
  background: var(--teal);
  color: #ffffff;
  font-size: clamp(0.86rem, 1.05vw, 1.12rem);
  padding: 0.7rem;
  text-align: center;
}

.work-tab:last-child { border-right: 0; }

.work-tab.active,
.work-tab[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.94);
  color: #087eb5;
  box-shadow: inset 0 0 0 3px #1783ff;
}

.work-tab span {
  font-size: 1.25em;
  line-height: 1;
}

.work-content {
  min-height: 360px;
  padding: clamp(1rem, 2vw, 1.6rem);
  background: rgba(235, 248, 247, 0.86);
  border-radius: 0 0 8px 8px;
}

.work-tab-panel {
  min-height: 320px;
  display: grid;
  align-content: center;
  justify-items: stretch;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(24, 51, 43, 0.04);
}

.work-tab-panel[hidden] {
  display: none;
}

@media (max-width: 1100px) {
  .work-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.empty-note {
  max-width: 760px;
  margin: 0;
  justify-self: center;
  color: #5b5f5c;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800;
  text-align: center;
}

.skill-list {
  width: min(780px, 100%);
  display: grid;
  gap: 1rem;
}

.skill-list article,
.recommendation-card,
.lesson-card {
  padding: 1rem;
  display: grid;
  gap: 0.45rem;
  border: 1px solid #d6eee8;
  border-radius: 8px;
  background: #fbf8ee;
}

.lesson-card {
  width: min(820px, 100%);
  justify-self: center;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border-color: #b9e2dd;
  background: linear-gradient(135deg, #fffdf5, #eefafa);
}

.lesson-card h4 {
  margin: 0.1rem 0;
  color: var(--ink);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.1;
}

.lesson-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.lesson-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lesson-link,
.complete-lesson,
.completed-badge {
  min-height: 2.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.lesson-link {
  background: #d8f1f2;
  color: #075b63;
}

.lesson-link:hover,
.lesson-link:focus-visible {
  background: #bfe6e8;
}

.complete-lesson {
  background: var(--primary);
  color: #ffffff;
}

.completed-badge {
  background: #dcfce7;
  color: #126334;
}

.skill-list strong,
.recommendation-card strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.skill-list p,
.recommendation-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard-hero {
  min-height: 360px;
  padding: clamp(1.25rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 1rem;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(24, 51, 43, 0.1);
}

.dashboard h2 {
  max-width: 860px;
  font-size: clamp(2.4rem, 5vw, 5rem);
}

.student-welcome h2 {
  max-width: none;
  font-size: clamp(2.55rem, 4.08vw, 4.25rem);
  white-space: nowrap;
}

.hero-text {
  max-width: 760px;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.55;
}

.lab-board {
  padding: 1rem;
  display: grid;
  align-content: center;
  gap: 0.85rem;
  border-radius: 8px;
  background: #17352e;
  color: #f8fff9;
}

.board-row {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.board-icon {
  display: grid;
  place-items: center;
  min-height: 2.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #17251f;
  font-weight: 900;
}

.two-column {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
}

.dashboard-preview {
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  background: #f7fff9;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.dashboard-preview div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.dashboard-preview div:last-child { border-bottom: 0; }
.dashboard-preview span { color: #0f7a3a; font-weight: 800; }

.footer {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem) 2rem;
  color: rgba(24, 51, 43, 0.7);
}

@media (max-width: 820px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 58vh;
    padding: 2rem;
  }

  .login-art {
    min-height: 42vh;
  }

  .topbar,
  .dashboard-hero,
  .two-column,
  .work-tabs,
  .lesson-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar,
  .student-welcome {
    align-items: start;
  }

  .student-welcome {
    display: grid;
    grid-template-columns: 1fr;
  }

  .student-welcome h2 {
    font-size: clamp(2.04rem, 10.2vw, 3.4rem);
    white-space: normal;
  }

  .grade-card {
    justify-self: stretch;
  }

  .score-summary summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .score-summary summary strong {
    width: max-content;
    margin-left: 2rem;
  }

  .score-row {
    align-items: stretch;
    flex-direction: column;
  }

  .score-row-metrics {
    justify-items: start;
  }

  .work-tab {
    border-right: 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.32);
  }

  .lesson-actions {
    justify-content: stretch;
  }

  .lesson-link,
  .complete-lesson,
  .completed-badge {
    width: 100%;
  }
}
