/* ============================================
   ATM — Screen-Specific Styles
   ============================================ */

/* ============================================
   Welcome Screen
   ============================================ */

.welcome-screen {
  display: flex;
  flex-direction: column;
  padding: var(--space-xl);
  padding-top: var(--space-3xl);
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

.welcome-hero {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.logo-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  color: var(--color-secondary);
  box-shadow: 0 8px 32px rgba(245, 182, 66, 0.35);
}

.brand-title {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
  letter-spacing: -1px;
}

.brand-tagline {
  font-size: var(--font-screen-subtitle);
  color: var(--color-text-secondary);
}

.welcome-features {
  margin-bottom: var(--space-2xl);
}

@media (min-width: 769px) {
  .welcome-features {
    max-width: 28rem;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--color-border);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-text {
  display: flex;
  flex-direction: column;
}

.feature-text strong {
  font-weight: 600;
  color: var(--color-secondary);
  font-size: var(--font-body);
}

.feature-text span {
  font-size: var(--font-caption);
  color: rgba(26, 26, 26, 0.72);
}

.welcome-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.skip-link {
  display: block;
  text-align: center;
  padding: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--font-caption);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.skip-link:hover {
  color: var(--color-text);
}

/* ============================================
   Auth Screens (Sign In / Sign Up)
   ============================================ */

.auth-screen {
  display: flex;
  flex-direction: column;
  padding: var(--space-xl);
  padding-top: var(--space-xl);
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

.auth-back {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: var(--space-xl);
  transition: background var(--transition-fast);
}

.auth-back:hover {
  background: var(--color-border);
}

.auth-header {
  margin-bottom: var(--space-xl);
}

.auth-header h1 {
  font-size: var(--font-auth-headline);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.auth-header p {
  font-size: var(--font-body);
  color: var(--color-text-secondary);
}

.auth-form {
  margin-bottom: var(--space-lg);
}

@media (min-width: 769px) {
  .auth-screen {
    align-items: center;
  }

  .auth-back {
    align-self: flex-start;
  }

  .auth-header {
    max-width: 28rem;
    width: 100%;
    text-align: center;
  }

  .auth-form {
    max-width: 28rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .auth-form .btn.btn-block {
    align-self: center;
    width: min(100%, 22rem);
    margin-left: 0;
    margin-right: 0;
  }
}

.phone-input-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.country-code {
  padding: var(--space-md);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  font-weight: 500;
  color: var(--color-text);
}

.phone-input-group .form-input {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  flex: 1;
}

/* Password input with toggle button */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-input {
  padding-right: 48px; /* Make room for toggle button */
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  z-index: 10;
}

.password-toggle:hover {
  color: var(--color-primary);
}

.password-toggle:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-divider span {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.social-buttons {
  display: flex;
  gap: var(--space-sm);
}

.btn-social {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-social:hover {
  background: var(--color-bg);
  border-color: var(--color-text-muted);
}

.auth-switch {
  text-align: center;
  margin-top: var(--space-xl);
  color: var(--color-text-secondary);
}

.auth-switch a {
  color: var(--color-primary-dark);
  font-weight: 600;
  text-decoration: none;
}

/* ============================================
   Profile Select Screen
   ============================================ */

/* =====================================================
   Profile Select — Netflix-style circular avatars
   ===================================================== */
.profile-select-screen {
  --profile-circle-size: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  position: relative;
  overflow-x: hidden;
}

/* Three-dot menu */
.profile-select-menu-container {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
}

.profile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: rgba(248, 250, 252, 0.70);
}

.profile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #F8FAFC;
}

/* Header */
.profile-select-header {
  text-align: center;
  margin-bottom: 48px;
}

.profile-select-header .logo-circle {
  display: none;
}

.profile-select-header h1 {
  font-size: 40px;
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.profile-select-header .subtitle {
  font-size: 16px;
  color: rgba(248, 250, 252, 0.50);
  font-weight: 400;
}

/* Shared row: profiles + add button all inline (no auto margins — they break flex gap) */
.profiles-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  width: 100%;
  max-width: 1100px;
  margin-bottom: 40px;
}

.profile-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 32px;
  margin: 0;
  margin-bottom: 0;
  width: auto;
  max-width: none;
  flex: 0 0 auto;
}

.profiles-row .add-profile-card {
  flex: 0 0 auto;
}

/* Each profile — no box, just avatar + name */
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.22s ease;
  min-width: var(--profile-circle-size, 180px);
}

.profile-card:hover {
  transform: scale(1.10);
  border: none;
  box-shadow: none;
}

.profile-card:active {
  transform: scale(1.04);
}

.profile-card.manage-mode {
  position: relative;
  cursor: default;
}

.profile-card.manage-mode:hover {
  transform: none;
}

.profile-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Large circular avatar */
.profile-avatar {
  box-sizing: border-box;
  width: var(--profile-circle-size, 180px);
  height: var(--profile-circle-size, 180px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 700;
  border: 3px solid transparent;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
  flex-shrink: 0;
}

.profile-card:hover .profile-avatar {
  border-color: #F5B642;
  box-shadow: 0 0 0 4px rgba(245, 182, 66, 0.25);
}

/* Profile name & grade below circle */
.profile-info {
  text-align: center;
}

.profile-info .profile-name {
  display: block;
  font-weight: 600;
  color: #F8FAFC;
  font-size: 19px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.profile-info .profile-grade {
  display: block;
  font-size: 14px;
  color: rgba(248, 250, 252, 0.45);
  margin-top: 3px;
}

/* Manage-mode action buttons */
.profile-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: 8px;
  justify-content: center;
}

.profile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  color: rgba(248, 250, 252, 0.70);
}

.profile-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.profile-action-btn.edit-btn {
  color: #F5B642;
  border-color: rgba(245, 182, 66, 0.40);
}

.profile-action-btn.edit-btn:hover {
  background: rgba(245, 182, 66, 0.15);
}

.profile-action-btn.delete-btn {
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.40);
}

.profile-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Empty state */
.empty-profiles {
  text-align: center;
  padding: var(--space-xl);
  color: rgba(248, 250, 252, 0.50);
}

.empty-profiles .subtitle {
  margin-top: var(--space-xs);
}

/* Add New Learner — same circle size, dashed border */
.add-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.22s ease;
  color: rgba(248, 250, 252, 0.55);
  width: auto;
  min-width: var(--profile-circle-size, 180px);
}

.add-profile-card:hover {
  transform: scale(1.10);
  background: transparent;
  color: #F5B642;
}

.add-profile-card .add-icon {
  box-sizing: border-box;
  width: var(--profile-circle-size, 180px);
  height: var(--profile-circle-size, 180px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  /* Same 3px border weight as .profile-avatar so circles match visually */
  border: 3px dashed rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition: border-color 0.22s ease, background 0.22s ease;
}

.add-profile-card:hover .add-icon {
  border-color: #F5B642;
  background: rgba(245, 182, 66, 0.08);
}

.add-profile-card span {
  font-weight: 500;
  font-size: 17px;
  white-space: nowrap;
}

/* Footer — Manage Profiles link */
.profile-select-footer {
  margin-top: 32px;
  text-align: center;
  padding-top: 0;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: rgba(248, 250, 252, 0.45);
  font-size: 14px;
  cursor: pointer;
  padding: var(--space-sm);
  transition: color 0.18s ease;
  letter-spacing: 0.02em;
}

.text-link:hover {
  color: #F8FAFC;
}

/* Avatar Selection */
.avatar-selection {
  margin-bottom: var(--space-lg);
}

.avatar-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  justify-content: center;
}

@media (min-width: 480px) {
  .avatar-options-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.avatar-option {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  padding: 0;
  background: var(--color-white);
}

.avatar-option:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.avatar-option.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-white), 0 0 0 4px var(--color-primary);
}

