/* ============================================
   TOEFL Writing Lab — Sharp Editorial Design System
   Sprout Education Brand Language
   ============================================ */

/* --- Google Font --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --color-text: #1A1A1A;
  --color-text-secondary: #666666;
  --color-text-muted: #999999;
  --color-text-dim: #999999;
  --color-accent: #2D5D4E;
  --color-teal: #3A8C96;
  --color-bg: #F5F6F5;
  --color-bg-alt: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F5F6F5;
  --color-surface-glass: #FFFFFF;
  --color-surface-glass-hover: #F5F6F5;
  --color-border: #DEDEDE;
  --color-border-hover: #999999;
  --color-primary: #1A1A1A;
  --color-primary-light: #2D5D4E;
  --color-primary-dark: #111111;
  --color-accent-light: #3A8C96;
  --color-success: #2D5D4E;
  --color-success-light: #2D5D4E;
  --color-warning: #B8860B;
  --color-warning-light: #B8860B;
  --color-error: #C05050;
  --color-error-light: #C05050;

  /* Spacing: 6px base unit */
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 40px;
  --space-8: 48px;
  --space-10: 64px;

  /* Legacy spacing aliases (for existing code) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Radii — zero everywhere */
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;
  --radius-full: 0px;

  /* Shadows — none for flat elements */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;
  --shadow-glow-accent: none;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* No animated gradient background */
body::before {
  display: none;
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-text);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: #CCCCCC;
  border-radius: 0px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999999;
}

/* --- Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--color-text);
}

h1 { font-size: 2.25rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 600; }

/* text-gradient: no gradient, just dark text */
.text-gradient {
  color: var(--color-text);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

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

.text-sm {
  font-size: 0.75rem;
}

/* ============================================
   COMPONENTS
   ============================================ */

/* --- App Header / Navbar --- */
.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header .logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--color-text);
}

.app-header .logo-symbol {
  margin-right: 6px;
  color: var(--color-accent);
}

.app-header .tagline {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* --- Card (Sharp Editorial) --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-lg);
  transition: border-color var(--transition-normal);
}

.card:hover {
  border-color: var(--color-border-hover);
  transform: none;
  box-shadow: none;
}

.card-static {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-lg);
}

.card-static:hover {
  transform: none;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border-radius: 0px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--color-text);
  color: #FFFFFF;
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: #333333;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-text);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--color-text);
  background: transparent;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 14px 30px;
  font-size: 0.9375rem;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 0px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(45, 93, 78, 0.1);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(184, 134, 11, 0.1);
  color: var(--color-warning);
}

.badge-error {
  background: rgba(192, 80, 80, 0.1);
  color: var(--color-error);
}

.badge-info {
  background: rgba(58, 140, 150, 0.1);
  color: var(--color-teal);
}

.badge-neutral {
  background: rgba(153, 153, 153, 0.1);
  color: var(--color-text-muted);
}

/* --- Task Cards (Home Page) --- */
.task-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: var(--space-2xl) 0;
  border: 1px solid var(--color-border);
}

.task-card {
  background: var(--color-surface);
  border: none;
  border-right: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-xl);
  text-align: center;
  transition: background var(--transition-normal), border-color var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.task-card:last-child {
  border-right: none;
}

/* Subtle top accent bar on hover */
.task-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.task-card:hover::before {
  opacity: 1;
}

.task-card:hover {
  background: var(--color-surface-hover);
}

.task-card-icon {
  font-size: 0.6875rem;
  margin-bottom: var(--space-md);
  display: block;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.025em;
  color: var(--color-text);
}

.task-card-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-card-desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.task-card-active {
  border-color: var(--color-border);
  box-shadow: none;
  animation: none;
}

.task-card-active::before {
  opacity: 1;
}

.task-card-active:hover {
  transform: none;
  box-shadow: none;
  background: var(--color-surface-hover);
}

.task-card-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.task-card-disabled:hover {
  transform: none;
  background: var(--color-surface);
}

.task-card-disabled::before {
  display: none;
}

