:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --text: #17202a;
  --muted: #5f6c7b;
  --panel: #ffffff;
  --line: #d8dee7;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e2f4f1;
  --error: #b42318;
  --shadow: 0 16px 40px rgba(31, 42, 55, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.intro {
  margin-bottom: 28px;
}

.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-link {
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.lead span {
  color: var(--text);
  font-weight: 700;
}

.tool-panel,
.results-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-panel {
  padding: 22px;
}

.extract-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  font: inherit;
  outline: none;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.status {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status.error {
  color: var(--error);
  font-weight: 700;
}

.results-section {
  margin-top: 22px;
  overflow: hidden;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.count {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 5px 10px;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.results {
  display: grid;
  gap: 0;
}

.results.empty {
  padding: 24px 22px;
  color: var(--muted);
}

.result-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 18px 22px;
}

.result-item--without-thumbnail {
  grid-template-columns: minmax(0, 1fr) auto;
}

.result-item:last-child {
  border-bottom: 0;
}

.url-text {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.thumbnail {
  width: 120px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f5;
  object-fit: cover;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.paste-button,
.copy-button {
  min-width: 86px;
  background: #22303c;
}

.paste-button:hover,
.copy-button:hover {
  background: #111a22;
}

.action-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 328px;
}

.open-button,
.remember-button,
.save-button,
.copy-button,
.delete-button {
  min-width: 0;
  padding: 0 12px;
}

.remember-button {
  background: #6d5f12;
}

.remember-button:hover {
  background: #51470d;
}

.save-button {
  background: #245f8f;
}

.save-button:hover {
  background: #1b486c;
}

.delete-button {
  background: #8f2f24;
}

.delete-button:hover {
  background: #6f2119;
}

.last-updated {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 24px, 1040px);
    padding: 28px 0;
  }

  .input-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .input-row input {
    grid-column: 1 / -1;
  }

  .result-item {
    grid-template-columns: 1fr;
  }

  .thumbnail {
    width: 100%;
    max-width: 280px;
  }

  button,
  .paste-button,
  .copy-button,
  .open-button,
  .remember-button,
  .save-button,
  .delete-button {
    width: 100%;
    padding: 0 8px;
  }

  .page-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .action-group {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
  }

  .last-updated {
    text-align: left;
  }
}
