/* ============================================
   AP Essay Workshop — ETI-Inspired Dark Theme
   ============================================ */

:root {
  --bg-deep: #0f1114;
  --bg-surface: #181b20;
  --bg-elevated: #1f2329;
  --bg-hover: #262b33;
  --border: #2a2f38;
  --border-light: #353b45;
  --text-primary: #e2e4e8;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #c9a96e;
  --accent-dim: #a68a4e;
  --accent-glow: rgba(201, 169, 110, 0.15);
  --accent-subtle: rgba(201, 169, 110, 0.08);
  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.15);
  --warning: #fbbf24;
  --error: #f87171;
  --font-body: 'Georgia', 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Consolas', 'Monaco', monospace;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow-soft: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --transition: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.75;
  min-height: 100vh;
  letter-spacing: 0.01em;
}

/* Screens */
.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ---- Auth Screen ---- */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(201, 169, 110, 0.06) 0%, transparent 60%),
    var(--bg-deep);
}
.auth-container h1 {
  font-family: var(--font-body);
  font-size: 3rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}
.auth-subtitle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 4rem;
  font-weight: 500;
}
.auth-note {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2rem;
  opacity: 0.7;
}

/* ---- Buttons ---- */
.btn {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::before { opacity: 1; }
.btn:hover { 
  background: var(--bg-hover); 
  border-color: var(--border-light);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-dim) 0%, #8a723e 100%);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(201, 169, 110, 0.25);
}
.btn-primary:hover { 
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  box-shadow: 0 4px 16px rgba(201, 169, 110, 0.35);
  border-color: #d4b87a;
}
.btn-small { font-size: 0.78rem; padding: 0.35rem 0.8rem; }
.btn-icon {
  background: none; 
  border: none; 
  color: var(--text-secondary);
  cursor: pointer; 
  padding: 0.5rem; 
  border-radius: var(--radius);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { 
  color: var(--text-primary); 
  background: var(--bg-hover); 
}
.btn-reveal {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-light);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 0.6rem 1.2rem;
  margin-top: 1rem;
  transition: all var(--transition-smooth);
}
.btn-reveal:hover { 
  border-color: var(--accent-dim); 
  color: var(--accent);
  border-style: solid;
}
.btn-reveal:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-reveal:hover:not(:disabled) { background: var(--accent-subtle); }
.btn-complete {
  background: var(--success-dim);
  border-color: var(--success);
  color: var(--success);
}

/* ---- Header ---- */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.header-left, .header-right { display: flex; align-items: center; gap: 1rem; }
.header-title {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  font-weight: 400;
}
.user-name {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
}
.save-indicator {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.save-indicator.visible { opacity: 1; }

/* ---- Sidebar ---- */
#sidebar {
  position: fixed;
  top: 56px; left: 0; bottom: 0;
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  z-index: 90;
  overflow-y: auto;
  transition: transform var(--transition-smooth);
}
#sidebar.collapsed { transform: translateX(-240px); }
.sidebar-header {
  padding: 0 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.sidebar-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
#rung-nav { list-style: none; }
.rung-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  border-left: 3px solid transparent;
  position: relative;
}
.rung-nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  transition: height var(--transition-smooth);
}
.rung-nav-item:hover:not(.locked) {
  background: var(--bg-hover);
}
.rung-nav-item.active {
  background: var(--accent-glow);
  border-left-color: transparent;
}
.rung-nav-item.active::before {
  height: 60%;
}
.rung-nav-item.locked {
  opacity: 0.35;
  cursor: not-allowed;
}
.rung-nav-item.completed {
  opacity: 0.8;
}
.rung-nav-item.completed .rung-status {
  background: var(--success);
  border-color: var(--success);
}
.rung-nav-item.completed .rung-status::after {
  content: '\2713';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--bg-deep);
  font-weight: 700;
}
.rung-status {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
}
.rung-nav-item.active .rung-status {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.rung-nav-item.active .rung-status::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--bg-deep);
  border-radius: 50%;
}
.rung-number {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 18px;
  text-align: center;
  letter-spacing: 0.05em;
}
.rung-label {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 450;
  line-height: 1.3;
}
.rung-nav-item.active .rung-label { 
  color: var(--text-primary); 
  font-weight: 500;
}
.rung-nav-item.active .rung-number { 
  color: var(--accent); 
}

/* ---- Main Content ---- */
#content {
  margin-left: 240px;
  margin-top: 56px;
  min-height: calc(100vh - 56px);
  padding: 3rem 3.5rem 5rem;
  max-width: 820px;
}

