/* Veleno's small interaction details. Load after the room and gallery styles. */
:root {
  --veleno-scroll-track: #13292b;
  --veleno-scroll-thumb: #b99b68;
  --veleno-scroll-hover: #dcc18e;
  --veleno-scroll-active: #f0d8a5;
}

@media (forced-colors: none) {
  /* Standards styling also reaches nested prompt panes and horizontal strips. */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--veleno-scroll-thumb) var(--veleno-scroll-track);
  }

  #place.prompt-gallery .gallery-filmstrip {
    scrollbar-width: thin;
    scrollbar-color: var(--veleno-scroll-thumb) var(--veleno-scroll-track);
  }

  /* Chromium/WebKit use the rounded version; Firefox keeps the rules above. */
  @supports selector(::-webkit-scrollbar) {
    *,
    dialog,
    #place.prompt-gallery .gallery-filmstrip {
      scrollbar-width: auto;
      scrollbar-color: auto;
    }

    *::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    *::-webkit-scrollbar-track,
    *::-webkit-scrollbar-corner {
      background: var(--veleno-scroll-track);
    }

    *::-webkit-scrollbar-track {
      border-radius: 10px;
    }

    *::-webkit-scrollbar-thumb {
      min-height: 32px;
      min-width: 32px;
      background: var(--veleno-scroll-thumb);
      border: 2px solid var(--veleno-scroll-track);
      border-radius: 10px;
    }

    *::-webkit-scrollbar-thumb:hover {
      background: var(--veleno-scroll-hover);
    }

    *::-webkit-scrollbar-thumb:active {
      background: var(--veleno-scroll-active);
    }
  }
}

/* A true cursor, not a following element: fixed 32px art with a 3,2 hotspot. */
@media (hover: hover) and (pointer: fine) and (forced-colors: none) {
  :root {
    --veleno-cursor-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M3 2v23l6-6 4.7 10 4-1.9L13 17h9Z' fill='%23d7b783' stroke='%230b1c1e' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='m24 3 4 2.3v4.6L24 12l-4-2.1V5.3Z' fill='%23d7b783' stroke='%230b1c1e' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='m24 5.5 1.9 1.1v2.1L24 9.8l-1.9-1.1V6.6Z' fill='%231b3536'/%3E%3C/svg%3E") 3 2;
    --veleno-cursor-click: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M3 2v23l6-6 4.7 10 4-1.9L13 17h9Z' fill='%23f3dfad' stroke='%230b1c1e' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='m24 2 1.6 4.4L30 8l-4.4 1.6L24 14l-1.6-4.4L18 8l4.4-1.6Z' fill='%23edca80' stroke='%230b1c1e' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 3 2;
  }

  html,
  body,
  #map:not([draggable="true"]),
  #map:not([draggable="true"]):active,
  #map.in-room:not([draggable="true"]),
  #map.in-room:not([draggable="true"]):active {
    cursor: var(--veleno-cursor-arrow), default;
  }

  :is(a[href], button, summary, select, label[for], [role="button"], input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], input[type="range"], input[type="color"]):not(:disabled):not([aria-disabled="true"]):not([draggable="true"]),
  #place :is(a[href], button, summary, select, label[for], [role="button"]):not(:disabled):not([aria-disabled="true"]):not([draggable="true"]),
  #scene-card button:not(:disabled):not([aria-disabled="true"]),
  #scene-back:not(:disabled),
  #place-enter:not(:disabled) {
    cursor: var(--veleno-cursor-click), pointer;
  }

  /* Selectable prompt copy and editable fields retain the familiar I-beam. */
  :is(pre, pre *, textarea, input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"], input[type="number"], [contenteditable]:not([contenteditable="false"])),
  #place :is(pre, pre *, textarea, input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"], input[type="number"], [contenteditable]:not([contenteditable="false"])) {
    cursor: text;
  }

  :is(button, input, select):disabled,
  [aria-disabled="true"],
  #place [aria-disabled="true"],
  #scene-card button:disabled,
  #scene-back:disabled,
  #place-enter:disabled,
  #place.prompt-gallery button:disabled {
    cursor: not-allowed;
  }

  /* No blanket descendant cursor rule: canvas crosshair/grab/grabbing and
     explicit inline tool cursors keep their own native behavior. */
  [draggable="true"],
  #map[draggable="true"],
  #place [draggable="true"],
  #place.prompt-gallery [draggable="true"] {
    cursor: grab;
  }

  [draggable="true"]:active,
  #map[draggable="true"]:active,
  #place [draggable="true"]:active,
  #place.prompt-gallery [draggable="true"]:active {
    cursor: grabbing;
  }
}

/* Let high-contrast users keep platform colors, widths, and native cursors. */
@media (forced-colors: active) {
  *,
  dialog,
  #place.prompt-gallery .gallery-filmstrip {
    scrollbar-color: auto !important;
    scrollbar-width: auto !important;
  }
}
