:root {
  --bg: #f5f8f6;
  --surface: #ffffff;
  --surface-soft: #eef6f1;
  --ink: #17202a;
  --muted: #62717f;
  --line: #dbe4ea;
  --teal: #13806f;
  --teal-dark: #0f5f55;
  --coral: #c75136;
  --amber: #d99a21;
  --blue: #2563eb;
  --shadow: 0 18px 45px rgba(30, 50, 70, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] { display: none !important; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(19, 128, 111, 0.16), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(217, 154, 33, 0.16), transparent 30%),
    var(--bg);
}

.login-card {
  display: grid;
  gap: 22px;
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-copy,
.login-error,
.save-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-error {
  min-height: 22px;
  color: var(--coral);
  font-weight: 800;
}

.microsoft-login {
  display: flex;
  justify-content: center;
  text-decoration: none;
}

.entra-login {
  display: grid;
  gap: 14px;
}

.entra-login p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label,
.game-settings label {
  display: grid;
}

.login-form label span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-form input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.demo-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.demo-users button,
.logout-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: #14242a;
  color: #f8fbfd;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2dd4bf, var(--teal));
  box-shadow: 0 8px 20px rgba(45, 212, 191, 0.22);
  font-size: 1.35rem;
  font-weight: 800;
}

.login-brand-banner {
  align-items: center;
  background: linear-gradient(135deg, #14242a, #176c70);
  border-radius: 16px;
  color: #fff;
  display: flex;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.login-brand-banner .eyebrow { color: #a7f3d0; font-size: 0.82rem; margin-bottom: 0.2rem; }
.login-brand-banner small { color: #d7e8e7; }

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #b7c5cc;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.logout-button {
  margin-top: auto;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d7e2e7;
  text-align: left;
}

.tab-button:hover,
.tab-button.is-active {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar,
.content-layout {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.user-badge {
  width: fit-content;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 800;
  white-space: nowrap;
}

.user-controls {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  margin-left: auto;
}

.topbar-logout {
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid #cbd8de;
  border-radius: 999px;
  background: #14242a;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.topbar-logout:hover,
.topbar-logout:focus-visible {
  background: var(--teal-dark);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(320px, 100%);
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.teacher-panel {
  width: min(1180px, 100%);
  margin: 0 auto 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.teacher-settings {
  display: grid;
  gap: 12px;
}

.teacher-topic {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.teacher-submodules {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.admin-workspace {
  margin-bottom: 1.5rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.admin-tab {
  border: 1px solid var(--border, #dce3ea);
  border-radius: 999px;
  background: #fff;
  color: #415064;
  cursor: pointer;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
}

.admin-tab.is-active {
  background: #172554;
  border-color: #172554;
  color: #fff;
}

.admin-grid,
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-stat-grid article,
.admin-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1rem;
}

.admin-stat-grid article {
  display: flex;
  flex-direction: column;
  min-height: 100px;
  justify-content: center;
}

.admin-stat-grid strong {
  color: #172554;
  font-size: 2rem;
}

.admin-stat-grid span,
.admin-card small,
.report-row small {
  color: #64748b;
}

.admin-card h3 {
  margin: 0 0 1rem;
}

.admin-wide {
  margin-top: 1rem;
}

.stack-form,
.compact-form {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stack-form {
  flex-direction: column;
}

.compact-form input {
  flex: 1;
}

.stack-form input,
.stack-form select,
.stack-form textarea,
.compact-form input {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-sizing: border-box;
  font: inherit;
  padding: 0.72rem 0.8rem;
  width: 100%;
}

.stack-form textarea {
  min-height: 86px;
  resize: vertical;
}

.stack-form fieldset {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-list-card,
.report-row {
  align-items: flex-start;
  border-top: 1px solid #eef2f7;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0;
}

.admin-item-heading {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  width: 100%;
}

.admin-item-heading h3 {
  margin: 0;
}

.danger-button {
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.45rem 0.65rem;
}

.danger-button:hover {
  background: #fef2f2;
}

.admin-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.admin-chip {
  background: #f1f5f9;
  border-radius: 999px;
  color: #475569;
  font-size: 0.8rem;
  padding: 0.3rem 0.55rem;
}

.admin-chip button {
  background: none;
  border: 0;
  color: #b91c1c;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0 0 0.25rem;
}

.hierarchy-module {
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  margin-bottom: 0.85rem;
  padding: 1rem;
}

.hierarchy-module > .admin-item-heading strong,
.hierarchy-category > .admin-item-heading strong {
  display: block;
}

.hierarchy-category {
  background: #f8fafc;
  border-left: 3px solid #818cf8;
  border-radius: 0 10px 10px 0;
  margin: 0.85rem 0 0 1rem;
  padding: 0.8rem;
}

.hierarchy-label {
  color: #64748b;
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
  text-transform: uppercase;
}

.module-browser-category {
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
  padding-top: 1rem;
}

.module-browser-category h4,
.module-browser-subcategory h5 {
  margin: 0 0 0.65rem;
}

.module-browser-subcategory {
  background: #f8fafc;
  border-left: 3px solid #818cf8;
  border-radius: 0 10px 10px 0;
  margin: 1rem 0 0 1rem;
  padding: 0.85rem;
}

.browser-question {
  align-items: flex-start;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0;
}

.browser-question small {
  color: #64748b;
}

.word-entry-card h4 {
  color: #172554;
  font-size: 1.35rem;
  margin: 0.4rem 0;
}

.question-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.35rem 0 0.65rem;
}

.learning-tag {
  background: #e8f0ff;
  border: 1px solid #b9cdf5;
  border-radius: 999px;
  color: #294f8f;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
}

.learning-tag.is-empty {
  background: #f3f3f3;
  border-color: #d6d6d6;
  color: #666;
  font-weight: 500;
}

.question-tag-editor {
  align-items: end;
  border-top: 1px solid #e4e4e4;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
}

.question-tag-editor label {
  display: grid;
  gap: 0.3rem;
}

.word-meaning-row {
  background: #f8fafc;
  border-left: 3px solid #818cf8;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.8rem;
  width: 100%;
}

.word-memory-picture {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.ai-status {
  background: #fff7ed;
  border-radius: 999px;
  color: #9a3412;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.35rem 0.55rem;
}

.ai-status.is-connected {
  background: #dcfce7;
  color: #166534;
}

.student-transfer-row > div {
  display: flex;
  flex-direction: column;
}

.class-picker {
  align-items: center;
  display: flex;
  font-weight: 800;
  gap: 0.75rem;
}

.class-picker select {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  flex: 1;
  font: inherit;
  padding: 0.7rem;
}

.question-filter-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  margin-bottom: 1rem;
}

.question-filter-grid label {
  color: #475569;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: 800;
  gap: 0.35rem;
}

.question-filter-grid select {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font: inherit;
  padding: 0.7rem;
}

.homework-section-form {
  align-items: end;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.homework-section-form label {
  color: #475569;
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 0.35rem;
}

.homework-section-form input,
.homework-section-form select {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-sizing: border-box;
  font: inherit;
  padding: 0.7rem;
  width: 100%;
}

.homework-section-card {
  border-top: 1px solid #e2e8f0;
  padding: 1rem 0;
}

.homework-placeholder-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.homework-date-chip {
  background: #eef2ff;
  border-radius: 999px;
  color: #3730a3;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
}

.admin-edit-row {
  border-top: 1px solid #eef2f7;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr 2fr auto auto;
  padding: 0.75rem 0;
}

.admin-edit-row select {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  min-width: 0;
  padding: 0.55rem;
}

.schedule-edit-row {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.schedule-edit-row > div,
.schedule-edit-row > button {
  grid-column: span 1;
}

.schedule-row-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.schedule-form-row {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.schedule-form-row + .schedule-form-row {
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
  padding-top: 1rem;
}

.schedule-form-row label {
  color: #475569;
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 0.35rem;
}

.schedule-form-row input,
.schedule-form-row select {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-sizing: border-box;
  font: inherit;
  padding: 0.68rem;
  width: 100%;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) repeat(2, 1fr);
}

.report-row > div {
  display: flex;
  flex-direction: column;
}

.status-pill {
  background: #e0e7ff;
  border-radius: 999px;
  color: #3730a3;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
}

.admin-note {
  color: #64748b;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .report-row {
    grid-template-columns: 1fr;
  }

  .compact-form {
    flex-direction: column;
  }

  .admin-edit-row,
  .schedule-edit-row {
    grid-template-columns: 1fr;
  }
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 2px;
  color: var(--muted);
}

.submodule-toggle {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  margin-top: 18px;
}

.content-layout.has-no-picture-panel {
  grid-template-columns: 1fr;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--teal-dark);
}

.primary-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.lesson-list,
.assignment-list {
  display: grid;
  gap: 12px;
}

.lesson-item,
.assignment-item,
.word-card,
.module-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.word-card,
.module-card {
  padding: 0;
  overflow: hidden;
}

.word-card.is-selected {
  border-color: rgba(19, 128, 111, 0.55);
  box-shadow: 0 0 0 3px rgba(19, 128, 111, 0.12);
}

.word-card-button {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.module-card-button {
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 130px;
  padding: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.module-card-button strong {
  font-size: 1.25rem;
}

.module-card-button span:last-child {
  color: var(--muted);
  line-height: 1.5;
}

.module-card-button:hover strong {
  color: var(--teal-dark);
}

.module-intro {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.module-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.word-card-button strong {
  font-size: 1.35rem;
}

.meaning-text {
  color: var(--ink);
  font-weight: 650;
  line-height: 1.45;
}

.example-text {
  color: var(--muted);
  line-height: 1.5;
}

.word-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.word-links div {
  padding: 14px 16px;
}

.word-links div + div {
  border-left: 1px solid var(--line);
}

.word-links p {
  margin: 0 0 5px;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.word-links span {
  color: var(--muted);
  line-height: 1.45;
}

.meaning-picture {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-soft);
}

.picture-copy,
.mini-quiz {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.picture-copy p,
.mini-quiz p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-options button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  padding: 0 12px;
}

.quiz-options button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfe;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.game-board,
.game-settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.game-board {
  display: grid;
  gap: 22px;
  align-content: start;
  min-height: 430px;
  padding: 22px;
}

.stage-board {
  background:
    linear-gradient(180deg, rgba(20, 36, 42, 0.04), transparent 32%),
    #fbfdfe;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #14242a;
  color: #ffffff;
}

.stage-header strong {
  display: block;
  margin-top: 3px;
  font-size: 1.35rem;
}

.stage-kicker {
  color: #a7f3d0;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.coin-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(217, 154, 33, 0.18);
}

.coin-counter span {
  color: #facc15;
}

.game-visual {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(19, 128, 111, 0.12), rgba(217, 154, 33, 0.14)),
    #ffffff;
}

.stage-visual {
  background:
    radial-gradient(circle at 22% 0%, rgba(250, 204, 21, 0.32), transparent 34%),
    radial-gradient(circle at 78% 0%, rgba(37, 99, 235, 0.24), transparent 34%),
    linear-gradient(180deg, #23343b 0%, #17242a 58%, #0f181d 100%);
}

.stage-visual::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 36px;
  background: repeating-linear-gradient(90deg, #263942 0 48px, #1d2e35 48px 96px);
}

.spotlight {
  position: absolute;
  top: -30px;
  width: 120px;
  height: 210px;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.34), transparent 86%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  opacity: 0.78;
  animation: spotlight-sway 3.4s ease-in-out infinite alternate;
}

.spotlight-left {
  left: 20%;
  transform: rotate(18deg);
}

.spotlight-right {
  right: 20%;
  transform: rotate(-18deg);
  animation-delay: 0.6s;
}

.stage-visual .math-orbit {
  border-color: rgba(255, 255, 255, 0.38);
}

.stage-visual .math-orbit span {
  background: #fef3c7;
  color: #9a3412;
}

.stage-avatar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 98px;
  height: 122px;
  transform: translateX(-50%);
  animation: avatar-bounce 0.75s ease-in-out infinite alternate;
  z-index: 1;
}

.avatar-hair,
.avatar-face,
.avatar-body,
.avatar-guitar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.avatar-hair {
  top: 0;
  width: 54px;
  height: 34px;
  border-radius: 50% 50% 40% 40%;
  background: #0f172a;
}

.avatar-face {
  top: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ffd7b3;
  box-shadow:
    -10px 13px 0 -7px #17202a,
    10px 13px 0 -7px #17202a;
}

.avatar-body {
  bottom: 4px;
  width: 58px;
  height: 66px;
  border-radius: 16px 16px 10px 10px;
  background: #c75136;
}

.avatar-guitar {
  bottom: 28px;
  width: 100px;
  height: 28px;
  border-radius: 999px;
  background: #facc15;
  transform: translateX(-50%) rotate(-14deg);
  box-shadow: 36px -8px 0 -8px #fef3c7;
}

.speaker {
  position: absolute;
  bottom: 20px;
  width: 54px;
  height: 70px;
  border-radius: 8px;
  background: #0b1216;
  z-index: 1;
}

.speaker::before,
.speaker::after {
  content: "";
  position: absolute;
  left: 50%;
  border-radius: 50%;
  background: #2f454f;
  transform: translateX(-50%);
}

.speaker::before {
  top: 10px;
  width: 18px;
  height: 18px;
}

.speaker::after {
  bottom: 10px;
  width: 30px;
  height: 30px;
}

.speaker-left {
  left: 18px;
}

.speaker-right {
  right: 18px;
}

.math-orbit {
  position: absolute;
  inset: 18px auto auto 24px;
  width: 108px;
  height: 108px;
  border: 2px dashed rgba(19, 128, 111, 0.35);
  border-radius: 50%;
  animation: orbit-spin 9s linear infinite;
}

.math-orbit span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal-dark);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(30, 50, 70, 0.12);
}

.math-orbit span:nth-child(1) {
  left: 37px;
  top: -17px;
}

.math-orbit span:nth-child(2) {
  right: -17px;
  top: 37px;
}

.math-orbit span:nth-child(3) {
  bottom: -17px;
  left: 37px;
}

.math-orbit span:nth-child(4) {
  left: -17px;
  top: 37px;
}

.rocket {
  position: absolute;
  right: 74px;
  bottom: 34px;
  width: 48px;
  height: 82px;
  border-radius: 50% 50% 12px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #dbeafe 100%);
  border: 3px solid #2563eb;
  transform: rotate(42deg);
  animation: rocket-float 2.6s ease-in-out infinite;
}

.rocket::before,
.rocket::after {
  content: "";
  position: absolute;
  bottom: 8px;
  width: 22px;
  height: 28px;
  border-radius: 6px;
  background: #2563eb;
}

.rocket::before {
  left: -16px;
}

.rocket::after {
  right: -16px;
}

.rocket-window {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #a7f3d0;
  border: 3px solid #0f5f55;
  transform: translateX(-50%);
}

.rocket-flame {
  position: absolute;
  bottom: -31px;
  left: 50%;
  width: 20px;
  height: 34px;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(180deg, #fef3c7 0%, #d95d39 100%);
  transform: translateX(-50%);
  animation: flame-pulse 0.45s ease-in-out infinite alternate;
}

.number-cloud span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(30, 50, 70, 0.1);
  animation: number-bob 3.4s ease-in-out infinite;
}

.number-cloud span:nth-child(1) {
  left: 48%;
  top: 18px;
}

.number-cloud span:nth-child(2) {
  left: 61%;
  top: 66px;
  animation-delay: 0.4s;
}

.number-cloud span:nth-child(3) {
  left: 76%;
  top: 18px;
  animation-delay: 0.8s;
}

.number-cloud span:nth-child(4) {
  left: 33%;
  bottom: 20px;
  animation-delay: 1.2s;
}

.lcm-visual .math-orbit span {
  width: 42px;
  font-size: 0.78rem;
}

.factor-stack {
  position: absolute;
  right: 72px;
  bottom: 28px;
  display: grid;
  gap: 8px;
  animation: number-bob 3s ease-in-out infinite;
}

.factor-stack span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 34px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(30, 50, 70, 0.1);
}

.game-scorebar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.game-scorebar div {
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.game-scorebar span,
.game-settings label span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.game-scorebar strong {
  display: block;
  margin-top: 4px;
  font-size: 2rem;
}

.streak-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe4ea;
}

.streak-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #13a06f, #facc15, #c75136);
  transition: width 0.22s ease;
}

.problem-area {
  display: grid;
  gap: 14px;
  place-items: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.problem-area p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.game-feedback {
  font-weight: 800;
}

.problem-text {
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 1;
}

.compact-problem {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1.1;
}

.answer-input {
  width: min(260px, 100%);
  min-height: 58px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-size: 1.65rem;
  font-weight: 800;
}

.answer-input:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(19, 128, 111, 0.16);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.game-settings {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 18px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.settings-grid,
.range-grid {
  display: grid;
  gap: 10px;
}

.range-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.game-settings input,
.game-settings select {
  width: 100%;
  min-height: 38px;
  margin-top: 5px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.range-section {
  display: grid;
  gap: 10px;
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rocket-float {
  0%,
  100% {
    transform: translateY(0) rotate(42deg);
  }

  50% {
    transform: translateY(-10px) rotate(42deg);
  }
}

@keyframes flame-pulse {
  from {
    height: 25px;
    opacity: 0.78;
  }

  to {
    height: 38px;
    opacity: 1;
  }
}

@keyframes number-bob {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-12px) scale(1.06);
  }
}

@keyframes spotlight-sway {
  from {
    opacity: 0.55;
  }

  to {
    opacity: 0.88;
  }
}

@keyframes avatar-bounce {
  from {
    transform: translateX(-50%) translateY(0);
  }

  to {
    transform: translateX(-50%) translateY(-8px);
  }
}

.lesson-meta,
.assignment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-pill {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill.due {
  background: rgba(217, 154, 33, 0.16);
  color: #8a5a05;
}

.status-pill.review {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.student-homework-picker {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 1rem;
}

.student-homework-hero {
  align-items: center;
  background: linear-gradient(135deg, #173f47, #176c70 65%, #26a69a);
  border-radius: 24px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  overflow: hidden;
  padding: 1.5rem;
  position: relative;
}

.student-homework-hero::after {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  content: "";
  height: 180px;
  position: absolute;
  right: -60px;
  top: -80px;
  width: 180px;
}

.student-homework-hero h3 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  margin: 0.25rem 0;
}

.student-homework-hero p {
  color: #d9f4f0;
  margin: 0;
}

.student-kicker {
  color: #a7f3d0;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.student-homework-count {
  align-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  min-width: 92px;
  padding: 0.8rem;
  position: relative;
  z-index: 1;
}

.student-homework-count strong { font-size: 1.8rem; }
.student-homework-count span { font-size: 0.75rem; font-weight: 800; }

.student-homework-picker label {
  display: grid;
  font-weight: 700;
  gap: 0.4rem;
}

.student-homework-date {
  align-items: center;
  background: #e8f0ff;
  border-radius: 14px;
  color: #294f8f;
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
}

.student-homework-date div { display: grid; gap: 0.15rem; }
.calendar-icon { font-size: 1.4rem; }

.student-homework-grid {
  display: grid;
  gap: 1.25rem;
}

.homework-module { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 32px rgba(20, 36, 42, 0.07); overflow: hidden; }
.homework-module-heading { align-items: center; background: linear-gradient(135deg, #f0fbf8, #e3f5f1); border: 0; color: #173f47; cursor: pointer; display: grid; gap: 0.85rem; grid-template-columns: auto 1fr auto auto; padding: 1.1rem 1.25rem; text-align: left; width: 100%; }
.homework-module-heading > span:nth-child(2) { display: grid; gap: 0.15rem; }
.homework-module-heading small { color: #16706f; font-size: 0.7rem; font-weight: 900; text-transform: uppercase; }
.homework-module-heading strong { font-size: 1.2rem; }
.homework-module-icon { background: #16706f; border-radius: 12px; color: #fff; display: grid; font-weight: 900; height: 44px; place-items: center; width: 44px; }
.homework-module-total { background: #fff; border-radius: 999px; color: #16706f; font-size: 0.78rem; font-weight: 900; padding: 0.5rem 0.75rem; }
.homework-module-chevron { font-size: 1.2rem; }
.homework-module-content { display: grid; gap: 1rem; padding: 1.25rem; }
.homework-module-content[hidden] { display: none; }
.homework-word-list { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.homework-word-button { background: #f3f7f8; border: 1px solid #cadadd; border-radius: 999px; color: #344c53; cursor: pointer; font: inherit; font-weight: 800; min-height: 38px; padding: 0.4rem 0.9rem; }
.homework-word-button:hover { border-color: #16706f; color: #16706f; }
.homework-word-button.is-active { background: #16706f; border-color: #16706f; color: #fff; }
.homework-selected-word > .student-homework-card { box-shadow: none; margin: 0; }
.homework-word-navigation { align-items: center; display: grid; gap: 1rem; grid-template-columns: 1fr auto 1fr; margin-top: 1rem; }
.homework-word-navigation button:last-child { justify-self: end; }
.homework-word-navigation span { color: var(--muted); font-size: 0.82rem; font-weight: 900; }
.homework-word-navigation button:disabled { cursor: not-allowed; opacity: 0.4; }

.student-homework-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 0.8rem;
  box-shadow: 0 12px 32px rgba(20, 36, 42, 0.07);
  padding: 1.35rem;
}

.student-word-card { border-top: 5px solid #26a69a; }
.student-word-card > h3 { color: #173f47; font-size: clamp(2rem, 5vw, 3rem); margin: 0; }
.student-card-heading { align-items: center; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; }
.word-type { color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.word-prompt { color: var(--muted); margin: 0; }
.reveal-button { justify-self: start; min-height: 44px; padding-inline: 1.1rem; }

.student-homework-answer {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
  padding-top: 0.9rem;
}

.student-meaning-card {
  background: #f6fbfa;
  border: 1px solid #d7ebe8;
  border-radius: 18px;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr);
  overflow: hidden;
  padding: 0;
}

.student-meaning-picture { background: #e5f3f1; min-height: 190px; overflow: hidden; }
.student-meaning-picture img { display: block; height: 100%; object-fit: cover; width: 100%; }
.student-meaning-copy { align-content: center; display: grid; gap: 0.75rem; padding: 1.2rem 1.2rem 1.2rem 0; }
.meaning-number { color: #16706f; font-size: 0.75rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.meaning-definition { color: #173f47; font-size: 1.15rem; font-weight: 800; line-height: 1.45; margin: 0; }
.meaning-usage { background: #fff; border-left: 4px solid #f0ab48; border-radius: 0 10px 10px 0; color: #42585f; line-height: 1.55; margin: 0; padding: 0.8rem; }
.meaning-usage strong { display: block; color: #8a5a05; font-size: 0.72rem; margin-bottom: 0.25rem; text-transform: uppercase; }
.student-fallback-picture { border-radius: 18px; max-height: 360px; }
.word-detail-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.word-detail-grid > div { background: #f4f7f8; border-radius: 12px; display: grid; gap: 0.3rem; padding: 0.85rem; }
.word-detail-grid strong { color: #16706f; font-size: 0.76rem; text-transform: uppercase; }
.picture-idea { color: var(--muted); }

.dictionary-hero {
  background: linear-gradient(135deg, #173f47, #225f68);
  border-radius: 24px;
  color: #fff;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  padding: 1.5rem;
}
.dictionary-hero h3 { font-size: clamp(1.5rem, 4vw, 2.25rem); margin: 0.25rem 0; }
.dictionary-hero p { color: #d9f4f0; margin: 0; }
.dictionary-search { align-items: center; align-self: center; background: #fff; border-radius: 14px; color: #476169; display: flex; gap: 0.6rem; padding: 0 1rem; }
.dictionary-search input { border: 0; font: inherit; min-height: 52px; outline: 0; width: 100%; }
.dictionary-result-count { color: var(--muted); font-weight: 800; margin: 1rem 0; }
.dictionary-word-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 10px 28px rgba(20, 36, 42, 0.07); display: grid; gap: 1rem; overflow: hidden; padding: 1.25rem; }
.dictionary-word-heading { align-items: center; display: flex; justify-content: space-between; }
.dictionary-word-heading span { color: #16706f; font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }
.dictionary-word-heading h3 { color: #173f47; font-size: 2rem; margin: 0.15rem 0 0; }
.dictionary-word-heading img { border-radius: 14px; height: 90px; object-fit: cover; width: 120px; }
.dictionary-preview-meaning { color: #42585f; font-weight: 700; line-height: 1.5; margin: 0; }
.dictionary-definitions { display: grid; gap: 0.65rem; }
.dictionary-definitions > div { align-items: start; background: #f6fbfa; border-radius: 12px; display: grid; gap: 0.3rem 0.7rem; grid-template-columns: 28px 1fr; padding: 0.8rem; }
.dictionary-definitions strong { background: #16706f; border-radius: 50%; color: #fff; display: grid; height: 26px; place-items: center; width: 26px; }
.dictionary-definitions p { font-weight: 700; margin: 0; }
.dictionary-definitions small { color: var(--muted); grid-column: 2; }
.dictionary-word-details { display: grid; gap: 1rem; }
.dictionary-word-details[hidden] { display: none; }
.dictionary-word-details .student-meaning-picture img { object-fit: contain; }
.admin-word-search { display: flex; gap: 0.75rem; }
.admin-word-search input { flex: 1; min-height: 44px; }
.word-assignment-row { align-items: end; border-top: 1px solid var(--line); display: grid; gap: 0.75rem; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(110px, 0.35fr)) auto; padding: 1rem 0; }
.word-assignment-row > div, .word-assignment-row label { display: grid; gap: 0.35rem; }
.word-assignment-row small { color: var(--muted); }

.student-homework-answer[hidden] {
  display: none;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 18px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .rocket {
    right: 46px;
  }

  .factor-stack {
    right: 46px;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 18px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .user-controls { justify-content: space-between; margin-left: 0; width: 100%; }
  .sidebar .logout-button { display: none; }
  .student-homework-hero { align-items: flex-start; gap: 1rem; }
  .student-homework-picker,
  .student-meaning-card,
  .word-detail-grid,
  .dictionary-hero,
  .word-assignment-row { grid-template-columns: 1fr; }
  .admin-word-search { align-items: stretch; flex-direction: column; }
  .student-meaning-copy { padding: 1rem; }
  .student-meaning-picture { min-height: 220px; }
  .homework-module-heading { grid-template-columns: auto 1fr auto; }
  .homework-module-total { display: none; }
  .homework-module-content { padding: 0.85rem; }
  .homework-word-list { flex-wrap: nowrap; margin-inline: -0.85rem; overflow-x: auto; padding: 0 0.85rem 0.5rem; }
  .homework-word-button { flex: 0 0 auto; }
  .homework-word-navigation { grid-template-columns: 1fr 1fr; }
  .homework-word-navigation span { grid-column: 1 / -1; grid-row: 1; text-align: center; }

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

  .nav-list,
  .word-links,
  .game-scorebar,
  .range-grid {
    grid-template-columns: 1fr;
  }

  .word-links div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-visual {
    min-height: 180px;
  }

  .number-cloud span:nth-child(1) {
    left: 42%;
  }

  .number-cloud span:nth-child(2) {
    left: 58%;
  }

  .number-cloud span:nth-child(3) {
    left: 74%;
  }
}
