/* ======================================================
   CMU Paper Reviewer — Design System
   ====================================================== */

/* --- CSS Variables --- */
:root {
  --cmu-red: #C41230;
  --cmu-red-dark: #9E0E27;
  --cmu-red-light: #fdf2f4;

  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-300: #D4D4D4;
  --gray-400: #A3A3A3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0A0A0A;

  --success: #16A34A;
  --success-light: #F0FDF4;
  --success-border: #BBF7D0;
  --error: #DC2626;
  --error-light: #FEF2F2;
  --error-border: #FECACA;
  --info: #2563EB;
  --info-light: #EFF6FF;
  --info-border: #BFDBFE;
  --warning: #CA8A04;
  --warning-light: #FEFCE8;
  --warning-border: #FEF08A;

  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
}

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

/* --- Base --- */
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cmu-red);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* --- Header --- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  border-top: 3px solid var(--cmu-red);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cmu-red);
  letter-spacing: -0.01em;
}

header nav {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}

header nav a {
  color: var(--gray-600);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}

header nav a:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

header nav a.active {
  background: var(--cmu-red-light);
  color: var(--cmu-red);
  text-decoration: none;
}

/* --- Layout --- */
main {
  max-width: 740px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}

.hero h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--cmu-red);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--gray-500);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto;
}

/* --- Cards --- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease-out;
}

.card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.card > p {
  color: var(--gray-500);
  font-size: 0.93rem;
  margin-bottom: 1rem;
}

/* --- Mode Toggle (pill capsule) --- */
.mode-toggle {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  padding: 3px;
  margin-bottom: 1rem;
}

.mode-pill {
  padding: 0.5rem 1.25rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.mode-pill:hover {
  color: var(--gray-700);
}

.mode-pill.active {
  background: var(--cmu-red);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* --- Mode description callout --- */
.mode-description {
  color: var(--gray-500);
  font-size: 0.88rem;
  line-height: 1.55;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: 1rem;
}

/* --- Labels --- */
label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}

label:first-of-type {
  margin-top: 0;
}

.required {
  color: var(--cmu-red);
  font-weight: 600;
}

.optional {
  color: var(--gray-400);
  font-weight: 400;
  font-size: 0.82em;
}

/* --- Form inputs --- */
input[type="email"],
input[type="text"],
input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.93rem;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--cmu-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.12);
}

input::placeholder {
  color: var(--gray-400);
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 1.25rem;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--cmu-red);
  background: var(--cmu-red-light);
}

.drop-zone.has-file {
  border-color: var(--success);
  background: var(--success-light);
  border-style: solid;
}

.drop-zone-icon {
  display: block;
  margin: 0 auto 0.75rem;
  color: var(--cmu-red);
  opacity: 0.5;
}

.drop-zone.has-file .drop-zone-icon {
  color: var(--success);
}

.drop-zone p {
  color: var(--gray-500);
  font-size: 0.93rem;
}

.drop-zone.has-file p {
  color: var(--success);
  font-weight: 600;
}

.clear-file {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.3rem 1rem;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--error);
  background: var(--error-light);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s;
}

.clear-file:hover {
  background: var(--error-border);
}

.drop-zone input[type="file"] {
  display: none;
}

/* --- Optional uploads --- */
.optional-uploads {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.optional-upload-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-500);
  transition: border-color 0.15s, background 0.15s;
  margin-top: 0;
}

.optional-upload-label:hover {
  border-color: var(--cmu-red);
  background: var(--cmu-red-light);
  color: var(--gray-700);
}

.optional-upload-label svg {
  flex-shrink: 0;
  color: var(--gray-400);
}

.file-tag {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* --- Settings Section --- */
.settings-section {
  margin-top: 1.25rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-700);
  transition: background 0.15s;
}

.settings-header:hover {
  background: var(--gray-100);
}

.settings-header svg {
  color: var(--gray-400);
  flex-shrink: 0;
}

.settings-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}

.settings-panel {
  padding: 1rem;
  border-top: 1px solid var(--gray-200);
}

.setting-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.setting-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.setting-info {
  flex: 1;
  min-width: 0;
}