.avatar-option svg {
  width: 28px;
  height: 28px;
}

/* Avatar icon display */
.avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-icon svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.profile-avatar.avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar.avatar-icon svg {
  width: 32px;
  height: 32px;
}

/* Profile select screen: icons fill the large circle (overrides 32px cap above) */
.profile-select-screen .profile-avatar.avatar-icon svg {
  width: 78%;
  height: 78%;
  max-width: 142px;
  max-height: 142px;
}

/* OTP Section */
.otp-section {
  margin-top: var(--space-lg);
}

.otp-section.hidden {
  display: none;
}

.otp-message {
  text-align: center;
  margin-bottom: var(--space-lg);
  color: var(--color-text-secondary);
}

.otp-message span {
  font-weight: 600;
  color: var(--color-text);
}

.otp-inputs {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.otp-input {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  transition: all var(--transition-fast);
}

.otp-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.resend-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  background: none;
  border: none;
  cursor: pointer;
}

.resend-link span {
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* ============================================
   S0 — Entry Screen
   ============================================ */

.s0-entry {
  display: flex;
  flex-direction: column;
  padding-top: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

/* Active Profile Banner */
.active-profile-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
}

.profile-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-avatar-small.avatar-icon {
  font-size: 0;
}

.profile-avatar-small.avatar-icon svg {
  width: 20px;
  height: 20px;
}

.profile-greeting {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.profile-greeting .greeting-text {
  font-size: var(--font-caption);
  color: rgba(26, 26, 26, 0.62);
}

.profile-greeting .profile-name {
  font-weight: 700;
  color: var(--color-secondary);
  font-size: var(--font-body);
}

.switch-profile-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.switch-profile-btn:hover {
  background: var(--color-primary-lighter);
  border-color: var(--color-primary);
  color: var(--color-text);
}

.s0-entry .logo-section {
  text-align: center;
  margin-bottom: 24px;
}

.s0-entry .logo-section.compact {
  margin-bottom: 20px;
}

.s0-entry .logo-section.compact .welcome-title {
  font-size: 20px;
}

.s0-entry .logo-image {
  height: 48px;
  margin-bottom: 16px;
}

.s0-entry .welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.s0-entry .welcome-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.5;
}

.s0-entry .action-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
  padding-bottom: 20px;
}

.s0-entry .action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.s0-entry .action-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.s0-entry .action-card.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.s0-entry .action-card.primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.s0-entry .action-card .card-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.s0-entry .action-card.primary .card-icon {
  background: rgba(255, 255, 255, 0.2);
}

.s0-entry .action-card .card-icon svg {
  width: 24px;
  height: 24px;
  color: var(--color-primary-dark);
}

.s0-entry .action-card.primary .card-icon svg {
  color: var(--color-secondary);
}

.s0-entry .action-card .card-content {
  flex: 1;
  min-width: 0;
}

.s0-entry .action-card .card-title {
  font-size: var(--font-label);
  font-weight: 700;
  color: var(--color-secondary);
  margin-bottom: 2px;
}

.s0-entry .action-card.primary .card-title {
  color: var(--color-secondary);
}

.s0-entry .action-card .card-subtitle {
  font-size: var(--font-caption);
  color: rgba(26, 26, 26, 0.72);
  line-height: 1.45;
}

.s0-entry .action-card.primary .card-subtitle {
  color: rgba(0, 0, 0, 0.6);
}

.s0-entry .action-card .arrow-icon {
  width: 20px;
  height: 20px;
  color: rgba(26, 26, 26, 0.45);
  flex-shrink: 0;
}

.s0-entry .action-card.primary .arrow-icon {
  color: var(--color-secondary);
}

.s0-entry .journey-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: var(--font-caption);
}

.s0-entry .stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.s0-entry .stat-value {
  font-weight: 700;
  color: var(--color-primary-dark);
}

.s0-entry .stat-label {
  color: rgba(26, 26, 26, 0.65);
}

.s0-entry .stat-divider {
  color: rgba(26, 26, 26, 0.35);
}

/* ============================================
   S1 — Student Context
   ============================================ */

.s1-student-context .form-card {
  background: var(--color-white);
  border-radius: var(--radius-2xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.s1-student-context .section-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-md);
  margin-top: var(--space-lg);
}

.s1-student-context .section-title:first-child {
  margin-top: 0;
}

/* ============================================
   S2 — Assessment Type
   ============================================ */

/* Readable column width on large screens (avoids stretched toggle, select, and cards) */
.s2-assessment-type {
  max-width: min(100%, 36rem);
  margin-left: auto;
  margin-right: auto;
}

/* Primary CTA: full column width (overrides global .btn-block max-width) */
.s1-student-context .btn.btn-block,
.s2-assessment-type .btn.btn-block,
.s3-configure .btn.btn-block {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
}

.s2-assessment-type .screen-header h1 {
  font-size: var(--font-screen-title-compact);
  font-weight: 800;
  color: #F8FAFC;
  letter-spacing: -0.02em;
}

.s2-assessment-type .screen-header .subtitle {
  font-size: var(--font-screen-subtitle);
  color: rgba(248, 250, 252, 0.55);
}

/* Mode Toggle Section */
.mode-toggle-section {
  margin-bottom: 24px;
}

.mode-toggle {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  padding: 5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mode-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  font-size: var(--font-label);
  font-weight: 600;
  color: rgba(248, 250, 252, 0.65);
  background: transparent;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-toggle-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.mode-toggle-btn:hover {
  color: #F8FAFC;
  background: rgba(255, 255, 255, 0.08);
}

.mode-toggle-btn.active {
  color: #1A1A1A;
  background: linear-gradient(135deg, #F5B642, #F97316);
  box-shadow: 0 4px 16px rgba(245, 182, 66, 0.35);
}

.mode-toggle-btn.active svg {
  opacity: 1;
}

/* Past Tests View */
.past-tests-container {
  margin-top: 24px;
}

.past-tests-empty {
  text-align: center;
  padding: 48px 24px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.past-tests-empty .empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: rgba(245, 182, 66, 0.15);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F5B642;
}

.past-tests-empty h3 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.past-tests-empty p {
  font-size: var(--font-size-base);
  color: rgba(248, 250, 252, 0.65);
  margin: 0;
}

.past-tests-list {
  display: flex;
  flex-direction: column;
}

/* Past test items use type-card styling */
.past-test-item {
  margin-bottom: 24px;
}

.past-test-item:last-child {
  margin-bottom: 0;
}

/* Override for generated tests - they should look selected like type-cards */
.past-test-item.generated {
  border-color: #F5B642;
  background: rgba(245, 182, 66, 0.1);
  box-shadow: 0 0 0 1px rgba(245, 182, 66, 0.35), 0 8px 28px rgba(0, 0, 0, 0.25);
}

.past-test-item.generated .type-icon {
  background: linear-gradient(135deg, #F5B642, #E5A632);
  border: none;
}

.past-test-item.generated .type-icon svg {
  color: #1A1A1A;
}

.past-test-item.generated .type-badge {
  background: rgba(245, 182, 66, 0.2);
  color: #F5B642;
  border: 1px solid rgba(245, 182, 66, 0.45);
}

.past-test-item.generated .check-indicator {
  background: linear-gradient(135deg, #F5B642, #F97316);
  border-color: transparent;
}

.past-test-item.generated .check-indicator svg {
  color: #1A1A1A;
}

/* Format Options Modal */
.format-options-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.format-options-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.70);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.format-options-modal-content {
  position: relative;
  background: rgba(20, 17, 46, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-2xl);
  padding: 28px 24px 24px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 1001;
  color: var(--color-text);
}

.format-options-modal-content h3 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  padding-right: 40px;
}

.format-options-modal-content .modal-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.format-options-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.format-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  color: var(--color-text);
}

.format-option-btn:hover {
  border-color: var(--color-primary);
  background: rgba(245, 182, 66, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.format-option-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary-light);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.format-option-icon svg {
  width: 24px;
  height: 24px;
}

.format-option-label {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
}

.format-option-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.format-options-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text-secondary);
}

