/* cards grid */
.cards {
  display: grid;
  gap: 16px;
}
@media (min-width: 720px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

/* components.css — cards, buttons, forms, callouts, misc */

/* ---------- cards ---------- */
/* Surface only — tool pages (tvbox/sub) also use .card */
.card {
  padding: 20px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
}

/* Nav entry cards (home) */
a.nav-card,
.nav-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--ease), border-color var(--ease),
    box-shadow var(--ease);
  position: relative;
}

a.nav-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  text-decoration: none;
}

a.nav-card:active {
  transform: translateY(0);
}

.card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-card h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 4px;
}

.nav-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.nav-card .arrow {
  flex: 0 0 auto;
  align-self: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform var(--ease), color var(--ease);
}

a.nav-card:hover .arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ---------- icon box ---------- */

.icon-box {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.55);
}

.icon-box svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

/* ---------- tag ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
}

.tag.accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: var(--radius-ctrl);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease),
    background-color var(--ease), border-color var(--ease), color var(--ease);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

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

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.6);
}

.btn-primary:hover {
  text-decoration: none;
  box-shadow: 0 10px 26px -8px rgba(124, 58, 237, 0.65);
}

.btn-secondary {
  color: var(--text);
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.btn-secondary:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn-ghost:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--soft);
}

/* ---------- forms ---------- */

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: var(--radius-ctrl);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color var(--ease), box-shadow var(--ease);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- callouts ---------- */

.callout {
  padding: 14px 16px;
  border-radius: var(--radius-ctrl);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  line-height: 1.55;
}

.callout.warn,
.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.callout.info {
  background: var(--soft);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
  color: var(--text);
}

/* ---------- status line ---------- */

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status-line::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-line.ok {
  color: var(--ok);
}

.status-line.ok::before {
  background: var(--ok);
}

.status-line.bad {
  color: var(--bad);
}

.status-line.bad::before {
  background: var(--bad);
}

/* ---------- note ---------- */

.note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- back link ---------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--ease);
}

.back:hover {
  color: var(--accent);
  text-decoration: none;
}

.back svg {
  width: 16px;
  height: 16px;
  transform: rotate(180deg);
}

.card-body .tag { margin-bottom: 8px; }
.card-body h2 { margin: 0 0 6px; }
.seg-nav a .icon { display: inline-block; width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; }
.icon { width: 20px; height: 20px; }

/* ============================================================
   P1 shared UI components (append-only)
   Depends on tokens.css variables.
   ============================================================ */

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  z-index: 9999;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  max-width: min(92vw, 420px);
}

.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  will-change: opacity, transform;
}

.toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-out {
  opacity: 0;
  transform: translateY(8px);
}

.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.toast.ok::before { background: var(--ok); }
.toast.bad::before { background: var(--bad); }
.toast.info::before { background: var(--accent); }

.toast.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.toast.info { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

@media (min-width: 900px) {
  .toast-host {
    left: auto;
    right: 24px;
    bottom: 24px;
    transform: none;
    align-items: flex-end;
  }
}

/* ---------- Empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 28px 20px;
  color: var(--muted);
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.empty-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42ch;
}

.empty-action {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Loading skeleton ---------- */
.skel {
  position: relative;
  overflow: hidden;
  background: var(--soft);
  border-radius: var(--radius-ctrl);
}

.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--line) 70%, transparent) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: skel-shimmer 1.4s var(--ease) infinite;
}

@keyframes skel-shimmer {
  to { transform: translateX(100%); }
}

.skel-line {
  height: 12px;
  border-radius: var(--radius-pill);
}

.skel-line + .skel-line { margin-top: 8px; }
.skel-line.short { width: 55%; }

.skel-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
}

.skel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.skel-card {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.skel-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skel-wrap .skel-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skel-wrap .skel-row .skel-line { flex: 1; margin: 0; }

/* ---------- Error state ---------- */
.error-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--bad) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line));
  border-radius: var(--radius-card);
  color: var(--text);
}

