:root {
  color-scheme: dark;
  --bg: #06070a;
  --panel: #10141c;
  --panel-strong: #151b27;
  --text: #eef4ff;
  --muted: #94a2b8;
  --blue: #43a6ff;
  --blue-strong: #1786ee;
  --error: #ff7a7a;
  --border: #273245;
  --focus: #78c2ff;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(67, 166, 255, 0.18), transparent 32rem),
    linear-gradient(180deg, #090d14 0%, var(--bg) 52%, #050608 100%);
  color: var(--text);
}

.site-banner {
  border-bottom: 1px solid rgba(67, 166, 255, 0.22);
  background: rgba(6, 7, 10, 0.88);
  box-shadow: 0 14px 40px var(--shadow);
}

.site-banner h1 {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  color: var(--blue);
  font-size: clamp(1.55rem, 2.4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.app-shell {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 7vh, 5rem) 0 max(2rem, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  gap: 1rem;
  align-items: stretch;
}

.input-panel,
.output-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(16, 20, 28, 0.88);
  box-shadow: 0 20px 52px var(--shadow);
}

.input-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem;
}

.input-panel label,
.output-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 18rem;
  resize: vertical;
  border: 1px solid #334158;
  border-radius: 8px;
  padding: 1rem;
  background: #080b10;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
  outline: none;
}

textarea::placeholder {
  color: #687792;
}

textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(120, 194, 255, 0.18);
}

.self-destruct-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid rgba(120, 194, 255, 0.18);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.72);
}

.checkbox-label {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  text-transform: none;
}

.checkbox-label input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--blue);
  flex: 0 0 auto;
}

.self-destruct-options {
  display: grid;
  gap: 0.45rem;
}

.self-destruct-options[hidden] {
  display: none;
}

.self-destruct-options select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #334158;
  border-radius: 8px;
  padding: 0 0.8rem;
  background: #080b10;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.self-destruct-options select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(120, 194, 255, 0.18);
  outline: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

button {
  min-height: 2.75rem;
  border: 1px solid rgba(120, 194, 255, 0.34);
  border-radius: 8px;
  padding: 0 1.2rem;
  background: var(--blue);
  color: #03111f;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

button:hover {
  background: #68b8ff;
}

.secondary-button {
  background: #d8e6f6;
  color: #10141c;
}

.secondary-button:hover {
  background: #f3f8ff;
}

button:focus-visible {
  outline: 3px solid rgba(120, 194, 255, 0.34);
  outline-offset: 2px;
}

.output-panel {
  display: flex;
  min-height: 18rem;
  padding: 1rem;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(21, 27, 39, 0.96), rgba(12, 15, 22, 0.96));
}

.output-text {
  flex: 1;
  min-height: 12rem;
  margin: 0;
  border: 1px solid rgba(67, 166, 255, 0.22);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(67, 166, 255, 0.07);
  color: var(--blue);
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: pre-wrap;
}

.output-text[data-empty="true"] {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  text-align: center;
}

.output-text[data-state="encoded"],
.output-text[data-state="decoded"] {
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 700;
}

.output-text[data-state="error"] {
  color: var(--error);
  border-color: rgba(255, 122, 122, 0.4);
  background: rgba(255, 122, 122, 0.08);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

.self-destruct-status {
  min-height: 1.4rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 1rem, 980px);
    padding: max(1rem, env(safe-area-inset-top)) 0 max(1.5rem, env(safe-area-inset-bottom));
  }

  textarea,
  .output-panel {
    min-height: 14rem;
  }

  textarea {
    max-height: 40svh;
  }

  .output-text {
    min-height: 10rem;
  }

  button {
    width: 100%;
    min-height: 3rem;
  }

  .site-banner h1 {
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-left: max(1rem, env(safe-area-inset-left));
  }
}
