:root {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: rgba(17, 24, 39, 0.9);
  --panel-2: rgba(15, 23, 42, 0.94);
  --line: rgba(255, 255, 255, 0.2);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --shadow: 0 26px 80px rgba(2, 6, 23, 0.5);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0 !important;
  overflow: auto !important;
  background:
    radial-gradient(circle at 12% 12%, rgba(56, 189, 248, 0.16), transparent 34rem),
    radial-gradient(circle at 88% 88%, rgba(34, 197, 94, 0.13), transparent 30rem),
    var(--bg) !important;
  color: var(--text) !important;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif !important;
}

.app-frame,
#app {
  width: min(1040px, calc(100vw - 36px));
  margin-inline: auto;
}

.app-frame {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(18px);
}

.eyebrow {
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-frame h1,
.app-frame p {
  margin: 0;
}

.app-frame h1 {
  color: var(--text);
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.92;
}

.app-frame p {
  color: var(--muted);
}

#app {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

#app > #app {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.container {
  width: 100% !important;
  display: grid !important;
  gap: 14px;
  margin: 0 !important;
  padding: 16px !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.24) !important;
  box-shadow: none !important;
}

.container.info {
  color: var(--muted) !important;
  line-height: 1.55;
  text-align: center;
}

.buttons {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: center;
}

.row {
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  display: grid !important;
  justify-items: center;
  gap: 12px;
}

.container .row {
  overflow: hidden;
}

.container .row:has(progress),
.container .row:has(.log) {
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
}

.container .row:has(progress) > *,
.container .row:has(.log) > * {
  justify-self: center;
}

.container .row:has(.log) .log {
  justify-self: stretch;
}

button.primary,
select.primary {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(34, 197, 94, 0.5) !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(14, 165, 233, 0.9)) !important;
  color: #03131a !important;
  cursor: pointer;
  font-weight: 900;
  text-transform: none !important;
}

select.primary {
  appearance: auto;
  background: var(--panel-2) !important;
  color: var(--text) !important;
  padding: 0 12px;
}

select.primary option {
  background: #111827;
  color: var(--text);
}

.disabled,
button.primary.disabled {
  cursor: not-allowed !important;
  filter: grayscale(1);
  opacity: 0.55 !important;
}

input[type="file"] {
  display: none !important;
}

#text-img {
  width: min(680px, 100%) !important;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020617;
  object-fit: contain;
}

#text-img.loading {
  opacity: 0.55;
  filter: grayscale(0.4);
}

progress {
  position: static !important;
  left: auto !important;
  width: min(620px, 100%) !important;
  max-width: 100%;
  height: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.45);
}

progress::-webkit-progress-bar {
  background: rgba(2, 6, 23, 0.45);
}

progress::-webkit-progress-value {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(14, 165, 233, 0.9));
}

.log {
  position: static !important;
  left: auto !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto !important;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--muted);
  padding: 10px;
  scrollbar-color: rgba(56, 189, 248, 0.72) rgba(15, 23, 42, 0.7);
  scrollbar-width: thin;
}

.log-item-text {
  max-width: 100%;
  color: var(--muted) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.result {
  align-content: start;
}

.result .row > div {
  width: 100%;
  min-height: 160px;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  padding: 14px;
  line-height: 1.55;
  text-align: left;
}

@media (max-width: 720px) {
  .app-frame,
  #app {
    width: calc(100vw - 20px);
  }

  #app,
  .app-frame {
    padding: 16px;
  }
}
