/* Classic 32px cursors approved in the desktop preview. */
@media (hover: hover) and (pointer: fine) {
  :root {
    --retro-cursor-arrow: url("assets/cursors/classic/arrow.png") 1 1, default;
    --retro-cursor-hand: url("assets/cursors/classic/hand.png") 11 2, pointer;
    --retro-cursor-text: url("assets/cursors/classic/text.png") 16 16, text;
    --retro-cursor-move: url("assets/cursors/classic/move.png") 16 16, move;
  }

  html,
  body,
  .window > .titlebar {
    cursor: var(--retro-cursor-arrow);
  }

  /* Readable content keeps a text cursor; desktop and window margins stay arrows. */
  .welcome-row,
  .welcome-panel,
  .field,
  .article,
  .profile-role,
  .contact-value,
  .address,
  .player-display,
  .music-times,
  .music-list-heading,
  .window-status,
  #dialog-body {
    cursor: var(--retro-cursor-text);
  }

  :root button,
  :root a[href],
  :root select,
  :root summary,
  :root [role="button"],
  :root input:is([type="button"], [type="submit"], [type="reset"],
    [type="image"], [type="checkbox"], [type="radio"], [type="range"],
    [type="color"], [type="file"]),
  .music-progress input[type="range"],
  .music-library-player #music-volume,
  .check-row input:enabled + label,
  .music-library-player label[for="music-volume"],
  .game-version:has(select:enabled),
  label:has(> :is(input, select, textarea):enabled) {
    cursor: var(--retro-cursor-hand);
  }

  :root input:not([type]),
  :root input:is([type="text"], [type="email"], [type="search"],
    [type="url"], [type="tel"], [type="password"], [type="number"]),
  :root textarea,
  :root [contenteditable]:not([contenteditable="false"]) {
    cursor: var(--retro-cursor-text);
  }

  /* Disabled controls must win over the player-specific range rules. */
  :root :is(button, input, select, textarea):disabled,
  :root [aria-disabled="true"],
  .music-progress input[type="range"]:disabled,
  .music-library-player #music-volume:disabled,
  .check-row input:disabled + label,
  .music-library-player:has(#music-volume:disabled) label[for="music-volume"],
  .game-version:has(select:disabled) {
    cursor: var(--retro-cursor-arrow);
  }
}

/* Only these titlebars can actually be dragged in the desktop layout. */
@media (hover: hover) and (pointer: fine) and (min-width: 701px) {
  .window:not(.maximized) > .titlebar,
  .window:not(.maximized) > .titlebar > .window-title,
  .window:not(.maximized) > .titlebar > .icon {
    cursor: var(--retro-cursor-move);
  }
}

/* Native scrollbars ignore document cursors. Styled scrollbar parts keep the
   approved arrow while retaining the browser's scrolling and drag behavior. */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar,
  ::-webkit-scrollbar-track,
  ::-webkit-scrollbar-track-piece,
  ::-webkit-scrollbar-thumb,
  ::-webkit-scrollbar-button,
  ::-webkit-scrollbar-corner {
    cursor: var(--retro-cursor-arrow);
  }

  ::-webkit-scrollbar {
    width: 16px;
    height: 16px;
    background: #dfdfdf;
  }

  ::-webkit-scrollbar-track {
    background: repeating-conic-gradient(#fff 0% 25%, #d3d3d3 0% 50%) 0 0 / 2px 2px;
  }

  ::-webkit-scrollbar-thumb {
    min-height: 24px;
    min-width: 24px;
    background: #c6c6c6;
    box-shadow: var(--bevel);
  }

  ::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
    background-color: #c6c6c6;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 8px 8px;
    box-shadow: var(--bevel);
  }

  ::-webkit-scrollbar-button:vertical:decrement:start,
  ::-webkit-scrollbar-button:vertical:increment:end,
  ::-webkit-scrollbar-button:horizontal:decrement:start,
  ::-webkit-scrollbar-button:horizontal:increment:end {
    display: block;
    width: 16px;
    height: 16px;
  }

  ::-webkit-scrollbar-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23171717' d='M1 6h6L4 2z'/%3E%3C/svg%3E");
  }

  ::-webkit-scrollbar-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23171717' d='M1 2h6L4 6z'/%3E%3C/svg%3E");
  }

  ::-webkit-scrollbar-button:horizontal:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23171717' d='M6 1v6L2 4z'/%3E%3C/svg%3E");
  }

  ::-webkit-scrollbar-button:horizontal:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23171717' d='M2 1v6l4-3z'/%3E%3C/svg%3E");
  }

  ::-webkit-scrollbar-button:active {
    box-shadow: var(--inset);
  }

  ::-webkit-scrollbar-corner {
    background: #c6c6c6;
  }
}
