:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #68707a;
  --line: #d8dee8;
  --panel: #ffffff;
  --surface: #f5f7f2;
  --surface-strong: #e8f0ec;
  --green: #2f7d5c;
  --green-dark: #205b43;
  --red: #b84a3a;
  --yellow: #f3c35b;
  --blue: #3d6fb6;
  --shadow: 0 18px 44px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 125, 92, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(184, 74, 58, 0.12), transparent 38%),
    var(--surface);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(32, 33, 36, 0.08);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
}

.brand h1,
.brand p,
.hero-copy h2,
.hero-copy p,
.login-panel h2 {
  margin: 0;
}

.brand h1 {
  font-size: 21px;
}

.brand p,
.muted {
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-layout {
  width: min(1380px, calc(100vw - 36px));
  margin: 34px auto;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 330px 300px;
  gap: 24px;
}

.login-hero {
  min-height: 520px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: #1f2a27;
}

.hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(19, 34, 31, 0.9), rgba(19, 34, 31, 0.28) 54%, rgba(19, 34, 31, 0.1)),
    url("/hero-cover.png") center / cover no-repeat,
    #1f2a27;
}

.hero-logo {
  position: absolute;
  z-index: 2;
  top: 28px;
  left: 32px;
  width: 118px;
  max-height: 118px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.letter-grid {
  position: absolute;
  inset: 42px;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  opacity: 0.8;
}

.letter-grid span {
  display: grid;
  place-items: center;
  min-height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 34px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
}

.hero-copy {
  position: absolute;
  z-index: 2;
  left: 42px;
  right: 42px;
  bottom: 78px;
  color: #fff;
}

.hero-copy h2 {
  max-width: 680px;
  font-size: 44px;
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 540px;
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.hero-contact {
  position: absolute;
  z-index: 2;
  left: 42px;
  right: 42px;
  bottom: 30px;
  color: #fff;
  font-weight: 800;
  text-decoration-color: rgba(255, 255, 255, 0.45);
}

.login-panel,
.side-panel,
.main-panel,
.progress-modal {
  border: 1px solid rgba(32, 33, 36, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 26px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.register-panel {
  padding: 20px;
  gap: 12px;
  justify-content: start;
}

.login-panel h2 {
  font-size: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: #3f464d;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--green);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

input[type="number"] {
  appearance: textfield;
}

.role-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.role-choice label {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.warning-note {
  padding: 10px;
  border-radius: 8px;
  background: #fff7df;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 125, 92, 0.22);
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  background: #e7ece6;
  color: var(--ink);
  border: 1px solid #d4ddd4;
}

.ghost-button {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.error {
  min-height: 20px;
  color: var(--red);
  margin: 0;
}

.workspace {
  width: min(1320px, calc(100vw - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.admin-page {
  width: 100%;
}

.side-panel,
.main-panel {
  padding: 18px;
}

.user-block {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.user-block strong {
  display: block;
  font-size: 18px;
}

.mode-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.mode-button {
  width: 100%;
  min-height: 56px;
  padding: 11px 14px;
  text-align: left;
  display: grid;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(32, 33, 36, 0.04);
}

.mode-button.active {
  border-color: var(--green);
  background: var(--surface-strong);
  color: var(--green-dark);
  box-shadow: inset 5px 0 0 var(--green), 0 10px 24px rgba(47, 125, 92, 0.12);
}

.mode-button:hover {
  border-color: rgba(47, 125, 92, 0.52);
  background: #f9fbf8;
}

.mode-button span {
  color: var(--muted);
  font-weight: 600;
}

.stats-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  padding: 12px;
  border-radius: 8px;
  background: #f6f1e7;
}

.stat b {
  display: block;
  font-size: 22px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

.panel-head h2 {
  margin: 0;
  font-size: 28px;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  margin-top: 18px;
  align-items: end;
}

.manual-toggle {
  margin-top: 12px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.manual-toggle input {
  width: 18px;
  height: 18px;
}

.rule-list {
  max-height: 360px;
  overflow: auto;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rule-picker {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

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

.category-pill {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.category-pill.active {
  border-color: var(--green);
  background: var(--surface-strong);
  color: var(--green-dark);
}

.category-pill span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rule-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: start;
}

.rule-check-list {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rule-check {
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 7px;
  color: var(--ink);
  font-weight: 700;
}

.rule-check:hover {
  background: #f4f7f4;
}

.rule-check-all {
  background: var(--surface-strong);
}

.rule-check span {
  overflow-wrap: anywhere;
}

.rule-check b {
  color: var(--muted);
  font-size: 13px;
}

.selected-rule {
  min-height: 66px;
  padding: 12px;
  border-radius: 8px;
  background: #f6f1e7;
}

.selected-rule b {
  display: block;
  font-size: 24px;
}

.selected-rule span {
  color: var(--muted);
  font-size: 13px;
}

.rule-row {
  width: 100%;
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.rule-row.active {
  background: #eaf3ee;
  color: var(--green-dark);
}

.question-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.word-prompt {
  font-size: 26px;
  font-weight: 850;
  line-height: 1.25;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.choice {
  min-width: 46px;
  height: 42px;
  border: 1px solid var(--line);
  background: #f8faf8;
}

.choice.selected {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.answer-input-label,
.letter-input-row {
  margin-top: 14px;
}

.letter-input-row {
  display: grid;
  grid-template-columns: 90px 150px;
  gap: 10px;
  align-items: center;
}

.letter-input-row input {
  height: 54px;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  text-transform: lowercase;
}

.live-question {
  max-width: 720px;
}

.line-row {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.line-row.selected {
  border-color: var(--blue);
  background: #eef4ff;
}

.static-line-row {
  cursor: default;
}

.line-words {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.line-words span {
  padding: 4px 8px;
  border-radius: 6px;
  background: #f3f5f7;
}

.practice-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.setup-actions {
  justify-content: flex-start;
}

.result-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.result-item {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.result-item.ok {
  border-color: #00a94f;
  border-left: 8px solid #00c853;
  background: #dcffe9;
  box-shadow: 0 10px 24px rgba(0, 200, 83, 0.16);
}

.result-item.bad {
  border-color: #ef233c;
  border-left: 8px solid #ff1744;
  background: #ffe0e6;
  box-shadow: 0 10px 24px rgba(255, 23, 68, 0.16);
}

.result-item.ok b {
  color: #007a35;
}

.result-item.bad b {
  color: #c00024;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(32, 33, 36, 0.36);
  z-index: 10;
}

.progress-modal {
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.teacher-quick-panel {
  margin: 16px 0 0;
  padding-bottom: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.button-row,
.table-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.table-head {
  justify-content: space-between;
  margin-top: 16px;
}

.table-head h3 {
  margin: 0;
}

.section-head h3,
.student-lists h4 {
  margin: 0;
}

.student-card-grid,
.admin-list {
  display: grid;
  gap: 12px;
}

.student-card,
.admin-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.student-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.student-card-head b,
.student-card-head span {
  display: block;
}

.mini-stat {
  min-width: 82px;
  text-align: right;
}

.mini-stat b {
  display: block;
  font-size: 20px;
}

.mini-stat span {
  color: var(--muted);
  font-size: 12px;
}

.teacher-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.student-lists {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.student-lists h4 {
  font-size: 13px;
  color: var(--green-dark);
}

.student-lists ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.activity-details {
  margin-top: 16px;
}

.activity-details summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--green-dark);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-layout,
  .workspace,
  .setup-grid,
  .category-grid,
  .rule-select-row,
  .progress-grid,
  .teacher-metrics,
  .student-lists {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 420px;
  }

  .hero-copy h2 {
    font-size: 34px;
  }

  .letter-grid {
    inset: 22px;
  }
}

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

  .login-panel {
    align-self: auto;
  }

  .login-hero {
    min-height: 460px;
  }

  .hero-copy h2 {
    font-size: 36px;
  }
}
