:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent: #06b6d4;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --font: "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.bg-pattern {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2rem;
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.org-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #047857;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.admin-link:hover {
  background: var(--primary-light);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.admin-container {
  max-width: 960px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.step-badge {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Name selection */
.name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.name-btn {
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.name-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.name-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.password-gate {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pwd-label {
  font-size: 0.95rem;
  color: var(--text);
}

.student-pwd-input {
  max-width: 280px;
  letter-spacing: 0.2em;
  text-align: center;
  font-size: 1.2rem;
}

.student-pwd-input.hidden-input {
  display: none;
}

.name-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.name-actions .btn {
  min-width: 140px;
}

/* Buttons */
.btn {
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.05rem;
  min-width: 160px;
}

/* Quiz toolbar */
.quiz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.meta {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg);
}

.save-status.saving {
  color: var(--warning);
}

.save-status.saved {
  color: var(--success);
}

/* Word list */
.word-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.word-row {
  display: grid;
  grid-template-columns: 48px 1fr 1.2fr;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.word-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.word-row.row-correct {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.word-row.row-wrong {
  border-color: #fecaca;
  background: #fffafa;
}

.word-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.word-chinese {
  font-size: 1.05rem;
  font-weight: 500;
}

#quiz-form,
#quiz-form .word-chinese,
#quiz-form .word-num,
#quiz-form .word-row {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#quiz-form .word-input {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.word-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.word-input-wrap .word-input {
  flex: 1;
  min-width: 0;
}

.word-feedback {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}

.word-feedback.checking {
  opacity: 1;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.word-feedback.correct {
  opacity: 1;
  background: var(--success-bg);
  color: var(--success);
}

.word-feedback.wrong {
  opacity: 1;
  background: #fef2f2;
  color: #ef4444;
}

.word-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}

.word-input:focus {
  border-color: var(--primary);
}

.word-input.filled {
  background: #fafafa;
}

/* 手机端输入框：配合 lang=zh-CN 与 autocorrect=off 减少联想 */
.word-input-mobile {
  ime-mode: auto;
}

/* Submit bar */
.submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  position: sticky;
  bottom: 16px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
}

.progress-wrap {
  flex: 1;
  min-width: 200px;
}

.progress-wrap span {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Result */
.result-card {
  text-align: center;
  padding: 48px 28px;
}

.wrong-section {
  margin: 28px 0 8px;
  text-align: left;
}

.wrong-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  text-align: center;
}

.wrong-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.wrong-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  background: #fffafa;
}

.wrong-chinese {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.wrong-answers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.wrong-user {
  color: #b91c1c;
}

.wrong-user em {
  font-style: normal;
  font-weight: 500;
}

.wrong-expected {
  color: #047857;
}

.wrong-expected strong {
  font-weight: 600;
}

.report-wrong-compact .wrong-title {
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.wrong-compact-grid {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.wrong-compact-head,
.wrong-compact-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 4px;
  align-items: center;
  padding: 3px 6px;
  font-size: 0.62rem;
  line-height: 1.2;
}

.wrong-compact-head {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.58rem;
}

.wrong-compact-row {
  border-top: 1px solid #f1f5f9;
}

.wrong-compact-row:nth-child(even) {
  background: #fafbfc;
}

.wc-cn {
  font-weight: 500;
  color: var(--text);
}

.wc-u {
  color: #b91c1c;
  word-break: break-all;
}

.wc-e {
  color: #047857;
  font-weight: 600;
  word-break: break-all;
}

.retake-banner {
  padding: 14px 20px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.report-card-wrap {
  padding: 32px 28px 24px;
}

.report-footer {
  text-align: center;
  margin-top: 16px;
}

.report-header {
  text-align: center;
  margin-bottom: 24px;
}

.report-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.report-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.report-comment {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.report-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    var(--success) 0 calc(var(--pct) * 1%),
    #fecaca calc(var(--pct) * 1%) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.chart-donut-inner {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chart-donut-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.chart-donut-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.chart-donut-pct {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
  margin-top: 4px;
}

.chart-legend {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.chart-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.chart-legend .dot.correct {
  background: var(--success);
}

.chart-legend .dot.wrong {
  background: #f87171;
}

.chart-bars {
  margin-bottom: 20px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.bar-label {
  width: 72px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
}

.bar-fill.correct {
  background: var(--success);
}

.bar-fill.wrong {
  background: #f87171;
}

.report-all-correct {
  text-align: center;
  padding: 16px;
  background: var(--success-bg);
  color: #047857;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.retake-notice {
  margin-top: 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 1px solid #fdba74;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: #9a3412;
  text-align: center;
}

.retake-notice strong {
  color: #c2410c;
}

.retake-notice.failed {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: #fca5a5;
  color: #991b1b;
}

.retake-notice.failed strong {
  color: #b91c1c;
}

.report-badge.failed {
  color: #b91c1c;
  background: #fef2f2;
}

.attempt-compare {
  margin: 20px 0 8px;
  text-align: left;
}

.attempt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.attempt-row.retake {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.grant-btn {
  white-space: nowrap;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.focus-warning {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.confirm-card {
  max-width: 400px;
  text-align: left;
  padding: 28px 24px 24px;
}

.confirm-title {
  font-size: 1.15rem;
  margin-bottom: 12px;
  text-align: center;
}

.confirm-summary {
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 12px;
  text-align: center;
}

.confirm-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.confirm-list {
  max-height: 160px;
  overflow-y: auto;
  margin: 0 0 16px 1.2em;
  font-size: 0.85rem;
  color: #b45309;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.confirm-actions .btn {
  flex: 1;
  min-width: 120px;
}

.report-body {
  width: 100%;
}

.report-mobile-fit .report-header {
  margin-bottom: 12px;
}

.report-mobile-fit .report-header h2 {
  font-size: 1.2rem;
}

.report-mobile-fit .report-comment {
  font-size: 0.82rem;
}

.report-mobile-fit .chart-donut {
  width: 120px;
  height: 120px;
}

.report-mobile-fit .chart-donut-inner {
  width: 88px;
  height: 88px;
}

.report-mobile-fit .chart-donut-num {
  font-size: 1.5rem;
}

.report-mobile-fit .report-wrong-compact .wrong-title {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.report-mobile-fit .report-wrong-compact .wrong-list {
  max-height: none;
  gap: 4px;
}

.report-mobile-fit .report-wrong-compact .wrong-item {
  padding: 6px 8px;
}

.report-mobile-fit .report-wrong-compact .wrong-chinese {
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.report-mobile-fit .report-wrong-compact .wrong-answers {
  font-size: 0.68rem;
  gap: 2px;
}

.report-ultra-compact .report-wrong-compact .wrong-chinese {
  font-size: 0.75rem;
}

.report-ultra-compact .report-wrong-compact .wrong-answers {
  font-size: 0.62rem;
}

.report-ultra-compact .chart-donut {
  width: 100px;
  height: 100px;
}

.report-ultra-compact .chart-donut-inner {
  width: 72px;
  height: 72px;
}

.report-ultra-compact .chart-donut-num {
  font-size: 1.25rem;
}

.report-ultra-compact .attempt-compare {
  margin-bottom: 8px;
}

.report-ultra-compact .attempt-row {
  padding: 6px 10px;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .report-card-wrap {
    padding: 16px 12px 12px;
  }

  .report-footer {
    font-size: 0.8rem;
    margin-top: 8px;
  }

  .report-wrong-compact .wrong-answers {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 8px;
  }
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 16px 0;
}

.score-num {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.score-divider {
  font-size: 2rem;
  color: var(--text-muted);
}

.score-total {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.accuracy {
  font-size: 1.1rem;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.05rem;
}

/* Admin */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 0.9rem;
  font-weight: 500;
}

.form-row input[type="date"],
.select-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  max-width: 240px;
}

.form-row input:focus,
.select-input:focus {
  border-color: var(--primary);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-family: var(--font);
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.file-name {
  margin-top: 8px;
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
}

.toast {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.toast.success {
  background: var(--success-bg);
  color: #047857;
}

.toast.error {
  background: #fef2f2;
  color: #b91c1c;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.download-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.select-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th,
.results-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.results-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.results-table tr:hover td {
  background: #fafbfc;
}

.status-done {
  color: var(--success);
  font-weight: 500;
}

.status-pending {
  color: var(--text-muted);
}

.login-card {
  max-width: 420px;
  margin: 48px auto 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.password-input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
  width: 100%;
}

.password-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.login-error {
  color: #b91c1c;
  font-size: 0.9rem;
  padding: 10px 12px;
  background: #fef2f2;
  border-radius: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: modalPop 0.3s ease;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.modal-message {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.modal-login-form .btn {
  width: 100%;
  margin-top: 4px;
}

#btn-logout {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
}

@media (max-width: 640px) {
  .word-row {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }

  .word-input-wrap {
    grid-column: 1 / -1;
  }

  .submit-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-lg {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .name-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
