:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --border-hover: #d6d3d1;
  --primary: #e07a5f;
  --primary-hover: #cf6a4f;
  --primary-soft: #fdf4f1;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-none: none;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --max-w: 520px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.25rem calc(2rem + var(--safe-bottom));
}

.page--narrow {
  max-width: 640px;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.brand--link {
  text-decoration: none;
  color: inherit;
}

.brand--link:hover {
  text-decoration: none;
  opacity: 0.85;
}

.brand__name {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero__title {
  margin: 0 0 0.5rem;
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.hero__title--sm {
  font-size: 1.375rem;
}

.hero__subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.15s;
}

.input-wrap:focus-within {
  border-color: var(--primary);
}

.input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.875rem 1rem;
  font: inherit;
  color: var(--text);
  outline: none;
}

.input::placeholder {
  color: #a8a29e;
}

.input-action {
  flex-shrink: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0 1rem;
  cursor: pointer;
}

.input-action:hover {
  background: var(--primary-soft);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

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

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

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

.btn--primary.is-loading .btn__label::after {
  content: "…";
}

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

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

.btn--secondary {
  width: 100%;
  min-height: 42px;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}

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

.status {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  text-align: center;
}

.status--error {
  color: #b91c1c;
}

.status--info {
  color: var(--text-muted);
}

.status--loading {
  color: var(--text-muted);
}

.results__summary {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-align: center;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.media-card {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.media-card__thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.media-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-card__badge {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.72);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.media-card:hover .media-card__badge {
  background: var(--primary);
}

.ad-slot {
  min-height: 0;
  margin: 1.5rem 0;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer p {
  margin: 0 0 0.375rem;
}

.footer__nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.75rem 0;
}

.footer__nav a {
  color: var(--text-muted);
}

.footer__nav a:hover {
  color: var(--primary);
}

.prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  line-height: 1.65;
}

.prose p,
.prose ul {
  margin: 0 0 1rem;
}

.prose ul {
  padding-left: 1.25rem;
}

@media (min-width: 480px) {
  .hero__title {
    font-size: 1.875rem;
  }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
