:root {
  --bg0: #f4f7f8;
  --bg1: #e8eef1;
  --ink: #1a2b32;
  --muted: #5c727c;
  --teal: #0d7a78;
  --teal-deep: #065e5c;
  --line: rgba(26, 43, 50, 0.12);
  --surface: rgba(255, 255, 255, 0.72);
  --danger: #b42318;
  --ok: #067a4f;
  --font-display: "DM Sans", "Source Sans 3", sans-serif;
  --font-body: "Source Sans 3", "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(13, 122, 120, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(26, 43, 50, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.45), transparent 70%);
}

.page {
  position: relative;
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero {
  margin-bottom: 1.75rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--teal-deep);
}

.tagline {
  margin: 0.65rem 0 0;
  max-width: 36rem;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.45;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab.active {
  color: var(--teal-deep);
  border-bottom-color: var(--teal);
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.25rem 1.35rem 1.4rem;
  animation: fadeIn 0.28s ease;
}

.panel[hidden] {
  display: none !important;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
}

textarea,
select,
input[type="number"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.65rem 0.75rem;
}

textarea {
  resize: vertical;
  min-height: 8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.4;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.file-btn input {
  display: none;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.15rem;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.55rem 1.05rem;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--teal-deep);
}

.btn.ghost {
  background: transparent;
}

.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  animation: fadeIn 0.25s ease;
}

.status.error {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

.status.loading {
  color: var(--teal-deep);
}

.results {
  margin-top: 1.35rem;
  animation: fadeIn 0.35s ease;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.results-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.chip {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 2px;
}

.chip.acp { color: var(--ok); }
.chip.non { color: var(--muted); }
.chip.bad { color: var(--danger); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  font-family: var(--font-display);
  font-weight: 600;
  background: rgba(13, 122, 120, 0.06);
  cursor: pointer;
  user-select: none;
}

th:hover {
  background: rgba(13, 122, 120, 0.12);
}

td.seq {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.foot {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

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

@media (max-width: 640px) {
  .page { width: calc(100% - 1.25rem); padding-top: 1.5rem; }
  .actions { flex-direction: column; align-items: stretch; }
}