.coming-soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 0px;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Top Bar (Writing Pages) --- */
.top-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-bar-center {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.top-bar-task {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.top-bar-question {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 0px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* --- Timer --- */
.timer-display {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  transition: color var(--transition-fast);
  letter-spacing: -0.02em;
}

.timer-danger {
  color: var(--color-warning) !important;
}

.timer-critical {
  color: var(--color-error) !important;
  animation: pulse 0.6s ease-in-out infinite;
}

/* Timer bar (progress) */
.timer-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 0px;
  overflow: hidden;
  width: 120px;
}

.timer-bar-fill {
  height: 100%;
  border-radius: 0px;
  background: var(--color-accent);
  transition: width var(--transition-fast), background-color var(--transition-fast);
}

/* Timer bar color states */
.timer-bar-fill.timer-fill-warning {
  background: var(--color-warning);
}

.timer-bar-fill.timer-fill-danger {
  background: var(--color-error);
}

/* --- Word Count --- */
.word-count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 0px;
  transition: all var(--transition-fast);
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

.wc-low {
  background: rgba(192, 80, 80, 0.08) !important;
  border-color: var(--color-error) !important;
  color: var(--color-error) !important;
}

.wc-normal {
  background: rgba(45, 93, 78, 0.08) !important;
  border-color: var(--color-success) !important;
  color: var(--color-success) !important;
}

.wc-high {
  background: rgba(184, 134, 11, 0.08) !important;
  border-color: var(--color-warning) !important;
  color: var(--color-warning) !important;
}

/* --- Two-Column Layout --- */
.two-col-layout {
  display: grid;
  grid-template-columns: 65% 35%;
  gap: 0;
  min-height: calc(100vh - 60px);
}

.col-main {
  padding: var(--space-lg);
  overflow-y: auto;
  background: var(--color-surface);
}

.col-sidebar {
  padding: var(--space-lg);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  background: var(--color-bg);
}

/* --- Prompt Card --- */
.prompt-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.prompt-card .prompt-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.prompt-card .prompt-value {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
}

.prompt-card .scenario-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

/* --- Bullet Points --- */
.bullet-list {
  list-style: none;
  padding: 0;
  margin-top: var(--space-md);
}

.bullet-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.bullet-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 0px;
  border: 1px solid var(--color-border);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-fast);
}

