:root {
  color-scheme: dark;
  --bg: #02040a;
  --panel: #10131e;
  --panel-2: #161a27;
  --field: #080b13;
  --text: #f7fbff;
  --muted: #a9b2c7;
  --line: #30394f;
  --gold: #ffd76a;
  --gold-strong: #ffb82e;
  --gold-soft: #fff0b8;
  --gold-deep: #9d6b12;
  --danger: #ff8585;
  --success: #7dffad;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.54);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 72% 14%, rgba(255, 184, 46, 0.22), transparent 22%),
    radial-gradient(circle at 22% 24%, rgba(255, 215, 106, 0.14), transparent 26%),
    linear-gradient(135deg, #02040a 0%, #07111a 48%, #03030a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: auto -10% -20% -10%;
  z-index: -2;
  height: 52vh;
  background:
    linear-gradient(108deg, transparent 5%, rgba(255, 215, 106, 0.6) 8%, transparent 12%),
    linear-gradient(122deg, transparent 14%, rgba(255, 184, 46, 0.7) 17%, transparent 22%),
    linear-gradient(96deg, transparent 35%, rgba(255, 240, 184, 0.54) 39%, transparent 45%),
    linear-gradient(112deg, transparent 48%, rgba(255, 215, 106, 0.5) 52%, transparent 59%),
    linear-gradient(102deg, transparent 66%, rgba(157, 107, 18, 0.58) 70%, transparent 77%);
  filter: blur(10px);
  opacity: 0.62;
  transform: skewY(-8deg);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(2, 4, 10, 0.98) 0 28%, rgba(2, 4, 10, 0.42) 48%, rgba(2, 4, 10, 0.92) 100%),
    linear-gradient(180deg, rgba(2, 4, 10, 0.12), rgba(2, 4, 10, 0.95));
  pointer-events: none;
}

.background-art {
  position: fixed;
  top: 92px;
  right: 8vw;
  z-index: -2;
  width: min(430px, 46vw);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 215, 106, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 34%, rgba(157, 107, 18, 0.26) 35% 38%, transparent 39%),
    radial-gradient(circle, transparent 0 52%, rgba(255, 215, 106, 0.42) 53% 56%, transparent 57%),
    conic-gradient(from 20deg, transparent 0 15%, rgba(255, 184, 46, 0.72) 16% 22%, transparent 23% 42%, rgba(255, 240, 184, 0.64) 43% 50%, transparent 51% 100%);
  box-shadow: 0 0 90px rgba(255, 215, 106, 0.16);
  opacity: 0.66;
}

button,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  width: min(1180px, calc(100% - 34px));
  margin: 0 auto;
  padding: 36px 0 52px;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
  margin-bottom: 36px;
  border: 1px solid rgba(255, 215, 106, 0.35);
  border-radius: 18px;
  background:
    linear-gradient(135deg, #0c111d 0%, #101827 54%, #090c15 100%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 215, 106, 0.08);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.brandbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, transparent 0 18%, rgba(255, 215, 106, 0.16) 18.5%, transparent 19.2%),
    linear-gradient(290deg, transparent 0 76%, rgba(255, 184, 46, 0.13) 76.5%, transparent 77.3%);
  pointer-events: none;
}

.brandbar::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-strong));
}

.brand-identity {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid rgba(255, 215, 106, 0.78);
  border-radius: 14px;
  background:
    radial-gradient(circle at 70% 28%, rgba(255, 215, 106, 0.28), transparent 36%),
    linear-gradient(135deg, #071620, #10162a);
  box-shadow: 0 0 28px rgba(255, 215, 106, 0.22);
  position: relative;
  overflow: hidden;
}

.brand-logo img {
  position: relative;
  z-index: 2;
  display: block;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: contain;
  border-radius: 10px;
}

.brand-logo::before,
.brand-logo::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 215, 106, 0.72);
  border-radius: 50%;
  width: 58px;
  height: 18px;
  transform: rotate(-24deg);
}

.brand-logo::after {
  border-color: rgba(255, 184, 46, 0.62);
  transform: rotate(28deg);
}

.brand-logo span {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-copy {
  text-align: left;
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1;
  letter-spacing: 1.4px;
  text-shadow: 0 0 18px rgba(255, 215, 106, 0.34);
  transition: color 160ms ease, text-shadow 160ms ease;
}

.brand-identity:hover .brand-copy h1 {
  color: var(--gold-soft);
  text-shadow: 0 0 22px rgba(255, 215, 106, 0.52);
}

.brand-action {
  position: relative;
  z-index: 1;
  min-width: 150px;
}

.guide {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(300px, 0.9fr);
  gap: 28px;
  align-items: center;
  min-height: 290px;
  margin-bottom: 26px;
  perspective: 1200px;
}

.guide::before {
  content: "";
  position: absolute;
  inset: -24px auto -18px 34%;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--gold-soft), var(--gold-strong), transparent);
  transform: skewX(-18deg);
  opacity: 0.78;
}

.guide::after {
  content: "";
  position: absolute;
  inset: -34px -20px -34px 44%;
  z-index: 0;
  border-radius: 34px;
  background:
    radial-gradient(circle at 62% 40%, rgba(255, 215, 106, 0.24), transparent 36%),
    radial-gradient(circle at 46% 64%, rgba(255, 184, 46, 0.16), transparent 42%);
  opacity: 0.82;
  pointer-events: none;
}

