* {
  box-sizing: border-box;
}

:root {
  --paper-centre: #fffcec;
  --paper-edge: #fff8e6;
  --page-bg: #171614;
  --frame-outer: #443a32;
  --frame-inner: #302a26;
  --text: #d8d1c5;
  --muted: #aaa294;
  --border: #716a61;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: min(95vw, 1280px);
  height: 95vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#frame {
  flex: 1;
  min-height: 0;
  padding: 13px;
  background: var(--frame-inner);
  border: 5px solid var(--frame-outer);
  border-radius: 2px;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.55),
    inset 0 0 10px rgba(255, 255, 255, 0.035);
}

#paper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse at 48% 45%,
      var(--paper-centre) 0%,
      #fffbea 50%,
      var(--paper-edge) 100%
    );
}

#paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    repeating-radial-gradient(
      ellipse at 20% 30%,
      rgba(80, 65, 45, 0.035) 0,
      rgba(80, 65, 45, 0.035) 0.4px,
      transparent 0.6px,
      transparent 3px
    );
  mix-blend-mode: multiply;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

#controls {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  user-select: none;
}

.control {
  display: flex;
  align-items: center;
  gap: 9px;
}

input[type="range"] {
  width: 145px;
  accent-color: var(--muted);
}

output {
  width: 34px;
  color: var(--muted);
  text-align: right;
}

select,
button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  padding: 7px 10px;
}

select:disabled {
  opacity: 0.38;
}

button {
  cursor: pointer;
}

button:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 760px) {
  #app {
    width: 97vw;
    height: 97vh;
  }

  #frame {
    padding: 8px;
  }

  #controls {
    gap: 10px 14px;
  }

  input[type="range"] {
    width: 100px;
  }

  .scale-control {
    display: none;
  }
}
