/* Почитай мне */
:root {
  --font-display: "Literata", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  --paper: #f3ede1;
  --surface: #fffbf4;
  --ink: #2b241c;
  --muted: #5e564c;
  --accent: #8f4e32;
  --accent-bright: #a85c3b;
  --line: #2b241c22;
  --scroll-track: #f3ede1;
  --scroll-thumb: #2b241c38;
  --scroll-thumb-hover: #8f4e328c;
  color: var(--ink);
  color-scheme: light;
  font-family: var(--font-body);
  font-synthesis: none;
  text-rendering: optimizelegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

body {
  background: var(--paper);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 2px solid var(--scroll-track);
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  border: 2px solid var(--scroll-track);
  background-clip: padding-box;
}

.page {
  min-height: 100svh;
  padding: max(0.85rem, env(safe-area-inset-top, 0px))
    max(0.65rem, env(safe-area-inset-right, 0px))
    max(2rem, env(safe-area-inset-bottom, 0px))
    max(0.65rem, env(safe-area-inset-left, 0px));
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  display: flex;
  position: relative;
  overflow: hidden auto;
}

.atmosphere {
  z-index: -1;
  background:
    radial-gradient(80% 50% at 12% 0%, #8f4e3214, #0000 55%),
    radial-gradient(70% 45% at 92% 8%, #3d5c4a14, #0000 50%),
    linear-gradient(180deg, #f7f2e8 0%, var(--paper) 42%, #ebe4d6 100%);
  position: fixed;
  inset: 0;
}

.brand {
  text-align: center;
  margin-bottom: clamp(2rem, 6vh, 3.5rem);
  animation: 0.9s cubic-bezier(0.22, 1, 0.36, 1) both rise;
}

.brand-mark {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0;
  font-size: clamp(1.85rem, 4.5vw, 2.45rem);
  font-weight: 500;
  line-height: 1;
}

.brand-line {
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  color: var(--muted);
  margin: 0.35rem 0 0;
  font-size: clamp(0.88rem, 1.6vw, 1.02rem);
  font-weight: 400;
}

.stage {
  text-align: center;
  flex-direction: column;
  flex: 1;
  justify-content: flex-start;
  align-items: center;
  gap: clamp(1.35rem, 3.5vw, 2rem);
  width: min(1200px, 100%);
  animation: 1s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both rise;
  display: flex;
}

.stage-body {
  flex-direction: column;
  align-items: center;
  gap: clamp(1.35rem, 3.5vw, 2rem);
  width: 100%;
  display: flex;
}

.controls {
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  display: flex;
}

.field-label {
  font-family: var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  font-size: 0.72rem;
  font-weight: 650;
}

.niche-select {
  z-index: 5;
  width: min(100%, 320px);
  position: relative;
}

.niche-trigger {
  appearance: none;
  cursor: pointer;
  width: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  background: var(--surface);
  border: none;
  border-radius: 999px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.05rem;
  font-size: 0.95rem;
  font-weight: 550;
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  display: flex;
  box-shadow: inset 0 0 0 1px var(--line);
}

.niche-trigger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.niche-trigger:not(:disabled):hover {
  box-shadow: inset 0 0 0 1px #8f4e3266;
}

.niche-select.is-open .niche-trigger {
  background: #8f4e3212;
  box-shadow: inset 0 0 0 1px #8f4e328c;
}

.niche-trigger:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.niche-label {
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
  overflow: hidden;
}

.niche-caret {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  width: 0;
  height: 0;
  margin-left: 0.15rem;
  transition: transform 0.2s;
}

.niche-select.is-open .niche-caret {
  transform: rotate(180deg);
}

.niche-menu {
  scrollbar-color: #2b241c38 var(--surface);
  background: var(--surface);
  border-radius: 1rem;
  max-height: min(50vh, 420px);
  margin: 0;
  padding: 0.35rem;
  animation: 0.22s cubic-bezier(0.22, 1, 0.36, 1) both menu-in;
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  overflow-y: auto;
  box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px #2b241c24;
}

.niche-option {
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  font-family: var(--font-body);
  text-align: left;
  background: transparent;
  border: none;
  width: 100%;
  border-radius: 0.7rem;
  align-items: center;
  padding: 0.68rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s;
  display: flex;
}

.niche-option:hover {
  background: #8f4e3212;
}

.niche-option:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: -2px;
}

.niche-option.is-active {
  color: var(--accent);
  background: #8f4e321c;
}

.niche-option + .niche-option {
  margin-top: 0.1rem;
}

@keyframes menu-in {
  0% {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.reel {
  --slot-h: clamp(3.1rem, 9vw, 4.35rem);
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: calc(var(--slot-h) * 3 + 4.5rem);
  padding-top: 0.75rem;
  display: flex;
}

.reel-eyebrow {
  font-family: var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  font-size: 0.74rem;
  font-weight: 650;
  min-height: 1.2rem;
}

.reel-wheel {
  width: min(100%, 52rem);
}

.reel-wheel-viewport {
  height: calc(var(--slot-h) * 3);
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 16%,
    #000 84%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 16%,
    #000 84%,
    transparent 100%
  );
}

.reel-wheel-track {
  will-change: transform;
}

.reel-slot {
  height: var(--slot-h);
  max-width: 28ch;
  margin: 0 auto;
  padding: 0 0.35rem;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  text-align: center;
  text-wrap: balance;
  align-content: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.08;
}

.reel-slot.is-center {
  color: var(--ink);
  font-size: clamp(1.85rem, 5.4vw, 3.35rem);
  font-weight: 500;
}

.reel-slot.is-adjacent {
  color: var(--muted);
  font-size: clamp(1rem, 2.8vw, 1.35rem);
  font-weight: 500;
  opacity: 0.52;
}

.reel-tags {
  max-width: 42ch;
  min-height: 2.85rem;
  max-height: 2.85rem;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  align-content: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.reel.is-spinning .reel-slot.is-center {
  opacity: 0.94;
}

.reel.is-landed .reel-slot.is-center {
  color: var(--ink);
}

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

.actions {
  justify-content: center;
  align-items: center;
  min-height: 3.35rem;
  display: flex;
}

.btn {
  appearance: none;
  cursor: pointer;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  border: none;
  border-radius: 999px;
  min-width: 9.5rem;
  min-height: 3.05rem;
  padding: 0.95rem 1.7rem;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

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

.btn.primary {
  background: var(--accent);
  color: #fffaf3;
  box-shadow: 0 10px 28px #8f4e3240;
}

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

@keyframes rise {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .stage,
  .niche-menu {
    animation: none !important;
    transition: none !important;
  }
}

.error-screen {
  text-align: center;
  min-height: 100svh;
  color: var(--ink);
  background: transparent;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  padding: 2rem;
  display: flex;
  position: relative;
}

.error-screen-mark {
  font-family: var(--font-display);
  color: var(--accent);
  margin: 0;
  font-size: 1.35rem;
  font-weight: 500;
}

.error-screen-title {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 500;
}

.error-screen-body {
  max-width: 36ch;
  font-family: var(--font-body);
  color: var(--muted);
  margin: 0 0 0.5rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.error-screen .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
