@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0c10;
  --card: #121319;
  --text: #e6e8ee;
  --muted: #9aa0aa;
  --accent: #00d4ff;
  --accent-hover: #00b8e6;
  --accent-2: #8aebff;
  --border: #2a2e3b;
  --shadow: rgba(0, 0, 0, 0.5);
  --success: #00ff9d;
  --danger: #ff4d4d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px;
}

.container.wide {
  max-width: 1400px;
}

header {
  margin-bottom: 32px;
  text-align: center;
}

header h1 {
  margin: 0;
  font-weight: 700;
  font-size: 2.5rem;
  background: linear-gradient(135deg, #fff 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 40px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.dropzone {
  width: 100%;
  min-height: 240px;
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--muted);
  font-weight: 500;
  font-size: 1.1rem;
}

.dropzone:hover,
.dropzone.hover {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.05);
  transform: translateY(-2px);
  color: var(--accent);
}

.dropzone input {
  display: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.primary,
.secondary,
.ghost {
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  background: var(--accent);
  color: #00161a;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 212, 255, 0.4);
}

.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--muted);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.ghost.subtle {
  font-size: 0.85rem;
  padding: 8px 16px;
}

footer {
  color: var(--muted);
  margin-top: 40px;
  text-align: center;
  font-size: 0.9rem;
}

/* Toolbar */
.toolbar {
  position: sticky;
  top: 20px;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(18, 19, 25, 0.85);
  margin-bottom: 24px;
  padding: 20px;
}

.toolbar .row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.toolbar .group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar select,
.toolbar input[type="number"] {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.toolbar select:focus,
.toolbar input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* Checkbox */
.checkbox-label {
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid #00161a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked+.slider {
  background-color: var(--accent);
}

.switch input:checked+.slider:before {
  transform: translateX(22px);
}

/* Workarea */
.workarea {
  display: grid;
  gap: 24px;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 10px 30px var(--shadow);
}

.panel h3 {
  margin: 0 0 16px;
  font-weight: 600;
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3::before {
  content: '';
  display: block;
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

.panel.two {
  display: flex;
  gap: 24px;
}

.subpanel {
  flex: 1;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.canvas-wrap img {
  max-width: 100%;
  display: block;
  opacity: 0.9;
  /* Slight dim to make crop lines pop */
}

.canvas-wrap canvas {
  position: absolute;
  inset: 0;
  inset: 0;
  cursor: crosshair;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}