:root {
  --bg-deep: #050b1e;
  --bg-main: #0b1a3a;
  --bg-glow: rgba(63, 131, 248, 0.45);
  --glass-bg: rgba(10, 22, 48, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --text-main: #f5f7ff;
  --text-secondary: #c7d2fe;
  /* Accents */
  --blue-accent: linear-gradient(135deg, #4f8bff 0%, #7db7ff 100%);
  --pink-accent: linear-gradient(135deg, #ff7ab5 0%, #ffb2d8 100%);
  --orange-accent: linear-gradient(135deg, #ffb86b 0%, #ffd6a1 100%);
  --primary-color: #7db7ff;
}

* {
  box-sizing: border-box;
}

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

#agent-help-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
}

/* Hide ElevenLabs branding caption globally (all browsers). */
a[href*="elevenlabs" i][aria-label*="powered" i],
a[href*="elevenlabs" i][title*="powered" i],
[class*="powered" i][class*="eleven" i],
[id*="powered" i][id*="eleven" i],
[data-testid*="powered" i][data-testid*="eleven" i],
[aria-label*="Powered by ElevenLabs" i] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 700px) {
  #agent-help-root {
    right: 12px;
    bottom: 12px;
  }
}

body {
  font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  overflow-x: hidden;

  background-color: var(--bg-deep);
  background-image:
    radial-gradient(900px 700px at 12% 12%, rgba(92, 148, 255, 0.45), transparent 60%),
    radial-gradient(800px 600px at 88% 18%, rgba(54, 120, 255, 0.3), transparent 60%),
    radial-gradient(1000px 800px at 50% 105%, rgba(12, 42, 110, 0.7), transparent 65%),
    linear-gradient(140deg, #0b1a3a 0%, #081634 45%, #050b1e 100%);
}

/* Background Mesh / Blob */
.background-mesh {
  display: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  padding: 26px 22px 54px;
  text-align: left;
}

header.main-header h1 {
  font-size: 2.02rem;
  margin: 10px 0 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-align: center;
}

.clickable-title {
  cursor: pointer;
}

#auth-placeholder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  width: 100%;
}

#login-btn {
  display: flex;
}

.auth-login-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.auth-login-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-divider {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.email-auth {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.email-register-fields {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  flex-basis: 100%;
}

.email-auth-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-basis: 100%;
}

.auth-input,
.auth-select {
  height: 38px;
  min-width: 170px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0 14px;
  font-size: 0.88rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.auth-input::placeholder {
  color: rgba(245, 247, 255, 0.7);
}

.auth-input:focus,
.auth-select:focus {
  border-color: rgba(125, 183, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(125, 183, 255, 0.18);
}

.auth-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.auth-error {
  width: 100%;
  margin: 2px 0 0;
  color: #ffb6b6;
  font-size: 0.8rem;
}

.email-auth-buttons .active-auth-btn {
  background: rgba(125, 183, 255, 0.28);
  border-color: rgba(125, 183, 255, 0.65);
}

.email-auth-buttons .auth-btn {
  padding: 8px 12px;
  font-size: 0.82rem;
}

#user-profile {
  display: flex;
  cursor: pointer;
  border-radius: 999px;
  padding: 4px 8px;
  transition: background 0.2s ease;
}

#user-profile:hover {
  background: rgba(255, 255, 255, 0.08);
}

#logout-btn {
  display: inline-block;
}

/* Top Bar - iCloud Style */
.user-bar {
  position: sticky;
  top: 16px;
  z-index: 100;
  background: rgba(9, 18, 40, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 auto 28px;
  max-width: 1000px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  flex-wrap: wrap;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-links {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-self: end;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav-btn {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--primary-color);
}

.auth-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, background 0.2s;
}

.auth-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.22);
}

/* Instructions */
/* .instructions-card wrapper removed as it was empty */

.timer-text {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.instruction-box {
  background: var(--glass-bg);
  border-radius: 20px;
  padding: 22px 26px;
  max-width: 1000px;
  margin: 0 auto 32px;
  border: 1px solid var(--glass-border);
  text-align: center;
  box-shadow: var(--card-shadow);
}

#instructions {
  line-height: 1.6;
}

