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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: black;
}

#canvas1 {
    display: block;
    width: 100vw;
    height: 100vh;
    background-color: black;
}

#cornerButton {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-top: 60px solid rgba(255, 255, 255, 0.2);
    border-left: 60px solid transparent;
    cursor: pointer;
    transition: border-top-color 0.3s ease;
    z-index: 1000;
}

#cornerButton:hover {
    border-top-color: rgba(255, 255, 255, 0.4);
}

#optionsPanel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 250px;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    display: none;
    z-index: 1001;
}

#optionsPanel h2 {
    margin-bottom: 8px;
}

#optionsPanel label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

#optionsPanel input {
    width: 100%;
    padding: 6px;
    margin-bottom: 12px;
    border: 1px solid #555;
    border-radius: 3px;
    background-color: #222;
    color: #fff;
    font-size: 14px;
}

#optionsPanel button {
    display: inline-block;
    margin-right: 5px;
    margin-top: 5px;
    background-color: #333;
    border: 1px solid #777;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    color: #fff;
    transition: background-color 0.2s;
    font-size: 14px;
}

#optionsPanel button:hover {
    background-color: #555;
}

.color-container {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.flow-color {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
}

/* ---------- Phones and touch screens ---------- */
html,
body {
  overscroll-behavior: none;
}

#canvas1 {
  /* The visible viewport, not the one behind the browser bar */
  height: 100dvh;
}

#cornerButton {
  -webkit-tap-highlight-color: transparent;
}

#optionsPanel {
  width: min(250px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The colour picker never runs off a small screen */
.pcr-app {
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
}

@media (pointer: coarse) {
  #optionsPanel button,
  #optionsPanel input {
    min-height: 44px;
  }

  .flow-color,
  .color-container .pickr .pcr-button {
    width: 44px;
    height: 44px;
  }

  .color-container {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pcr-app .pcr-interaction input,
  .pcr-app .pcr-interaction .pcr-type,
  .pcr-app .pcr-interaction .pcr-save,
  .pcr-app .pcr-interaction .pcr-clear {
    min-height: 40px;
    font-size: 14px;
  }
}

/* ---------- Art Lab live preview (?embed=1, see ../js/embed.js) ----------
   Only the canvas shows, filling the frame; the options button, panel and
   colour pickers stay hidden and out of reach. */
html.is-embed body {
  visibility: hidden;
}

html.is-embed #canvas1 {
  visibility: visible;
  width: 100vw;
  height: 100vh;
}
