.scanner-main {
  padding-bottom: 72px;
}

.scanner-hero {
  padding: 58px 0 26px;
}

.scanner-hero h1 {
  margin: 14px 0 12px;
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 61px);
  letter-spacing: -2.8px;
  line-height: 1.04;
}

.scanner-hero h1 span {
  color: var(--green);
}

.scanner-hero > p:last-child {
  max-width: 580px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.scanner-privacy {
  margin: 0 0 24px;
  padding: 15px 18px;
  border: 1px solid #dfe9df;
  border-radius: 10px;
  background: #edf4ed;
  color: #4f6854;
  font-size: 12px;
  line-height: 1.7;
}

.scanner-panel {
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}

.scanner-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.scanner-heading h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 25px;
  letter-spacing: -0.7px;
}

.scanner-heading > p {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.camera-frame {
  position: relative;
  display: grid;
  min-height: 220px;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #18221e;
}

.camera-frame video {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-placeholder {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 12px;
  color: #d3ddd6;
  font-size: 12px;
  text-align: center;
}

.camera-placeholder[hidden] {
  display: none;
}

.camera-placeholder-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid #52645a;
  border-radius: 15px;
  color: #e4eee6;
}

.camera-placeholder-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.camera-guide {
  position: absolute;
  inset: 9% 17%;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 4px;
  pointer-events: none;
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
}

.scanner-actions .primary-button {
  min-height: 40px;
  padding: 0 15px;
  cursor: pointer;
}

.scanner-actions .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.scanner-actions .secondary-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #59665e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.scanner-actions .secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #c8d8ca;
  background: #f7faf7;
}

.scanner-actions .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.scanner-actions .secondary-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.scanner-actions :focus-visible,
.scan-page-remove:focus-visible {
  outline: 3px solid #9dbba2;
  outline-offset: 3px;
}

.scanner-hint,
.scanner-disclaimer {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.scanner-hint {
  margin: 11px 0 0;
}

.scanner-panel .conversion-status {
  margin-top: 10px;
}

.scan-pages {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pages-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pages-heading h3 {
  margin: 0;
  font-size: 13px;
}

.pages-heading h3 span {
  color: var(--muted);
  font-weight: 500;
}

.pages-heading .secondary-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-color: #ead9d5;
  border-radius: 8px;
  background: #fff8f6;
  color: #875246;
  cursor: pointer;
  font-size: 11px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.pages-heading .secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #dbbcb5;
  background: #fff1ed;
}

.pages-heading .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.clear-pages-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.scan-page-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.scan-page-card {
  position: relative;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbf9;
}

.scan-page-card img {
  display: block;
  width: 100%;
  height: 145px;
  object-fit: contain;
  border-radius: 5px;
  background: #fff;
}

.scan-page-card p {
  margin: 8px 24px 2px 2px;
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-page-remove {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #79564e;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.scanner-export {
  margin-top: 20px;
}

.scanner-disclaimer {
  margin: 17px 0 0;
}

.scanner-main .download-result {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0;
  padding: 0 17px;
  border-radius: 8px;
  background: var(--green);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.scanner-main .download-result:hover {
  transform: translateY(-1px);
  background: var(--green-dark);
  box-shadow: 0 6px 14px rgba(35, 85, 64, 0.16);
}

.scanner-main .download-result svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.scanner-main .download-result:focus-visible,
.clear-pages-button:focus-visible {
  outline: 3px solid #9dbba2;
  outline-offset: 3px;
}

.scanner-main .download-result[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .scanner-hero {
    padding-top: 42px;
  }

  .scanner-hero h1 {
    letter-spacing: -2px;
  }

  .scanner-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .camera-frame {
    min-height: 190px;
    aspect-ratio: 4 / 3;
  }

  .camera-guide {
    inset-inline: 9%;
  }

  .scanner-actions {
    align-items: stretch;
  }

  .scanner-actions .primary-button,
  .scanner-actions .secondary-button {
    flex: 1 1 42%;
  }

  .scan-page-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