.setting-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.2rem;
}

.setting-desc {
  font-size: 0.78rem;
  color: var(--gray-500);
  line-height: 1.45;
}

.setting-control {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-sub-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--gray-200);
}

.setting-sub-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
  margin: 0;
}

.setting-sub-hint {
  font-size: 0.72rem;
  color: var(--gray-400);
  white-space: nowrap;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.focused-feedback-section {
  margin-bottom: 1rem;
}

.focused-feedback-section textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color 0.2s;
}

.focused-feedback-section textarea:focus {
  outline: none;
  border-color: var(--cmu-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.1);
}

.date-input {
  height: 32px;
  padding: 0 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--gray-800);
}

.date-input:focus {
  outline: none;
  border-color: var(--cmu-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.12);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray-300);
  border-radius: 24px;
  transition: 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

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

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

.toggle-sm {
  width: 36px;
  height: 20px;
}

.toggle-sm .toggle-slider::before {
  height: 14px;
  width: 14px;
}

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

/* Range input */
.range-input {
  width: 100px;
  accent-color: var(--cmu-red);
}

.range-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--cmu-red);
  min-width: 1.5rem;
  text-align: center;
}

/* Select input */
.select-input {
  height: 34px;
  padding: 0 0.6rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--cmu-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.12);
}

/* --- Criteria Config Modal --- */
.criteria-presets-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.criteria-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.criteria-config-item {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--gray-100);
}

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

.criteria-config-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.criteria-arrows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  min-width: 1.2rem;
  align-items: center;
}

.criteria-arrow-btn {
  background: none;
  border: none;
  font-size: 0.65rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  width: 1.2rem;
  height: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.criteria-arrow-btn:hover {
  color: var(--cmu-red);
}

.criteria-arrow-placeholder {
  display: block;
  width: 1.2rem;
  height: 0.85rem;
}

.criteria-config-item[draggable="true"] {
  transition: background 0.15s, box-shadow 0.15s;
}

.criteria-config-item.dragging {
  opacity: 0.4;
  background: var(--gray-100);
}

.criteria-config-item.drag-over {
  box-shadow: 0 -2px 0 0 var(--cmu-red);
}

.criteria-config-item.criteria-disabled {
  opacity: 0.5;
  background: var(--gray-50);
}

.criteria-rank {
  color: var(--cmu-red);
  font-weight: 700;
  font-size: 0.82rem;
}

.criteria-config-info {
  flex: 1;
  min-width: 0;
}

.criteria-config-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-800);
}

.criteria-config-desc {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.4;
  margin-top: 0.15rem;
}

.criteria-remove-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  transition: color 0.15s;
}

.criteria-remove-btn:hover {
  color: var(--error);
}

