* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark light;
  background: Canvas;
  color: CanvasText;
  font: 14px system-ui, sans-serif;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "header" "main";

  header {
    padding: 1em;

    button {
      border: none;
      background: transparent;
      cursor: pointer;
    }
  }

  #controls {
    position: absolute;
    height: auto;
    right: 0;
    top: 0;
    overflow-y: auto;
    padding: 10px;
  }

  .canvas-container {
    grid-area: main;
    position: relative;
    overflow: hidden;
  }

  #curveCanvas {
    display: block;
    width: 100%;
    height: 100dvh;
    cursor: crosshair;
    --s: 100px;
    --g: #0000 90deg, light-dark(#adb7bd20, #d8dee910) 0;
    background: conic-gradient(from 90deg at 2px 2px, var(--g)) 0 0 / var(--s) var(--s),
      conic-gradient(from 90deg at 1px 1px, var(--g)) 0 0 / calc(var(--s) / 5) calc(var(--s) / 5);
  }

  .canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  .point-info {
    position: absolute;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-family: monospace;
    display: none;
    z-index: 10;
  }

  @media (max-width: 800px) {
    body {
      grid-template-columns: 1fr;
      grid-template-areas: "main" "controls";
      height: fit-content;
      overflow: auto;
    }

    #curveCanvas {
      height: 60dvh;
    }

    #controls {
      height: auto;
      max-height: 40dvh;
    }
  }

  dialog {
    padding: 2em;
    margin: auto;
    border: 1px solid ButtonBorder;
    border-radius: 0.5em;

    button {
      border: none;
      background: transparent;
      cursor: pointer;
    }

    kbd {
      border: 1px solid ButtonBorder;
      background: ButtonFace;
      border-radius: 5px;
      padding: 5px;
      font-family: monospace;
    }

    ul {
      margin: 1em
    }


    li {
      line-height: 2;
    }
  }

}
