:root {
  --bg-0: #e8eef4;
  --bg-1: #d4e2ec;
  --ink: #1a2430;
  --ink-muted: #5a6b7c;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #f7fafc;
  --stroke: rgba(26, 36, 48, 0.12);
  --accent: #0d7a6f;
  --accent-hover: #0a635a;
  --accent-soft: rgba(13, 122, 111, 0.12);
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 18px 50px rgba(26, 36, 48, 0.08);
  --radius: 18px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", "Outfit", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-0);
  line-height: 1.45;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 12% 8%, rgba(13, 122, 111, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 88% 18%, rgba(47, 110, 168, 0.16), transparent 50%),
    linear-gradient(165deg, var(--bg-0), var(--bg-1) 55%, #c9d8e4);
  animation: drift 18s var(--ease) infinite alternate;
}

@keyframes drift {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(12deg); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header {
  max-width: 920px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1rem;
  animation: rise 0.7s var(--ease) both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(13, 122, 111, 0.28);
}

.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1;
}

.tagline {
  margin: 0.65rem 0 0;
  color: var(--ink-muted);
  font-size: 1.05rem;
  max-width: 28rem;
  animation: rise 0.8s var(--ease) 0.08s both;
}

.layout {
  max-width: 920px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.upload-panel {
  animation: rise 0.85s var(--ease) 0.12s both;
}

.dropzone {
  border: 2px dashed rgba(26, 36, 48, 0.22);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
  cursor: pointer;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.88);
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.dropzone-inner {
  padding: clamp(2rem, 6vw, 3.25rem) 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drop-icon {
  width: 3rem;
  height: 3rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.drop-text {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.drop-sub {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.drop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

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

.btn-ghost {
  background: transparent;
  border-color: var(--stroke);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.85rem 1.6rem;
  font-size: 1.05rem;
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink-muted);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.35);
}

.upload-progress {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 0.45rem;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(26, 36, 48, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #2f6ea8);
  transition: width 0.2s linear;
}

.files-panel,
.results-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem 1.35rem;
  animation: rise 0.55s var(--ease) both;
}

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

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

.table-wrap {
  overflow-x: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.file-table th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.5rem 0.65rem;
  border-bottom: 1px solid var(--stroke);
}

.file-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(26, 36, 48, 0.06);
  vertical-align: middle;
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-name {
  font-weight: 500;
  word-break: break-word;
  max-width: 18rem;
}

.file-size {
  color: var(--ink-muted);
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink-muted);
}

.status-uploaded .status-dot,
.status-waiting .status-dot { background: #667085; }
.status-processing .status-dot {
  background: var(--warn);
  animation: pulse 1s ease-in-out infinite;
}
.status-done .status-dot { background: var(--ok); }
.status-error .status-dot { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.panel-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.results-table .result-time {
  color: var(--ink-muted);
  white-space: nowrap;
}

.results-table .result-meta-cell {
  color: var(--ink-muted);
  font-size: 0.9rem;
  max-width: 16rem;
  word-break: break-word;
}

.results-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 3rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: min(360px, calc(100vw - 2rem));
}

.author-link {
  position: fixed;
  right: 1.25rem;
  bottom: 1rem;
  z-index: 40;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.author-link:hover,
.author-link:focus-visible {
  color: var(--accent);
}

@media (max-width: 640px) {
  .author-link {
    right: 1rem;
    bottom: 0.85rem;
    font-size: 0.8rem;
  }
}

.toast {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #1a2430;
  color: #f5f8fa;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  font-size: 0.92rem;
  animation: toast-in 0.35s var(--ease) both;
}

.toast.is-error {
  background: #7a1f18;
}

.toast.is-leaving {
  animation: toast-out 0.3s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 640px) {
  .site-header {
    padding-top: 1.75rem;
  }

  .file-table th:nth-child(2),
  .file-table td:nth-child(2) {
    display: none;
  }

  .panel-actions {
    justify-content: stretch;
  }

  .panel-actions .btn {
    width: 100%;
  }
}
