/* ==========================================================================
   MAMMOTH TOEFL WRITING SYSTEM - STYLESHEET
   ========================================================================== */

/* --- Design Tokens & Variables --- */
:root {
  /* Colors */
  --color-primary: #0a2540;        /* TOEFL Deep Slate */
  --color-secondary: #005082;      /* TOEFL Ocean Blue */
  --color-accent: #0070f3;         /* Modern Tech Blue */
  --color-background: #f1f5f9;     /* Soft slate background */
  --color-surface: #ffffff;        /* Pure white for panels */
  --color-text-main: #1e293b;      /* Slate 800 */
  --color-text-muted: #64748b;     /* Slate 500 */
  --color-border: #cbd5e1;         /* Slate 300 */
  --color-warning: #f59e0b;        /* Amber (Time alarm) */
  --color-danger: #ef4444;         /* Red (Pasted text flags) */
  --color-success: #10b981;        /* Emerald (Healthy markers) */
  
  /* Font Families */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;

  /* Card shadow and glass effects */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-blur: blur(12px);
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
}

/* --- Base Resets --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background-color: var(--color-background);
  color: var(--color-text-main);
  overflow: hidden; /* App layout structure */
  display: flex;
  flex-direction: column;
}

/* --- Global Utilities --- */
.w-100 {
  width: 100% !important;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  text-decoration: none;
  gap: 0.5rem;
}
.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.btn-primary {
  background-color: var(--color-accent);
  color: #fff;
}
.btn-primary:hover {
  background-color: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 112, 243, 0.3);
}
.btn-secondary {
  background-color: #e2e8f0;
  color: var(--color-text-main);
  border-color: #cbd5e1;
}
.btn-secondary:hover {
  background-color: #cbd5e1;
}
.btn-success {
  background-color: var(--color-success);
  color: white;
}
.btn-success:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-danger-action {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger-action:hover {
  background-color: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background-color: var(--color-secondary);
  color: white;
  text-transform: uppercase;
}

/* --- Glassmorphic Cards --- */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-md);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

/* --- Header Styling --- */
.app-header {
  background-color: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  border-bottom: 2px solid var(--color-secondary);
  flex-shrink: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.025em;
}
.logo-text span {
  font-weight: 400;
  color: #a5f3fc; /* Soft cyan color */
}
.header-nav {
  display: flex;
  gap: 0.5rem;
}
.nav-btn {
  background: transparent;
  color: #94a3b8;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.nav-btn:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.08);
}
.nav-btn.active {
  color: white;
  background-color: var(--color-secondary);
  border-color: rgba(255,255,255,0.15);
}

/* --- Main Layout --- */
.app-main {
  flex-grow: 1;
  overflow: hidden;
  position: relative;
}

.app-view {
  display: none;
  height: 100%;
  width: 100%;
  padding: 1.5rem 2rem;
  overflow-y: auto;
}
.app-view.active {
  display: block;
}

/* ==========================================================================
   VIEW 0: LOGIN VIEW (登录卡片样式)
   ========================================================================== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90%;
  padding-bottom: 2rem;
}
.login-card {
  width: 440px;
  padding: 2.5rem;
}
.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-logo .logo-icon {
  font-size: 3rem;
}
.login-logo h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-top: 0.5rem;
}
.login-logo p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 1.5rem;
  border: 1px solid #cbd5e1;
}
.login-tab-btn {
  background: transparent;
  border: none;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
}
.login-tab-btn.active {
  background-color: white;
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.login-form {
  display: none;
}
.login-form.active {
  display: block;
}

.login-error {
  margin-top: 1rem;
  color: var(--color-danger);
  font-size: 0.85rem;
  text-align: center;
  font-weight: 500;
}

.sync-notice-box {
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem;
  font-size: 0.8rem;
  color: #92400e;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   VIEW 1: TEACHER CONFIG & TABLES (真题及表格管理)
   ========================================================================== */
