* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(32, 91, 160, 0.15), transparent 28%),
    linear-gradient(180deg, #eef3f8, #f5f7fa 44%, #edf2f7);
  color: #18212b;
}

body.drag-active::before {
  content: "Drop image to load";
  position: fixed;
  inset: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed #00a779;
  border-radius: 24px;
  background: rgba(11, 33, 52, 0.72);
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
  z-index: 9999;
  pointer-events: none;
}

.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 22px 24px;
  background: linear-gradient(135deg, #18344d, #274e70 58%, #3d7ca6);
  border-radius: 20px;
  color: #fff;
  box-shadow: 0 18px 45px rgba(24, 52, 77, 0.22);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.76);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.02;
}

.hero-copy {
  margin: 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.5;
}

.hero-note {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.note-pill {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(197, 210, 223, 0.85);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(17, 42, 67, 0.08);
}

.upload,
button {
  border: 1px solid #1f405e;
  background: linear-gradient(180deg, #234a6f, #1a3a57);
  color: #fff;
  border-radius: 10px;
  padding: 11px 16px;
  min-height: 46px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.upload {
  min-width: 190px;
  justify-content: center;
  text-align: center;
}

.upload.drag-over {
  background: linear-gradient(180deg, #00a779, #007d5b);
  border-color: #007d5b;
}

.upload:hover,
button:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(26, 58, 87, 0.2);
}

.upload input {
  display: none;
}

button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  font-size: 14px;
  color: #28445c;
  font-weight: 600;
  margin-left: auto;
}

.mobile-switcher {
  display: none;
}

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

.panel {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid #dbe4ec;
  box-shadow: 0 14px 36px rgba(24, 33, 43, 0.08);
}

.panel.drop-target {
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.panel.drop-target.drag-over {
  border-color: #00a779;
  box-shadow: 0 18px 40px rgba(0, 167, 121, 0.18);
  transform: translateY(-1px);
}

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

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

.adjustment {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f5f8fb;
  border: 1px solid #dbe4ec;
  border-radius: 12px;
}

.adjustment span,
.adjustment strong {
  font-size: 13px;
  color: #28445c;
}

.adjustment strong {
  min-width: 42px;
  text-align: right;
}

.adjustment input[type="range"] {
  width: 100%;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

.hint {
  margin: 0;
  color: #617487;
  font-size: 13px;
  text-align: right;
}

.canvas-wrap {
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, #edf2f7 25%, transparent 25%, transparent 75%, #edf2f7 75%),
    linear-gradient(45deg, #edf2f7 25%, transparent 25%, transparent 75%, #edf2f7 75%),
    linear-gradient(180deg, #fafcff, #eef3f8);
  background-size: 22px 22px, 22px 22px, auto;
  background-position: 0 0, 11px 11px, 0 0;
  border: 1px solid #d5dde6;
  border-radius: 12px;
  overflow: auto;
}

canvas {
  max-width: 100%;
  display: block;
  touch-action: none;
}

.tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #dbe4ec;
  border-radius: 14px;
  color: #40576d;
  font-size: 14px;
}

.tip strong {
  color: #16334e;
}

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

  .hero {
    flex-direction: column;
    padding: 20px;
  }

  .hero-note {
    justify-content: flex-start;
  }

  .status {
    width: 100%;
    margin-left: 0;
  }

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

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

  .hint {
    text-align: left;
  }

  .canvas-wrap {
    min-height: 320px;
  }

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

@media (max-width: 640px) {
  .app {
    padding: 14px;
  }

  body.drag-active::before {
    inset: 10px;
    border-radius: 18px;
    font-size: 18px;
    padding: 18px;
    text-align: center;
  }

  .hero {
    margin-bottom: 14px;
    padding: 18px 16px;
    border-radius: 16px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .toolbar {
    position: sticky;
    top: 10px;
    z-index: 20;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
  }

  .upload,
  button {
    width: 100%;
    min-height: 50px;
    padding: 13px 14px;
    font-size: 15px;
  }

  .status {
    order: 10;
    font-size: 13px;
  }

  .mobile-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(197, 210, 223, 0.85);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(17, 42, 67, 0.08);
  }

  .switcher-button {
    width: 100%;
    min-height: 44px;
    border: 1px solid #c9d7e3;
    background: #eef4f9;
    color: #28445c;
    box-shadow: none;
  }

  .switcher-button.active {
    border-color: #1f405e;
    background: linear-gradient(180deg, #234a6f, #1a3a57);
    color: #fff;
  }

  .panel {
    padding: 12px;
    border-radius: 16px;
  }

  .panel-head {
    margin-bottom: 10px;
  }

  .panel h2 {
    font-size: 17px;
  }

  .adjustment {
    grid-template-columns: 58px 1fr 48px;
    padding: 10px;
  }

  .adjustment span,
  .adjustment strong {
    font-size: 12px;
  }

  .canvas-wrap {
    min-height: 240px;
    overflow: hidden;
  }

  canvas {
    width: 100%;
    height: auto;
  }

  .tip {
    padding: 12px 14px;
    font-size: 13px;
  }

  .workspace.mobile-show-original .panel-corrected,
  .workspace.mobile-show-corrected .panel-original {
    display: none;
  }
}
