:root {
  --ink: #f7f8fb;
  --muted: #aeb5c4;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(20, 24, 35, 0.9);
  --accent: #3977f6;
  --max-viewport-height: 100dvh;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body,
button,
input {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.reader-shell {
  --reader-body-font-size: 22px;
  --reader-title-font-size: 41px;
  --reader-side-padding: clamp(22px, 6vw, 58px);
  min-height: var(--max-viewport-height);
  padding: 0 0 max(36px, env(safe-area-inset-bottom));
  background: #f5f4f1;
  color: #1c1b19;
}

.reader-card {
  width: min(760px, 100%);
  min-height: var(--max-viewport-height);
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 60px rgba(28, 27, 25, 0.08);
}

.reader-cover {
  display: block;
  width: 100%;
  max-height: 48vh;
  object-fit: cover;
  background: #e8e6e1;
}

.reader-header,
.reader-body,
.reader-footer {
  padding-inline: var(--reader-side-padding);
}

.reader-header {
  padding-top: clamp(28px, 7vw, 56px);
}

.reader-meta {
  margin: 0 0 14px;
  color: #77736c;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.reader-header h1 {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--reader-title-font-size);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.025em;
}

.reader-body {
  padding-top: 30px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--reader-body-font-size);
  line-height: 1.55;
}

.reader-block {
  margin: 0 0 1.25em;
  overflow-wrap: anywhere;
}

.reader-inline-image {
  display: block;
  width: calc(100% + var(--reader-side-padding) + var(--reader-side-padding));
  max-width: none;
  height: auto;
  margin: 1.5em calc(0px - var(--reader-side-padding));
  border-radius: 0;
  background: #e8e6e1;
}

.reader-inline-video {
  width: calc(100% + var(--reader-side-padding) + var(--reader-side-padding));
  max-width: none;
  margin: 28px calc(0px - var(--reader-side-padding));
}

.reader-inline-video video,
.reader-inline-video iframe {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 0;
  background: #000;
  aspect-ratio: 16 / 9;
}

.reader-inline-video video {
  height: auto;
  min-height: 180px;
}

.reader-inline-video figcaption {
  margin: 10px var(--reader-side-padding) 0;
  color: #77747d;
  font-size: 14px;
  line-height: 1.4;
}

.reader-block > b:only-child {
  display: block;
  margin-top: 1.7em;
  font-size: 1.18em;
  line-height: 1.3;
}

.reader-block blockquote {
  margin: 1.6em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 4px solid #ff2f6d;
  color: #504d48;
  font-style: italic;
}

.reader-block a {
  color: #b41649;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.reader-footer {
  padding-top: 18px;
  padding-bottom: 48px;
}

.reader-images {
  display: grid;
  gap: 0;
  padding: 12px 0 18px;
}

.reader-images[hidden] {
  display: none;
}

.reader-images img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  background: #e8e6e1;
}

.reader-source {
  width: 100%;
  height: 60px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  background: #3770f4;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reader-source:active {
  background: #3469e5;
}

.reader-shell[data-theme="dark"] {
  color: #f5f5f7;
  background: #101012;
  color-scheme: dark;
}

.reader-shell[data-theme="dark"] .reader-card {
  background: #19191b;
  box-shadow: none;
}

.reader-shell[data-theme="dark"] .reader-meta {
  color: #aaa9af;
}

.reader-shell[data-theme="dark"] .reader-block blockquote {
  color: #cbc9cf;
}

.reader-shell[data-theme="dark"] .reader-block a {
  color: #8eb3ff;
}

.reader-shell[data-theme="dark"] .reader-cover,
.reader-shell[data-theme="dark"] .reader-inline-image,
.reader-shell[data-theme="dark"] .reader-inline-video video,
.reader-shell[data-theme="dark"] .reader-inline-video iframe,
.reader-shell[data-theme="dark"] .reader-images img {
  background: #2a2a2e;
}

.reader-settings {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 0;
  width: min(347px, calc(100vw - 48px));
  height: 108px;
  display: flex;
  align-items: center;
  margin: auto;
  padding: 24px;
  border-radius: 64px;
  background: #37373b;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  pointer-events: none;
  transition: opacity 160ms ease, transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reader-settings.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.reader-theme,
.reader-font-control button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 100ms ease, opacity 100ms ease, background-color 140ms ease;
}

.reader-theme {
  position: relative;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
}

.reader-theme:active,
.reader-font-control button:active,
.reader-theme.is-pressed,
.reader-font-control button.is-pressed {
  transform: scale(0.9);
  opacity: 0.78;
}

.reader-theme + .reader-theme {
  margin-left: 12px;
}

.reader-theme--light {
  color: #000;
  background: #f8f8f8;
}

.reader-theme--dark {
  color: #fff;
  background: #000;
}

