:root {
  color-scheme: light dark;
  --bg: #14161a;
  --fg: #e8e8ea;
  --accent: #5b8dee;
  --card: #1e2127;
  --error: #e5534b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1rem 2rem;
}

main {
  width: 100%;
  max-width: 760px;
}

.brand {
  width: 100%;
}

.brand svg {
  display: block;
  width: 100%;
  height: auto;
}

.brand.small {
  max-width: 280px;
  margin-bottom: 1.5rem;
}

.tagline {
  color: #9a9ea6;
  margin-top: 0.75rem;
  margin-bottom: 2rem;
}

form#probe-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

input[type="url"] {
  flex: 1;
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  border: 1px solid #3a3f47;
  background: var(--card);
  color: var(--fg);
  font-size: 1rem;
}

button {
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

#result {
  background: var(--card);
  border-radius: 10px;
  padding: 1.25rem;
}

.mode-row {
  display: flex;
  gap: 1.5rem;
  margin: 1rem 0;
}

#progress-wrap {
  margin-top: 1rem;
}

#progress-bar {
  height: 8px;
  border-radius: 4px;
  background: #333740;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

#progress-label {
  font-size: 0.85rem;
  color: #9a9ea6;
}

.file-btn {
  display: none;
  margin-top: 1rem;
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
}

/* Styled with the class above rather than the #file-link id, and gated
   the same way here, so nothing ever competes with [hidden] by
   specificity -- a plain `#file-link { display: ... }` rule previously
   beat the browser's default `[hidden] { display: none }`, so the link
   showed up (with no href) before any grab ever ran. */
.file-btn:not([hidden]) {
  display: inline-block;
}

.error {
  color: var(--error);
  margin-top: 1rem;
}

.status {
  color: #9a9ea6;
  margin-top: -0.75rem;
  margin-bottom: 1.5rem;
}

.status::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.5em;
  border: 2px solid #4a4f58;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.05em;
}

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

.site-footer {
  width: 100%;
  max-width: 760px;
  margin-top: 3rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #5c626e;
}

.site-footer a {
  color: #8991a0;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.site-footer .dot {
  opacity: 0.6;
}

.doc {
  background: var(--card);
  border-radius: 10px;
  padding: 2rem;
  line-height: 1.6;
}

.doc h1 {
  margin-top: 0;
}

.doc h2 {
  font-size: 1.1rem;
  margin-top: 2rem;
}

.doc ul,
.doc ol {
  padding-left: 1.25rem;
}

.doc li + li {
  margin-top: 0.4rem;
}

.doc a {
  color: var(--accent);
}

.doc code {
  background: #2a2e37;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.cookie-banner {
  display: none;
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  max-width: 640px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid #333740;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 50;
}

/* Same fix as .file-btn above: an author-stylesheet class rule beats
   the browser's default [hidden] rule at equal specificity, so without
   this the banner ignored its `hidden` attribute/property entirely. */
.cookie-banner:not([hidden]) {
  display: flex;
}

.cookie-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: #c3c7cf;
  line-height: 1.5;
}

.cookie-banner a {
  color: var(--accent);
}

.cookie-banner button {
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
  }
}
