:root {
  --bg: #071521;
  --bg-alt: #0d1f2d;
  --panel: rgba(12, 24, 34, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --primary: #63d8ff;
  --primary-strong: #2bb2fc;
  --accent: #9ef7c8;
  --text: #edf7ff;
  --muted: #a7c0d2;
  --success: #87f5c7;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  --ring: rgba(99, 216, 255, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top, rgba(99, 216, 255, 0.22), transparent 24%),
    linear-gradient(135deg, #071521 0%, #0b1a27 38%, #0d2330 100%);
  color: var(--text);
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

.topbar {
  margin-bottom: 28px;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #071521;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.1;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(350px, 1fr);
  gap: 28px;
}

.panel {
  background: rgba(12, 24, 34, 0.74);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(16px);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.tag-pill,
.mini-stat {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tag-pill {
  background: rgba(99, 216, 255, 0.12);
  color: var(--primary);
}

.mini-stat {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.upload-box {
  border: 1.5px dashed rgba(158, 247, 200, 0.6);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(16, 36, 48, 0.88), rgba(13, 28, 39, 0.7));
  padding: 18px 16px;
  transition: border-color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-box.dragover {
  border-color: var(--primary);
  box-shadow: 0 0 0 5px var(--ring);
  transform: translateY(-1px);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  min-height: 110px;
}

.upload-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.7rem;
  background: rgba(99, 216, 255, 0.12);
  color: var(--primary);
}

.upload-label strong {
  font-size: 1.08rem;
}

.upload-label small {
  color: var(--muted);
}

#imageInput {
  display: none;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-group label,
.label-row {
  color: var(--muted);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

select,
input[type="number"],
input[type="range"] {
  width: 100%;
}

select,
input[type="number"] {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 20, 28, 0.85);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
}

input[type="range"] {
  accent-color: var(--primary-strong);
}

.resize-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.checkbox-row input {
  accent-color: var(--primary-strong);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  padding: 13px 18px;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #06131b;
  box-shadow: 0 18px 28px rgba(43, 178, 252, 0.25);
}

.secondary-btn {
  background: rgba(158, 247, 200, 0.08);
  border: 1px solid rgba(158, 247, 200, 0.2);
  color: var(--text);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.preview-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.status-badge.neutral {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.status-badge.success {
  color: var(--success);
  background: rgba(135, 245, 199, 0.09);
}

.compare-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compare-surface {
  position: relative;
  width: 100%;
  height: 420px;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(7, 21, 33, 0.92), rgba(13, 33, 42, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.compare-surface img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.after-layer {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
  border-right: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 12px 0 26px rgba(0, 0, 0, 0.15);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: #06131b;
  border-radius: 50%;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  font-size: 1.2rem;
  font-weight: 800;
  pointer-events: none;
}

#compareSlider {
  width: 100%;
  height: 34px;
  accent-color: var(--primary-strong);
}

.stats-box {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stats-box > div {
  border-radius: 14px;
  padding: 14px 12px;
  background: rgba(8, 21, 29, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.stats-box span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.76rem;
  color: var(--muted);
}

.stats-box strong {
  font-size: 0.93rem;
}

@media (max-width: 860px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .compare-surface {
    height: 300px;
  }
}