.add-criteria-section {
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.add-criteria-header {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.add-criteria-fields {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.add-criteria-input {
  flex: 1;
  height: 34px;
  padding: 0 0.6rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}

.add-criteria-input:focus {
  outline: none;
  border-color: var(--cmu-red);
}

/* --- Verification Code --- */
.verification-code-section {
  margin-top: 1.5rem;
}

.code-viewer {
  margin-top: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
}

.code-file-content {
  padding: 0.85rem;
  background: var(--gray-50);
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.code-file-content pre {
  margin: 0;
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--gray-800);
  white-space: pre;
}

/* --- Annotation Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 700px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  animation: slideDown 0.3s ease-out;
}

.modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.modal .modal-subtitle {
  font-size: 0.88rem;
  color: var(--gray-500);
  margin-bottom: 1.25rem;
}

.modal .item-preview {
  background: var(--cmu-red-light);
  border-left: 3px solid var(--cmu-red);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.55;
  max-height: 340px;
  overflow-y: auto;
}

.annotation-group {
  margin-bottom: 1rem;
}

.annotation-group-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.annotation-hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.annotation-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.annotation-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.annotation-btn:hover {
  border-color: var(--cmu-red);
  color: var(--cmu-red);
}

.annotation-btn.selected {
  background: var(--cmu-red);
  border-color: var(--cmu-red);
  color: #fff;
}

.annotation-textarea {
  width: 100%;
  min-height: 72px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--gray-800);
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.annotation-textarea:focus {
  outline: none;
  border-color: var(--cmu-red);
  box-shadow: 0 0 0 2px rgba(196, 18, 48, 0.1);
}

.debate-trigger {
  margin-top: 0.75rem;
  text-align: center;
}

.debate-btn {
  width: 100%;
}

/* --- Debate Mode --- */
.modal.modal-debate {
  max-width: 1100px;
  width: 96%;
}

.debate-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  min-height: 500px;
}

.debate-left {
  border-right: 1px solid var(--gray-200);
  padding-right: 1.5rem;
  overflow-y: auto;
  max-height: 70vh;
}

.debate-right {
  display: flex;
  flex-direction: column;
}

.debate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 0.75rem;
}

.debate-title { font-weight: 700; color: var(--gray-800); }

.turn-counter {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.chat-user {
  align-self: flex-end;
  background: var(--cmu-red);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-assistant {
  align-self: flex-start;
  background: var(--gray-100);
  color: var(--gray-800);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.88rem;
  resize: none;
}

.chat-input:focus { outline: none; border-color: var(--cmu-red); }

.typing-indicator { color: var(--gray-400); }

.derail-message {
  text-align: center;
  padding: 1rem;
  font-weight: 700;
  color: var(--warning);
  font-size: 1.1rem;
}

.debate-conclusion {
  padding: 1rem;
  text-align: center;
}

.verdict-text { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }
.verdict-question { font-size: 0.88rem; color: var(--gray-500); margin-bottom: 0.75rem; }
.verdict-buttons { display: flex; gap: 1rem; justify-content: center; }

.verdict-btn {
  font-size: 2rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

.verdict-btn.verdict-agree:hover { border-color: var(--success); background: var(--success-light); }
.verdict-btn.verdict-disagree:hover { border-color: var(--error); background: var(--error-light); }

/* --- Concrete Action Items --- */
.action-item-section {
  margin-top: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.action-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  cursor: pointer;
  user-select: none;
}

.action-item-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

.action-type-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.action-badge-writing {
  background: var(--cmu-red-light);
  color: var(--cmu-red);
  border: 1px solid rgba(196, 18, 48, 0.2);
}

.action-badge-implementation {
  background: var(--info-light);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.action-chevron { margin-left: auto; transition: transform 0.2s; }
.action-item-body { display: none; padding: 1rem; }
.action-item-section.expanded .action-item-body { display: block; }
.action-item-section.expanded .action-chevron { transform: rotate(180deg); }

/* Diff view */
.diff-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.diff-panel { border-radius: var(--radius); overflow: hidden; }

.diff-original { background: #fef2f2; border: 1px solid #fecaca; }
.diff-suggested { background: #f0fdf4; border: 1px solid #bbf7d0; }

.diff-panel-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.75rem;
}

.diff-original .diff-panel-header { color: var(--error); background: rgba(220, 38, 38, 0.05); }
.diff-suggested .diff-panel-header { color: var(--success); background: rgba(22, 163, 74, 0.05); }

.diff-panel-content {
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Code action items */
.code-changes-box, .run-command-box {
  margin-top: 0.75rem;
}

.code-changes-header, .run-command-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 0.35rem;
}

.code-block {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: "SF Mono", "Fira Code", monospace;
}

.copy-btn {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  color: var(--gray-500);
}

.copy-btn:hover { background: var(--gray-100); }

.action-location, .action-files, .action-description {
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-top: 0.5rem;
  line-height: 1.55;
}

.new-paragraph-box {
  margin-top: 0.75rem;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  background: #f0fdf4;
  overflow: hidden;
}

.new-paragraph-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--success);
  background: rgba(22, 163, 74, 0.05);
  padding: 0.5rem 0.75rem;
}

.new-paragraph-text {
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .debate-layout { grid-template-columns: 1fr; }
  .debate-left { border-right: none; border-bottom: 1px solid var(--gray-200); padding-right: 0; padding-bottom: 1rem; max-height: 200px; }
  .diff-view { grid-template-columns: 1fr; }
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 44px;
  padding: 0 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.93rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--cmu-red);
  color: #fff;
  margin-top: 1.25rem;
}

.btn-primary:hover {
  background: var(--cmu-red-dark);
  text-decoration: none;
}

.btn-primary:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-200);
  text-decoration: none;
}

.btn-sm {
  height: 34px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius);
}