.format-options-modal-close:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
  color: var(--color-text);
}

.format-options-modal-close svg {
  width: 16px;
  height: 16px;
}

/* Subject Selection Section */
.subject-section {
  margin-bottom: 20px;
}

.subject-section .form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: var(--font-label);
  font-weight: 700;
  color: var(--color-text);
}

.subject-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: var(--font-caption);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.subject-chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
}

.subject-chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-secondary);
}

.subject-chip svg {
  width: 16px;
  height: 16px;
}

.s2-assessment-type .subject-section .form-label {
  font-size: var(--font-label);
  font-weight: 700;
  color: rgba(248, 250, 252, 0.92);
}

.s2-assessment-type .subject-section .form-label svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.s2-test-type-heading {
  margin-top: 24px;
  margin-bottom: 14px;
}

.s2-test-type-heading .form-label {
  margin-bottom: 0;
  font-size: var(--font-label);
  font-weight: 700;
  color: rgba(248, 250, 252, 0.92);
}

.s2-assessment-type #btn-continue.btn-lg {
  min-height: 56px;
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.s2-assessment-type #btn-continue.btn-primary:not(:disabled) {
  box-shadow: 0 8px 28px rgba(245, 182, 66, 0.45);
}

.s2-assessment-type .type-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.s2-assessment-type .type-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 18px 16px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: var(--shadow-card);
}

.s2-assessment-type .type-card:hover {
  border-color: rgba(245, 182, 66, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(245, 182, 66, 0.2);
}

.s2-assessment-type .type-card.selected {
  border-color: #F5B642;
  background: linear-gradient(145deg, rgba(245, 182, 66, 0.16) 0%, rgba(249, 115, 22, 0.08) 100%);
  box-shadow: 0 0 0 2px rgba(245, 182, 66, 0.35), 0 12px 36px rgba(0, 0, 0, 0.35);
}

.s2-assessment-type .type-icon {
  width: 56px;
  height: 56px;
  background: rgba(245, 182, 66, 0.18);
  border: 1px solid rgba(245, 182, 66, 0.25);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.s2-assessment-type .type-card.selected .type-icon {
  background: linear-gradient(135deg, #F5B642, #E5A632);
  border-color: transparent;
}

.s2-assessment-type .type-icon svg {
  width: 28px;
  height: 28px;
  color: #F5B642;
}

.s2-assessment-type .type-card.selected .type-icon svg {
  color: #1A1A1A;
}

.s2-assessment-type .type-content {
  flex: 1;
}

.s2-assessment-type .type-header {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-between;
}

.s2-assessment-type .type-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: #F8FAFC;
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.s2-assessment-type .type-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.s2-assessment-type .type-badge {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(245, 182, 66, 0.15);
  color: #F5B642;
  border: 1px solid rgba(245, 182, 66, 0.35);
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.s2-assessment-type .type-badge.completed {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.test-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.test-delete-btn:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

.test-delete-btn:active {
  transform: scale(0.95);
}

.test-delete-btn svg {
  width: 16px;
  height: 16px;
}

.s2-assessment-type .type-description {
  font-size: var(--font-size-base);
  color: rgba(248, 250, 252, 0.72);
  line-height: 1.55;
  margin-bottom: 12px;
}

.s2-assessment-type .type-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  color: rgba(248, 250, 252, 0.55);
}

.s2-assessment-type .type-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.s2-assessment-type .type-meta svg {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

.s2-assessment-type .check-indicator {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.s2-assessment-type .check-indicator svg {
  display: none;
}

.s2-assessment-type .type-card.selected .check-indicator {
  background: linear-gradient(135deg, #F5B642, #F97316);
  border-color: transparent;
}

.s2-assessment-type .type-card.selected .check-indicator svg {
  display: block;
  color: #1A1A1A;
}

/* ============================================
   S3 — Configure
   ============================================ */

.s3-configure .screen-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.s3-configure .test-type-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 14px;
  background: var(--color-primary-lighter);
  border-radius: var(--radius-full);
  width: fit-content;
}

.s3-configure .test-type-label {
  font-size: var(--font-caption);
  font-weight: 600;
  color: rgba(248, 250, 252, 0.72);
}

.s3-configure .test-type-value {
  font-size: var(--font-body);
  font-weight: 700;
  color: var(--color-primary-dark);
}

.s3-configure .config-section {
  margin-bottom: 24px;
}

.s3-configure .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.s3-configure .form-label {
  font-size: var(--font-label);
  font-weight: 700;
}

.s3-configure .form-label svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.s3-configure .section-label {
  font-size: var(--font-label-group);
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.s3-configure .section-label svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.s3-configure .form-hint {
  font-size: var(--font-caption);
  color: rgba(248, 250, 252, 0.62);
  margin-top: var(--space-sm);
}

.s3-configure .multi-select-trigger {
  min-height: 52px;
  font-size: var(--font-label);
  padding: 16px 18px;
}

.s3-configure .multi-select-placeholder {
  color: rgba(248, 250, 252, 0.78);
}

.s3-configure .multi-select-selected {
  font-weight: 600;
}

.s3-configure #chapters-select.form-input {
  display: none !important;
}

.s3-configure .config-section .form-input {
  font-size: var(--font-label);
}

/* Chapter picker list: dark glass (matches app; avoids native OS select contrast bugs) */
.s3-configure .multi-select-menu {
  background: rgba(26, 23, 48, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.s3-configure .multi-select-dropdown-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.s3-configure .multi-select-dropdown-option.selected {
  background: rgba(245, 182, 66, 0.16);
}

.s3-configure .multi-select-dropdown-option span:last-child {
  color: rgba(248, 250, 252, 0.95);
  font-weight: 500;
}

.s3-configure .multi-select-dropdown-option.selected span:last-child {
  color: #fcd34d;
  font-weight: 600;
}

.s3-configure .multi-select-dropdown-option .checkmark,
.s3-configure .multi-select-dropdown-option .radiomark {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
}

.s3-configure .multi-select-dropdown-option.selected .checkmark {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.s3-configure .multi-select-dropdown-option.selected .radiomark {
  border-color: var(--color-primary);
}

.s3-configure .multi-select-dropdown-option.selected .radiomark .radio-inner {
  background: var(--color-primary);
}

.s3-configure .difficulty-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.s3-configure .difficulty-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 14px;
  font-size: var(--font-caption);
  font-weight: 600;
  text-align: center;
  background: var(--color-white);
  border: 2px solid rgba(15, 12, 41, 0.12);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-secondary);
  box-shadow: var(--shadow-sm);
}

.s3-configure .difficulty-pill:hover {
  background: var(--color-primary-lighter);
  border-color: var(--color-primary);
  color: var(--color-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.s3-configure .difficulty-pill.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-secondary);
  box-shadow: 0 4px 12px rgba(245, 182, 66, 0.4);
}

.s3-configure .difficulty-pill .pill-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-secondary);
  transition: color var(--transition-fast);
}

.s3-configure .difficulty-pill.selected .pill-icon {
  color: var(--color-secondary);
}

.s3-configure .difficulty-pill .pill-label {
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--color-secondary);
  transition: color var(--transition-fast);
}

.s3-configure .difficulty-pill.selected .pill-label {
  color: var(--color-secondary);
  font-weight: 700;
}

/* Question Count Stepper */
.s3-configure .count-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-xl);
}

.s3-configure .stepper-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border: 2px solid rgba(15, 12, 41, 0.12);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-secondary);
}

