:root {
  --room: #4a5259;
  --tile: rgba(12, 16, 18, 0.14);
  --plastic: #b4bcc4;
  --plastic_dark: #8e98a2;
  --plastic_light: #cfd6dc;
  --ink: #1c2228;
  --muted: #3f4850;
  --lcd_well: #0d1a12;
  --lcd_green: #6fef6a;
  --lcd_dim: #3a8f42;
  --led: #3dff4a;
  --start: #1f7a3a;
  --start_ink: #e8ffe9;
  --error: #f3d27a;
  --focus: #d7ff6a;
}

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

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

body {
  background-color: var(--room);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 18%),
    repeating-linear-gradient(0deg, var(--tile) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(90deg, var(--tile) 0 1px, transparent 1px 36px);
  color: var(--ink);
  font-family: "Trebuchet MS", "Geneva", Verdana, sans-serif;
  line-height: 1.4;
}

.room {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3.5rem;
}

.copier {
  background:
    linear-gradient(180deg, var(--plastic_light) 0%, var(--plastic) 38%, var(--plastic_dark) 100%);
  border: 1px solid #6e777f;
  border-radius: 10px 10px 3px 3px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 22px 40px rgba(0, 0, 0, 0.38);
  padding: 1rem 1rem 0;
}

.machine_top {
  display: grid;
  gap: 1rem;
  padding: 0.35rem 0.35rem 1rem;
  border-bottom: 3px solid #7a838c;
}

.lcd_bezel {
  background: #6c757d;
  border: 1px solid #545c63;
  border-radius: 4px;
  padding: 0.55rem 0.65rem 0.6rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.lcd_brand {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d7dde2;
}

.lcd {
  background: var(--lcd_well);
  border: 2px solid #2a3330;
  min-height: 4.4rem;
  padding: 0.55rem 0.7rem;
  color: var(--lcd_green);
  font-family: "Lucida Console", Consolas, "Courier New", monospace;
  text-shadow: 0 0 8px rgba(111, 239, 106, 0.45);
}

.lcd_line {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.lcd_line_secondary {
  margin-top: 0.25rem;
  color: var(--lcd_dim);
  font-size: 0.78rem;
}

.lcd.is_error {
  color: var(--error);
  text-shadow: 0 0 8px rgba(243, 210, 122, 0.4);
}

.lcd.is_error .lcd_line_secondary {
  color: #c9a24e;
}

.led {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d7dde2;
}

.led_dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--led);
  box-shadow: 0 0 7px var(--led);
}

.led.is_busy .led_dot {
  background: #ffd65c;
  box-shadow: 0 0 7px #ffd65c;
}

.led.is_error .led_dot {
  background: #ff5a4a;
  box-shadow: 0 0 7px #ff5a4a;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

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

.status_message {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  background: #f3d27a;
  border: 1px solid #8a6b1e;
  color: #2b230e;
}

[hidden] {
  display: none !important;
}

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

.platen {
  margin-top: 1rem;
  padding: 0.7rem;
  background: #7c858e;
  border: 1px solid #5d666e;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.platen_glass {
  min-height: 14rem;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 1.4rem 1rem;
  background:
    linear-gradient(180deg, rgba(180, 220, 255, 0.12), rgba(255, 255, 255, 0.04)),
    repeating-linear-gradient(
      90deg,
      #9aa4ad 0 12px,
      #a7b0b8 12px 13px
    );
  border: 1px solid #4e575e;
  box-shadow: inset 0 0 0 6px #6f787f;
}

.platen.is_dragging .platen_glass {
  background-color: #b7c4ce;
}

.platen_title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.platen_hint {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
}

.choose_files {
  display: inline-block;
  padding: 0.6rem 0.95rem;
  min-height: 2.7rem;
  border: 1px solid #3e474e;
  background: linear-gradient(180deg, #dfe5ea, #b7c0c8);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.choose_files_quiet {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
}

.job_deck {
  margin-top: 1rem;
  background: #9aa3ab;
  border: 1px solid #6d767e;
  padding: 0.85rem 0.8rem 0.95rem;
}

.job_deck_header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.65rem;
}

.job_deck h2 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.job_deck_note,
.reorder_hint,
.field_note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.reorder_hint {
  margin: 0.55rem 0 0.7rem;
}

.job_list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.job_row {
  display: grid;
  grid-template-columns: 2.1rem 3rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem;
  background: #c5ccd3;
  border: 1px solid #7a838c;
  cursor: grab;
}

.job_row.is_drag_over {
  outline: 2px solid var(--lcd_green);
}

.job_index {
  font-family: "Lucida Console", Consolas, monospace;
  text-align: center;
  color: #3a434b;
}

.job_thumb {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  background: #e8ecef;
  border: 1px solid #6d767e;
}

.job_meta {
  min-width: 0;
}

.job_name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.job_size {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.job_controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

.job_controls button {
  min-width: 2.6rem;
  min-height: 2.6rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid #4e575e;
  background: linear-gradient(180deg, #e7ecef, #b7c0c8);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.job_controls button:disabled {
  opacity: 0.4;
  cursor: default;
}

.control_panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.panel_block {
  margin: 0;
  padding: 0.8rem 0.85rem 0.95rem;
  border: 1px solid #667078;
  background: #a8b1b9;
  min-width: 0;
}

.panel_block legend {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

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

.field_label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field_value {
  font-family: "Lucida Console", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.radio_row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.radio_chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #5d666e;
  background: #c5ccd3;
  cursor: pointer;
}

.radio_chip:has(input:checked) {
  background: #dfe8ee;
  border-color: #1c2228;
}

.radio_chip:has(input:disabled) {
  opacity: 0.5;
  cursor: default;
}

.color_row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.color_row input[type="color"] {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid #4e575e;
  background: #c5ccd3;
  cursor: pointer;
}

#margin_slider {
  width: 100%;
  margin: 0.45rem 0 0;
  accent-color: var(--start);
}

.field_note {
  margin-top: 0.45rem;
}

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

.start_button,
.clear_button {
  min-height: 2.9rem;
  font: inherit;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start_button {
  border: 1px solid #145528;
  background: linear-gradient(180deg, #3aa85a, var(--start));
  color: var(--start_ink);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.start_button:disabled,
.clear_button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.clear_button {
  border: 1px solid #4e575e;
  background: linear-gradient(180deg, #dfe5ea, #b7c0c8);
  color: var(--ink);
}

.cassettes {
  margin-top: 1rem;
}

.cassette {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 1.85rem;
  margin: 0.28rem -0.15rem 0;
  padding: 0 0.8rem;
  background: linear-gradient(180deg, #c5ccd3, #9aa3ab);
  border: 1px solid #5d666e;
  border-bottom-width: 3px;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #3a434b;
}

.cassette i {
  width: 42%;
  height: 0.55rem;
  background: #f4f1ea;
  border: 1px solid #c9c2b3;
  box-shadow: inset 0 -1px 0 #ddd6c8;
}

.start_button:focus-visible,
.clear_button:focus-visible,
.choose_files:focus-visible,
.job_controls button:focus-visible,
.radio_chip input:focus-visible,
#margin_slider:focus-visible,
#background_color_input:focus-visible,
.file_input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

  .job_row {
    grid-template-columns: 1.8rem 2.6rem minmax(0, 1fr);
  }

  .job_controls {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
