:root {
  --ink: #172020;
  --muted: #697272;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --line: #c9cdc7;
  --blue: #36a9e1;
  --blue-dark: #167ab5;
  --acid: #d8ff65;
  --coral: #ff6a55;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 76% 4%, rgba(54, 169, 225, .14), transparent 24rem), var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}
button, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--acid); outline-offset: 3px; }
.hidden { display: none !important; }
main { width: min(1480px, calc(100% - 48px)); min-height: 100vh; margin: 0 auto; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .08em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  font: 700 12px Consolas, monospace;
  letter-spacing: -.08em;
  box-shadow: 3px 3px 0 var(--ink);
}
.header-note, .live-label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.bot-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.bot-link:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--ink); }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(54, 169, 225, .12);
}
.connection-invalid .status-dot { background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 106, 85, .12); }
.intro {
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  gap: 64px;
  align-items: end;
  padding: clamp(46px, 6vw, 82px) 0 40px;
}
.eyebrow {
  margin: 0 0 16px;
  color: var(--blue-dark);
  font: 800 11px Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1 { max-width: 900px; margin: 0; font-size: clamp(46px, 7vw, 102px); font-weight: 900; letter-spacing: -.07em; line-height: .86; }
h1 span { color: var(--blue-dark); }
.intro-copy { max-width: 420px; margin: 0 0 7px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.invalid-link {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin: -8px 0 28px;
  padding: 16px 18px;
  border: 1px solid #9b3427;
  border-radius: 14px;
  background: #ffe0da;
  color: #662018;
}
.invalid-link div { display: flex; gap: 5px; flex-direction: column; }
.invalid-link strong { font-size: 13px; }
.invalid-link span { font-size: 12px; }
.invalid-link a { flex: 0 0 auto; color: #662018; font-size: 11px; font-weight: 900; }
.workspace { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.editor-panel, .output-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 6px 7px 0 rgba(23, 32, 32, .13);
}
.output-panel { background: var(--ink); color: #eff5f1; }
.panel-bar {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.output-panel .panel-bar { border-color: #394443; }
.panel-bar > div:first-child { display: flex; gap: 10px; align-items: center; }
.step { color: var(--muted); font: 10px Consolas, monospace; }
.output-panel .step { color: #94a09f; }
h2 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: .03em; }
.panel-actions { display: flex; gap: 14px; }
.text-button {
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.text-button.danger { color: var(--coral); }
textarea {
  display: block;
  width: 100%;
  height: 515px;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 24px;
  font: 13px/1.72 Consolas, monospace;
}
textarea::placeholder { color: #a1a8a5; }
.editor-footer, .output-footer {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.output-footer { border-color: #394443; color: #94a09f; }
.output-footer strong { color: #d7e0de; font-family: Consolas, monospace; }
.output-footer strong.over-limit { color: #ff816e; }
.output-meta { display: flex; min-width: 0; gap: 4px; flex-direction: column; }
.send-feedback { max-width: 330px; overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.send-feedback.error { color: #ff9a89; }
.send-feedback.success { color: var(--acid); }
.output-buttons { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.segmented { display: flex; padding: 3px; border: 1px solid #495554; border-radius: 999px; background: #0f1717; }
.segmented button {
  min-width: 56px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8f9b99;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}
.segmented button.active { background: var(--acid); color: var(--ink); }
.code-output, .preview-stage { height: 515px; margin: 0; overflow: auto; }
.code-output {
  padding: 24px;
  color: #d7e1de;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.72 Consolas, monospace;
}
.preview-stage {
  display: grid;
  place-items: start center;
  padding: 38px 28px;
  background: linear-gradient(rgba(20, 43, 52, .82), rgba(20, 43, 52, .82)), radial-gradient(circle at 20% 25%, #3d6470 1px, transparent 1px);
  background-size: auto, 18px 18px;
}
.telegram-bubble {
  position: relative;
  width: min(92%, 520px);
  padding: 13px 16px 25px;
  border-radius: 8px 15px 15px 15px;
  background: #e6f5dc;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
  color: #18211f;
  font: 14px/1.45 Arial, sans-serif;
  white-space: pre-wrap;
}
.telegram-bubble a { color: #168acd; text-decoration: none; }
.telegram-bubble code { padding: 1px 4px; border-radius: 4px; background: rgba(23, 32, 32, .1); font-family: Consolas, monospace; }
.telegram-bubble pre { overflow: auto; padding: 10px; border-radius: 7px; background: rgba(23, 32, 32, .09); }
.telegram-bubble blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid #5b9f61; }
.message-time { position: absolute; right: 10px; bottom: 6px; color: #6e8b78; font-size: 10px; }
.copy-button, .send-button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  padding: 11px 16px;
  border: 1px solid var(--acid);
  border-radius: 10px;
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.send-button { border-color: #77cffa; background: var(--blue); color: #07191f; }
.copy-button:hover, .send-button:hover { transform: translateY(-2px); box-shadow: 0 4px 0 rgba(216, 255, 101, .25); }
.copy-button:disabled, .send-button:disabled { cursor: not-allowed; opacity: .42; transform: none; }
.flow-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 3px 3px 0 var(--ink);
}
.support-strip { display: flex; gap: 36px; align-items: center; padding: 38px 0 30px; border-bottom: 1px solid var(--line); }
.support-strip p { flex: 0 0 auto; margin: 0; color: var(--muted); font: 800 10px Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; }
.support-strip ul { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.support-strip li { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 253, 248, .62); color: #505b5a; font-size: 11px; }
.support-strip li > :first-child { color: var(--blue-dark); font-family: Consolas, monospace; }
footer { display: flex; justify-content: space-between; padding: 24px 0 38px; color: var(--muted); font-size: 11px; }
footer p { margin: 0; }
footer code { color: var(--ink); }
.saved-link-reminder {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  display: grid;
  width: min(360px, calc(100vw - 28px));
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--ink);
  border-radius: 17px;
  background: var(--card);
  box-shadow: 7px 8px 0 rgba(23, 32, 32, .25);
}
.reminder-close { position: absolute; top: 7px; right: 9px; width: 25px; height: 25px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.reminder-icon { display: grid; width: 42px; height: 42px; grid-row: 1 / span 2; place-items: center; border: 1px solid var(--ink); border-radius: 50%; background: var(--blue); font-size: 17px; }
.saved-link-reminder p { margin: 0 0 3px; color: var(--blue-dark); font: 800 9px Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }
.saved-link-reminder strong { display: block; padding-right: 16px; font-size: 13px; }
.saved-link-reminder a { width: fit-content; color: var(--ink); font-size: 11px; font-weight: 900; }

@media (max-width: 900px) {
  main { width: min(100% - 28px, 720px); }
  .intro { grid-template-columns: 1fr; gap: 26px; }
  h1 { line-height: .92; }
  .workspace { grid-template-columns: 1fr; gap: 24px; }
  .flow-arrow { top: 50%; transform: translate(-50%, -50%) rotate(90deg); }
  textarea, .code-output, .preview-stage { height: 440px; }
}
@media (max-width: 560px) {
  main { width: min(100% - 20px, 520px); }
  .site-header { padding-top: 18px; }
  .header-note { font-size: 10px; }
  .intro { padding: 42px 0 30px; }
  h1 { font-size: clamp(43px, 14vw, 66px); }
  .intro-copy { font-size: 14px; }
  .panel-bar { min-height: 62px; padding: 12px 14px; }
  textarea, .code-output { height: 380px; padding: 18px; font-size: 12px; }
  .preview-stage { height: 380px; padding: 24px 12px; }
  .telegram-bubble { width: 100%; }
  .editor-footer, .output-footer { gap: 12px; align-items: flex-start; flex-direction: column; }
  .output-buttons { width: 100%; }
  .copy-button, .send-button { flex: 1; justify-content: center; }
  .invalid-link { align-items: flex-start; flex-direction: column; }
  .support-strip { align-items: flex-start; flex-direction: column; gap: 16px; }
  footer { gap: 10px; flex-direction: column; }
  .saved-link-reminder { right: 14px; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