/* ---- Bridge Sections ---- */
.bridge {
  padding: 2.5rem 0;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.bridge-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 1rem;
  font-weight: 600;
}
.bridge h2 {
  font-family: var(--font-body);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
}
.bridge p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.8;
}

/* ---- Activity Wrapper ---- */
.activity {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  transition: opacity var(--transition-smooth);
}
.activity:last-child { border-bottom: none; }
.activity-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.activity-number {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.activity-title {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.activity-instructions {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
  line-height: 1.8;
  padding-left: 0.3rem;
  border-left: 2px solid var(--border-light);
}
.activity-locked {
  opacity: 0.3;
  pointer-events: none;
  filter: blur(1px);
}
.activity-complete-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

/* ---- Passage ---- */
.passage {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  margin: 1.75rem 0;
  line-height: 1.9;
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}
.passage-source {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-style: italic;
  letter-spacing: 0.03em;
}
.passage p { margin-bottom: 1.25rem; }
.passage p:last-child { margin-bottom: 0; }

/* ---- Writing Area ---- */
.writing-area-container { margin: 1.5rem 0; }
.writing-area-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
}
.writing-area {
  width: 100%;
  min-height: 160px;
  padding: 1.25rem 1.5rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  resize: vertical;
  transition: all var(--transition-smooth);
}
.writing-area:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-soft);
}
.writing-area::placeholder { 
  color: var(--text-muted); 
  font-style: italic;
}
.writing-meta {
  display: flex;
  justify-content: flex-end;
  gap: 1.25rem;
  margin-top: 0.5rem;
  padding-right: 0.5rem;
}
.word-count {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ---- Reveal Panel ---- */
.reveal-panel { margin: 1.25rem 0; }
.reveal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  animation: fadeIn 0.4s ease;
}
.reveal-content strong { color: var(--text-primary); }

/* ---- Editable Table ---- */
.editable-table-container { margin: 1.5rem 0; overflow-x: auto; }
.editable-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  border-radius: var(--radius);
  overflow: hidden;
}
.editable-table th {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.editable-table td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.85rem;
  vertical-align: top;
  transition: background var(--transition);
}
.editable-table td[contenteditable="true"] {
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 2.5rem;
  cursor: text;
  transition: all var(--transition);
}
.editable-table td[contenteditable="true"]:focus {
  outline: none;
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 2px var(--accent-dim);
}
.editable-table tr:hover td {
  background: var(--bg-hover);
}

/* ---- Ranking Exercise ---- */
.ranking-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-smooth);
}
.ranking-item:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}
.ranking-select {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-deep);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 55px;
  cursor: pointer;
  transition: all var(--transition);
}
.ranking-select:focus {
  outline: none;
  border-color: var(--accent-dim);
}
.ranking-text { flex: 1; font-size: 0.92rem; color: var(--text-secondary); line-height: 1.6; }
.ranking-label { font-weight: 500; color: var(--text-primary); margin-bottom: 0.35rem; }

/* ---- Comparison View ---- */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.comparison-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-smooth);
}
.comparison-panel:hover {
  border-color: var(--border-light);
}
.comparison-panel-title {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.comparison-panel p { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.75; }

/* ---- Timer ---- */
.timer-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.timer-display {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  color: var(--accent);
  min-width: 90px;
  letter-spacing: 0.05em;
}
.timer-controls { display: flex; gap: 0.5rem; }

/* ---- Checklist ---- */
.checklist { margin: 1.5rem 0; }
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover {
  background: linear-gradient(90deg, var(--accent-subtle) 0%, transparent 100%);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: var(--radius);
}
.checklist-item input[type="checkbox"] {
  appearance: none;
  width: 20px; height: 20px;
  border: 1.5px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-deep);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 0.15rem;
  transition: all var(--transition-smooth);
  position: relative;
}
.checklist-item input[type="checkbox"]:hover {
  border-color: var(--accent-dim);
}
.checklist-item input[type="checkbox"]:checked {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.checklist-item input[type="checkbox"]:checked::after {
  content: '\2713';
  display: block;
  text-align: center;
  font-size: 0.7rem;
  color: #fff;
  line-height: 20px;
  font-weight: 700;
}
.checklist-label {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  transition: color var(--transition);
}
.checklist-item input[type="checkbox"]:checked + .checklist-label {
  color: var(--text-primary);
}

/* ---- Split Pane (for practice prompts) ---- */
.split-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}
.split-pane .passage { 
  margin: 0; 
  position: sticky; 
  top: 80px; 
  max-height: calc(100vh - 120px); 
  overflow-y: auto; 
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.split-pane .passage::-webkit-scrollbar {
  width: 6px;
}
.split-pane .passage::-webkit-scrollbar-track {
  background: transparent;
}
.split-pane .passage::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

/* ---- Progress Bar (within a rung) ---- */
.rung-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 2.5rem;
}
.rung-progress-step {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  transition: all var(--transition-smooth);
}
.rung-progress-step.done { 
  background: var(--accent); 
  box-shadow: 0 0 8px var(--accent-glow);
}
.rung-progress-step.current { 
  background: var(--accent-dim); 
}