.config-container {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}
.config-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.config-sidebar h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}
.instruction-card p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}
.template-downloads {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.template-downloads h4 {
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--color-text-main);
}
.template-downloads .btn {
  justify-content: flex-start;
}

/* Dropzone Styling */
.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 2rem 1rem;
  text-align: center;
  background-color: rgba(248, 250, 252, 0.5);
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-accent);
  background-color: rgba(0, 112, 243, 0.05);
}
.dropzone-icon {
  font-size: 2.2rem;
  transition: transform 0.2s ease;
}
.dropzone:hover .dropzone-icon {
  transform: translateY(-3px);
}
.dropzone p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.dropzone-or {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
}
.import-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: 4px;
}
.import-status.success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #065f46;
}
.import-status.error {
  background-color: rgba(239, 68, 68, 0.1);
  color: #991b1b;
}

/* Form Styles */
.form-card {
  padding: 2rem;
}
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
.form-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-primary);
}
.type-selector {
  display: flex;
  gap: 1.5rem;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
}
.radio-label input {
  display: none;
}
.radio-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  display: inline-block;
  position: relative;
  transition: border-color 0.2s;
}
.radio-label input:checked + .radio-custom {
  border-color: var(--color-accent);
}
.radio-label input:checked + .radio-custom::after {
  content: '';
  width: 10px;
  height: 10px;
  background-color: var(--color-accent);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.task-form {
  display: none;
}
.task-form.active {
  display: block;
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-text-main);
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}
.student-bubble-config {
  background-color: rgba(241, 245, 249, 0.5);
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}
.student-bubble-config h4 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: var(--color-secondary);
  border-left: 3px solid var(--color-accent);
  padding-left: 0.5rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

/* Data Table Card Styles */
.table-card {
  padding: 1.5rem;
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.table-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-primary);
}
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background-color: white;
}
.mammoth-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.mammoth-table th, .mammoth-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.mammoth-table th {
  background-color: #f8fafc;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text-main);
  user-select: none;
}
.mammoth-table tbody tr:last-child td {
  border-bottom: none;
}
.mammoth-table tbody tr {
  transition: background-color 0.15s ease;
}
.mammoth-table tbody tr:hover {
  background-color: #f1f5f9;
}
.mammoth-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ==========================================================================
   VIEW 2: STUDENT PORTAL (学生主页)
   ========================================================================== */
.student-portal-split {
  align-items: start;
}

/* ==========================================================================
   VIEW 5: STUDENT SANDBOX (学生答题沙盒)
   ========================================================================== */
.student-writing-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f3f4f6;
}

/* TOEFL Topbar */
.toefl-topbar {
  background-color: #0b1a2c; /* Authentic dark slate */
  color: #fff;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 14px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
  user-select: none;
}
.toefl-timer-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.toefl-timer {
  color: #38bdf8; /* Luminous soft blue */
  font-family: monospace;
  font-size: 18px;
  letter-spacing: 0.05em;
  transition: color 0.5s ease;
}
.toefl-timer.warning {
  color: var(--color-warning);
  animation: pulse 1s infinite alternate;
}
.toefl-btn-time, .toefl-btn-word {
  background-color: #1e293b;
  color: #fff;
  border: 1px solid #475569;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: normal;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.toefl-btn-time:hover, .toefl-btn-word:hover {
  background-color: #334155;
  border-color: #64748b;
}