.bullet-checked .bullet-check {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.bullet-checked {
  color: var(--color-text);
}

/* --- Email Editor --- */
.email-editor {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  overflow: hidden;
}

.email-field {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.email-field-label {
  color: var(--color-text-muted);
  font-weight: 600;
  min-width: 70px;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.email-field-value {
  color: var(--color-text-secondary);
}

.email-separator {
  height: 1px;
  background: var(--color-border);
}

.textarea-editor {
  width: 100%;
  min-height: 320px;
  background: var(--color-surface);
  border: none;
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.8;
  padding: var(--space-md);
  resize: vertical;
  outline: none;
}

.textarea-editor::placeholder {
  color: var(--color-text-muted);
}

.textarea-editor:focus {
  background: var(--color-surface);
}

/* Editor bottom bar */
.editor-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

/* --- Sidebar Panel (Phrase Menu) --- */
.sidebar-panel {
  position: relative;
}

.sidebar-panel-title {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

.sidebar-section {
  margin-bottom: var(--space-sm);
  border-radius: 0px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  transition: background var(--transition-fast);
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-section-header:hover {
  background: #ECECEC;
}

.sidebar-section-header::after {
  content: '\25BE';
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.sidebar-section.collapsed .sidebar-section-header::after {
  transform: rotate(-90deg);
}

.sidebar-section-content {
  padding: var(--space-sm);
  max-height: 500px;
  overflow: hidden;
  transition: max-height var(--transition-slow), padding var(--transition-slow);
}

.sidebar-section.collapsed .sidebar-section-content {
  max-height: 0;
  padding: 0 var(--space-sm);
}

.phrase-item {
  padding: var(--space-sm) var(--space-md);
  border-radius: 0px;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.5;
  margin-bottom: 1px;
  border-left: 2px solid transparent;
}

.phrase-item:hover {
  background: rgba(45, 93, 78, 0.06);
  color: var(--color-text);
  border-left-color: var(--color-accent);
  padding-left: calc(var(--space-md) + 4px);
}

.phrase-item::before {
  content: '\203A';
  margin-right: 6px;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.phrase-item:hover::before {
  color: var(--color-accent);
}

.sidebar-category-label {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--color-border);
  margin-top: var(--space-md);
}

.sidebar-category-label:first-child {
  margin-top: 0;
}

.sidebar-panel.collapsed .sidebar-category-label {
  display: none;
}

.sidebar-panel.collapsed .sidebar-section {
  display: none;
}

/* --- Score Dashboard --- */
.score-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.score-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-xl);
}

.score-big {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
  letter-spacing: -0.03em;
  /* No gradient */
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

.score-big.animate-in {
  animation: scoreReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.score-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.score-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  padding: 4px 0;
}

.score-detail-label {
  color: var(--color-text-secondary);
  font-weight: 400;
}

.score-detail-value {
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* --- Radar Chart --- */
.radar-chart-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Diagnostics --- */
.section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

.diagnostic-item {
  border-radius: 0px;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  border: 1px solid var(--color-border);
  border-left: 3px solid;
  animation: slideUp 0.4s ease forwards;
  opacity: 0;
  background: var(--color-surface);
}

.diagnostic-item:nth-child(1) { animation-delay: 0.1s; }
.diagnostic-item:nth-child(2) { animation-delay: 0.2s; }
.diagnostic-item:nth-child(3) { animation-delay: 0.3s; }
.diagnostic-item:nth-child(4) { animation-delay: 0.4s; }
.diagnostic-item:nth-child(5) { animation-delay: 0.5s; }

.diagnostic-good {
  background: rgba(45, 93, 78, 0.04);
  border-left-color: var(--color-success);
}

.diagnostic-warning {
  background: rgba(184, 134, 11, 0.04);
  border-left-color: var(--color-warning);
}

.diagnostic-error {
  background: rgba(192, 80, 80, 0.04);
  border-left-color: var(--color-error);
}

.diagnostic-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.diagnostic-icon {
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.diagnostic-sentence {
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.diagnostic-body {
  padding-left: 26px;
}

.diagnostic-explanation {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.diagnostic-suggestion {
  background: rgba(45, 93, 78, 0.06);
  border-radius: 0px;
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
  border-left: 2px solid var(--color-accent);
}

.suggestion-prefix {
  font-size: 0.6875rem;
  color: var(--color-accent);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.suggestion-text {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.diagnostic-dimension {
  margin-top: var(--space-sm);
  display: inline-block;
}

/* --- Diff View --- */
.diff-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 0px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.diff-original, .diff-polished {
  padding: var(--space-lg);
}

.diff-original {
  background: rgba(192, 80, 80, 0.03);
  border-right: 1px solid var(--color-border);
}

.diff-polished {
  background: rgba(45, 93, 78, 0.03);
}

.diff-header {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}

.diff-content {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
}

.diff-sentence {
  margin-bottom: var(--space-sm);
}

.diff-highlight {
  background: rgba(184, 134, 11, 0.12);
  padding: 1px 4px;
  border-radius: 0px;
}

/* --- Loading & Spinners --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.loading-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.loading-text {
  margin-top: var(--space-md);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.loading-subtext {
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg,
    #ECECEC 25%,
    #DEDEDE 50%,
    #ECECEC 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0px;
}

.skeleton-line {
  height: 12px;
  margin-bottom: var(--space-sm);
  border-radius: 0px;
}

.skeleton-line:last-child {
  width: 60%;
}

.skeleton-block {
  height: 100px;
  border-radius: 0px;
}

/* Feedback loading indicator */
.feedback-loading {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  margin-bottom: var(--space-xl);
}

.feedback-loading-text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* --- Hero Section (Home) --- */
.hero-section {
  text-align: center;
  padding: var(--space-3xl) 0 var(--space-xl);
  animation: fadeIn 0.6s ease forwards;
}

.hero-section h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.hero-section p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
}

/* --- Recent Section --- */
.recent-section {
  margin: var(--space-2xl) 0;
  animation: fadeIn 0.6s ease forwards;
  animation-delay: 0.3s;
  opacity: 0;
}

.recent-empty {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
}

.recent-empty-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  display: block;
  color: var(--color-text-muted);
}

.recent-empty-msg {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.recent-empty-sub {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  margin-bottom: -1px;
  transition: border-color var(--transition-fast);
  cursor: pointer;
}

.recent-item:hover {
  background: var(--color-surface);
  border-color: var(--color-border-hover);
  z-index: 1;
  position: relative;
}

/* --- Action Buttons (Result Page) --- */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl) 0;
}

/* --- Template Warning --- */
.template-warning-item {
  margin-bottom: var(--space-md);
}

.warnings-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-warning);
  padding: var(--space-lg);
  border-radius: 0px;
}

.detected-phrase {
  font-size: 0.9375rem;
  margin-bottom: var(--space-sm);
}

.warning-text {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.alternatives {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.alt-label {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Error State --- */
.error-state {
  text-align: center;
  padding: var(--space-2xl);
}

.error-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: var(--space-md);
  color: var(--color-error);
}

.error-state p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

/* --- Footer --- */
.app-footer {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-2xl);
  background: var(--color-surface);
}

.app-footer p {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.app-footer p + p {
  margin-top: var(--space-xs);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: none; }
}

@keyframes scoreReveal {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
  .task-cards {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }

  .task-card {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .task-card:last-child {
    border-bottom: none;
  }

  .two-col-layout {
    grid-template-columns: 1fr;
  }

  .col-sidebar {
    border-left: none;
    border-top: 1px solid var(--color-border);
  }

  .score-dashboard {
    grid-template-columns: 1fr;
  }

  .diff-view {
    grid-template-columns: 1fr;
  }

  .diff-original {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .hero-section h1 {
    font-size: 2.25rem;
  }

  .score-big {
    font-size: 3rem;
  }
}

@media (max-width: 767px) {
  :root {
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;
  }

  .hero-section h1 {
    font-size: 1.75rem;
  }

  .top-bar {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* ============================================
   TASK 1: BUILD A SENTENCE
   ============================================ */

/* Word Bank */
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-height: 48px;
}

/* Word Chip */
.word-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: grab;
  user-select: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.word-chip:hover {
  border-color: var(--color-text);
  background: var(--color-surface-hover);
}

.word-chip:active {
  cursor: grabbing;
}

.word-chip.dragging {
  opacity: 0.5;
}

/* Answer Slots */
.answer-slots {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  min-height: 48px;
}

.answer-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px dashed var(--color-border);
  border-radius: 0px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  transition: all var(--transition-fast);
}

.answer-slot.filled {
  border-style: solid;
  border-color: var(--color-text);
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
}

.answer-slot.prefilled {
  border-style: solid;
  border-color: var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: default;
  font-weight: 400;
}

.answer-slot.drag-over {
  border-color: var(--color-accent);
  border-style: solid;
  background: rgba(45, 93, 78, 0.06);
}

/* Feedback States */
.feedback-correct {
  border-left: 3px solid var(--color-success) !important;
  background: rgba(45, 93, 78, 0.04) !important;
}

.feedback-incorrect {
  border-left: 3px solid var(--color-error) !important;
  background: rgba(192, 80, 80, 0.04) !important;
}

/* Grammar Panel */
.grammar-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: 0px;
  padding: var(--space-lg);
}

/* Question Progress */
.question-progress {
  display: flex;
  gap: 4px;
  align-items: center;
}

.progress-dot {
  font-size: 0.625rem;
  color: var(--color-border);
  line-height: 1;
}

.progress-dot.completed {
  color: var(--color-success);
}

.progress-dot.active {
  color: var(--color-text);
}

/* Sentence Action Buttons */
.sentence-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Summary Card */
.summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-2xl);
  max-width: 480px;
  width: 100%;
}

/* ============================================
   TASK 3: ACADEMIC DISCUSSION
   ============================================ */

/* Discussion Post */
.discussion-post {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0px;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.post-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.post-avatar {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 0px;
  flex-shrink: 0;
}

.professor-avatar {
  background: var(--color-accent);
  color: #FFFFFF;
}

.student-avatar {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.post-author {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-text);
  display: block;
  line-height: 1.2;
}

.post-role {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.post-body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

/* Discussion Checklist */
.discussion-checklist {
  border: 1px solid var(--color-border);
  border-radius: 0px;
  background: var(--color-bg);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

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

.checklist-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  border-radius: 0px;
}

.checklist-icon.warning {
  background: rgba(184, 134, 11, 0.12);
  color: var(--color-warning);
}

.checklist-icon.success {
  background: rgba(45, 93, 78, 0.12);
  color: var(--color-success);
}

.checklist-text {
  flex: 1;
}