/* ---- Blockquote ---- */
blockquote {
  border-left: 3px solid var(--accent-dim);
  background: var(--bg-elevated);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  color: var(--text-secondary);
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.75;
}

/* ---- Lists (inside content areas) ---- */
.passage ul, .passage ol,
.activity-instructions ul, .activity-instructions ol,
.reveal-content ul, .reveal-content ol,
.comparison-panel ul, .comparison-panel ol,
.bridge ul, .bridge ol {
  padding-left: 1.75rem;
  margin: 0.75rem 0;
}
.passage li, .activity-instructions li,
.reveal-content li, .comparison-panel li, .bridge li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---- Horizontal Rule ---- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ---- Ranking Exercise Container ---- */
.ranking-exercise {
  margin: 1.5rem 0;
}

/* ---- Utility ---- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-small { font-size: 0.85rem; }
.italic { font-style: italic; }

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.fade-in { 
  animation: fadeIn 0.4s ease forwards; 
}
.fade-in-stagger {
  animation: fadeIn 0.4s ease forwards;
  opacity: 0;
}
.rung-nav-item {
  animation: slideInLeft 0.3s ease forwards;
  opacity: 0;
}
.rung-nav-item:nth-child(1) { animation-delay: 0.05s; }
.rung-nav-item:nth-child(2) { animation-delay: 0.1s; }
.rung-nav-item:nth-child(3) { animation-delay: 0.15s; }
.rung-nav-item:nth-child(4) { animation-delay: 0.2s; }
.rung-nav-item:nth-child(5) { animation-delay: 0.25s; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  #content {
    padding: 2.5rem 2.5rem 4rem;
    max-width: 100%;
  }
}
@media (max-width: 900px) {
  .split-pane { grid-template-columns: 1fr; }
  .split-pane .passage {
    position: relative;
    top: 0;
    max-height: 400px;
  }
  .comparison { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #sidebar { 
    transform: translateX(-240px); 
    width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  #sidebar.open { 
    transform: translateX(0); 
  }
  #content { 
    margin-left: 0; 
    padding: 2rem 1.5rem 3rem; 
  }
  .auth-container h1 {
    font-size: 2.25rem;
  }
  .bridge h2 {
    font-size: 1.5rem;
  }
  .activity-title {
    font-size: 1.2rem;
  }
  .passage {
    padding: 1.5rem;
  }
  .timer-container {
    flex-wrap: wrap;
  }
}
@media (max-width: 480px) {
  #app-header {
    padding: 0 1rem;
  }
  .header-title {
    font-size: 0.9rem;
  }
  #content {
    padding: 1.5rem 1rem 3rem;
  }
  .bridge {
    padding: 1.5rem 0;
  }
  .bridge h2 {
    font-size: 1.35rem;
  }
  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
  }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 85;
  opacity: 0;
  transition: opacity var(--transition-smooth);
}
.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selection styling */
::selection {
  background: var(--accent-glow);
  color: var(--text-primary);
}

/* Persistent writing prompt (replaces disappearing placeholder for long prompts) */
.writing-prompt {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.75rem 1rem;
  line-height: 1.5;
}
.writing-prompt + .writing-area {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Earlier Work Panel */
.earlier-work-panel {
  margin: 1.5rem 0;
}
.earlier-work-toggle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-align: left;
}
.earlier-work-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.earlier-work-toggle.open { border-radius: var(--radius) var(--radius) 0 0; border-bottom-color: transparent; }
.earlier-work-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}
.earlier-work-rung { margin-bottom: 1rem; }
.earlier-work-rung h4 { font-family: var(--font-ui); font-size: 0.8rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.earlier-work-entry { margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.earlier-work-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.earlier-work-id { font-family: var(--font-ui); font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.earlier-work-text { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; }
