:root {
  --bg: #1a1a1a;
  --bg-panel: #262626;
  --text: #ffffff;
  --text-muted: #a1a1aa;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #3f3f46;
  --delete-bg: rgba(239, 68, 68, 0.2);
  --delete-text: #fca5a5;
  --insert-bg: rgba(34, 197, 94, 0.2);
  --insert-text: #86efac;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1rem;
  box-sizing: border-box;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 600;
}

.controls {
  display: flex;
  gap: 0.5rem;
}

.helper-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 8px;
}

.helper-banner p {
  margin: 0;
  color: var(--text);
  font-size: 0.85rem;
}

.helper-actions {
  display: flex;
  gap: 0.5rem;
}

.runtime-status {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  min-height: 1.2rem;
}

select, button {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
}

button:hover {
  background: var(--border);
}

.primary-btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.panes {
  display: flex;
  flex: 1;
  gap: 1rem;
  min-height: 0; /* Important for flex child scrolling */
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  position: relative;
}

label {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 1rem;
  resize: none;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  outline: none;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.footer-actions {
  display: flex;
  gap: 0.5rem;
}

.footer-note {
  margin: 0;
  max-width: 46rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.diff-container {
  flex: 1;
  padding: 1rem;
  color: var(--text);
  overflow-y: auto;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.diff-del {
  background: var(--delete-bg);
  color: var(--delete-text);
  text-decoration: line-through;
  border-radius: 2px;
}

.diff-add {
  background: var(--insert-bg);
  color: var(--insert-text);
  border-radius: 2px;
}

.hidden {
  display: none !important;
}

#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent);
  font-weight: 500;
}

/* Modal & Settings Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.3s ease;
}

.modal-content {
  background: #1a1a1a;
  padding: 1.5rem;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.field input {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #333;
  padding: 0.75rem;
  border-radius: 6px;
  color: white;
  font-size: 0.9rem;
}

.hint {
  font-size: 0.7rem;
  color: #555;
  margin-top: 0.4rem;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 900px) {
  .header,
  .footer,
  .helper-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .controls,
  .footer-actions,
  .helper-actions {
    flex-wrap: wrap;
  }

  .panes {
    flex-direction: column;
  }
}
