:root {
  --bg: #040814;
  --panel: rgba(9, 14, 31, 0.78);
  --border: rgba(129, 140, 248, 0.18);
  --text: #f5f7ff;
  --muted: rgba(219, 229, 255, 0.7);
  --muted-soft: rgba(219, 229, 255, 0.46);
  --violet: #818cf8;
  --violet-soft: rgba(129, 140, 248, 0.12);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 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 {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top left, rgba(129, 140, 248, 0.14), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(34, 211, 238, 0.1), transparent 26%),
    linear-gradient(180deg, #040814 0%, #02050d 100%);
  color: var(--text);
  font-family: var(--body);
  overflow-x: hidden;
}

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

.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(129, 140, 248, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 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.55;
}

.page-orb--violet {
  inset: auto auto 10% -6%;
  width: 34rem;
  height: 34rem;
  background: rgba(129, 140, 248, 0.22);
}

.page-orb--cyan {
  inset: 4% -6% auto auto;
  width: 24rem;
  height: 24rem;
  background: rgba(34, 211, 238, 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(129, 140, 248, 0.18), rgba(34, 211, 238, 0.12)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(129, 140, 248, 0.24);
  color: var(--violet);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 40px rgba(129, 140, 248, 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(--violet);
}

.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(129, 140, 248, 0.32);
  background: rgba(129, 140, 248, 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(129, 140, 248, 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(--cyan);
  text-shadow: 0 0 28px rgba(34, 211, 238, 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(129, 140, 248, 0.18);
  background: rgba(129, 140, 248, 0.08);
  color: #e0e7ff;
  font-size: 0.875rem;
  font-weight: 700;
}

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

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

.panel-header {
  margin-bottom: 22px;
}

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

.control-block + .control-block,
.signal-meta,
.action-row,
.preview-card,
.preview-meta,
.notes-list {
  margin-top: 20px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.label-row label,
.label-row span {
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 700;
}

.label-row > span:last-child {
  color: var(--muted-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mode-chip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  min-height: 82px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.mode-chip strong {
  font-size: 0.92rem;
}

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

.mode-chip.is-active,
.mode-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.36);
  background: rgba(129, 140, 248, 0.1);
}

textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 18px 18px 16px;
  font: 500 0.94rem/1.7 "Manrope", sans-serif;
  resize: vertical;
  min-height: 210px;
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

textarea:focus {
  border-color: rgba(129, 140, 248, 0.36);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12);
}

textarea::placeholder {
  color: var(--muted-soft);
}

.example-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.example-chip {
  padding: 10px 12px;
  border: 1px solid rgba(129, 140, 248, 0.18);
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.08);
  color: #dbe4ff;
  font: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.example-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.32);
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 210px;
  padding: 22px;
  border-radius: 22px;
  border: 1px dashed rgba(129, 140, 248, 0.3);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.44);
  background: rgba(129, 140, 248, 0.08);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(34, 211, 238, 0.12));
  color: var(--violet);
}

.drop-icon svg {
  width: 30px;
  height: 30px;
}

.drop-zone strong {
  font-size: 1rem;
}

.drop-zone p,
.file-meta-card__hint,
.preview-empty p,
.notes-list li,
.footer-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.file-meta-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.file-meta-card__eyebrow {
  margin: 0 0 8px;
  color: var(--muted-soft);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.file-meta-card__name {
  margin: 0 0 8px;
  font-weight: 700;
  word-break: break-word;
}

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

.meta-item,
.meta-card,
.preview-card,
.notes-list {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.meta-item,
.meta-card {
  padding: 14px 16px;
}

.meta-item span,
.meta-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-item strong,
.meta-card strong {
  display: block;
  line-height: 1.45;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.action-btn {
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.34);
}

.action-btn--primary {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.18), rgba(34, 211, 238, 0.14));
  border-color: rgba(129, 140, 248, 0.28);
}

.preview-stage,
.preview-card__body {
  display: grid;
  place-items: center;
  min-height: 280px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

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

.empty-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.16), rgba(34, 211, 238, 0.12));
  color: var(--violet);
}

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

.preview-empty h3,
.notes-list h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.result-shell {
  width: 100%;
  height: 100%;
  padding: 16px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.result-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.12);
  color: #dbe4ff;
  font-size: 0.76rem;
}

#result-text {
  min-height: 220px;
  height: calc(100% - 40px);
  background: rgba(4, 8, 20, 0.56);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.preview-card {
  overflow: hidden;
}

.preview-card__head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted-soft);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.preview-card__body {
  min-height: 220px;
  padding: 16px;
}

#preview-image {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 14px;
}

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

.error-message {
  margin: 18px 0 0;
  color: #fda4af;
  line-height: 1.7;
}

.notes-list {
  padding: 20px 22px;
}

.notes-list ul {
  margin: 0;
  padding-left: 18px;
}

.notes-list li + li {
  margin-top: 8px;
}

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

.footer-copy p {
  margin-top: 10px;
}

.base64-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(129, 140, 248, 0.22);
  background: rgba(7, 12, 28, 0.95);
  color: var(--text);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  font: 600 14px var(--body);
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.base64-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@media (max-width: 720px) {
  .app-shell {
    padding: 18px 12px 48px;
  }

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

  .hero-panel,
  .panel,
  .footer-panel {
    border-radius: 22px;
    padding: 22px;
  }

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