:root {
  --bg: #f6f8ff;
  --surface: #ffffff;
  --surface-2: #f0f3ff;
  --text: #1d2340;
  --muted: #5b648a;
  --primary: #0b7a75;
  --primary-strong: #085d59;
  --accent: #f28f3b;
  --border: #d7dcf0;
  --ok: #1f8f4a;
  --danger: #c0392b;
  --shadow: 0 10px 30px rgba(29, 35, 64, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 90% -10%, #dbe8ff 0%, transparent 50%),
    radial-gradient(900px 600px at -20% 10%, #d7fff2 0%, transparent 45%),
    var(--bg);
  padding: 16px;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.35;
}

.bg-shape-a {
  width: 260px;
  height: 260px;
  background: #7ad3ff;
  top: -80px;
  right: -70px;
}

.bg-shape-b {
  width: 220px;
  height: 220px;
  background: #8dffbf;
  bottom: -60px;
  left: -50px;
}

.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  animation: rise 420ms ease;
}

@keyframes rise {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.hero {
  padding: 8px 4px;
}

.badge {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #d9fff6;
  color: #065953;
  font-weight: 700;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  line-height: 1.15;
  font-size: clamp(1.4rem, 5vw, 2rem);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.home-ribbon {
  position: fixed;
  top: 18px;
  right: 0;
  width: 52px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  text-decoration: none;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 8px 20px rgba(29, 35, 64, 0.22);
  z-index: 1000;
}

.home-ribbon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.home-ribbon:hover {
  filter: brightness(1.08);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.file-zone {
  border: 2px dashed #9cb4f0;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.file-zone:hover,
.file-zone:focus-visible,
.file-zone.is-dragging {
  border-color: var(--primary);
  background: #e8fff7;
  outline: none;
}

.file-title {
  margin: 0;
  font-weight: 700;
}

.file-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toolbar-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr 1fr;
}

.config-item {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.config-item input,
.config-item select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.config-check {
  align-content: end;
}

.config-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 10px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: 46px;
  transition: transform 130ms ease, background 130ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.92;
  cursor: wait;
}

.btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 999px;
  display: inline-block;
  animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.app-alert-host {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.app-alert {
  min-width: 260px;
  max-width: min(92vw, 520px);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  font-size: 0.9rem;
  line-height: 1.35;
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-alert.show {
  opacity: 1;
  transform: translateY(0);
}

.app-alert-success {
  border-left-color: var(--ok);
}

.app-alert-error {
  border-left-color: var(--danger);
}

.app-alert-info {
  border-left-color: var(--accent);
}

.editors {
  display: grid;
  gap: 12px;
}

.editor {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 300px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.editor-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.head-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 8px;
  cursor: pointer;
}

.editor h2 {
  margin: 0;
  font-size: 1rem;
}

.editor-head span {
  font-size: 0.86rem;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 260px;
  border: 0;
  resize: vertical;
  border-radius: 0 0 16px 16px;
  padding: 12px;
  font: 500 0.9rem/1.5 "JetBrains Mono", monospace;
  color: #121528;
  background: #fbfcff;
}

textarea:focus {
  outline: 2px solid #acd8ff;
  outline-offset: -2px;
}

.terminal {
  width: 100%;
  overflow: hidden;
}

.terminal-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.terminal-head h2 {
  margin: 0;
  font-size: 1rem;
}

.terminal-body {
  margin: 0;
  min-height: 220px;
  max-height: 460px;
  overflow: auto;
  padding: 12px;
  border-radius: 0 0 16px 16px;
  background: #101521;
  color: #bcf5da;
  font: 500 0.86rem/1.45 "JetBrains Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.obf-footer {
  margin-top: 4px;
  padding: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f7ff 100%);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}

.obf-footer-grid {
  display: grid;
  gap: 14px;
}

.obf-footer h3,
.obf-footer h4 {
  margin: 0 0 8px;
  color: #03a7d3;
}

.obf-footer p {
  margin: 0;
  color: var(--muted);
}

.obf-footer-links {
  display: grid;
  gap: 6px;
}

.obf-footer a {
  color: var(--text);
  text-decoration: none;
}

.obf-footer a:hover {
  color: #03a7d3;
}

.obf-footer-copy {
  margin-top: 14px !important;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}

@media (max-width: 700px) {
  .home-ribbon {
    top: 12px;
    width: 48px;
    height: 40px;
  }

}

@media (min-width: 760px) {
  .obf-footer {
    display: none;
  }

  .obf-footer {
    margin-top: auto;
  }

  .obf-footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
    align-items: start;
  }
}


@media (min-width: 900px) {
  body {
    padding: 24px;
  }

  .toolbar {
    grid-template-columns: 1.2fr 1fr;
    align-items: start;
  }

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

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