/* Themes Panel */
.themes-section {
  margin-top: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 22px;
  box-shadow: var(--card-shadow);
}

.section-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
}

/* Grid Layout */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

/* Cards - iCloud Tiles */
.card {
  background: rgba(12, 23, 50, 0.7);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 24px 16px 20px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;

  overflow: hidden;
  position: relative;
  cursor: pointer;
  text-align: center;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.35);
  background: rgba(16, 30, 66, 0.8);
  z-index: 10;
}

.card-header-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.card-blue .card-header-accent {
  background: var(--blue-accent);
}

.card-pink .card-header-accent {
  background: var(--pink-accent);
}

.card-orange .card-header-accent {
  background: var(--orange-accent);
}

.icon-wrapper {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.12);
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2), 0 8px 16px rgba(0, 0, 0, 0.25);
}

.card h3 {
  margin: 15px 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0;
}

/* --------------------------------------------------------------------------
   App View Styles (Quiz, Results, etc.) - Adapted to new theme
-------------------------------------------------------------------------- */

/* Quiz View */
#quiz-view {
  width: 100%;
}

#quiz-container {
  max-width: 700px;
  margin: 0 auto;
}

/* Reuse glass/card style for Questions */
.question-card {
  background: rgba(10, 20, 45, 0.72);
  backdrop-filter: blur(18px);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  color: var(--text-main);
}

.question-card>div:first-child {
  /* Level Badge */
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 23px;
  line-height: 1.4;
  color: var(--text-main);
}

.options-grid {
  display: grid;
  gap: 12px;
}

.option-label {
  background: rgba(12, 23, 50, 0.7);
  padding: 13px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  font-weight: 500;
  color: var(--text-main);
}

.option-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  background: rgba(16, 30, 66, 0.9);
}

.option-radio {
  display: none;
}

.option-label:has(.option-radio:checked) {
  background: rgba(125, 183, 255, 0.2);
  color: white;
  border-color: rgba(125, 183, 255, 0.5);
  box-shadow: 0 10px 20px rgba(0, 150, 255, 0.25);
}

.text-answer-input {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  font-size: 0.93rem;
  margin-top: 10px;
  background: rgba(12, 23, 50, 0.7);
  color: var(--text-main);
}

.text-answer-input:focus {
  outline: none;
  border-color: rgba(125, 183, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(125, 183, 255, 0.2);
}

/* Quiz Controls */
#quiz-controls {
  display: flex;
  justify-content: space-between;
  margin: 20px auto;
  max-width: 700px;
}

#quiz-view {
  width: 100%;
}

#progress-container {
  max-width: 700px;
  margin: 0 auto 20px;
  background: rgba(10, 20, 45, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 9px 13px;
  backdrop-filter: blur(16px);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--text-main);
  font-size: 0.9em;
}

.progress-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

#progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue-accent);
  transition: width 0.3s ease;
}

#btn-dont-know {
  color: #ffd39a;
}

.primary-btn {
  background: var(--blue-accent);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 12px 30px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Dashboard */
#dashboard-view {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 28px;
  max-width: 980px;
  margin: 0 auto;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text-main);
}

#back-to-test-btn {
  margin: 6px 0 14px;
}

#dashboard-view h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
}

.dashboard-section {
  margin-bottom: 14px;
}

#history-section {
  margin-bottom: 18px;
}

.table-container {
  background: rgba(8, 18, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  color: var(--text-main);
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* History table as tiles */
#history-table {
  border-collapse: separate;
  border-spacing: 0 10px;
  table-layout: fixed;
}

#history-table thead th {
  padding-bottom: 6px;
}

#history-table.history-table-teacher th#th-student {
  width: 30%;
}

#history-table.history-table-teacher th#th-date {
  width: 14%;
}

#history-table.history-table-teacher th#th-level {
  width: 12%;
}

