:root {
  font:
    15px/1.45 "Inter",
    Arial,
    sans-serif;
  color: #233730;
  background: #f3f3ed;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid #bfc9bf;
  background: #fdfdf8;
}
h1 {
  font:
    normal clamp(27px, 3vw, 38px)/1.1 Georgia,
    serif;
  letter-spacing: -1.4px;
  margin: 0;
}
main {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  gap: 22px;
  padding: 24px clamp(18px, 4vw, 54px);
  max-width: 1540px;
  margin: auto;
}
aside,
.viewer {
  background: #fdfdf8;
  border: 1px solid #cdd1c8;
  border-radius: 10px;
}
aside {
  padding: 17px;
  align-self: start;
}
h2 {
  font-size: 16px;
  margin: 22px 0 9px;
}
h2:first-child {
  margin-top: 0;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
input[type="number"] {
  width: 100%;
  display: block;
  margin: 3px 0 6px;
  border: 1px solid #bdc6bc;
  border-radius: 5px;
  padding: 7px;
  background: #fff;
  font: inherit;
  font-size: 14px;
}
button,
.upload {
  font: inherit;
  font-size: 13px;
  background: #f7f8f1;
  border: 1px solid #b7c2b8;
  border-radius: 5px;
  padding: 8px 10px;
  cursor: pointer;
  color: inherit;
}
button:focus-visible,
.upload:focus-within {
  outline: 2px solid #31806c;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:hover:not(:disabled),
[aria-pressed="true"] {
  background: #e1ece3;
}
aside > button,
.upload {
  width: 100%;
  text-align: center;
}
.upload {
  display: block;
  position: relative;
  font-weight: 600;
  overflow: hidden;
}
.upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
#filename {
  font-size: 12px;
  color: #52695c;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.pair,
.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.pair,
.tools {
  margin: 9px 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 8px;
}
.primary {
  background: #274a3c;
  color: white;
  font-weight: 600;
}
.primary:hover:not(:disabled) {
  background: #335e4c;
}
.viewer {
  overflow: hidden;
  align-self: start;
}
.bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 17px;
  border-bottom: 1px solid #cdd1c8;
}
.bar span,
#status {
  color: #4f6459;
  font-size: 13px;
}
.drawing {
  position: relative;
  background: #fff;
  min-height: 180px;
  display: grid;
  place-items: center;
}
.drawing canvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
  touch-action: manipulation;
}
#empty {
  position: absolute;
  text-align: center;
  color: #5d7166;
  padding: 18px;
  pointer-events: none;
}
#status {
  padding: 11px 17px;
  min-height: 44px;
  border-top: 1px solid #cdd1c8;
}
button[hidden],
p[hidden] {
  display: none;
}
@media (max-width: 760px) {
  main {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }
  aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
  }
  aside h2,
  aside .tools,
  aside .pair {
    grid-column: 1/-1;
    margin: 4px 0;
  }
  .viewer {
    grid-row: 1;
  }
  .drawing {
    min-height: 100px;
  }
  header {
    padding: 12px;
  }
  aside h2:not(:first-child) {
    margin-top: 10px;
  }
}

canvas:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: 2px;
}

.cursor-readout {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: #4b5563;
}
