:root {
  --bg: #040915;
  --panel: rgba(8, 14, 31, 0.78);
  --border: rgba(45, 212, 191, 0.18);
  --text: #f3f7ff;
  --muted: rgba(221, 233, 255, 0.66);
  --cyan: #2dd4bf;
  --cyan-soft: rgba(45, 212, 191, 0.12);
  --lime: #a3e635;
  --lime-soft: rgba(163, 230, 53, 0.12);
  --shadow: 0 30px 80px rgba(1, 6, 18, 0.56);
  --mono: "Orbitron", sans-serif;
  --body: "Manrope", sans-serif;
}

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

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

body {
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.12), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(163, 230, 53, 0.1), transparent 28%),
    linear-gradient(180deg, #040915 0%, #02050d 100%);
  color: var(--text);
  font-family: var(--body);
  overflow-x: hidden;
}

.page-noise,
.page-grid,
.page-orb {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.page-noise {
  opacity: 0.16;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.3) 0 0.7px, transparent 0.9px),
    radial-gradient(circle at 80% 40%, rgba(255, 255, 255, 0.18) 0 0.8px, transparent 1px);
  background-size: 16px 16px, 24px 24px;
  mix-blend-mode: soft-light;
}

.page-grid {
  background-image:
    linear-gradient(rgba(45, 212, 191, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.82), transparent 85%);
}

.page-orb {
  filter: blur(96px);
  opacity: 0.5;
}

.page-orb--cyan {
  inset: auto auto 10% -6%;
  width: 34rem;
  height: 34rem;
  background: rgba(45, 212, 191, 0.22);
}

.page-orb--lime {
  inset: 4% -6% auto auto;
  width: 24rem;
  height: 24rem;
  background: rgba(163, 230, 53, 0.18);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

.app-header,
.hero-panel,
.panel,
.footer-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12, 19, 40, 0.88) 0%, rgba(7, 12, 28, 0.8) 100%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border-radius: 24px;
  margin-bottom: 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(163, 230, 53, 0.12)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(45, 212, 191, 0.24);
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 40px rgba(45, 212, 191, 0.1);
}

.brand-icon svg {
  width: 28px;
  height: 28px;
}

.brand-kicker,
.panel-eyebrow,
.hero-eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--cyan);
}

.brand-name {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.back-link:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 212, 191, 0.28);
  background: rgba(45, 212, 191, 0.08);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.hero-panel {
  border-radius: 32px;
  padding: 36px;
  margin-bottom: 22px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.6), transparent);
}

.hero-copy {
  max-width: 760px;
}

.hero-title {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-title span {
  display: block;
}

.accent-word {
  color: var(--lime);
  text-shadow: 0 0 28px rgba(163, 230, 53, 0.24);
}

.hero-description {
  margin: 18px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #d8fff7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 1fr);
  gap: 22px;
}

.panel {
  border-radius: 28px;
  padding: 28px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.panel-header h2,
.footer-panel h2 {
  margin: 0;
  font-size: 1.5rem;
}

.control-block + .control-block,
.signal-meta,
.action-row,
.toggle-row {
  margin-top: 24px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.label-row label,
.label-row span:first-child {
  color: var(--text);
  font-weight: 700;
}

textarea {
  width: 100%;
}

#source-text,
#result-text {
  resize: vertical;
  min-height: 230px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(3, 7, 18, 0.68);
  color: var(--text);
  font: inherit;
  line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#source-text:focus,
#result-text:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.34);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

#source-text::placeholder {
  color: rgba(218, 232, 255, 0.38);
}

#result-text {
  min-height: 320px;
  background: linear-gradient(180deg, rgba(4, 9, 20, 0.96), rgba(8, 14, 30, 0.94));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.chip-grid,
.example-grid,
.preview-meta,
.signal-meta,
.action-row,
.delimiter-row {
  display: grid;
  gap: 12px;
}

.chip-grid--two,
.example-grid,
.delimiter-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-chip,
.example-chip,
.action-btn,
.delimiter-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.mode-chip,
.example-chip,
.delimiter-chip {
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.mode-chip:hover,
.example-chip:hover,
.delimiter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 212, 191, 0.28);
  background: rgba(45, 212, 191, 0.08);
}

.mode-chip strong {
  display: block;
  margin-bottom: 6px;
}

.mode-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.mode-chip.is-active,
.delimiter-chip.is-active {
  border-color: rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.12);
  box-shadow: 0 16px 30px rgba(18, 105, 96, 0.14);
}

.panel-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.toggle-row span:first-child {
  font-weight: 700;
  color: var(--text);
}

.toggle-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 100px;
  min-height: 42px;
  padding: 0 14px 0 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
}

.toggle-pill__track {
  position: absolute;
  left: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: transform 0.22s ease, background 0.22s ease;
}

.toggle-pill__label {
  font-size: 0.92rem;
  font-weight: 700;
}

.toggle-pill.is-active .toggle-pill__track {
  transform: translateX(16px);
  background: linear-gradient(135deg, var(--cyan), var(--lime));
}

.signal-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-item,
.meta-card {
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.meta-item span,
.meta-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.meta-item strong,
.meta-card strong {
  display: block;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.action-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-btn {
  min-height: 56px;
  border-radius: 18px;
  padding: 0 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
}

.action-btn--primary {
  border-color: rgba(45, 212, 191, 0.34);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.28), rgba(163, 230, 53, 0.14));
  box-shadow: 0 20px 36px rgba(12, 95, 87, 0.18);
}

.preview-stage {
  padding: 20px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(4, 9, 20, 0.9), rgba(8, 14, 30, 0.92));
}

.preview-empty {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon {
  width: 82px;
  height: 82px;
  margin: 0 auto 18px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.16);
}

.empty-icon svg {
  width: 40px;
  height: 40px;
}

.preview-empty h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.preview-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.result-header {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.meta-card--wide {
  grid-column: 1 / -1;
}

.error-message {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  color: #ffd8e2;
  background: rgba(255, 124, 161, 0.08);
  border: 1px solid rgba(255, 124, 161, 0.16);
  line-height: 1.6;
}

.footer-panel {
  border-radius: 28px;
  padding: 30px 32px;
  margin-top: 22px;
}

.footer-copy {
  max-width: 760px;
}

.footer-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 20px 16px 56px;
  }

  .app-header,
  .hero-panel,
  .panel,
  .footer-panel {
    border-radius: 24px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chip-grid--two,
  .delimiter-row,
  .example-grid,
  .signal-meta,
  .preview-meta,
  .action-row {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding: 28px 24px;
  }

  .panel,
  .footer-panel {
    padding: 24px;
  }
}
