/* ---------------------------------------------------------------
   Random Image — минималистичная тёмная типографика на белом фоне.
   Палитра: белый фон, почти чёрный текст, мягкий синий акцент.
   --------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --ink: #0d0d0d;
  --muted: #6b7280;
  --line: #e5e5e5;
  --accent: #4d6bfe;
  --accent-hover: #3f5ae0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13, 13, 13, 0.04), 0 14px 34px rgba(13, 13, 13, 0.06);
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Сцена ------------------------------------------------------ */

.stage {
  width: 100%;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* --- Рамка с картинкой ----------------------------------------- */

.frame {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.frame img.loaded {
  opacity: 1;
}

/* --- Спиннер ---------------------------------------------------- */

.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.spinner.visible {
  opacity: 1;
}

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

/* --- Управление ------------------------------------------------- */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

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

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

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.seed {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--muted);
  min-width: 10ch;
}

/* --- Подсказка -------------------------------------------------- */

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink);
}

/* --- Адаптив ---------------------------------------------------- */

@media (max-width: 520px) {
  body {
    padding: 24px 16px;
  }

  .frame {
    border-radius: 12px;
  }

  .btn {
    width: 100%;
  }
}

/* --- Уважение к настройкам пользователя ------------------------- */

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }

  .frame img,
  .btn {
    transition: none;
  }
}