.guide-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.guide-copy p {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.guide-copy h2 {
  min-height: 3.92em;
  margin: 0;
  color: #ffffff;
  font-size: clamp(36px, 5.6vw, 70px);
  line-height: 0.98;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 34px rgba(255, 215, 106, 0.18);
}

.guide-copy h2::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 0.82em;
  margin-left: 0.1em;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(255, 215, 106, 0.7);
  vertical-align: -0.08em;
  animation: caretBlink 720ms steps(1) infinite;
}

.guide-card {
  position: relative;
  z-index: 1;
  margin: 0;
  border: 1px solid #343e54;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow), 0 0 38px rgba(255, 215, 106, 0.16);
  overflow: hidden;
  transform-style: preserve-3d;
  animation: photoFloat3d 8s ease-in-out infinite;
  will-change: transform;
}

.guide-card:hover {
  animation-play-state: paused;
  box-shadow: var(--shadow), 0 0 54px rgba(255, 215, 106, 0.24);
}

.guide-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold), var(--gold-strong));
}

.guide-image-button {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #050811;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}

.guide-image-button:hover {
  transform: none;
  border-color: transparent;
  background: #050811;
}

.guide-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--field);
  transition: transform 180ms ease;
}

.guide-card:hover img {
  transform: scale(1.012);
}

.guide-card figcaption {
  margin: 0;
  padding: 15px 17px 17px;
  border-top: 1px solid #2c3548;
  color: #dbe7f7;
  background: #111724;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.telegram-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow), 0 0 26px rgba(255, 215, 106, 0.08);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.telegram-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold), var(--gold-strong));
}

.telegram-copy {
  position: relative;
  z-index: 1;
}

.telegram-copy p {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.telegram-copy h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.12;
}

#telegramInput {
  position: relative;
  z-index: 1;
  min-height: 92px;
  resize: vertical;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  display: flex;
  min-width: 0;
  min-height: 520px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.guide-card::after {
  content: none;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold), var(--gold-strong));
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  color: #ffffff;
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: 0;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

textarea,
.result {
  width: 100%;
  min-height: 350px;
  flex: 1;
  border: 1px solid #343e54;
  border-radius: 14px;
  background: var(--field);
  color: #f5f8ff;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

textarea {
  resize: vertical;
  padding: 17px;
  line-height: 1.6;
  font-size: 14px;
}

.image-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 34px);
  border: 1px solid rgba(255, 215, 106, 0.5);
  border-radius: 18px;
  background: #070a12;
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.72), 0 0 46px rgba(255, 215, 106, 0.18);
  padding: 14px;
}

.image-modal::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(6px);
}

.image-modal img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 12px;
  background: #050811;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  border-color: rgba(255, 215, 106, 0.72);
  border-radius: 50%;
  background: rgba(8, 11, 19, 0.72);
  color: var(--gold-soft);
  padding: 0;
  font-size: 15px;
  line-height: 1;
  text-transform: none;
}

textarea::placeholder {
  color: #858fa5;
}

textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 215, 106, 0.14), 0 0 28px rgba(255, 215, 106, 0.08);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 13px;
}

button,
.brand-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #364158;
  border-radius: 8px;
  background: #1b2130;
  color: #eef5ff;
  padding: 0 17px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover,
.brand-action:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  background: #222b3d;
  color: #ffffff;
}

button.primary,
.copy-button,
.brand-action {
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold), var(--gold-strong));
  color: #171006;
  box-shadow: 0 0 28px rgba(255, 215, 106, 0.2);
}

button.primary:hover,
.copy-button:hover,
.brand-action:hover {
  box-shadow: 0 0 34px rgba(255, 215, 106, 0.34);
}

.icon-button {
  min-width: 78px;
}

.copy-button {
  min-width: 128px;
}

.status {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--success);
  font-size: 12px;
  font-weight: 850;
}

.status.error {
  color: var(--danger);
}

.result {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 18px;
  line-height: 1.7;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  font-size: 14px;
}

@media (max-width: 940px) {
  .app {
    padding-top: 22px;
  }

  .brandbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 26px;
  }

  .brand-action {
    width: max-content;
  }

  .guide {
    grid-template-columns: 1fr;
  }

  .guide::before {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .telegram-panel {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 430px;
  }
}

@media (max-width: 540px) {
  .app {
    width: min(100% - 18px, 1180px);
  }

  .guide-copy h2 {
    font-size: 38px;
  }

  .actions,
  .actions button {
    width: 100%;
  }
}

@keyframes caretBlink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes photoFloat3d {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg);
  }

  22% {
    transform: translate3d(10px, -7px, 0) rotateX(1.2deg) rotateY(-2.2deg);
  }

  46% {
    transform: translate3d(-8px, 6px, 0) rotateX(-1deg) rotateY(2deg);
  }

  70% {
    transform: translate3d(7px, 8px, 0) rotateX(-1.4deg) rotateY(-1.4deg);
  }

  86% {
    transform: translate3d(-5px, -5px, 0) rotateX(1deg) rotateY(1.5deg);
  }
}