/* --- Messages --- */
.message {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.93rem;
  margin-top: 1rem;
  line-height: 1.55;
}

.message.success {
  background: var(--success-light);
  color: #166534;
  border: 1px solid var(--success-border);
}

.message.error {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid var(--error-border);
}

.message.info {
  background: var(--info-light);
  color: #1E40AF;
  border: 1px solid var(--info-border);
}

/* --- Status badges --- */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-pending  { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.status-ocr      { background: var(--info-light);    color: var(--info);    border: 1px solid var(--info-border); }
.status-reviewing { background: #F5F3FF; color: #7C3AED; border: 1px solid #DDD6FE; }
.status-completed { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.status-failed   { background: var(--error-light);   color: var(--error);   border: 1px solid var(--error-border); }

/* --- Key display --- */
.key-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cmu-red);
  background: var(--cmu-red-light);
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  letter-spacing: 2px;
  margin: 1rem 0;
  user-select: all;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(196, 18, 48, 0.1);
  border-radius: 6px;
  cursor: pointer;
  color: var(--cmu-red);
  transition: background 0.15s;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: rgba(196, 18, 48, 0.2);
}

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

/* --- Progress Steps --- */
.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  flex: 1;
  max-width: 140px;
}

.progress-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--gray-200);
}

.progress-step.done:not(:last-child)::after {
  background: var(--success);
}

.progress-step.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--cmu-red) 50%, var(--gray-200) 50%);
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}

.step-dot svg {
  display: none;
}

.progress-step.done .step-dot {
  background: var(--success);
}

.progress-step.done .step-dot svg {
  display: block;
  width: 14px;
  height: 14px;
  color: #fff;
}

.progress-step.active .step-dot {
  background: var(--cmu-red);
  animation: pulse 2s infinite;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-400);
  text-align: center;
}

.progress-step.done .step-label {
  color: var(--success);
}

.progress-step.active .step-label {
  color: var(--cmu-red);
  font-weight: 600;
}

/* --- Review Summary Card --- */
.review-summary {
  background: var(--cmu-red-light);
  border: 1px solid rgba(196, 18, 48, 0.15);
  border-left: 4px solid var(--cmu-red);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.summary-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cmu-red);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--gray-500);
  font-weight: 500;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.summary-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.summary-tag {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.summary-tag:hover {
  border-color: var(--cmu-red);
  color: var(--cmu-red);
  background: var(--cmu-red-light);
}

/* --- Expandable Item Cards --- */
.review-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.review-item:hover {
  box-shadow: var(--shadow-sm);
}

.review-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.review-item-header:hover {
  background: var(--gray-50);
}

.review-item-title {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.review-item.open {
  border-color: rgba(196, 18, 48, 0.3);
  box-shadow: 0 0 0 1px rgba(196, 18, 48, 0.08);
}

.item-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cmu-red-light);
  color: var(--cmu-red);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.criteria-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--info-light);
  color: var(--info);
  border: 1px solid var(--info-border);
  flex-shrink: 0;
}

/* Per-item annotate button (inside expanded item body) */
.annotate-pill {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  margin-top: 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--cmu-red-light);
  color: var(--cmu-red);
  border: 1px solid rgba(196, 18, 48, 0.2);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.annotate-pill:hover {
  background: var(--cmu-red);
  color: #fff;
  border-color: var(--cmu-red);
}

.chevron {
  width: 20px;
  height: 20px;
  color: var(--gray-400);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.review-item.open .chevron {
  transform: rotate(180deg);
}

.review-item-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  animation: slideDown 0.2s ease-out;
}

.review-item.open .review-item-body {
  display: block;
}