.error-title {
  font-size: 13px;
  font-weight: 600;
  color: color-mix(in srgb, var(--bad) 70%, var(--text));
}

.error-msg {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  word-break: break-word;
}

.error-box .actions { margin-top: 6px; }

/* ---------- ResultMedia ---------- */
.result-media {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.result-media__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
  word-break: break-word;
}

.result-media__author {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.result-media__author img,
.result-media__author .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--soft);
}

.result-media__desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.result-media__video,
.result-media__video video {
  display: block;
  width: 100%;
  max-height: 480px;
  border-radius: 16px;
  background: #000;
}

.result-media__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.result-media__grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-ctrl);
  background: var(--soft);
}

.result-media__audio,
.result-media__audio audio {
  width: 100%;
}

.result-media__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.result-media__json {
  font-size: 12px;
  color: var(--muted);
}

.result-media__json summary {
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.result-media__json pre {
  margin: 8px 0 0;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-ctrl);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre;
}

/* ---------- Form layout helpers ---------- */
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.form-row > * { flex: 1 1 0; min-width: 0; }
.form-row > .btn,
.form-row > button { flex: 0 0 auto; }

@media (max-width: 640px) {
  .form-row { flex-direction: column; }
  .form-row > * { flex: 1 1 auto; width: 100%; }
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-block + .section-block { margin-top: 20px; }

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-in,
  .toast.is-out {
    transition: none;
    transform: none;
  }
  .skel::after {
    animation: none;
    opacity: 0.4;
  }
}

/* ---------- P2: UrlCopy / probe-card / soft-section / sticky-filters ---------- */
.url-copy {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.url-copy input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctrl);
  background: var(--bg, var(--card));
  color: var(--text);
}

.url-copy button {
  white-space: nowrap;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-radius: var(--radius-ctrl);
  padding: 12px 16px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}

.url-copy button.copied {
  background: var(--ok);
}

.probe-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.probe-card:hover {
  transform: translateY(-2px);
}

.probe-card.failed {
  opacity: 0.72;
}

.probe-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.probe-card__name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  word-break: break-all;
  color: var(--text);
}

.probe-card__status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.probe-card__status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}

.probe-card.failed .probe-card__status .dot {
  background: var(--bad);
}

.probe-card__latency {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.probe-card__blurb {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.probe-card .url-copy {
  margin-top: 4px;
}

.probe-card .tag.adult {
  background: #fdecea;
  color: #a33;
}

html[data-theme="dark"] .probe-card .tag.adult {
  background: #3a1f22;
  color: #f0a0a8;
}

.sticky-filters {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.sticky-filters input[type="search"] {
  flex: 1;
  min-width: 200px;
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctrl);
  background: var(--bg, var(--card));
  color: var(--text);
}

.sticky-filters .tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sticky-filters .tabs button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.sticky-filters .tabs button.active {
  background: var(--text);
  color: var(--card);
  border-color: var(--text);
}

.soft-section {
  margin-top: 36px;
  padding: 22px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--soft) 80%, transparent), var(--card));
  box-shadow: var(--shadow);
}

.soft-section__head {
  margin-bottom: 14px;
}

.soft-section__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}

.soft-section__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.soft-section__sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.soft-section .cards {
  margin-top: 4px;
}

.soft-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.soft-card:hover {
  transform: translateY(-2px);
}

.soft-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.soft-card__name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  word-break: break-all;
  color: var(--text);
}

.soft-card__blurb {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.ext-link svg {
  width: 14px;
  height: 14px;
}

#topBtn,
.top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
}

#topBtn svg,
.top-btn svg {
  width: 14px;
  height: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .probe-card,
  .soft-card {
    transition: none;
  }

  .probe-card:hover,
  .soft-card:hover {
    transform: none;
  }

  .sticky-filters .tabs button {
    transition: none;
  }
}

/* theme pill icon */
.pill-btn .theme-icon,
.pill-btn svg.theme-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-card h2 .icon-ext,
.nav-card h2 svg.icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  display: inline-block;
}