.s3-configure .stepper-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.s3-configure .stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.s3-configure .stepper-btn svg {
  width: 24px;
  height: 24px;
}

.s3-configure .count-display {
  text-align: center;
  min-width: 80px;
}

.s3-configure .count-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.s3-configure .count-label {
  font-size: var(--font-caption);
  color: rgba(248, 250, 252, 0.55);
  margin-top: 6px;
}

/* Format Options - Matching Difficulty Pills Style */
.s3-configure .format-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.s3-configure .format-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 14px;
  font-size: var(--font-caption);
  font-weight: 600;
  text-align: center;
  background: var(--color-white);
  border: 2px solid rgba(15, 12, 41, 0.12);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-secondary);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.s3-configure .format-pill:hover {
  background: var(--color-primary-lighter);
  border-color: var(--color-primary);
  color: var(--color-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.s3-configure .format-pill.selected,
.s3-configure .format-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-secondary);
  box-shadow: 0 4px 12px rgba(245, 182, 66, 0.4);
}

.s3-configure .format-pill.selected .pill-icon,
.s3-configure .format-pill.active .pill-icon {
  color: var(--color-secondary);
}

.s3-configure .format-pill.selected .pill-label,
.s3-configure .format-pill.active .pill-label {
  color: var(--color-secondary);
  font-weight: 700;
}

.s3-configure .format-pill.selected .pill-description,
.s3-configure .format-pill.active .pill-description {
  color: var(--color-secondary);
  opacity: 0.9;
}

.s3-configure .format-pill:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.s3-configure .format-pill .pill-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-secondary);
  transition: color var(--transition-fast);
}

.s3-configure .format-pill .pill-label {
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--color-secondary);
  transition: color var(--transition-fast);
  line-height: 1.2;
}

.s3-configure .format-pill .pill-description {
  font-size: var(--font-meta);
  color: rgba(26, 26, 26, 0.65);
  font-weight: 400;
  line-height: 1.35;
  margin-top: 2px;
  transition: color var(--transition-fast);
  text-align: center;
  max-width: 100%;
  word-wrap: break-word;
}

/* Ensure format pills match difficulty pills exactly */
.s3-configure .format-pill:hover .pill-description {
  color: rgba(26, 26, 26, 0.75);
}

/* ============================================
   S4 — Digital Taking
   ============================================ */

.s4-digital-taking {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: var(--space-lg);
}

/* Top bar: title + subject (left) + reference code (right) */
.s4-digital-taking .s4-exam-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.s4-digital-taking .s4-exam-meta {
  flex: 1;
  min-width: 0;
}

.s4-digital-taking .test-name {
  font-size: var(--font-screen-title-compact);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.25;
}

.s4-digital-taking .test-subject {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.s4-digital-taking .test-id {
  position: static;
  flex-shrink: 0;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 6px 12px;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-all;
}

/* Progress: grouped strip */
.s4-digital-taking .s4-progress-panel {
  margin-bottom: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
}

.s4-digital-taking .s4-progress-panel .progress-text {
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-base);
}

.s4-digital-taking .s4-progress-panel .progress-text .current {
  color: var(--color-primary);
  font-weight: 700;
}

.s4-digital-taking .s4-progress-panel #progress-percent {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.s4-digital-taking .question-container {
  margin-bottom: var(--space-md);
  flex: 1;
  min-height: 0;
}

.s4-digital-taking .question-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.s4-digital-taking .question-meta-row .question-number {
  margin-bottom: 0;
}

.s4-digital-taking .question-meta-row .question-type-badge {
  margin-left: 0;
}

.s4-digital-taking .question-type-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.16);
}

/* Question stem: one surface (the card) + amber rail only — no nested panel */
.s4-digital-taking #question-text {
  margin-top: 0;
  margin-bottom: var(--space-xl);
  padding: var(--space-lg) var(--space-lg) var(--space-lg) calc(var(--space-lg) + 4px);
  border-left: 4px solid var(--color-primary);
  font-size: clamp(1.25rem, 2.8vw, 1.5rem);
  line-height: 1.55;
  font-weight: 600;
  color: var(--color-text);
}

.s4-digital-taking .answer-area {
  margin-top: 0;
}

.s4-digital-taking .s4-nav-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
}

.s4-digital-taking .nav-buttons {
  margin-top: 0;
}

.s4-digital-taking .nav-buttons .btn-prev {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.s4-digital-taking .nav-buttons .btn-prev:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

/* ============================================
   S5 — Print Download
   ============================================ */

.s5-print-download .download-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.s5-print-download .download-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-2xl);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.s5-print-download .download-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card-hover);
}

.s5-print-download .download-icon {
  width: 52px;
  height: 52px;
  background: var(--color-primary-light);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.s5-print-download .download-icon svg {
  width: 26px;
  height: 26px;
  color: var(--color-primary-dark);
}

.s5-print-download .download-content {
  flex: 1;
}

.s5-print-download .download-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.s5-print-download .download-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.s5-print-download .download-action {
  width: 40px;
  height: 40px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.s5-print-download .download-action svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-secondary);
}

/* ============================================
   S6 — Upload
   ============================================ */

/* Upload screen layout */
.s6-upload {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 0;
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  overflow: hidden;
  max-width: min(100%, 40rem);
  margin: 0 auto;
  width: 100%;
}

.s6-upload .screen-header.compact {
  padding: var(--space-md) var(--space-lg);
  flex-shrink: 0;
}

.s6-upload .screen-header.compact h1 {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.s6-upload .upload-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--space-lg) var(--space-lg);
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.s6-upload .content-section {
  margin-bottom: var(--space-lg);
}

.s6-upload .content-section:first-child {
  margin-top: 0;
}

.s6-upload .content-section.tips-compact {
  margin-bottom: 8px;
}

.s6-upload .tips-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  font-size: 11px;
  color: var(--color-text-secondary);
}

.s6-upload .tips-inline .tip-icon {
  font-size: 14px;
}

.s6-upload .submission-instructions {
  padding: var(--space-lg) var(--space-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  margin-top: var(--space-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  width: 100%;
  box-sizing: border-box;
}

.s6-upload .submission-instructions .instructions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.s6-upload .submission-instructions .instructions-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--font-size-base);
  color: #f8fafc;
  margin-bottom: 14px;
  line-height: 1.55;
  padding-left: 0;
}

.s6-upload .submission-instructions .instructions-list li:last-child {
  margin-bottom: 0;
}

.s6-upload .submission-instructions .instructions-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: 0.55em;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5b642, #f97316);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(245, 182, 66, 0.25);
}

.s6-upload .upload-footer {
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 5;
}

.s6-upload .upload-footer .btn-block {
  max-width: 320px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 6px;
  padding: 16px 20px;
  min-height: 52px;
  font-size: var(--font-size-lg);
  font-weight: 800;
  display: flex;
}

.s6-upload .upload-footer .btn-primary:not(:disabled) {
  box-shadow: 0 4px 20px rgba(245, 182, 66, 0.35);
}