/* Claim box */
.claim-box {
  background: var(--cmu-red-light);
  border-left: 3px solid var(--cmu-red);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.claim-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cmu-red);
  margin-bottom: 0.35rem;
}

.claim-text {
  font-size: 0.9rem;
  color: var(--gray-800);
  line-height: 1.65;
}

/* Criteria box */
.criteria-box {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.criteria-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}

.criteria-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--info);
  background: var(--info-light);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--info-border);
}

/* Limitations status box */
.limitations-box {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.35rem 0;
  margin-bottom: 0.75rem;
}

.limitations-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}

.limitations-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.limitations-badge.not-mentioned {
  background: var(--gray-100);
  color: var(--gray-500);
  border: 1px solid var(--gray-200);
}

.limitations-badge.mentioned-not-justifiable {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

/* Evidence section */
.evidence-section {
  margin-top: 0.25rem;
}

.evidence-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 0.6rem;
}

.evidence-pair {
  margin-bottom: 0.75rem;
}

.evidence-pair:last-child {
  margin-bottom: 0;
}

/* Quote box */
.quote-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.quote-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  margin-bottom: 0.3rem;
}

.quote-text {
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.6;
  font-style: italic;
}

/* Comment box */
.comment-box {
  border-left: 2px solid var(--gray-300);
  margin-left: 1rem;
  margin-top: 0.4rem;
  padding: 0.6rem 0.85rem;
}

.comment-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-400);
  margin-bottom: 0.25rem;
}

.comment-text {
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.6;
}

/* Math & code in review items */
.math-display {
  display: block;
  overflow-x: auto;
  margin: 0.5rem 0;
  text-align: center;
}

.math-inline {
  display: inline;
}

.code-block {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
}

.code-block code {
  background: none;
  padding: 0;
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  color: var(--gray-800);
}

/* Legacy body styles for raw markdown fallback */
.review-item-body h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

.review-item-body p {
  font-size: 0.9rem;
  color: var(--gray-700);
  line-height: 1.65;
}

/* --- Citation Card --- */
.citation-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-top: 3px solid var(--cmu-red);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}

.citation-card h3 {
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.citation-list {
  list-style: none;
  padding: 0;
}

.citation-list li {
  font-size: 0.85rem;
  color: var(--gray-600);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--gray-200);
  line-height: 1.5;
}

.citation-list li:last-child {
  border-bottom: none;
}

/* Reference date badges */
.ref-date-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.ref-date-badge.ref-before {
  background: var(--gray-100);
  color: var(--gray-500);
  border: 1px solid var(--gray-200);
}

