:root {
  --bg-1: #f8f4ea;
  --bg-2: #dce8d8;
  --ink: #172121;
  --accent: #0b8f68;
  --accent-2: #16425b;
  --danger: #9f2b2b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, var(--bg-2), var(--bg-1));
  color: var(--ink);
  min-height: 100vh;
}

.app-shell {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.panel {
  width: min(780px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(22, 66, 91, 0.2);
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
}

.lead {
  margin-top: 8px;
  opacity: 0.85;
}

.identity-row {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

input,
button {
  border: 1px solid #b9c9c4;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
}

input {
  flex: 1;
}

button {
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button.ghost {
  background: white;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
}

.swipe-zone {
  margin-top: 18px;
}

.card {
  background: white;
  border: 2px solid #d6e2de;
  border-radius: 16px;
  padding: 20px;
  transition: transform 0.2s ease;
}

.card.swipe-left {
  transform: translateX(-14px) rotate(-1deg);
  border-color: var(--accent-2);
}

.card.swipe-right {
  transform: translateX(14px) rotate(1deg);
  border-color: var(--accent-2);
}

.choices {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.skip-choice-row {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.skip-choice-row .ghost {
  width: 100%;
}

.left {
  background: var(--accent-2);
}

.right {
  background: var(--accent-2);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.analyze-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #eef4f3;
  border: 1px solid #cfded8;
  font-size: 14px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #9bb6ad;
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none;
}

.result,
.history,
.settings {
  margin-top: 18px;
  background: #f6faf8;
  border: 1px solid #d4e2db;
  border-radius: 12px;
  padding: 14px;
}

.history ul,
.result ul {
  margin: 8px 0;
  padding-left: 20px;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
}

.score-table th,
.score-table td {
  border: 1px solid #d4e2db;
  padding: 8px;
  text-align: left;
}

.score-table th {
  background: #edf5f2;
}

.compact-table small {
  opacity: 0.8;
}

.scorebar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #d9e5e1;
  margin-top: 6px;
  overflow: hidden;
}

.scorebar-fill {
  height: 100%;
  background: linear-gradient(90deg, #16425b, #0b8f68);
}

.topic-detail {
  margin: 6px 0;
  line-height: 1.35;
}

.topic-sources {
  margin-top: 4px;
}

.topic-sources ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.topic-sources a {
  color: var(--accent-2);
}

.check-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 8px;
}

.check-pass {
  background: #dff4ea;
  color: #0a6648;
}

.check-warn {
  background: #fff0d8;
  color: #8a5a00;
}

@media (max-width: 640px) {
  .identity-row,
  .actions,
  .choices {
    grid-template-columns: 1fr;
    display: grid;
  }
}
