* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f7fb;
  color: #1f2937;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.panel {
  position: relative;
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.source-tab {
  background: #eef2ff;
  color: #1e3a8a;
  border: 1px solid #c7d2fe;
  padding: 8px 12px;
}

.source-tab:hover {
  background: #dbeafe;
}

.source-tab.is-active {
  background: #0b5cff;
  border-color: #0b5cff;
  color: #fff;
}

input[type="text"],
select {
  flex: 1;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #cdd5df;
  border-radius: 8px;
  background: #fff;
}

button {
  border: none;
  border-radius: 8px;
  background: #0b5cff;
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  background: #0046d5;
}

.results,
.output {
  min-height: 72px;
}

.back-btn {
  position: static;
  display: inline-block;
  margin-bottom: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  padding: 0;
  line-height: 1;
  font-size: 20px;
  opacity: 0.8;
  transition: color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.back-btn:hover {
  background: transparent;
  color: #334155;
  opacity: 1;
  transform: translateX(-1px);
}

.back-btn:focus-visible {
  background: transparent;
  color: #334155;
  outline: none;
}

.hidden {
  display: none;
}

.empty {
  color: #64748b;
}

.result-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.result-item p {
  margin: 6px 0;
}

.generate-btn {
  margin-top: 12px;
}

.citation-block {
  margin-bottom: 14px;
}

.reference-preview {
  display: block;
  line-height: 2;
  padding-left: 36px;
  text-indent: -36px;
}

.reference-preview a {
  color: #0b5cff;
}

.citation-value {
  margin-bottom: 12px;
}

.citation-actions {
  margin-top: 0;
}

.copy-btn {
  background: #334155;
  padding: 8px 12px;
}

.copy-btn:hover {
  background: #1e293b;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px;
  border-radius: 8px;
}

@media (max-width: 700px) {
  .row {
    flex-direction: column;
  }

  button:not(.source-tab):not(.back-btn) {
    width: 100%;
  }

  .citation-actions .copy-btn {
    width: auto;
  }
}
