:root {
  --bg: #f4f6f8;
  --bg-elevated: #ffffff;
  --ink: #16191f;
  --ink-muted: #5c6570;
  --line: #d8dee6;
  --line-strong: #b7c0cc;
  --accent: #0b6e6e;
  --accent-hover: #095858;
  --accent-soft: #e6f3f3;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 25, 31, 0.04), 0 12px 32px rgba(22, 25, 31, 0.06);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #e8f2f2 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #edf0f5 0%, transparent 50%),
    var(--bg);
}

.page {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3.5rem;
}

.header {
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.tagline {
  margin: 0.65rem 0 0;
  max-width: 36rem;
  color: var(--ink-muted);
  font-size: 1.1rem;
}

.privacy {
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "original arrow processed"
    "options options options";
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

#original-panel {
  grid-area: original;
}

.flow-arrow {
  grid-area: arrow;
}

#options {
  grid-area: options;
}

#processed-panel {
  grid-area: processed;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 420px;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.arrow-line {
  width: 2px;
  height: 4.5rem;
  background: linear-gradient(to bottom, var(--line), var(--accent));
  position: relative;
}

.arrow-line::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--accent);
}

.dropzone {
  flex: 1;
  min-height: 260px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  overflow: hidden;
  position: relative;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.dropzone-idle {
  text-align: center;
  padding: 1.5rem;
}

.dropzone-icon {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 0.85rem;
  border: 2px solid var(--accent);
  border-radius: 10px;
  position: relative;
}

.dropzone-icon::before {
  content: "";
  position: absolute;
  inset: 10px 14px auto;
  height: 2px;
  background: var(--accent);
}

.dropzone-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 2px;
  height: 16px;
  background: var(--accent);
  transform: translateX(-50%);
}

.dropzone-title {
  margin: 0;
  font-weight: 600;
}

.dropzone-hint {
  margin: 0.35rem 0 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.preview-wrap {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #eef1f4 25%, transparent 25%),
    linear-gradient(-45deg, #eef1f4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef1f4 75%),
    linear-gradient(-45deg, transparent 75%, #eef1f4 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #fff;
}

.preview-wrap img {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  display: block;
}

.processed-empty {
  flex: 1;
  min-height: 260px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  background: #fafbfc;
  text-align: center;
  padding: 1.5rem;
}

.meta {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}

.meta > div {
  min-width: 0;
}

.meta dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.meta dd {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.options {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
}

.options h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 1.15rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.value-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.field-hint {
  color: var(--ink-muted);
  font-size: 0.82rem;
}

select,
input[type="number"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

select:focus-visible,
input[type="number"]:focus-visible,
input[type="range"]:focus-visible,
.btn:focus-visible,
.compare-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  border-radius: 11px;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 110, 110, 0.22);
}

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

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn-secondary:hover {
  background: #f3f5f7;
}

.btn-process {
  width: 100%;
  padding: 0.95rem 1.2rem;
  font-size: 1.08rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.compare {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.35rem;
  margin-bottom: 1.5rem;
}

.compare h2 {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.compare-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 480px;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  user-select: none;
  touch-action: none;
}

.compare-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.compare-before-clip {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
  border-right: 2px solid #fff;
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 28px;
  transform: translateX(-50%);
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.compare-knob {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.compare-label {
  position: absolute;
  bottom: 0.7rem;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
}

.compare-label-before {
  left: 0.7rem;
}

.compare-label-after {
  right: 0.7rem;
}

.footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.88rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer p {
  margin: 0;
}

.footer-credit {
  color: var(--ink);
  font-weight: 600;
}

.footer-coffee a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-coffee a:hover {
  color: var(--accent-hover);
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "original"
      "options"
      "arrow"
      "processed";
  }

  .flow-arrow {
    flex-direction: row;
    padding: 0.25rem 0;
  }

  .arrow-line {
    width: 3.5rem;
    height: 2px;
    background: linear-gradient(to right, var(--line), var(--accent));
  }

  .arrow-line::after {
    bottom: auto;
    left: auto;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: var(--accent);
  }

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

  .panel {
    min-height: 0;
  }

  .compare-frame {
    aspect-ratio: 4 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
