:root {
  --bg: #05070f;
  --panel: #0d1524;
  --panel-2: #0c1527;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #f7a556;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(53, 121, 255, 0.08), transparent 24%),
    radial-gradient(circle at 80% 10%, rgba(34, 211, 238, 0.12), transparent 25%),
    linear-gradient(145deg, #060912 0%, #06070f 40%, #05060d 100%);
  color: var(--text);
  min-height: 100vh;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 18px 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  padding: 24px;
  margin-bottom: 24px;
  background: linear-gradient(120deg, #0f1b30 0%, #0c1323 55%, #0a1020 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
}

.hero-copy h1 {
  margin: 10px 0 8px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.hero-copy p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.hero-note {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}

.hero-note h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.hero-note ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 18px;
}

.layout-grid>* {
  min-width: 0;
}

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h2 {
  margin: 2px 0 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 2px;
}

.label {
  margin: 0;
  font-weight: 600;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
}

.pill.subtle {
  color: #0a0d16;
  background: var(--accent);
  border: none;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(34, 211, 238, 0.35);
}

.chip.status {
  border-color: rgba(34, 211, 238, 0.4);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.25), transparent);
}

.chip.status.ready {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.45), rgba(34, 211, 238, 0.18));
  border-color: rgba(34, 197, 94, 0.6);
  color: #d1fae5;
}

.chip.status.error {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.4), rgba(244, 63, 94, 0.15));
  border-color: rgba(244, 63, 94, 0.5);
  color: #ffe4e6;
}

.upload-area {
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
}

.upload-card {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.upload-card:hover {
  border-color: rgba(34, 211, 238, 0.45);
  transform: translateY(-1px);
}

.upload-card input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.sample-row {
  display: grid;
  gap: 8px;
}

.sample-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.sample-button:hover {
  border-color: rgba(34, 211, 238, 0.5);
  transform: translateY(-1px);
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
}

.control {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 8px;
}

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

input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b1020;
  box-shadow: 0 10px 30px rgba(34, 211, 238, 0.25);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b1020;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ghost-button,
.primary-button {
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.primary-button {
  background: linear-gradient(90deg, var(--accent) 0%, #60e1ff 100%);
  color: #04111f;
  border: none;
  box-shadow: 0 14px 30px rgba(34, 211, 238, 0.35);
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.canvas-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.08), transparent 40%),
    radial-gradient(circle at 70% 30%, rgba(247, 165, 86, 0.08), transparent 35%),
    #0b1020;
  padding: 14px;
  min-height: 360px;
  overflow: hidden;
}

#image-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.85), rgba(5, 7, 15, 0.92));
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.results {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.prediction {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.prediction-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #dce6f5;
  word-break: break-word;
}

.bar {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #6ee7ff);
}

.caption {
  color: var(--muted);
}

.floating-crop-btn {
  position: absolute;
  z-index: 20;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.floating-crop-btn:hover {
  transform: translateX(-50%) scale(1.05);
}

.checkbox-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Inherit padding from .control */
  cursor: pointer;
}

.checkbox-control label {
  font-size: 14px;
  font-weight: 600;
  /* Match other labels */
  color: var(--text);
  /* Match other labels */
  cursor: pointer;
}

/* Toggle Switch Design */
.checkbox-control input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  outline: none;
}

.checkbox-control input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

.checkbox-control input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.crop-overlay {
  position: absolute;
  border: 1px dashed rgba(34, 211, 238, 0.85);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 0 24px rgba(34, 211, 238, 0.15);
  pointer-events: none;
  display: none;
}

@media (max-width: 1024px) {

  .hero,
  .layout-grid {
    grid-template-columns: 1fr;
  }

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

  .action-row {
    flex-wrap: wrap;
  }
}