:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #687385;
  --line: #dde3ee;
  --accent: #0f8b8d;
  --accent-dark: #0a6f73;
  --danger: #b42318;
  --shadow: 0 20px 60px rgba(22, 32, 52, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.12), rgba(245, 247, 251, 0) 320px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.header {
  grid-column: 1 / -1;
  padding: 12px 0 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.subtitle {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.upload-panel {
  min-height: 430px;
  padding: 18px;
}

.drop-zone {
  display: grid;
  min-height: 392px;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px dashed #aeb9c9;
  border-radius: 8px;
  background: #f9fbfe;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: #eefafa;
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 20px;
}

.controls-panel,
.status-panel {
  padding: 18px;
}

.controls-panel {
  grid-column: 2;
  grid-row: 2;
}

.status-panel {
  grid-column: 2;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: 19px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.mode,
.scale-grid button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.mode:disabled {
  color: #a5afbf;
  cursor: not-allowed;
}

.mode.active,
.scale-grid button.selected {
  border-color: var(--accent);
  background: #e9fbfb;
  color: var(--accent-dark);
  font-weight: 700;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.custom-scale {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.custom-scale input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
}

.primary,
.download {
  display: inline-flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary:hover,
.download:hover {
  background: var(--accent-dark);
}

.primary:disabled {
  background: #b8c6d6;
  cursor: not-allowed;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.message {
  min-height: 48px;
  margin: 14px 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.message.error {
  color: var(--danger);
}

@media (max-width: 880px) {
  .app {
    width: min(100% - 24px, 640px);
    padding: 24px 0;
  }

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

  .controls-panel,
  .status-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .upload-panel {
    min-height: auto;
  }

  .drop-zone {
    min-height: 260px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 38px;
  }

  .subtitle {
    font-size: 16px;
  }

  .mode-row {
    grid-template-columns: 1fr;
  }

  .scale-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