/* TOEFL Workspace structure */
.toefl-workspace {
  flex-grow: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.toefl-left-pane {
  background-color: #ffffff;
  border-right: 3px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.toefl-pane-scroll {
  padding: 1.5rem;
  overflow-y: auto;
  height: 100%;
  font-size: 15px;
  line-height: 1.65;
  color: #0f172a;
}
.toefl-pane-scroll p {
  margin-bottom: 1rem;
}
.toefl-pane-scroll h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.toefl-right-pane {
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.toefl-right-header {
  padding: 1rem 1.25rem 0.5rem 1.25rem;
  background-color: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
}
.toefl-right-header h4 {
  font-size: 14px;
  font-weight: bold;
  color: #0f172a;
  margin-bottom: 0.25rem;
}
.toefl-header-item {
  margin-bottom: 0.25rem;
  color: #334155;
}
.toefl-header-item strong {
  color: #0f172a;
}

/* Forum Discussion Style (Academic Discussion) */
.toefl-forum-area {
  padding: 1.25rem;
  background-color: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  max-height: 50%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.forum-bubble {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.forum-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  background-size: cover;
  background-position: center;
}
/* CSS gradients for circular avatars */
.avatar-prof { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar-andrew { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar-claire { background: linear-gradient(135deg, #10b981, #047857); }

.forum-content {
  background-color: #f8fafc;
  padding: 0.875rem 1.1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid #e2e8f0;
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
  position: relative;
}
.forum-content strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

/* Toolbar */
.toefl-editor-toolbar {
  background-color: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
  user-select: none;
}
.toefl-tools-left {
  display: flex;
  gap: 4px;
}
.toefl-tool-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 3px 12px;
  font-size: 11px;
  font-family: Arial, sans-serif;
  border-radius: 2px;
  cursor: pointer;
}
.toefl-tool-btn:hover {
  background-color: #ffffff;
  border-color: #94a3b8;
}
.toefl-tools-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.toefl-word-count {
  font-size: 13px;
  font-weight: bold;
  color: #0f172a;
  font-family: monospace;
}

/* Editor Text Area */
.toefl-textarea-container {
  flex-grow: 1;
  background-color: #ffffff;
  padding: 1.25rem;
  overflow: hidden;
}
.toefl-textarea {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: #0f172a;
  background: transparent;
}

/* TOEFL Bottom Bar */
.toefl-bottombar {
  background-color: #0b1a2c;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1.25rem;
  border-top: 1px solid #1e293b;
  flex-shrink: 0;
  user-select: none;
}
.toefl-submit-btn {
  background: linear-gradient(to bottom, #10b981, #059669);
  color: #fff;
  border: 1px solid #047857;
  padding: 6px 20px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.toefl-submit-btn:hover {
  background: linear-gradient(to bottom, #34d399, #10b981);
}

/* Question bank tab filters */
.q-bank-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
  user-select: none;
}
.q-filter-tab {
  background: transparent;
  border: none;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
  position: relative;
}
.q-filter-tab:hover {
  color: var(--color-primary);
}
.q-filter-tab.active {
  color: var(--color-accent);
}
.q-filter-tab.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-accent);
}

/* ==========================================================================
   VIEW 3: TEACHER DASHBOARD (轨迹回放面板)
   ========================================================================== */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
}
.dashboard-upload-card {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}
.dashboard-upload-card h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
}
.dashboard-upload-card p {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.dashboard-analysis-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 1.5rem;
}
.dashboard-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
}
.student-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.student-meta h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary);
}
.student-meta .report-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  min-height: 500px;
}

/* Replay Player UI */
.player-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  height: 100%;
}
.player-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.player-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-primary);
}
.player-speeds {
  display: flex;
  gap: 2px;
  background-color: #e2e8f0;
  padding: 2px;
  border-radius: 4px;
}
.speed-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  color: var(--color-text-muted);
}
.speed-btn.active {
  background-color: white;
  color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.player-screen {
  flex-grow: 1;
  background-color: white;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  min-height: 350px;
}
.player-screen-header {
  background-color: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
  font-size: 12px;
  font-weight: bold;
  color: var(--color-text-muted);
}
.player-textarea-wrapper {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
  position: relative;
}
.player-textarea-readonly {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-main);
  outline: none;
}
.player-cursor {
  color: var(--color-accent);
  font-weight: bold;
  margin-left: -1px;
  margin-right: -1px;
  animation: blink 1s step-end infinite;
  display: inline-block;
  width: 1px;
}