.ref-date-badge.ref-after {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

/* --- Review content (raw markdown fallback) --- */
.review-content {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  line-height: 1.7;
}

.review-content h2 {
  color: var(--cmu-red);
  border-bottom: 2px solid var(--cmu-red);
  padding-bottom: 0.3rem;
  margin-top: 1.5rem;
}

.review-content h4 {
  color: var(--gray-600);
  margin-top: 1rem;
}

.review-content blockquote {
  border-left: 4px solid var(--cmu-red);
  margin: 0.8rem 0;
  padding: 0.5rem 1rem;
  background: var(--cmu-red-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.review-content code {
  background: var(--gray-100);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

.review-content pre {
  background: var(--gray-100);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

/* --- Spinner --- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--cmu-red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

/* --- Activity Log --- */
.progress-info {
  padding: 0.6rem 0;
  font-size: 0.88rem;
  color: var(--info);
}

.activity-log {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
}

.event-item {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

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

.event-step {
  font-weight: 600;
  color: var(--cmu-red);
  min-width: 2.5rem;
}

.event-time {
  color: var(--gray-400);
  font-size: 0.78rem;
  min-width: 5rem;
}

.event-tool {
  background: var(--gray-100);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.78rem;
}

.event-summary {
  color: var(--gray-600);
  flex: 1;
  min-width: 0;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-top: 3px solid var(--cmu-red);
  margin-top: 2rem;
}

.footer-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.footer-logo {
  height: 56px;
  width: auto;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.footer-logo:hover {
  opacity: 1;
}

footer p {
  color: var(--gray-400);
  font-size: 0.82rem;
  line-height: 1.5;
}

.footer-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--gray-300);
  text-underline-offset: 2px;
}

.footer-link:hover {
  color: var(--gray-600);
  text-decoration-color: var(--gray-400);
}

/* --- Expert Annotation Study page --- */
.study-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200, #e5e5e5);
}

.study-section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.placeholder-note {
  color: var(--gray-400);
  font-style: italic;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.86rem;
}

.compare-table th,
.compare-table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--gray-200, #e5e5e5);
  vertical-align: top;
}

.compare-table thead th {
  font-weight: 600;
  border-bottom: 2px solid var(--gray-300, #d1d5db);
}

.compare-table th[scope="row"] {
  font-weight: 600;
  color: var(--gray-600, #4b5563);
  white-space: nowrap;
}

.compare-table .cmu-col {
  color: var(--cmu-red);
}

.compare-table td.own {
  background: rgba(196, 18, 48, 0.045);
  font-weight: 500;
}

.compare-note {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 0.55rem;
}

.study-section ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.study-section li {
  margin-bottom: 0.5rem;
}

.paper-figure {
  margin-top: 1.9rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--gray-200, #e5e5e5);
}

.paper-figure .fig-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--cmu-red);
  margin-bottom: 0.65rem;
}

.paper-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  padding: 0.5rem;
  border: 1px solid var(--gray-200, #e5e5e5);
  border-radius: 8px;
  background: #fff;
}

.paper-figure .fig-summary {
  font-size: 0.9rem;
  color: var(--gray-600, #4b5563);
  margin-top: 0.8rem;
}

/* Recreated data table (Table 3) */
.data-table td {
  text-align: right;
}
.data-table th[scope="row"] {
  text-align: left;
}
.data-table thead th {
  text-align: right;
}
.data-table thead th:first-child {
  text-align: left;
}
.data-table td.hi {
  color: var(--cmu-red);
  font-weight: 600;
}

/* --- Rotating affiliation logos --- */
.affiliations {
  margin: 1.75rem auto 0;
  max-width: 760px;          /* ~6 logos visible at a time */
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.affil-caption {
  color: var(--gray-400);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.affil-track {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  width: max-content;
  animation: affil-scroll 70s linear infinite;
}

.affiliations:hover .affil-track {
  animation-play-state: paused;
}

.affil {
  flex: 0 0 auto;
}

.affil img {
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.55;
  transition: filter 0.2s, opacity 0.2s;
}

.affil img:hover {
  filter: none;
  opacity: 1;
}

@keyframes affil-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }   /* list is duplicated, so 50% = one full set */
}

@media (prefers-reduced-motion: reduce) {
  .affil-track { animation: none; }
}

/* --- Citation box --- */
.cite-box {
  max-width: 720px;
  margin: 2rem auto 0;
  text-align: left;
}

.cite-box .cite-prompt {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.bibtex-wrap {
  position: relative;
}

.bibtex-wrap pre {
  background: var(--gray-50, #f7f7f8);
  border: 1px solid var(--gray-200, #e5e5e5);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0;
}

.bibtex-wrap code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--gray-700, #374151);
  white-space: pre;
}

.copy-bibtex {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 6px;
  background: #fff;
  color: var(--gray-600, #4b5563);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.copy-bibtex:hover {
  background: var(--cmu-red);
  border-color: var(--cmu-red);
  color: #fff;
}

/* --- Inline lookup form --- */
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.inline-form input {
  flex: 1;
}

.inline-form .btn {
  margin-top: 0;
  white-space: nowrap;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 18, 48, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(196, 18, 48, 0); }
}

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

/* --- Responsive --- */
@media (max-width: 640px) {
  header {
    padding: 0 1rem;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .hero h2 {
    font-size: 1.4rem;
  }

  .card {
    padding: 1.5rem;
  }

  .summary-stats {
    flex-direction: column;
    gap: 0.75rem;
  }

  .progress-steps {
    gap: 0;
  }

  .step-label {
    font-size: 0.68rem;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form .btn {
    width: 100%;
  }
}