#history-table.history-table-teacher th#th-score {
  width: 10%;
}

#history-table.history-table-teacher th#th-actions {
  width: 34%;
}

#history-table thead th#th-score {
  text-align: center;
}

#history-table thead th#th-actions {
  text-align: right;
}

#history-table tbody tr {
  background: rgba(12, 23, 50, 0.75);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

#history-table tbody tr td {
  border-bottom: none;
  padding: 14px 16px;
}

#history-table tbody tr td:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

#history-table tbody tr td:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
  text-align: right;
  white-space: normal;
}

/* Results Overlay */
#result-section {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 22, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}

#guest-save-block {
  display: flex;
}

.result-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.close-btn {
  margin-top: 0;
}

#result-close-btn {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.result-card {
  background: rgba(10, 20, 45, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 800px;
  width: 100%;
  border-radius: 30px;
  padding: 40px;
  box-shadow: var(--card-shadow);
  text-align: center;
  color: var(--text-main);
  backdrop-filter: blur(18px);
}

.profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 22, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-modal-card {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 18, 40, 0.9);
  box-shadow: var(--card-shadow);
  padding: 22px;
}

.profile-modal-card h3 {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

.profile-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.profile-field-full {
  grid-column: 1 / -1;
}

.profile-input {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 0 12px;
  font-size: 0.92rem;
  outline: none;
}

.profile-input:focus {
  border-color: rgba(125, 183, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(125, 183, 255, 0.16);
}

.profile-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.profile-photo-block {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.profile-photo-preview-wrap {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.profile-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-photo-upload-btn {
  display: inline-flex;
  align-items: center;
}

.profile-password-block {
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.profile-password-block h4 {
  margin: 0 0 12px;
}

.profile-modal-message {
  margin: 14px 0 0;
  font-size: 0.88rem;
}

.profile-modal-message.is-error {
  color: #ffb6b6;
}

.profile-modal-message.is-success {
  color: #9af7b4;
}

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

.result-header h2 {
  color: var(--text-main);
  margin-bottom: 5px;
}

.result-level {
  font-size: 4rem;
  font-weight: 800;
  background: var(--blue-accent);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 10px 0;
}

.result-score {
  font-size: 1.5rem;
  /* Larger font */
  font-weight: 700;
  /* Bold */
  color: var(--text-main);
  margin-bottom: 20px;
}

.detailed-results {
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  background: rgba(8, 18, 40, 0.7);
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
  color: var(--text-main);
}

.analysis-item {
  background: rgba(12, 23, 50, 0.7);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.analysis-question-text {
  color: #f6f9ff;
  font-weight: 600;
  margin-bottom: 8px;
}

.analysis-item.correct {
  border-left: 4px solid #4caf50;
}

.analysis-item.incorrect {
  border-left: 4px solid #f44336;
}

/* Utility */
/* Navigation Buttons (Back) - Glass Style for Dark Background */
.sm-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  color: white;
  /* White text for visibility */
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 50px;
  backdrop-filter: blur(5px);
  transition: all 0.2s;
}

.sm-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  color: white;
}

/* New Quiz Classes */
.question-level-badge {
  background: var(--blue-accent);
  color: white;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.option-label-idk {
  border: 1px dashed rgba(255, 211, 154, 0.6) !important;
  color: #ffd39a;
}

.option-label-idk:hover {
  background: rgba(255, 211, 154, 0.12);
  border-color: rgba(255, 211, 154, 0.8) !important;
}

.error-msg {
  color: #ff7a7a;
  background: rgba(255, 122, 122, 0.12);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  border: 1px solid rgba(255, 122, 122, 0.3);
}


.analysis-meta {
  font-weight: normal;
  font-size: 0.9em;
  color: #e1e8ff;
}

.analysis-points {
  font-size: 0.8em;
  color: #d6defa;
}

.analysis-header {
  margin-top: 30px;
}

.table-placeholder {
  text-align: center;
  padding: 20px;
}

.table-error {
  color: red;
  text-align: center;
  padding: 20px;
}

.history-user-email {
  font-size: 0.8em;
  color: var(--text-secondary);
}

.history-topic {
  font-size: 0.8em;
  color: var(--text-secondary);
}

.history-actions-cell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}

.history-actions-cell button {
  white-space: nowrap;
}

.history-actions-inline {
  margin-top: 0;
}

#history-table tbody tr td.history-score-cell {
  text-align: center;
  vertical-align: middle;
  min-width: 140px;
}

#history-table:not(.history-table-teacher) tbody tr td.history-score-cell .history-actions-inline {
  margin-top: 10px;
  justify-content: center;
}

.history-score-value {
  display: inline-block;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.1;
}

.history-actions-col {
  white-space: normal;
  overflow-wrap: anywhere;
}

.history-view-btn {
  padding: 6px 10px;
  font-size: 0.8em;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.history-delete-btn {
  padding: 6px 10px;
  font-size: 0.8em;
  background: rgba(255, 77, 109, 0.15);
  color: #ff8aa0;
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.history-assign-btn {
  padding: 6px 10px;
  font-size: 0.8em;
  background: rgba(125, 183, 255, 0.2);
  color: var(--text-main);
  border: 1px solid rgba(125, 183, 255, 0.4);
  border-radius: 999px;
  cursor: pointer;
}

.history-assign-manual-btn {
  background: rgba(255, 184, 107, 0.2);
  border: 1px solid rgba(255, 184, 107, 0.4);
  color: #ffd39a;
}

.history-view-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.history-assign-btn:hover {
  background: rgba(125, 183, 255, 0.3);
}

.history-assign-manual-btn:hover {
  background: rgba(255, 184, 107, 0.3);
}

.history-delete-btn:hover {
  background: rgba(255, 77, 109, 0.25);
}

.history-delete-btn:hover {
  filter: brightness(1.1);
}

.history-view-btn::before,
.history-delete-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  display: inline-block;
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.9;
}

.history-view-btn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23EAF2FF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.history-delete-btn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FF8AA0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3Cpath d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/%3E%3C/svg%3E");
}

.certificate-btn {
  margin-top: 20px;
  background: #4caf50;
  color: white;
}

.student-tasks-panel {
  margin-top: 20px;
  background: rgba(12, 23, 50, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
}

.student-tasks-panel h3 {
  margin: 0 0 14px;
  color: var(--text-main);
}

#student-tasks-list {
  display: grid;
  gap: 12px;
}

#teacher-reviews-list {
  display: grid;
  gap: 12px;
}

.student-task-card {
  background: rgba(8, 18, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
}

.student-task-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.student-task-head h4 {
  margin: 0;
  color: var(--text-main);
}

.student-task-title-multiline {
  white-space: pre-line;
  line-height: 1.35;
}

.student-task-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.student-task-meta {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.legacy-task-note {
  font-size: 0.8rem;
  color: #ffd39a;
}

.student-task-body {
  margin: 10px 0 0;
  color: var(--text-main);
  line-height: 1.5;
}

.student-task-section-title {
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.student-task-rules {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-main);
}

.student-task-rules li {
  margin-bottom: 4px;
}

.student-task-items {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.student-task-item {
  background: rgba(12, 23, 50, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
}

.student-task-item-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.student-task-item-prompt {
  margin-top: 6px;
  line-height: 1.4;
  color: var(--text-main);
}

.task-lesson-blocks {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.task-lesson-block {
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 22, 45, 0.55);
}

.task-lesson-block-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.task-lesson-block-text {
  margin-top: 4px;
  line-height: 1.4;
  color: var(--text-main);
}

.task-block-mistake {
  border-color: rgba(255, 111, 97, 0.45);
  background: rgba(255, 111, 97, 0.08);
}

.task-block-rule {
  border-color: rgba(125, 183, 255, 0.45);
  background: rgba(125, 183, 255, 0.09);
}

.task-block-model {
  border-color: rgba(126, 214, 140, 0.45);
  background: rgba(126, 214, 140, 0.09);
}

.task-block-action {
  border-color: rgba(255, 200, 102, 0.45);
  background: rgba(255, 200, 102, 0.09);
}

.student-task-answer-label {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.student-task-prev-answer {
  margin-top: 8px;
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.student-task-prev-answer-label {
  color: var(--text-secondary);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.student-task-prev-answer-value {
  margin-top: 4px;
  color: var(--text-main);
  line-height: 1.4;
}

.student-task-answer,
.teacher-review-comment {
  width: 100%;
  margin-top: 6px;
  min-height: 84px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 18, 40, 0.75);
  color: var(--text-main);
  padding: 10px 12px;
  font-family: inherit;
  line-height: 1.4;
}

.student-task-answer:focus,
.teacher-review-comment:focus {
  outline: none;
  border-color: rgba(125, 183, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(125, 183, 255, 0.2);
}

.student-task-answer[readonly] {
  opacity: 0.78;
  cursor: not-allowed;
}

.student-task-actions,
.teacher-review-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.task-status-badge {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-pending {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
}

.status-submitted {
  background: rgba(125, 183, 255, 0.2);
  color: #d8e8ff;
  border: 1px solid rgba(125, 183, 255, 0.45);
}

.status-approved {
  background: rgba(76, 175, 80, 0.2);
  color: #90f0a4;
  border: 1px solid rgba(76, 175, 80, 0.45);
}

.status-needs-revision {
  background: rgba(255, 184, 107, 0.2);
  color: #ffd39a;
  border: 1px solid rgba(255, 184, 107, 0.45);
}

.task-teacher-comment {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.teacher-review-card {
  background: rgba(8, 18, 40, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
}

.teacher-student-group {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(8, 18, 40, 0.58);
  overflow: hidden;
}

.teacher-student-group + .teacher-student-group {
  margin-top: 10px;
}

.teacher-student-group-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(12, 23, 50, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.teacher-student-group-summary::-webkit-details-marker {
  display: none;
}

.teacher-student-group-main {
  min-width: 0;
  flex: 1 1 auto;
}

.teacher-student-group-name {
  font-weight: 700;
  color: var(--text-main);
}

.teacher-student-group-email {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.teacher-student-group-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.teacher-student-group-stats span {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
}

.teacher-student-group-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255, 255, 255, 0.6);
  border-bottom: 2px solid rgba(255, 255, 255, 0.6);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.teacher-student-group[open] .teacher-student-group-chevron {
  transform: rotate(-135deg);
}

.teacher-student-group-body {
  padding: 10px;
}

.teacher-review-answer-item {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(12, 23, 50, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.teacher-review-answer {
  margin-top: 8px;
  white-space: normal;
  line-height: 1.45;
  color: var(--text-main);
}

.teacher-review-answer-waiting {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.teacher-ai-check {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.teacher-ai-check-btn {
  justify-self: start;
}

.teacher-ai-check-result {
  margin: 0;
}

.teacher-ai-check-output {
  border: 1px solid rgba(125, 183, 255, 0.22);
  border-radius: 10px;
  background: rgba(125, 183, 255, 0.08);
  padding: 8px 10px;
}

.teacher-ai-check-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.teacher-ai-verdict {
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.ai-verdict-correct {
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid rgba(76, 175, 80, 0.4);
  color: #90f0a4;
}

.ai-verdict-partial {
  background: rgba(255, 184, 107, 0.2);
  border: 1px solid rgba(255, 184, 107, 0.4);
  color: #ffd39a;
}

.ai-verdict-incorrect {
  background: rgba(255, 111, 97, 0.2);
  border: 1px solid rgba(255, 111, 97, 0.4);
  color: #ffb7ab;
}

.teacher-ai-score {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.teacher-ai-check-row {
  margin-top: 8px;
}

.teacher-ai-check-row-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.teacher-ai-check-row-text {
  margin-top: 2px;
  line-height: 1.42;
  color: var(--text-main);
}

.teacher-ai-check-error {
  border: 1px solid rgba(255, 111, 97, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  color: #ffb7ab;
  background: rgba(255, 111, 97, 0.08);
}

.teacher-review-awaiting {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.task-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  background: rgba(4, 10, 22, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.task-editor-dialog {
  width: min(900px, 96vw);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: rgba(10, 20, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  padding: 16px;
}

.task-lang-dialog {
  width: min(440px, 96vw);
}

.task-editor-title {
  margin: 0;
  color: var(--text-main);
}

.task-editor-student {
  margin: 6px 0 14px;
  color: var(--text-secondary);
}

.task-editor-generation {
  margin: -8px 0 14px;
  color: #9cc6ff;
  font-size: 0.86rem;
}

.task-editor-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.task-editor-input,
.task-editor-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 18, 40, 0.8);
  color: var(--text-main);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.96rem;
  line-height: 1.4;
}

.task-editor-items-textarea {
  min-height: 180px;
}

.task-editor-title-input {
  resize: vertical;
  min-height: 80px;
}

.task-editor-input:focus,
.task-editor-textarea:focus {
  outline: none;
  border-color: rgba(125, 183, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(125, 183, 255, 0.2);
}

.task-lang-select {
  margin-top: 4px;
}

.task-editor-hint {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.task-editor-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.review-revision-btn {
  background: rgba(255, 184, 107, 0.22);
  border: 1px solid rgba(255, 184, 107, 0.4);
}

.review-delete-task-btn {
  background: rgba(255, 77, 109, 0.18);
  border: 1px solid rgba(255, 77, 109, 0.36);
  color: #ff9db0;
}

.review-delete-task-btn:hover {
  background: rgba(255, 77, 109, 0.28);
}

.tasks-empty {
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}


/* Zoom Controls */
.zoom-controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.zoom-controls button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 23, 50, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

/* Teacher Controls */
.teacher-controls {
  margin: 20px 0;
  padding: 18px;
  background: rgba(10, 20, 45, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(16px);
}

.teacher-controls-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.teacher-btn-migrate {
  background: rgba(125, 183, 255, 0.2);
  border: 1px solid rgba(125, 183, 255, 0.45);
  color: var(--text-main);
}

.teacher-btn-error {
  background: rgba(255, 77, 109, 0.2);
  border: 1px solid rgba(255, 77, 109, 0.4);
  color: #ff8aa0;
}

.teacher-btn-view {
  background: rgba(125, 183, 255, 0.2);
  border: 1px solid rgba(125, 183, 255, 0.45);
  color: var(--text-main);
}

.teacher-btn-review {
  background: rgba(97, 200, 170, 0.2);
  border: 1px solid rgba(97, 200, 170, 0.45);
  color: #b8f7e4;
}

.teacher-btn-refresh {
  background: rgba(255, 184, 107, 0.2);
  border: 1px solid rgba(255, 184, 107, 0.4);
  color: #ffd39a;
}

.teacher-btn-students {
  background: rgba(129, 140, 248, 0.2);
  border: 1px solid rgba(129, 140, 248, 0.42);
  color: #d8dbff;
}

.teacher-students-lang-container {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(8, 18, 40, 0.58);
}

.teacher-students-lang-container h4 {
  margin: 0;
  color: var(--text-main);
}

.teacher-students-lang-hint {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.teacher-students-lang-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.teacher-students-lang-refresh-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.teacher-students-lang-table-wrap {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.teacher-students-lang-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.teacher-students-lang-table th,
.teacher-students-lang-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  vertical-align: top;
}

.teacher-students-lang-table th {
  color: var(--text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(12, 23, 50, 0.7);
}

.teacher-students-lang-table tr:last-child td {
  border-bottom: none;
}

.teacher-student-lang-select {
  min-width: 150px;
  margin: 0;
  padding: 8px 10px;
}

.teacher-student-lang-actions {
  display: grid;
  gap: 6px;
}

.teacher-student-lang-status {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.teacher-student-lang-status.is-success {
  color: #9ef0b0;
}

.teacher-student-lang-status.is-error {
  color: #ffb5ad;
}

#stats-container {
  margin-top: 20px;
}

#questions-container {
  margin-top: 20px;
  text-align: left;
}

#questions-content {
  background: rgba(12, 23, 50, 0.75);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Questions Browser */
.questions-topic {
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  background: rgba(10, 20, 45, 0.6);
}

.questions-summary {
  font-weight: bold;
  cursor: pointer;
  font-size: 1.1em;
  padding: 5px;
  color: var(--text-main);
}

.questions-topic-body {
  padding: 10px;
}

.questions-empty {
  color: #888;
}

.questions-level {
  margin: 10px 0 5px;
  color: var(--text-secondary);
}

.questions-list {
  list-style: none;
  padding-left: 10px;
}

.questions-item {
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.questions-item-title {
  font-weight: bold;
  color: var(--text-main);
  margin-bottom: 5px;
}

.questions-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.questions-edit-btn {
  padding: 6px 10px;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.questions-edit-form {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 18, 40, 0.72);
}

.questions-edit-hint {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.questions-edit-textarea {
  resize: vertical;
  min-height: 74px;
}

.questions-edit-options {
  margin-top: 2px;
}

.questions-option-value {
  color: var(--text-secondary);
  font-size: 0.84em;
}

.questions-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.questions-save-btn,
.questions-cancel-btn {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.questions-edit-status {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.questions-edit-status.is-success {
  color: #9ef0b0;
}

.questions-edit-status.is-error {
  color: #ffb5ad;
}

.questions-text-answer {
  margin-left: 20px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.questions-answer-label {
  font-weight: bold;
  color: var(--text-main);
}

.questions-accepted {
  color: var(--text-secondary);
}

.questions-options {
  margin-left: 20px;
  list-style: none;
  padding: 0;
}

.questions-option {
  color: var(--text-secondary);
}

.questions-option-correct {
  color: #7dffb5;
  font-weight: bold;
}

.questions-explanation {
  margin-top: 5px;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* Error Statistics */
.error-stats-topic {
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  background: rgba(12, 23, 50, 0.7);
}

.error-stats-summary {
  font-weight: bold;
  cursor: pointer;
  font-size: 1.1em;
  padding: 5px;
  color: var(--text-main);
}

.error-stats-body {
  padding: 10px;
}

.error-stats-empty {
  color: var(--text-secondary);
  font-style: italic;
}

.error-stats-table {
  width: 100%;
  font-size: 0.9em;
  border-collapse: collapse;
}

.error-stats-header {
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.error-stats-cell {
  padding: 8px;
  color: var(--text-main);
}

.error-stats-head {
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.error-stats-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.error-rate {
  font-weight: bold;
}

.error-rate-low {
  color: #7dffb5;
}

.error-rate-med {
  color: #ffd39a;
}

.error-rate-high {
  color: #ff8aa0;
}

.zoom-controls button:hover {
  background: rgba(16, 30, 66, 0.9);
  transform: scale(1.1);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.4);
  color: var(--primary-color);
}

.zoom-controls button:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .container {
    padding: 18px 14px;
  }

  /* User Bar Mobile */
  .user-bar {
    flex-direction: column;
    padding: 15px;
    width: 100%;
    border-radius: 20px;
    gap: 15px;
  }

  #auth-placeholder {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-login-block {
    width: 100%;
    justify-content: center;
  }

  .auth-divider {
    display: none;
  }

  .email-auth {
    width: 100%;
    justify-content: center;
  }

  .auth-login-top {
    width: 100%;
    justify-content: center;
  }

  .email-register-fields {
    width: 100%;
    justify-content: center;
  }

  .auth-input,
  .auth-select {
    width: 100%;
    min-width: 0;
  }

  .email-auth-buttons {
    width: 100%;
    justify-content: center;
  }

  .email-auth-buttons .auth-btn {
    flex: 1 1 180px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    justify-self: center;
    gap: 10px;
    white-space: normal;
  }

  /* Dashboard Card */
  #dashboard-view {
    padding: 20px;
    width: 100%;
    box-shadow: none;
    /* Cleaner on mobile */
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
  }

  .profile-modal-card {
    padding: 16px;
  }

  .profile-modal-grid {
    grid-template-columns: 1fr;
  }

  /* Teacher Controls Centering */
  #teacher-controls h3 {
    text-align: center;
  }

  #teacher-controls>div {
    justify-content: center !important;
  }

  #teacher-controls button {
    width: 100%;
    /* Full width buttons for easier tapping */
    margin-bottom: 5px;
    font-size: 0.9rem;
    padding: 10px 20px;
  }

  /* Dashboard & History Table Styling */
  #dashboard-view h2 {
    color: var(--text-main);
    font-weight: 600;
  }

  .table-container {
    overflow-x: auto;
    margin-top: 20px;
    margin-bottom: 20px;
    background: rgba(8, 18, 40, 0.7);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* --- Responive Table: Card View --- */
  #history-table thead {
    display: none;
    /* Hide headers */
  }

  #history-table,
  #history-table tbody,
  #history-table tr,
  #history-table td {
    display: block;
    width: 100%;
  }

  #history-table th {
    color: var(--text-secondary);
    font-weight: 600;
  }

  #history-table tr {
    margin-bottom: 20px;
    background: rgba(12, 23, 50, 0.7);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  #history-table td {
    text-align: right;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    padding-left: 0;
    /* padding reset */
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
  }

  #history-table td:last-child {
    border-bottom: none;
  }

  /* Add labels via CSS content using data-label attribute (needs JS update) 
     Fallback if JS not updated: user still sees content but maybe less context.
     We will update JS to add data-label attributes.
  */
  #history-table td::before {
    content: attr(data-label);
    float: left;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.9em;
    text-transform: uppercase;
  }

  .history-actions-cell {
    justify-content: center;
  }

  #history-table td.history-score-cell {
    display: block !important;
    text-align: center;
  }

  .history-score-cell .history-actions-inline {
    margin-top: 10px;
    justify-content: center;
  }

  .student-task-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .teacher-student-group-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .teacher-student-group-stats {
    justify-content: flex-start;
    margin-left: 0;
  }

  .teacher-student-group-chevron {
    align-self: flex-end;
  }
}

@media (max-width: 600px) {
  .grid-container {
    grid-template-columns: 1fr;
  }
}

/* GLOBAL Dashboard Styles (Desktop & Mobile override) */
#teacher-controls h3 {
  color: var(--text-main) !important;
  text-align: center;
}

/* --- Report / Results Table Styles --- */
.report-container {
  color: #f6f9ff;
}

/* ... (previous report styles) ... */

/* --- Error Statistics (Teacher Dashboard) --- */
#stats-content {
  color: #f6f9ff;
}

#stats-content details {
  color: #f6f9ff;
}

#stats-content table th {
  color: #e7efff !important;
}

#stats-content table td {
  color: #f6f9ff !important;
}

.report-section h4 {
  color: #f6f9ff;
  /* Dark Navy for headings */
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 5px;
}

.report-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.report-label {
  width: 120px;
  font-weight: 600;
  color: #f6f9ff;
  /* FORCE DARK TEXT */
  flex-shrink: 0;
}

.report-bar-container {
  flex-grow: 1;
  background-color: #e0e0e0;
  height: 12px;
  border-radius: 6px;
  margin: 0 15px;
  overflow: hidden;
}

.report-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 1s ease-out;
}

.report-value {
  width: 100px;
  text-align: right;
  font-weight: 500;
  color: #f6f9ff;
  /* FORCE DARK TEXT */
  flex-shrink: 0;
}

.report-recommendation {
  background: rgba(125, 183, 255, 0.12);
  border-left: 5px solid rgba(125, 183, 255, 0.6);
  padding: 15px;
  border-radius: 8px;
  margin-top: 25px;
  color: #e7efff;
}

.report-recommendation h4 {
  color: #f6f9ff;
  margin-top: 0;
}

.report-details-hint {
  color: #e7efff !important;
  /* Darker gray for readability */
}