.player-controls {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.btn-play {
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.9rem;
  min-width: 90px;
}
.btn-play:hover {
  background-color: #0056b3;
}
.btn-play.playing {
  background-color: var(--color-warning);
}
.timeline-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.time-label {
  font-size: 12px;
  font-family: monospace;
  color: var(--color-text-muted);
}
.timeline-slider {
  flex-grow: 1;
  height: 6px;
  border-radius: 3px;
  outline: none;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* Dashboard Metrics Panel */
.dashboard-metrics-pane {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Fraud Risk Gauge */
.alert-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem;
  overflow: hidden;
}
.alert-card.risk-high {
  background-color: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}
.alert-card.risk-medium {
  background-color: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}
.alert-card.risk-low {
  background-color: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}

.gauge-area {
  flex-shrink: 0;
}
.gauge-outer {
  width: 90px;
  height: 45px; /* Semi-circle */
  position: relative;
  background-color: #e2e8f0;
  border-top-left-radius: 45px;
  border-top-right-radius: 45px;
  overflow: hidden;
}
.gauge-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 90px;
  height: 90px;
  background: conic-gradient(from 180deg, var(--color-success) 0deg, var(--color-warning) 90deg, var(--color-danger) 180deg);
  transform-origin: center center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.gauge-cover {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 74px;
  height: 37px;
  background-color: #fff;
  border-top-left-radius: 37px;
  border-top-right-radius: 37px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 2px;
}
.gauge-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text-main);
  line-height: 1.2;
}
.gauge-label {
  font-size: 9px;
  color: var(--color-text-muted);
}

.alert-details h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--color-text-main);
}
.alert-card.risk-high .alert-details h4 { color: var(--color-danger); }
.alert-card.risk-medium .alert-details h4 { color: var(--color-warning); }
.alert-card.risk-low .alert-details h4 { color: var(--color-success); }
.alert-details p {
  font-size: 0.825rem;
  line-height: 1.4;
  color: var(--color-text-muted);
}

/* Detailed Metrics */
.metrics-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  color: var(--color-primary);
}
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-main);
}
.metric-val {
  color: var(--color-accent);
}
.metric-bar-bg {
  height: 6px;
  background-color: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}
.metric-bar {
  height: 100%;
  border-radius: 3px;
  background-color: var(--color-accent);
  transition: width 0.5s ease-in-out;
}
.metric-item.danger .metric-bar { background-color: var(--color-danger); }
.metric-item.warning .metric-bar { background-color: var(--color-warning); }
.metric-item.success .metric-bar { background-color: var(--color-success); }
.metric-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Final Essay Viewer styles */
.essay-card {
  margin-top: 1.5rem;
}
.essay-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}
.essay-display {
  background-color: white;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}
.essay-display p {
  margin-bottom: 1rem;
}
.paste-highlight {
  background-color: rgba(239, 68, 68, 0.15);
  border-bottom: 2px dotted var(--color-danger);
  color: #7f1d1d;
  padding: 1px 3px;
  border-radius: 2px;
  cursor: help;
  position: relative;
}

/* ==========================================================================
   SUBMIT DIALOG (完成答题弹窗)
   ========================================================================== */
.glass-dialog {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  margin: auto;
  outline: none;
}
.glass-dialog::backdrop {
  background-color: rgba(10, 37, 64, 0.5);
  backdrop-filter: blur(4px);
}
.glass-dialog h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}
.glass-dialog p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ==========================================================================
   FOOTER (页脚)
   ========================================================================== */
.app-footer {
  background-color: #0b1a2c;
  color: #475569;
  text-align: center;
  padding: 0.75rem;
  font-size: 0.75rem;
  border-top: 1px solid #1e293b;
  flex-shrink: 0;
}

/* ==========================================================================
   ANIMATIONS & PULSERS
   ========================================================================== */
@keyframes blink {
  50% { opacity: 0; }
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.03); opacity: 1; text-shadow: 0 0 4px var(--color-warning); }
}
