:root {
  --bg: #f7f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #7b8190;
  --line: #d8dbe6;
  --blue: #075dc8;
  --blue-dark: #044aa3;
  --soft-blue: #eef5ff;
  --shadow: 0 24px 70px rgba(39, 55, 94, 0.10);
  --header-height: 82px;
  --hero-top-offset: 86px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 0 7.5vw;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 251, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
}

.brand-mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-name {
  font-size: 23px;
  font-weight: 950;
  letter-spacing: 0;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.footer-logo .brand-mark {
  width: 32px;
  height: 32px;
}

.footer-logo .brand-mark img {
  width: 29px;
  height: 29px;
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 28px;
}

.top-nav a,
.ghost-button,
.subscription-button {
  color: var(--ink);
  border: 0;
  background: transparent;
  text-decoration: none;
  font-weight: 650;
}

.top-nav a,
.subscription-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 25px;
  color: #fff;
  border-radius: 999px;
  background: var(--blue);
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px 0 6px;
  border-radius: 999px;
}

.account-button.is-logged-in {
  color: var(--blue-dark);
  background: #eef5ff;
  box-shadow: inset 0 0 0 1px #c6dcff;
}

.provider-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #fff;
  border-radius: 50%;
  background: #718096;
  font-size: 12px;
  font-weight: 950;
}

.provider-icon.telegram {
  background: #2aabee;
}

.provider-icon.google {
  background: linear-gradient(135deg, #4285f4 0 45%, #34a853 46% 62%, #fbbc05 63% 78%, #ea4335 79% 100%);
}

.provider-icon.yandex {
  background: #fc3f1d;
}

.provider-icon.email {
  background: var(--blue);
}

.provider-icon.phone {
  background: #16a34a;
}

.provider-icon.large {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.home-shell {
  width: min(1000px, calc(100% - 36px));
  margin: 0 auto;
  padding: 86px 0 72px;
}

.guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 34px;
  padding: 14px 16px 14px 20px;
  border: 1px solid #c7d8f5;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.guest-banner strong,
.guest-banner span {
  display: block;
}

.guest-banner strong {
  margin-bottom: 3px;
}

.guest-banner span {
  color: var(--muted);
  font-size: 14px;
}

.guest-banner button,
.primary-login {
  min-height: 40px;
  padding: 0 18px;
  color: #fff;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  font-weight: 750;
}

.hero-composer {
  position: relative;
  display: grid;
  gap: 0;
  justify-items: center;
  isolation: isolate;
}

.chat-surface {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(760px, 100%);
}

.chat-surface::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: calc(-1 * (var(--hero-top-offset, 86px) + var(--header-height, 82px)));
  right: -120px;
  bottom: 0;
  left: -120px;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(7, 93, 200, 0.16) 0%, rgba(87, 183, 255, 0.13) 28%, rgba(87, 183, 255, 0.06) 50%, transparent 74%);
  filter: blur(20px);
}

.chat-surface::after {
  content: none;
  display: none;
}

.conversation-panel {
  position: relative;
  top: calc(-1 * var(--hero-top-offset, 86px));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
  min-height: calc(300px + var(--hero-top-offset, 86px));
  max-height: calc(430px + var(--hero-top-offset, 86px));
  margin-bottom: calc(-1 * var(--hero-top-offset, 86px));
  padding: calc(22px + var(--hero-top-offset, 86px)) 22px 26px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.conversation-empty {
  align-self: center;
  justify-self: center;
  margin: auto;
  color: var(--muted);
  font-weight: 650;
}

.chat-entry {
  max-width: 100%;
  line-height: 1.45;
}

.chat-entry.user {
  align-self: flex-end;
  max-width: min(560px, 86%);
  padding: 10px 14px;
  color: #fff;
  border-radius: 18px 18px 8px 18px;
  background: var(--blue);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.chat-entry.assistant {
  align-self: flex-start;
  max-width: min(620px, 92%);
}

.chat-entry.status {
  padding: 10px 13px;
  color: #5b6477;
  border-radius: 16px;
  background: #f2f4fa;
  font-weight: 650;
}

.chat-entry.failed {
  padding: 10px 13px;
  color: #a32836;
  border-radius: 16px;
  background: #fff0f3;
  font-weight: 650;
}

.chat-entry.pending {
  align-self: flex-start;
  width: min(460px, 92%);
}

.result-card {
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
  padding: 12px;
  border: 1px solid #dce8fb;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 48px rgba(30, 70, 130, 0.12);
}

.result-media {
  position: relative;
}

.result-card.pending {
  width: 100%;
  padding: 12px;
  border-color: #cfe3ff;
  background: rgba(255, 255, 255, 0.92);
}

.pending-media {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--result-aspect, 1 / 1);
  min-height: 240px;
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(115deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 42%, rgba(255,255,255,0) 70%),
    linear-gradient(135deg, #edf4ff, #f8fbff 52%, #e5f1ff);
  background-size: 220% 100%, 100% 100%;
  animation: result-sheen 1.5s ease-in-out infinite;
}

.pending-caption {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #4f5a70;
  border-radius: 999px;
  font-weight: 800;
}

.pending-caption::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(7, 93, 200, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.pending-subtitle {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

@keyframes result-sheen {
  0% { background-position: 180% 0, 0 0; }
  100% { background-position: -80% 0, 0 0; }
}

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

.result-card img {
  display: block;
  width: 100%;
  aspect-ratio: var(--result-aspect, 1 / 1);
  max-height: 330px;
  object-fit: contain;
  border-radius: 12px;
  background: #edf4ff;
  cursor: zoom-in;
}

.download-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(10px);
  text-decoration: none;
}

.download-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