.reader-theme-check {
  display: grid;
  place-items: center;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  transform: scale(0.65);
  transition: opacity 140ms ease, transform 160ms ease;
}

.reader-theme.is-selected .reader-theme-check {
  opacity: 1;
  transform: scale(1);
}

.reader-font-control {
  width: 151px;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-left: 16px;
  overflow: hidden;
  border-radius: 53px;
  background: #fff;
}

.reader-font-control button {
  display: grid;
  place-items: center;
  padding: 0;
  color: #000;
  background: transparent;
  font-family: "Arial Rounded MT Bold", Inter, sans-serif;
  font-weight: 700;
  line-height: 1;
}

.reader-font-control button[hidden] {
  display: none;
}

.reader-font-control button:first-child {
  font-size: 18px;
}

.reader-font-control button:last-child {
  font-size: 28px;
}

.reader-font-control.has-reset {
  grid-template-columns: 45px 62px 44px;
}

#reader-font-reset {
  font-size: 18px;
}

.reader-font-control button:disabled {
  opacity: 0.28;
  cursor: default;
}

.reader-font-control button:disabled:active {
  transform: none;
}

@media (max-width: 370px) {
  .reader-settings {
    padding-inline: 20px;
  }

  .reader-theme + .reader-theme {
    margin-left: 10px;
  }

  .reader-font-control {
    width: auto;
    min-width: 0;
    flex: 1;
    margin-left: 12px;
  }

  .reader-font-control.has-reset {
    grid-template-columns: 1fr 1.4fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reader-settings,
  .reader-theme,
  .reader-theme-check,
  .reader-font-control button {
    transition: none;
  }
}

.reader-state {
  min-height: var(--max-viewport-height);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
}

.reader-state p,
.reader-state h1 {
  margin: 0;
}

.reader-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #ddd9d2;
  border-top-color: #ff2f6d;
  border-radius: 50%;
  animation: reader-spin 0.8s linear infinite;
}

.reader-error-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: #d83e50;
  font-size: 28px;
  font-weight: 800;
}

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

[hidden] {
  display: none !important;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.welcome-shell {
  min-height: var(--max-viewport-height);
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 15% 5%, rgba(57, 119, 246, 0.24), transparent 32rem),
    radial-gradient(circle at 90% 90%, rgba(111, 62, 216, 0.2), transparent 30rem),
    #080a10;
}

.welcome-card {
  width: min(780px, 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 52px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.055), transparent 55%),
    var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  display: grid;
  place-items: center;
  border-radius: 19px;
  font-size: 24px;
  background: linear-gradient(145deg, #4c8cff, #275edb);
  box-shadow: 0 14px 36px rgba(57, 119, 246, 0.34);
}

.eyebrow {
  margin: 0 0 5px;
  color: #7fa8ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(27px, 6vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.lead {
  max-width: 650px;
  margin: 30px 0 28px;
  color: #c4cad6;
  font-size: clamp(17px, 2.5vw, 21px);
  line-height: 1.55;
}

.video-form label {
  display: block;
  margin-bottom: 10px;
  color: #e7e9ef;
  font-size: 14px;
  font-weight: 650;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-row input {
  min-width: 0;
  flex: 1;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 15px;
  padding: 0 17px;
  outline: none;
  color: var(--ink);
  background: rgba(5, 7, 12, 0.72);
}

.input-row input:focus {
  border-color: #5b8efa;
  box-shadow: 0 0 0 4px rgba(57, 119, 246, 0.16);
}

.input-row button,
.toolbar-button {
  border: 0;
  border-radius: 14px;
  color: white;
  cursor: pointer;
}

.input-row button {
  height: 54px;
  padding: 0 24px;
  font-weight: 750;
  background: var(--accent);
}

.form-note,
.form-error {
  min-height: 20px;
  margin: 10px 2px 0;
  font-size: 13px;
}

.form-note {
  color: #7f8798;
}

.form-error {
  color: #ff9a9a;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 34px;
}

.feature-grid article {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 17px;
  background: rgba(255, 255, 255, 0.025);
}

.feature-grid strong {
  color: #8db3ff;
  font-size: 15px;
}

.feature-grid span {
  color: #939bac;
  font-size: 13px;
  line-height: 1.45;
}

.player-shell {
  height: var(--max-viewport-height);
  min-height: 480px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #030407;
}

.player-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    10px max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.96);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-button {
  min-height: 40px;
  padding: 0 15px;
  color: #e9ecf3;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.toolbar-button--quiet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
}

.toolbar-button--primary {
  background: var(--accent);
}

.player-stage {
  min-width: 0;
  min-height: 0;
  background: black;
}

.vk-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: black;
}