.s6-upload .upload-footer .btn-primary:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px dashed rgba(245, 182, 66, 0.35);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.s6-upload .upload-footer .btn-primary:disabled svg {
  stroke: #cbd5e1;
  opacity: 0.9;
}

.s6-upload .upload-footer p {
  margin: 6px 0 0 0;
  font-size: var(--font-size-sm);
  color: rgba(226, 232, 240, 0.85);
}

.s6-upload .upload-footer .text-muted {
  color: rgba(226, 232, 240, 0.8) !important;
}

.s6-upload .section-block {
  margin-bottom: 20px;
}

.s6-upload .section-label {
  display: block;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.s6-upload .assessment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.s6-upload .assessment-list::-webkit-scrollbar {
  width: 4px;
}

.s6-upload .assessment-list::-webkit-scrollbar-track {
  background: var(--color-bg);
  border-radius: 2px;
}

.s6-upload .assessment-list::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.s6-upload .assessment-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.s6-upload .empty-state {
  padding: 20px 12px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.s6-upload .assessment-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.s6-upload .assessment-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
  box-shadow: var(--shadow-sm);
}

.s6-upload .assessment-card.active {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
  box-shadow: 0 2px 8px rgba(245, 182, 66, 0.2);
}

.s6-upload .assessment-card-content {
  flex: 1;
  min-width: 0;
}

.s6-upload .assessment-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.s6-upload .assessment-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
}

.s6-upload .assessment-badge {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.s6-upload .assessment-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.s6-upload .assessment-card-meta .dot {
  opacity: 0.5;
}

.s6-upload .assessment-card-date {
  font-size: 10px;
  color: var(--color-text-muted);
}

.s6-upload .assessment-card-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.s6-upload .assessment-card.active .assessment-card-check {
  opacity: 1;
  background: var(--color-primary);
  color: var(--color-secondary);
}

.s6-upload .assessment-info-card {
  background: var(--color-primary-light);
  border-radius: var(--radius-xl);
  padding: 12px;
  margin-bottom: 0;
  border: 1px solid rgba(245, 182, 66, 0.3);
}

.s6-upload .info-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.s6-upload .info-content {
  padding-left: 22px;
}

.s6-upload .info-subject {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 3px;
}

.s6-upload .info-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.s6-upload .info-meta .dot {
  opacity: 0.5;
}

.s6-upload .upload-section {
  margin-bottom: 20px;
}

.s6-upload .upload-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 0;
}

.s6-upload .upload-options.horizontal {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.s6-upload .upload-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: var(--space-xl) var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 140px;
}

.s6-upload .upload-option-btn.compact {
  padding: 12px 8px;
  gap: 6px;
}

.s6-upload .upload-option-btn:hover {
  transform: translateY(-2px);
}

.s6-upload .upload-option-btn:active {
  transform: translateY(0);
}

.s6-upload .upload-option-btn .option-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.s6-upload .upload-option-btn .option-icon svg {
  width: 28px;
  height: 28px;
}

.s6-upload .upload-option-btn.compact .option-icon {
  width: 40px;
  height: 40px;
}

.s6-upload .option-icon.camera {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: var(--color-white);
}

.s6-upload .option-icon.upload {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-white);
}

.s6-upload .upload-option-btn .option-label {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: #f8fafc;
}

.s6-upload .upload-option-btn.compact .option-label {
  font-size: 11px;
}

.s6-upload .option-hint {
  font-size: 10px;
  color: var(--color-text-secondary);
}

/* File chips on upload — dark glass (global .file-item used white bg) */
.s6-upload .file-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 14px;
}

.s6-upload .file-name {
  font-size: var(--font-size-sm);
  color: #f8fafc;
}

.s6-upload .file-size {
  font-size: var(--font-size-xs);
  color: rgba(226, 232, 240, 0.85);
}

.s6-upload .file-icon {
  background: rgba(255, 255, 255, 0.08);
}

.s6-upload .file-icon svg {
  color: #f5b642;
}

/* ============================================
   S7 — Report
   ============================================ */

/* Match create-test column width (S2) */
.s7-report {
  max-width: min(100%, 36rem);
  margin: 0 auto;
  width: 100%;
}

.s7-report .assessment-context {
  margin-bottom: var(--space-lg);
}

.s7-report .context-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.s7-report .context-info {
  flex: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  min-width: 0;
}

.s7-report .context-test-name {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.25;
  color: #f8fafc;
  margin: 0;
  word-break: break-word;
}

.s7-report .context-test-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  margin: 0;
  width: 100%;
}

/* Glass + gold text — same language as S2 type cards / S3 chips */
.s7-report .test-code-value {
  font-family: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: #f5b642;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px 14px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-card);
  letter-spacing: 0.04em;
}

/* Same as .s3-configure .test-type-badge */
.s7-report .context-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 14px;
  margin: 2px 0 0;
  align-self: flex-start;
  max-width: 100%;
  width: fit-content;
  background: var(--color-primary-lighter);
  border: 1px solid rgba(245, 182, 66, 0.25);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.s7-report .context-subject {
  font-size: var(--font-body);
  font-weight: 700;
  color: var(--color-primary-dark);
}

.s7-report .context-meta-sep {
  color: rgba(248, 250, 252, 0.4);
  font-weight: 700;
  font-size: var(--font-size-base);
  line-height: 1;
  user-select: none;
}

.s7-report .context-date {
  font-size: var(--font-body);
  font-weight: 600;
  color: rgba(248, 250, 252, 0.72);
}

.s7-report .score-section {
  margin-bottom: var(--space-lg);
}

.s7-report .results-section {
  margin-bottom: var(--space-xl);
  margin-top: var(--space-sm);
}

.s7-report .results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.s7-report .results-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.s7-report .results-toggle {
  font-size: var(--font-size-base);
  color: #f5b642;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.s7-report .results-toggle:hover {
  color: #fcd34d;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.s7-report .feedback-section {
  margin-bottom: var(--space-xl);
}

/* Global Language Dropdown - Beside Test Info */
.s7-report .global-language-dropdown {
  flex-shrink: 0;
  position: relative;
}

.language-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.language-dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.language-dropdown-btn svg:first-child {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}

.language-dropdown-btn .dropdown-arrow {
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
  transition: transform 0.2s ease;
}

.language-dropdown-btn.open .dropdown-arrow {
  transform: rotate(180deg);
}

.language-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  background: rgba(20, 17, 46, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: dropdown-fade-in 0.2s ease;
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.language-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: rgba(248, 250, 252, 0.88);
  text-align: left;
  transition: background 0.2s ease;
}

.language-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.language-menu-item.active {
  color: var(--color-primary);
  background: rgba(245, 182, 66, 0.12);
}

.language-menu-item .lang-check {
  width: 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.language-menu-item.active .lang-check {
  opacity: 1;
}

/* Language Selector (keep for local use if needed) */
.language-selector {
  display: flex;
  gap: 4px;
  background: var(--color-bg-secondary);
  padding: 3px;
  border-radius: 8px;
  margin-right: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-btn:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.lang-btn.active {
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.lang-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.lang-btn span {
  font-size: 12px;
}

.feedback-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.feedback-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.s7-report .action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Worksheet View Section */
.worksheet-view-section {
  margin-bottom: var(--space-lg);
}

/* Worksheet Gallery Modal */
.worksheet-gallery-modal {
  max-width: 90vw;
  max-height: 90vh;
  width: 1200px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  outline: none;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Worksheet modal overlay specific styling */
#worksheet-modal.modal-overlay {
  position: fixed;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  overflow-y: auto;
  padding: var(--space-md);
}

.worksheet-gallery-modal .modal-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.worksheet-gallery-modal .modal-close:hover {
  background: var(--color-error);
  border-color: var(--color-error);
  color: var(--color-white);
  transform: rotate(90deg) scale(1.1);
  box-shadow: var(--shadow-lg);
}

.worksheet-gallery-modal .modal-close svg {
  width: 22px;
  height: 22px;
}

.worksheet-modal-header {
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  border-bottom: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: linear-gradient(to bottom, var(--color-white) 0%, var(--color-bg) 100%);
}

.worksheet-modal-header h3 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.worksheet-modal-header h3::before {
  content: '📄';
  font-size: var(--font-size-2xl);
}

.worksheet-page-indicator {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-primary-light);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-lg);
}

.worksheet-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

.worksheet-image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  overflow: auto;
  position: relative;
}

