:root {
  --room: #d5dde6;
  --ink: #12151a;
  --muted: #4b5560;
  --housing: #1a1e24;
  --housing_edge: #2c323b;
  --lid_scale: #8b96a3;
  --glass: #8fa6b6;
  --led: #d7f3ff;
  --led_glow: #7ec8e3;
  --paper: #ffffff;
  --focus: #5ec8e8;
  --error: #f3c7bc;
  --error_ink: #3a1510;
  --panel_ink: #e8eef4;
  --panel_muted: #9aa6b3;
  --scan: #3aa0c8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(ellipse at top, #e7eef5 0%, var(--room) 55%),
    var(--room);
  color: var(--ink);
  font-family: "Trebuchet MS", "Century Gothic", Verdana, sans-serif;
  line-height: 1.45;
}

.room {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.1rem 4rem;
}

.site_header {
  margin-bottom: 1.4rem;
}

.kicker {
  margin: 0 0 0.55rem;
  font-family: "Lucida Console", Consolas, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.lede {
  max-width: 38rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.status_message {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #8a3a2c;
  background: var(--error);
  color: var(--error_ink);
}

[hidden] {
  display: none !important;
}

.visually_hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.file_input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.scanner {
  background: var(--housing);
  color: var(--panel_ink);
  border: 1px solid #0d1014;
  box-shadow:
    0 18px 40px rgba(18, 21, 26, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 0.7rem 0.7rem 0.85rem;
}

.lid_hinge {
  display: flex;
  justify-content: space-evenly;
  padding: 0.15rem 2rem 0.45rem;
}

.lid_hinge span {
  width: 2.4rem;
  height: 0.55rem;
  background: #0f1216;
  border-radius: 0 0 4px 4px;
  box-shadow: inset 0 -1px 0 #3a414b;
}

.led_bar {
  height: 0.55rem;
  margin: 0 0.35rem 0.55rem 3.1rem;
  background: repeating-linear-gradient(
    90deg,
    var(--led) 0 0.42rem,
    #1a1e24 0.42rem 0.72rem
  );
  opacity: 0.4;
  box-shadow: 0 0 6px rgba(126, 200, 227, 0.25);
}

.scanner.is_lit .led_bar,
.scanner.is_dragging .led_bar {
  opacity: 1;
  box-shadow: 0 0 14px var(--led_glow);
}

.bed {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) 280px;
  gap: 0.55rem;
  align-items: stretch;
}

.lid_scale {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--lid_scale);
  font-family: "Lucida Console", Consolas, Menlo, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-align: right;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 11px,
      #3a424c 11px,
      #3a424c 12px
    );
}

.lid_scale li {
  padding-right: 0.35rem;
  background: var(--housing);
}

.platen {
  min-height: 24rem;
  cursor: pointer;
}

.glass {
  position: relative;
  min-height: 24rem;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(215, 243, 255, 0.28), rgba(255, 255, 255, 0.08) 22%, rgba(12, 22, 32, 0.18)),
    var(--glass);
  box-shadow:
    inset 0 0 48px rgba(10, 18, 28, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  border: 2px solid #3d454e;
}

.scanner.is_dragging .glass {
  background-color: #b7c9d6;
}

.drop_copy {
  text-align: center;
  padding: 1.4rem;
  color: #102028;
}

.drop_title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.drop_hint {
  margin: 0.45rem 0 1.1rem;
  color: #24323c;
}

.choose_file_button {
  display: inline-block;
  padding: 0.6rem 1rem;
  min-height: 2.6rem;
  border: 1px solid #102028;
  background: #eef4f8;
  color: #102028;
  font: inherit;
  cursor: pointer;
}

.preview_sheet {
  margin: 0;
  position: relative;
  max-width: calc(100% - 1.6rem);
  max-height: calc(100% - 1.6rem);
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(10, 18, 26, 0.35);
}

.preview_sheet img {
  display: block;
  max-width: 100%;
  max-height: 28rem;
}

.scan_bar {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--led);
  box-shadow: 0 0 12px var(--led_glow);
  animation: scan_sweep 1.4s linear infinite;
}

.scanner.is_scanning .scan_bar {
  display: block;
}

@keyframes scan_sweep {
  from {
    top: 0;
  }
  to {
    top: 100%;
  }
}

.control_deck {
  background: #14181e;
  border: 1px solid var(--housing_edge);
  padding: 1rem 0.95rem 1.1rem;
}

.field + .field {
  margin-top: 1.05rem;
}

.field_header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.field_label,
.readout dt {
  font-family: "Lucida Console", Consolas, Menlo, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--panel_muted);
}

.field_value {
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

.field_note,
.format_note {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--panel_muted);
}

.format_note {
  margin-top: 1.05rem;
}

.page_row {
  display: grid;
  grid-template-columns: 1fr 4.2rem 1fr;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.page_row input {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid #4a5560;
  background: #0f1216;
  color: var(--panel_ink);
  font: inherit;
  text-align: center;
}

#scale_slider,
#quality_slider {
  width: 100%;
  margin: 0.65rem 0 0;
  accent-color: var(--scan);
}

.readout {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid #2c323b;
}

.readout div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.readout dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.action_row {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.1rem;
}

.primary_button,
.secondary_button,
.ghost_button,
.step_button {
  font: inherit;
  cursor: pointer;
  min-height: 2.6rem;
}

.primary_button,
.secondary_button,
.ghost_button {
  padding: 0.7rem 0.85rem;
}

.primary_button {
  border: 0;
  background: var(--scan);
  color: #071018;
}

.secondary_button,
.ghost_button,
.step_button {
  border: 1px solid #6b7784;
  background: transparent;
  color: var(--panel_ink);
}

.primary_button:disabled,
.secondary_button:disabled,
.step_button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.primary_button:focus-visible,
.secondary_button:focus-visible,
.ghost_button:focus-visible,
.step_button:focus-visible,
.choose_file_button:focus-visible,
#scale_slider:focus-visible,
#quality_slider:focus-visible,
#page_input:focus-visible,
.file_input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .bed {
    grid-template-columns: 2.1rem 1fr;
  }

  .lid_scale {
    font-size: 0.6rem;
  }

  .control_deck {
    grid-column: 1 / -1;
  }

  .led_bar {
    margin-left: 2.5rem;
  }

  .platen,
  .glass {
    min-height: 16rem;
  }

  .preview_sheet img {
    max-height: 18rem;
  }
}