.player-footer {
  padding:
    9px
    max(12px, env(safe-area-inset-right))
    max(9px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background: #080a10;
}

.pip-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  color: white;
  font-size: 14px;
  font-weight: 750;
  background: var(--accent);
  cursor: pointer;
}

.player-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 28px;
  padding-top: 7px;
  color: #8c94a4;
  font-size: 12px;
  text-align: center;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55d38a;
  box-shadow: 0 0 12px rgba(85, 211, 138, 0.7);
}

.player-shell.is-immersive {
  position: fixed;
  z-index: 9999;
  inset: 0;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}

.player-shell.is-immersive .player-toolbar,
.player-shell.is-immersive .player-footer {
  display: none;
}

@media (max-width: 640px) {
  .welcome-card {
    border-radius: 23px;
    padding: 23px 19px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    border-radius: 16px;
  }

  .lead {
    margin: 23px 0;
  }

  .input-row {
    flex-direction: column;
  }

  .input-row button {
    width: 100%;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .toolbar-button {
    padding-inline: 11px;
    font-size: 12px;
  }

  .toolbar-button--quiet {
    width: 46px;
    overflow: hidden;
    white-space: nowrap;
  }
}

/* Start screen — matched to the selected Figma frame (360 × 800). */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.welcome-shell {
  min-height: var(--max-viewport-height);
  display: block;
  padding: 0;
  overflow: hidden;
  color: #000;
  background: #fff;
}

.welcome-card {
  width: min(100%, 560px);
  min-height: var(--max-viewport-height);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  padding: 52px 24px max(40px, calc(40px + env(safe-area-inset-bottom)));
  background: #fff;
  box-shadow: none;
}

.welcome-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.welcome-robot {
  display: block;
  width: min(304px, 92vw);
  aspect-ratio: 3 / 2;
  margin: 0 auto 26px;
  object-fit: cover;
}

.welcome-copy h1 {
  margin: 0;
  color: transparent;
  background: linear-gradient(175deg, #2f8cff 0%, #08203a 34%, #000 68%);
  background-clip: text;
  -webkit-background-clip: text;
  font-size: clamp(38px, 11.1vw, 52px);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.welcome-description {
  margin: 9px 0 0;
  color: #000;
  font-size: clamp(16px, 4.45vw, 19px);
  font-weight: 800;
  line-height: 1.38;
  letter-spacing: -0.015em;
}

.welcome-description span {
  font-size: 0.92em;
}

.link-form {
  position: relative;
  width: 100%;
  margin-top: 40px;
}

.link-input-frame {
  width: 100%;
  height: 60px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #eef6ff;
  box-shadow: inset 0 0 0 2px #4986f5;
}

.link-form input {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
  padding: 0 20px;
  outline: none;
  color: #173d75;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  caret-color: #4986f5;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

.link-form input::placeholder {
  color: #829fd5;
  opacity: 1;
}

.link-input-frame:focus-within {
  background: #e0efff;
  box-shadow:
    inset 0 0 0 2px #2f80ff,
    0 0 0 3px rgba(73, 134, 245, 0.12);
}

.link-form .form-note,
.link-form .form-error {
  position: absolute;
  right: 18px;
  bottom: -25px;
  left: 18px;
  min-height: 18px;
  margin: 0;
  color: #6c83aa;
  font-size: 12px;
  text-align: center;
}

.link-form .form-error {
  color: #cb334b;
}

.post-shell {
  min-height: var(--max-viewport-height);
  padding: 18px 14px max(28px, env(safe-area-inset-bottom));
  color: #101318;
  background: #f3f7fd;
}

.post-card {
  width: min(640px, 100%);
  margin: 0 auto;
  border-radius: 24px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(34, 77, 135, 0.12);
}

.post-back {
  border: 0;
  padding: 6px 0 18px;
  color: #3977f6;
  background: transparent;
  font-weight: 700;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8eef8;
}

.post-header strong {
  display: block;
  font-size: 16px;
}

.post-header p {
  margin: 4px 0 0;
  color: #778297;
  font-size: 13px;
}

.post-text {
  margin: 18px 0;
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.5;
}

.post-media {
  display: grid;
  gap: 8px;
  overflow: hidden;
  border-radius: 18px;
}

.post-media img,
.post-media video {
  width: 100%;
  max-height: 66vh;
  display: block;
  object-fit: contain;
  border-radius: 14px;
  background: #080a10;
}

.post-source {
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: #3977f6;
  font-size: 15px;
  font-weight: 750;
}

@media (max-height: 560px) {
  .welcome-card {
    padding-top: 22px;
    padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
  }

  .welcome-robot {
    width: min(240px, 72vw);
    margin-bottom: 14px;
  }

  .welcome-description {
    margin-top: 15px;
  }

  .link-form {
    margin-top: 24px;
  }
}