.worksheet-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  background: white;
  border: 1px solid var(--color-border);
  transition: transform var(--transition-normal);
}

.worksheet-image-container img:hover {
  transform: scale(1.02);
}

.worksheet-navigation {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-md);
  pointer-events: none;
  z-index: 10;
}

.worksheet-nav-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  color: var(--color-primary);
  backdrop-filter: blur(4px);
}

.worksheet-nav-btn:hover:not(:disabled) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.worksheet-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.worksheet-nav-btn svg {
  width: 28px;
  height: 28px;
}

.worksheet-thumbnails {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  overflow-x: auto;
  border-top: 2px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  min-height: 140px;
}

.worksheet-thumbnail {
  position: relative;
  width: 100px;
  height: 120px;
  border-radius: var(--radius-lg);
  border: 3px solid var(--color-border);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.worksheet-thumbnail:hover {
  border-color: var(--color-primary);
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.worksheet-thumbnail.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light), var(--shadow-lg);
  transform: scale(1.1);
}

.worksheet-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-label {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: var(--font-size-xs);
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .worksheet-gallery-modal {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    border-radius: 0;
  }
  
  .worksheet-gallery-modal .modal-close {
    top: var(--space-md);
    right: var(--space-md);
    width: 40px;
    height: 40px;
  }
  
  .worksheet-gallery-modal .modal-close svg {
    width: 20px;
    height: 20px;
  }
  
  .worksheet-modal-header {
    padding: var(--space-md) var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  
  .worksheet-modal-header h3 {
    font-size: var(--font-size-base);
    flex: 1 1 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 50px;
  }
  
  .worksheet-modal-header h3::before {
    font-size: var(--font-size-lg);
  }
  
  .worksheet-page-indicator {
    font-size: var(--font-size-xs);
    padding: 4px var(--space-sm);
    white-space: nowrap;
  }
  
  .worksheet-navigation {
    padding: 0 var(--space-xs);
  }
  
  .worksheet-nav-btn {
    width: 44px;
    height: 44px;
  }
  
  .worksheet-nav-btn svg {
    width: 22px;
    height: 22px;
  }
  
  .worksheet-image-container {
    padding: var(--space-md);
  }
  
  .worksheet-thumbnails {
    padding: var(--space-md);
    gap: var(--space-sm);
    justify-content: flex-start;
  }
  
  .worksheet-thumbnail {
    width: 70px;
    height: 90px;
  }
  
  /* History screen mobile optimization */
  .history-item {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }
  
  .history-item-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  
  .history-item-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .history-item-title {
    font-size: var(--font-size-base);
    margin-bottom: 4px;
  }
  
  .history-item-meta {
    font-size: 12px;
    gap: 6px;
    line-height: 1.3;
  }
  
  .history-item-meta span {
    white-space: nowrap;
  }
  
  .history-item-score {
    font-size: var(--font-size-base);
    padding: 4px 8px;
    flex-shrink: 0;
  }
  
  .history-item-delete {
    width: 28px;
    height: 28px;
    margin-right: 0;
  }
  
  .history-item-arrow {
    width: 20px;
    flex-shrink: 0;
  }
  
  .history-item-arrow svg {
    width: 14px;
    height: 14px;
  }
  
  /* Filter tabs mobile */
  .filter-tabs {
    padding: 4px;
    gap: 4px;
  }
  
  .filter-tab {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  /* Summary stats mobile */
  .summary-stats {
    gap: var(--space-sm);
  }
  
  .summary-stat {
    min-width: 0;
  }
  
  .stat-num {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
  }
  
  .stat-text {
    font-size: var(--font-size-sm);
  }

  .summary-header {
    font-size: var(--font-size-lg);
  }
}

/* ============================================
   Profile Screen
   ============================================ */

.profile-screen {
  padding-top: var(--space-md);
  padding-bottom: var(--space-3xl);
}

.profile-header {
  text-align: center;
  padding: var(--space-xl) 0;
  margin-bottom: var(--space-lg);
}

.avatar-container {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-md);
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-dark);
}

.avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-secondary);
}

.profile-name {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.profile-details {
  color: var(--color-text-secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-sm);
}

.stat-icon.accent {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.stat-icon.success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.profile-section {
  margin-bottom: var(--space-xl);
}

.profile-section .section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.info-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--color-text-secondary);
}

.info-value {
  font-weight: 500;
  color: var(--color-text);
}

.action-list {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.action-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.action-item:hover {
  background: var(--color-bg);
}

.action-item:last-child {
  border-bottom: none;
}

.action-item span {
  flex: 1;
  font-weight: 500;
  color: var(--color-text);
}

.action-item .chevron {
  color: var(--color-text-muted);
}

.action-item.danger span {
  color: var(--color-error);
}

.action-item.danger svg {
  color: var(--color-error);
}

/* Logout Section */
.logout-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
}

/* ============================================
   History Screen
   ============================================ */

.history-screen {
  max-width: min(100%, 36rem);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.history-screen .screen-header {
  margin-bottom: var(--space-lg);
}

.history-screen .screen-header h1 {
  color: #f8fafc;
  font-size: clamp(1.625rem, 4.2vw, 1.875rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.history-screen .screen-header .subtitle {
  color: rgba(248, 250, 252, 0.55);
  font-size: var(--font-size-base);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text);
  padding: 0;
}

.refresh-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-secondary);
  transform: rotate(90deg);
}

.refresh-btn:active {
  transform: rotate(90deg) scale(0.95);
}

.refresh-btn.refreshing {
  animation: spin 1s linear infinite;
  pointer-events: none;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Match S2 mode-toggle — dark glass + gold active pill (readable text) */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: var(--space-lg);
  padding: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.filter-tab {
  flex: 1;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: rgba(248, 250, 252, 0.65);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.filter-tab.active {
  background: linear-gradient(135deg, #f5b642, #f97316);
  color: #1a1a1a;
  box-shadow: 0 4px 16px rgba(245, 182, 66, 0.35);
}

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}

.empty-icon {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
}

.history-screen .empty-state h3 {
  font-size: var(--font-size-xl);
}

.empty-state p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

/* Loading State */
.loading-state {
  padding: var(--space-2xl) var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.loading-message {
  margin-top: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
}

/* Skeleton Loaders */
.skeleton-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.skeleton-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-bg) 0%, var(--color-border) 50%, var(--color-bg) 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-bg) 0%, var(--color-border) 50%, var(--color-bg) 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-title {
  width: 60%;
  height: 16px;
}

.skeleton-subtitle {
  width: 40%;
}

.skeleton-badge {
  width: 60px;
  height: 24px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-bg) 0%, var(--color-border) 50%, var(--color-bg) 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Match S2 type-card — dark glass, not white + invisible text */
.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: var(--shadow-card);
}

