:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-strong: #1b2128;
  --line: #2b333d;
  --line-strong: #42505d;
  --text: #edf2f4;
  --muted: #9aa7b2;
  --accent: #50e3a4;
  --accent-strong: #25c987;
  --warn: #f4bd50;
  --danger: #ff6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(80, 227, 164, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(244, 189, 80, 0.05), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
textarea,
input {
  font: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.08rem;
}

.header-copy,
.panel-title p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-pill {
  max-width: 48%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(20, 24, 29, 0.84);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(380px, 1.06fr);
  gap: 18px;
}

.input-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 24, 29, 0.94);
  box-shadow: var(--shadow);
}

.input-panel {
  display: flex;
  flex-direction: column;
  min-height: 710px;
  padding: 16px;
}

.panel-title {
  margin-bottom: 14px;
}

.drop-zone {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 330px;
  place-items: center;
  border: 1px dashed #4a5663;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    var(--panel-strong);
  background-size: 22px 22px;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.is-active {
  border-color: var(--accent);
  outline: none;
}

.drop-zone.is-dragover {
  border-color: var(--warn);
  background-color: #22282f;
  box-shadow: inset 0 0 0 1px rgba(244, 189, 80, 0.45);
}

.drop-zone.is-busy {
  cursor: progress;
}

#fileInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.empty-state {
  display: grid;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 1.35rem;
}

#previewImage {
  width: 100%;
  height: 100%;
  max-height: 56vh;
  object-fit: contain;
  background: #080a0c;
  transition: transform 160ms ease;
}

.notice {
  margin-top: 12px;
  border: 1px solid rgba(244, 189, 80, 0.46);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(244, 189, 80, 0.09);
  color: #ffd98b;
  line-height: 1.45;
}

.notice.is-error {
  border-color: rgba(255, 107, 107, 0.54);
  background: rgba(255, 107, 107, 0.09);
  color: #ffb3b3;
}

.controls {
  display: grid;
  gap: 14px;
  padding: 16px 0;
}

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

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #0d1115;
  color: var(--text);
}

.switch-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #0d1115;
  color: var(--text);
}

.button-grid {
  display: grid;
  gap: 10px;
}

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

.text-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #202730;
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  border-color: var(--accent);
  outline: none;
}

button.primary {
  border-color: transparent;
  background: var(--accent-strong);
  color: #06100b;
  font-weight: 700;
}

button.primary:disabled {
  border-color: var(--line);
  background: #202730;
}

button:disabled,
select:disabled,
input:disabled {
  color: #687581;
  cursor: not-allowed;
  opacity: 0.68;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #0d1115;
}

progress::-webkit-progress-bar {
  background: #0d1115;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--warn));
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--warn));
}

.result-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 710px;
  padding: 16px;
}

.result-title {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.result-actions {
  display: flex;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 540px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #090c0f;
  color: var(--text);
  line-height: 1.55;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
}

textarea::placeholder {
  color: #66727d;
}

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

  .input-panel,
  .result-panel {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding: 18px 0;
  }

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

  .status-pill {
    max-width: 100%;
  }

  .settings-grid,
  .main-actions,
  .text-actions {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 300px;
  }

  .result-title {
    grid-template-columns: 1fr;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 360px;
  }
}