.history-item:hover {
  border-color: rgba(245, 182, 66, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(245, 182, 66, 0.2);
}

.history-item.non-clickable {
  cursor: default;
  opacity: 0.8;
}

.history-item.non-clickable:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-card);
}

.history-item.non-clickable:hover .history-item-arrow {
  color: rgba(248, 250, 252, 0.45);
  transform: none;
}

.history-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-item-icon.success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.history-item-icon.warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.history-item-icon.fail {
  background: var(--color-error-light);
  color: var(--color-error);
}

.history-item-icon.in-progress {
  background: rgba(245, 182, 66, 0.15);
  color: #f5b642;
  border: 1px solid rgba(245, 182, 66, 0.25);
}

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-item-title {
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: #f8fafc;
  margin-bottom: 4px;
  line-height: 1.35;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-base);
  color: rgba(248, 250, 252, 0.62);
  line-height: 1.45;
}

.history-item-meta span {
  color: inherit;
}

.history-item-score {
  font-size: var(--font-size-xl);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.history-item-score.good {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.history-item-score.okay {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.history-item-score.low {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.history-item-score.in-progress {
  color: #fcd34d;
  background: rgba(245, 182, 66, 0.15);
  border: 1px solid rgba(245, 182, 66, 0.35);
  font-size: var(--font-size-base);
  font-weight: 600;
}

.history-item-delete {
  background: transparent;
  border: none;
  color: rgba(248, 250, 252, 0.45);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-right: var(--space-xs);
  opacity: 0.7;
  width: 32px;
  height: 32px;
}

.history-item-delete:hover {
  color: var(--color-error);
  background: var(--color-error-light);
  opacity: 1;
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-arrow {
  color: rgba(248, 250, 252, 0.45);
  flex-shrink: 0;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.history-item:hover .history-item-arrow {
  color: #f5b642;
  transform: translateX(2px);
}

.history-summary {
  margin-top: var(--space-xl);
}

.summary-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: var(--space-lg);
}

.summary-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: rgba(248, 250, 252, 0.75);
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.summary-header svg {
  color: #f5b642;
}

.summary-stats {
  display: flex;
  justify-content: space-around;
}

.summary-stat {
  text-align: center;
}

.stat-num {
  display: block;
  font-size: clamp(1.75rem, 4.2vw, 2.25rem);
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.stat-text {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-base);
  color: rgba(248, 250, 252, 0.58);
}

/* ============================================
   Settings Screen
   ============================================ */

.settings-screen .screen-header {
  margin-bottom: var(--space-lg);
}

.settings-screen {
  max-width: min(100%, 38rem);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  text-align: left;
  padding-bottom: var(--space-md);
}

.settings-section {
  margin-bottom: var(--space-2xl);
  width: 100%;
}

.settings-section .section-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.settings-section .section-title svg {
  color: #f5b642;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.settings-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: var(--space-md);
}

.setting-item svg {
  flex-shrink: 0;
  align-self: center;
  color: rgba(248, 250, 252, 0.5);
  transition: color var(--transition-fast);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item.clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.setting-item.clickable:hover {
  background: rgba(245, 182, 66, 0.08);
}

.setting-item.clickable:hover svg {
  color: #f5b642;
}

.setting-item.danger .setting-label {
  color: #fca5a5;
}

.setting-item.danger .setting-desc {
  color: rgba(248, 250, 252, 0.55);
}

.setting-item.danger.clickable:hover {
  background: rgba(239, 68, 68, 0.12);
}

.setting-item.danger.clickable:hover svg {
  color: #fecaca;
}

.setting-info {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.setting-label {
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: #f8fafc;
  display: block;
  margin-bottom: 6px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  line-height: 1.35;
}

.setting-desc {
  font-size: var(--font-size-base);
  color: rgba(248, 250, 252, 0.65);
  display: block;
  overflow-wrap: break-word;
  word-wrap: break-word;
  line-height: 1.5;
}

/* Theme toggle row (extended settings template) — dark glass + gold active */
.settings-screen .theme-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 4px;
}

.settings-screen .theme-option.active {
  background: linear-gradient(135deg, #f5b642, #f97316);
  color: #1a1a1a;
  box-shadow: 0 2px 10px rgba(245, 182, 66, 0.35);
}

.settings-screen .theme-option:not(.active) {
  color: rgba(248, 250, 252, 0.65);
}

.theme-toggle {
  display: flex;
  gap: var(--space-xs);
  background: var(--color-bg);
  padding: var(--space-xs);
  border-radius: var(--radius-md);
}

.theme-option {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.theme-option.active {
  background: var(--color-white);
  color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-border);
  transition: var(--transition-base);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: var(--transition-base);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.setting-select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: var(--font-size-base);
  cursor: pointer;
  min-height: 44px;
}

.setting-select:focus {
  outline: none;
  border-color: rgba(245, 182, 66, 0.55);
  box-shadow: 0 0 0 2px rgba(245, 182, 66, 0.2);
}

.version-info {
  text-align: center;
  padding: var(--space-2xl) var(--space-md) var(--space-xl);
  margin-top: var(--space-xl);
  color: rgba(248, 250, 252, 0.52);
  font-size: var(--font-size-base);
  line-height: 1.55;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.version-info p:first-child {
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: rgba(248, 250, 252, 0.82);
  margin-bottom: 8px;
}

.version-info p:last-child {
  font-size: var(--font-size-base);
  color: rgba(248, 250, 252, 0.5);
}

/* Toast */
.toast {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-secondary);
  color: var(--color-white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  opacity: 0;
  transition: all var(--transition-base);
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Generic .modal-overlay / .modal-content — defined in components.css (dark glass).
   Do not redeclare here: it overrode components and broke Privacy Policy (white panel + light text). */

/* About ATM — dark glass panel (light text vars are for dark UI; white .modal-content was unreadable) */
.about-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.about-atm-modal {
  width: 100%;
  max-width: 480px;
  padding: 36px 40px 32px;
  text-align: center;
  background: rgba(20, 17, 46, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.about-atm-modal h2 {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: #F8FAFC;
  letter-spacing: -0.02em;
}

.about-atm-tagline {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: #F5B642;
}

.about-atm-body {
  margin: var(--space-lg) 0 0;
  font-size: var(--font-size-base);
  line-height: 1.65;
  color: rgba(248, 250, 252, 0.82);
}

.about-atm-version {
  display: inline-block;
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: rgba(248, 250, 252, 0.55);
}

.about-atm-close-btn {
  margin-top: var(--space-xl);
  min-width: 140px;
  min-height: 48px;
  padding: 12px 28px;
  font-size: var(--font-size-lg);
  font-weight: 600;
}

/* ============================================
   Desktop & Tablet Responsive Overrides
   ============================================ */

/* Tablet (769px+): improved action card layout */
@media (min-width: 769px) and (max-width: 1024px) {
  .s0-entry .action-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    padding-bottom: 0;
  }

  .s0-entry .action-card:first-child {
    grid-column: 1 / -1;
  }

  .s0-entry .action-card {
    padding: var(--space-lg) var(--space-xl);
  }

  .s0-entry .logo-section.compact .welcome-title {
    font-size: 26px;
  }

  .active-profile-banner {
    padding: 14px 18px;
    border-radius: var(--radius-2xl);
  }
}

/* Desktop (1025px+): full 3-column action card grid */
@media (min-width: 1025px) {
  /* ---- S0 Entry: Welcome section ---- */
  .s0-entry {
    padding: 0;
  }

  .s0-entry .logo-section.compact {
    margin-bottom: var(--space-xl);
    text-align: left;
    padding-bottom: 0;
    border-bottom: none;
  }

  .s0-entry .logo-section.compact .welcome-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #F8FAFC;
  }

  /* ---- S0 Entry: 3-column action card grid ---- */
  .s0-entry .action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding-bottom: 0;
    max-width: none;
    margin-top: var(--space-md);
  }

  /* ---- Base card styles on desktop — glassmorphic ---- */
  .s0-entry .action-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 24px 24px;
    gap: 14px;
    min-height: 210px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  /* Subtle decorative blob in top-right corner of each card */
  .s0-entry .action-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.06;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .s0-entry .action-card:hover::after {
    opacity: 0.12;
  }

  /* ---- CARD 1: Take Test (primary amber) ---- */
  .s0-entry .action-card.primary {
    background: linear-gradient(140deg, #F5B642 0%, #F0A520 60%, #E89800 100%);
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(245, 182, 66, 0.4), 0 1px 4px rgba(0,0,0,0.08);
  }

  .s0-entry .action-card.primary::after {
    background: #FFFFFF;
    top: -30px;
    right: -30px;
    width: 130px;
    height: 130px;
    opacity: 0.12;
  }

  .s0-entry .action-card.primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(245, 182, 66, 0.55), 0 2px 8px rgba(0,0,0,0.1);
  }

  /* ---- CARD 2: Upload Answer Sheet (violet) ---- */
  .s0-entry .action-card:nth-child(2) {
    border-color: rgba(124, 58, 237, 0.30);
  }

  .s0-entry .action-card:nth-child(2)::after {
    background: #7C3AED;
    opacity: 0.10;
  }

  .s0-entry .action-card:nth-child(2):hover {
    border-color: rgba(124, 58, 237, 0.55);
    box-shadow: 0 12px 36px rgba(124, 58, 237, 0.25), inset 0 1px 0 rgba(255,255,255,0.10);
    transform: translateY(-4px);
  }

  .s0-entry .action-card:nth-child(2) .card-icon {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(99, 102, 241, 0.20));
    border-color: rgba(124, 58, 237, 0.35);
  }

  .s0-entry .action-card:nth-child(2) .card-icon svg {
    color: #A78BFA;
  }

  /* ---- CARD 3: Check Feedback (emerald) ---- */
  .s0-entry .action-card:nth-child(3) {
    border-color: rgba(16, 185, 129, 0.30);
  }

  .s0-entry .action-card:nth-child(3)::after {
    background: #10B981;
    opacity: 0.10;
  }

  .s0-entry .action-card:nth-child(3):hover {
    border-color: rgba(16, 185, 129, 0.55);
    box-shadow: 0 12px 36px rgba(16, 185, 129, 0.20), inset 0 1px 0 rgba(255,255,255,0.10);
    transform: translateY(-4px);
  }

  .s0-entry .action-card:nth-child(3) .card-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.20));
    border-color: rgba(16, 185, 129, 0.35);
  }

  .s0-entry .action-card:nth-child(3) .card-icon svg {
    color: #34D399;
  }

  /* ---- Shared card icon ---- */
  .s0-entry .action-card .card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(245, 182, 66, 0.18);
    border: 1px solid rgba(245, 182, 66, 0.25);
    flex-shrink: 0;
  }

  .s0-entry .action-card .card-icon svg {
    width: 26px;
    height: 26px;
    color: var(--color-primary-dark);
  }

  .s0-entry .action-card.primary .card-icon {
    background: rgba(255, 255, 255, 0.25);
  }

  .s0-entry .action-card.primary .card-icon svg {
    color: rgba(0, 0, 0, 0.75);
  }

  /* ---- Card content ---- */
  .s0-entry .action-card .card-content {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .s0-entry .action-card .card-title {
    font-size: var(--font-card-title);
    font-weight: 700;
    color: #F8FAFC;
    margin-bottom: 0;
    line-height: 1.3;
  }

  .s0-entry .action-card.primary .card-title {
    color: rgba(0, 0, 0, 0.85);
  }

  .s0-entry .action-card .card-subtitle {
    font-size: var(--font-card-subtitle);
    color: rgba(248, 250, 252, 0.65);
    line-height: 1.55;
  }

  .s0-entry .action-card.primary .card-subtitle {
    color: rgba(0, 0, 0, 0.55);
  }

  /* ---- Arrow icon ---- */
  .s0-entry .action-card .arrow-icon {
    align-self: flex-end;
    margin-top: auto;
    width: 20px;
    height: 20px;
    opacity: 0.28;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
  }

  .s0-entry .action-card:hover .arrow-icon {
    opacity: 1;
    transform: translateX(4px);
  }

  .s0-entry .action-card.primary .arrow-icon {
    color: rgba(0,0,0,0.7);
    opacity: 0.5;
  }

  .s0-entry .action-card.primary:hover .arrow-icon {
    opacity: 1;
    color: rgba(0,0,0,0.85);
  }

  /* ---- Journey stats badge ---- */
  .s0-entry .journey-stats {
    font-size: var(--font-caption);
    margin-top: 6px;
    gap: 8px;
  }

  .s0-entry .stat-value {
    font-size: var(--font-body);
    font-weight: 800;
    color: #059669;
  }

  .s0-entry .stat-label {
    color: var(--color-text-muted);
    font-size: var(--font-meta);
  }

  /* ---- Profile banner: hidden on desktop (shown in header chip instead) ---- */
  .active-profile-banner {
    display: none;
  }

  .profile-avatar-small {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(245, 182, 66, 0.3);
  }

  .profile-greeting .greeting-text {
    font-size: 11px;
    color: #92400E;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .profile-greeting .profile-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.2px;
  }

  .switch-profile-btn {
    background: rgba(255, 255, 255, 0.7);
    border-color: #FDE68A;
    color: #92400E;
    font-weight: 600;
    font-size: 12px;
  }

  .switch-profile-btn:hover {
    background: var(--color-white);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
  }

  /* ---- Sidebar nav section label ---- */
  #bottom-nav::before {
    content: "Menu";
    display: block;
    font-size: var(--font-caption);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.48);
    padding: 16px 20px 10px;
    margin-bottom: 2px;
  }

  /* ---- Screen header on desktop ---- */
  .screen-header {
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .screen-header h1 {
    font-size: var(--font-screen-title);
    font-weight: 800;
    letter-spacing: -0.5px;
  }
}

/* Large desktop (1440px+): widen action cards */
@media (min-width: 1440px) {
  .s0-entry .action-card {
    min-height: 230px;
    padding: 32px 28px 26px;
    border-radius: 22px;
  }

  .s0-entry .action-card .card-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  .s0-entry .action-card .card-icon svg {
    width: 30px;
    height: 30px;
  }

  .s0-entry .action-card .card-title {
    font-size: var(--font-card-title-emphasis);
  }

  .s0-entry .action-card .card-subtitle {
    font-size: var(--font-card-subtitle-large);
  }

  .s0-entry .logo-section.compact .welcome-title {
    font-size: 32px;
  }

  .active-profile-banner {
    padding: 18px 24px;
    margin-bottom: 28px;
  }
}

/* ============================================
   ATM Logo Styling
   ============================================ */

/* Logo image inside logo-circle */
.logo-circle .logo-img {
  width: 85%;
  height: auto;
  object-fit: contain;
  max-width: 80px;
  border-radius: 8px;
}

.logo-circle.small .logo-img {
  width: 75%;
  max-width: 50px;
  border-radius: 6px;
}

/* Remove background gradient when using image logo */
.logo-circle:has(.logo-img) {
  background: var(--color-white);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 2px solid var(--color-border);
  padding: var(--space-sm);
}

/* Header logo */
.header-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

