/* hyd-solitaire.css
   Draw-one Klondike in a dialog (#hyd-solitaire, behaviour in hyd-solitaire.js). Layout: titlebar,
   toolbar, a green table (stock, waste and foundation row on top, seven columns below), a photo bar
   and a footer. After a win, a fireworks canvas lies over the table and the "leaderboard" sheet
   slides down from under the toolbar. --sol-card-h and --sol-stack-step size the cards and the
   overlap of stacked cards; --pile-depth and --card-row (per column and card) and --drag-grab-x
   and --drag-grab-y (per drag ghost) are set by the script, as are the position and size of the
   fireworks canvas and the top of the sheet's well. */

/* A quiet classic card table inside the existing desktop. Only a saved win sends anything about the
   player: its name and move count go to the leaderboard (opening the board only reads it). */
#hyd-solitaire {
  --sol-card-h: clamp(103px,15vw,143px);
  --sol-stack-step: 26px;
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(900px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 3px;
  border: 1px solid;
  border-color: #f6f6f6 #5a5b60 #5a5b60 #f6f6f6;
  border-radius: 5px;
  background: #c6c6ca;
  color: #222;
  box-shadow: 0 14px 48px #0007;
  font:
    12px/1.4 'Lucida Grande',
    Tahoma,
    sans-serif;
  overflow: hidden;
  color-scheme: light;
}

/* Scaled by hyd-window-resize.js (attachDialog, 901 px and over): the dialog is zoomed as one piece, its layout
   staying the one it has at scale 1, so the cap that keeps it inside the viewport is divided by the scale (the
   scale is chosen so the dialog fits, with 8 px to spare on each side). The drag ghost and the fireworks canvas
   are placed from client pixels, so they cancel the zoom and their offsets stay screen pixels. */
#hyd-solitaire.is-dialog-scaled {
  max-height: calc((100dvh - 16px) / var(--hyd-dialog-scale, 1));
}

#hyd-solitaire.is-dialog-scaled :is(.solitaire-drag-ghost, .solitaire-fireworks) {
  zoom: calc(1 / var(--hyd-dialog-scale, 1));
}

/* The ghost's cards are zoomed again, so they look as the cards on the table do (hyd-solitaire.js divides their
   offsets by the scale). */
#hyd-solitaire.is-dialog-scaled .solitaire-drag-ghost .solitaire-card {
  zoom: var(--hyd-dialog-scale, 1);
}

#hyd-solitaire::backdrop {
  background: #11131a70;
}

#hyd-solitaire[open] {
  display: flex;
  flex-direction: column;
}

/* Script toggles hidden inside the dialog; !important stops any display rule from showing those
   parts anyway. */
#hyd-solitaire [hidden] {
  display: none !important;
}

#hyd-solitaire button {
  font: inherit;
  cursor: pointer;
}

/* --- Titlebar and window controls --- */
#hyd-solitaire .solitaire-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 3px 8px;
  border: 1px solid #919297;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(#f0f0f1, #cbcbce 48%, #b6b6ba 50%, #d5d5d8);
  color: #222;
  flex: none;
}

#hyd-solitaire h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font:
    bold 12px/1.4 'Lucida Grande',
    Tahoma,
    sans-serif;
  color: #222;
  text-shadow: 0 1px #fff8;
}

#hyd-solitaire .solitaire-title-spacer {
  width: 48px;
  flex: none;
}

#hyd-solitaire .solitaire-window-controls {
  display: flex;
  gap: 6px;
  flex: none;
  width: 48px;
}

#hyd-solitaire .solitaire-window-controls button {
  display: grid;
  place-items: center;
  padding: 0;
  min-width: 19px;
  width: 19px;
  height: 19px;
  border: 1px solid #6d7177;
  border-radius: 50%;
  background: linear-gradient(#fbfbfc, #adb1b8);
  color: #333;
  line-height: 1;
  font-size: 15px;
  box-shadow: inset 0 1px #fff;
}

/* --- Toolbar and score --- */
#hyd-solitaire .solitaire-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-bottom: 1px solid #64666b;
  flex: none;
  background: #d9d9dc;
}

#hyd-solitaire :is(.solitaire-toolbar, .solitaire-photo-bar, .solitaire-sheet-actions) > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 29px;
  padding: 4px 11px;
  border: 1px solid;
  border-color: #f6f6f7 #7f8188 #7f8188 #f6f6f7;
  border-radius: 3px;
  background: linear-gradient(#f7f7f8, #d9dadd);
  color: #202329;
  box-shadow: 0 1px #fff6;
  white-space: nowrap;
}

#hyd-solitaire button:disabled {
  cursor: default;
}

#hyd-solitaire
  :is(.solitaire-toolbar, .solitaire-photo-bar, .solitaire-sheet-actions)
  > button:disabled {
  color: #81838a;
  box-shadow: none;
}

#hyd-solitaire .solitaire-score {
  margin-left: auto;
  color: #51545b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Table: top row and the seven columns --- */
#hyd-solitaire .solitaire-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 62dvh;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #91aaa0 #164637;
  background: #16563f;
  border: 1px solid;
  border-color: #143e30 #73927e #73927e #143e30;
}

#hyd-solitaire .solitaire-table {
  min-width: 540px;
  padding: 15px 14px 21px;
  background: radial-gradient(ellipse at 40% 0, #27674c44, transparent 70%);
  min-height: 375px;
}

#hyd-solitaire :is(.solitaire-top, .solitaire-columns) {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

#hyd-solitaire .solitaire-top {
  margin-bottom: 22px;
}

#hyd-solitaire .solitaire-column {
  position: relative;
  min-width: 0;
  height: calc(var(--sol-card-h) + var(--pile-depth)*var(--sol-stack-step));
}

/* --- Cards and empty slots --- */
#hyd-solitaire .solitaire-card,
#hyd-solitaire .solitaire-slot {
  position: relative;
  display: block;
  width: 100%;
  height: var(--sol-card-h);
  min-width: 0;
  padding: 0;
  border: 1px solid #2f3630;
  border-radius: 5px;
  box-sizing: border-box;
  text-align: center;
  box-shadow: 1px 2px 2px #09291f70;
  background: #faf9f3;
  color: #222;
  overflow: hidden;
  touch-action: manipulation;
  outline-offset: 1px;
}

#hyd-solitaire .solitaire-column > .solitaire-card {
  position: absolute;
  top: calc(var(--card-row)*var(--sol-stack-step));
  left: 0;
}

#hyd-solitaire .solitaire-slot {
  background: #124b37;
  color: #86b59c;
  border: 1px solid #7aaa8c;
  box-shadow: inset 1px 1px #0e3229;
  font:
    28px Georgia,
    serif;
}

#hyd-solitaire .solitaire-card.suit-red {
  color: #ad263b;
}

#hyd-solitaire .solitaire-card.suit-black {
  color: #182127;
}

#hyd-solitaire .solitaire-card:not(:disabled):hover {
  filter: brightness(1.035);
}

#hyd-solitaire .solitaire-card:not(:disabled):not(.solitaire-stock) {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* --- Dragging: ghost, source and drop targets ---
   While a drag is live the whole dialog shows the grabbing cursor; !important beats the per-element
   cursors set on cards and buttons. */
#hyd-solitaire.is-dragging,
#hyd-solitaire.is-dragging * {
  cursor: grabbing !important;
}

#hyd-solitaire .solitaire-drag-ghost {
  position: fixed;
  z-index: 20;
  height: 0;
  transform: translate(calc(-1 * var(--drag-grab-x)),calc(-1 * var(--drag-grab-y)));
  pointer-events: none;
  filter: drop-shadow(3px 7px 5px #00180e66);
}

#hyd-solitaire .solitaire-drag-ghost .solitaire-card {
  position: absolute;
  left: 0;
  width: 100%;
  pointer-events: none;
  opacity: 1;
  box-shadow: 0 0 0 1px #fff7;
  filter: none;
}

#hyd-solitaire .solitaire-card.is-drag-source {
  opacity: 0.27;
}

#hyd-solitaire [data-sol-drop].is-drop-ready {
  outline: 2px dashed #e1d68799;
  outline-offset: 3px;
  border-radius: 5px;
}

#hyd-solitaire [data-sol-drop].is-drop-target {
  outline: 3px solid #f1d875;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #183e2c66;
}

#hyd-solitaire [data-sol-drop].is-drop-invalid {
  outline: 2px solid #d39287;
  outline-offset: 3px;
  border-radius: 5px;
}

/* --- Card backs, corners and faces --- */
#hyd-solitaire .solitaire-card.card-back {
  border: 3px solid #eceadf;
  background:
    repeating-linear-gradient(45deg, transparent 0 4px, #abc9be27 4px 5px),
    repeating-linear-gradient(-45deg, transparent 0 4px, #abc9be27 4px 5px), #284e65;
  box-shadow:
    0 0 0 1px #20352e,
    1px 2px 3px #07271c99;
  color: #dce8e4;
}

#hyd-solitaire .solitaire-back-mark {
  position: absolute;
  display: grid;
  place-items: center;
  left: 50%;
  top: 50%;
  width: 49px;
  height: 60px;
  transform: translate(-50%, -50%);
  border: 2px double #c1d8ce;
  outline: 1px solid #6e918d;
  outline-offset: 4px;
  font:
    italic 34px Georgia,
    serif;
  color: #c8ddd4;
  border-radius: 50%;
  background: #284e65;
}

#hyd-solitaire .stock-empty {
  background: #154e3b;
  color: #a8cdb4;
  box-shadow: inset 0 0 0 1px #94b79e80;
  font-size: 34px;
}

#hyd-solitaire .solitaire-corner {
  position: absolute;
  z-index: 2;
  left: 4px;
  top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: #faf9f3;
  border-radius: 2px;
  font:
    18px/1.15 Georgia,
    serif;
  padding: 0 2px;
}

#hyd-solitaire .solitaire-corner b {
  font-weight: bold;
}

#hyd-solitaire .solitaire-corner i {
  font-style: normal;
  font-size: 17px;
}

#hyd-solitaire .corner-bottom {
  left: auto;
  top: auto;
  right: 4px;
  bottom: 2px;
  transform: rotate(180deg);
}

#hyd-solitaire .solitaire-pips {
  position: absolute;
  inset: 25px 6px;
  display: grid;
  place-items: center;
  font:
    43px/1 Georgia,
    serif;
}

#hyd-solitaire .solitaire-face-photo {
  position: absolute;
  inset: 24px 6px;
  width: calc(100% - 12px);
  height: calc(100% - 48px);
  object-fit: cover;
  border: 1px solid #b5b2a6;
  box-sizing: border-box;
  pointer-events: none;
  filter: none;
}

/* --- Selection, hint and focus --- */
#hyd-solitaire .solitaire-card.is-selected,
#hyd-solitaire .solitaire-slot.is-selected {
  box-shadow:
    inset 0 0 0 3px #edc65e,
    0 0 0 2px #eac457;
  filter: brightness(1.045);
}

#hyd-solitaire .solitaire-card.is-hint,
#hyd-solitaire .solitaire-slot.is-hint {
  outline: 3px dashed #f4d472;
  outline-offset: 1px;
}

#hyd-solitaire button:focus-visible,
#hyd-solitaire summary:focus-visible {
  outline: 3px solid #a8d4ff;
  outline-offset: 2px;
}

/* --- Photo bar and footer --- */
#hyd-solitaire .solitaire-photo-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 9px;
  background: #dbdbde;
  border-top: 1px solid #f2f2f4;
  border-bottom: 1px solid #999ba1;
  flex: none;
}

#hyd-solitaire .solitaire-selected {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #41454b;
  font-size: 11px;
}

#hyd-solitaire .solitaire-photo-bar img {
  width: 23px;
  height: 23px;
  object-fit: cover;
  border: 1px solid #86878a;
}

#hyd-solitaire .solitaire-footer {
  padding: 7px 10px 6px;
  background: #d0d0d4;
  flex: none;
  color: #31363b;
  font-size: 11px;
}

#hyd-solitaire .solitaire-footer p {
  margin: 0;
  line-height: 1.45;
}

#hyd-solitaire .solitaire-footer details {
  margin-top: 4px;
}

#hyd-solitaire .solitaire-footer summary {
  cursor: pointer;
  color: #4e545c;
  width: max-content;
}

#hyd-solitaire .solitaire-footer details p {
  max-width: 70em;
  margin-top: 5px;
}

/* --- Won state --- */
#hyd-solitaire.is-won .solitaire-table-scroll {
  box-shadow: inset 0 0 0 3px #dabd67;
}

#hyd-solitaire.is-won #solitaire-status {
  font-weight: bold;
  color: #175136;
}

/* --- Win celebration: square-pixel fireworks over the felt, never in the way of a click --- */
#hyd-solitaire .solitaire-fireworks {
  position: absolute;
  z-index: 15;
  pointer-events: none;
  image-rendering: pixelated;
}

/* --- Leaderboard: an early Mac OS X sheet that slides down from under the toolbar --- */
#hyd-solitaire .solitaire-sheet-well {
  position: absolute;
  z-index: 16;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

#hyd-solitaire .solitaire-sheet {
  box-sizing: border-box;
  width: min(340px, calc(100% - 14px));
  max-height: calc(100% - 10px);
  margin: 0 auto;
  overflow: auto;
  padding: 9px 12px 12px;
  border: 1px solid #7f8188;
  border-top: 0;
  border-radius: 0 0 5px 5px;
  background: #ececee;
  color: #222;
  box-shadow:
    0 10px 26px #0007,
    inset 0 1px #fff;
  pointer-events: auto;
  transform: translateY(-100%);
  transition: transform 180ms ease-out;
}

#hyd-solitaire .solitaire-sheet-well.is-open .solitaire-sheet {
  transform: none;
}

body.motion-off #hyd-solitaire .solitaire-sheet {
  transition: none;
}

/* While the sheet is open the rest of the window is inert, and the photo bar and the footer (whose
   status repeats the sheet's win line) show as plain bands: a long board or a phone's narrow margins
   never leave slices of their text beside the sheet. */
#hyd-solitaire .solitaire-sheet-well.is-open ~ :is(.solitaire-photo-bar, .solitaire-footer) > * {
  visibility: hidden;
}

#hyd-solitaire .solitaire-sheet:focus {
  outline: none;
}

#hyd-solitaire .solitaire-sheet h3 {
  margin: 0 0 6px;
  font:
    bold 12px/1.4 'Lucida Grande',
    Tahoma,
    sans-serif;
}

#hyd-solitaire .solitaire-win-line {
  margin: 0 0 8px;
  color: #175136;
  font-weight: bold;
}

#hyd-solitaire .solitaire-save label {
  display: block;
  margin-bottom: 3px;
  color: #31363b;
  font-size: 11px;
}

#hyd-solitaire .solitaire-save input {
  box-sizing: border-box;
  width: 100%;
  height: 26px;
  padding: 3px 6px;
  border: 1px solid;
  border-color: #7f8188 #b9bbc0 #c9cbcf #7f8188;
  border-radius: 0;
  background: #fff;
  color: #202329;
  font:
    13px 'Lucida Grande',
    Tahoma,
    sans-serif;
  box-shadow: inset 0 1px 2px #0002;
}

#hyd-solitaire .solitaire-save input:focus-visible {
  outline: 3px solid #a8d4ff;
  outline-offset: 0;
}

#hyd-solitaire .solitaire-save input[aria-invalid='true'] {
  border-color: #9c2b2b;
}

/* Locked while an unconfirmed save keeps its receipt: greyed, so typing visibly does nothing. */
#hyd-solitaire .solitaire-save input:read-only {
  background: #f3f3f4;
  color: #51545b;
  box-shadow: none;
}

/* Empty messages take no space but stay in the accessibility tree, so screen readers announce
   them when their text arrives. */
#hyd-solitaire :is(.solitaire-name-error, .solitaire-save-status, .solitaire-board-state):empty {
  margin: 0;
  padding: 0;
}

#hyd-solitaire .solitaire-name-error {
  margin: 3px 0 0;
  color: #9c2b2b;
  font-size: 11px;
}

#hyd-solitaire .solitaire-save-note {
  margin: 6px 0 0;
  color: #51545b;
  font-size: 11px;
}

#hyd-solitaire .solitaire-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 9px;
}

#hyd-solitaire .solitaire-sheet-actions > .is-default {
  border-color: #5d6f86;
  font-weight: bold;
  box-shadow: 0 0 0 1px #9fb3c9;
}

/* "saving…" keeps focus, so it is greyed with aria-disabled instead of being disabled. */
#hyd-solitaire .solitaire-sheet-actions > button[aria-disabled='true'] {
  color: #81838a;
  box-shadow: none;
  cursor: default;
}

#hyd-solitaire .solitaire-save-status {
  margin: 8px 0 0;
  color: #175136;
  font-size: 11px;
}

#hyd-solitaire .solitaire-save-status.is-error {
  color: #9c2b2b;
}

/* The board: a list view with a metal header; columns line up because it is one table. */
#hyd-solitaire .solitaire-board {
  margin-top: 12px;
  border: 1px solid #8b8d92;
  background: #fff;
}

#hyd-solitaire .solitaire-board table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

#hyd-solitaire .solitaire-board col.rank {
  width: 2.6em;
}

#hyd-solitaire .solitaire-board col.moves {
  width: 4.8em;
}

#hyd-solitaire .solitaire-board :is(th, td) {
  padding: 3px 6px;
  overflow: hidden;
  font-weight: normal;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: baseline;
  white-space: nowrap;
}

#hyd-solitaire .solitaire-board :is(th, td):last-child {
  text-align: right;
}

#hyd-solitaire .solitaire-board th {
  padding-block: 2px;
  border-bottom: 1px solid #8b8d92;
  background: linear-gradient(#fbfbfc, #dcdde0);
  color: #41454b;
  font-size: 11px;
}

#hyd-solitaire .solitaire-board th + th {
  border-left: 1px solid #c2c4c8;
}

#hyd-solitaire .solitaire-board tbody tr:nth-child(even) {
  background: #eef3fa;
}

#hyd-solitaire .solitaire-board tbody tr.is-own {
  background: #a8d4ff;
}

#hyd-solitaire .solitaire-board td.rank {
  color: #6a6d73;
}

#hyd-solitaire .solitaire-board tbody tr.is-own td.rank {
  color: #41454b;
}

#hyd-solitaire .solitaire-board-state {
  margin: 0;
  padding: 8px 6px;
  color: #51545b;
  font-size: 11px;
}

/* --- Phones (up to 620px) --- */
@media (max-width: 620px) {
  #hyd-solitaire {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    font-size: 11px;
    --sol-stack-step: 25px;
  }

  #hyd-solitaire .solitaire-toolbar {
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px;
  }

  #hyd-solitaire .solitaire-score {
    font-size: 10px;
  }

  #hyd-solitaire :is(.solitaire-toolbar, .solitaire-photo-bar) > button {
    min-height: 34px;
    padding: 4px 8px;
  }

  #hyd-solitaire .solitaire-table {
    padding: 12px 10px 17px;
  }

  #hyd-solitaire :is(.solitaire-top, .solitaire-columns) {
    gap: 10px;
  }

  #hyd-solitaire .solitaire-photo-bar {
    gap: 5px;
    padding: 6px;
  }

  #hyd-solitaire .solitaire-photo-bar img {
    display: none;
  }

  #hyd-solitaire .solitaire-titlebar {
    min-height: 35px;
  }

  #hyd-solitaire .solitaire-window-controls button {
    width: 22px;
    height: 22px;
  }

  #hyd-solitaire .solitaire-window-controls {
    width: 50px;
  }

  #hyd-solitaire .solitaire-footer {
    padding: 6px 8px;
  }
}

/* --- Short windows --- */
@media (max-height: 520px) {
  #hyd-solitaire .solitaire-table-scroll {
    min-height: 0;
    max-height: 55dvh;
  }

  #hyd-solitaire .solitaire-photo-bar {
    padding-block: 3px;
  }

  #hyd-solitaire .solitaire-footer {
    padding-block: 4px;
  }
}

/* Keep the whole seven-column deal in view on a phone. Longer runs scroll
   vertically, so dragging a card need not compete with horizontal scrolling. */
@media (max-width: 620px) {
  #hyd-solitaire {
    --sol-card-h: clamp(62px,18vw,108px);
    --sol-stack-step: 20px;
  }

  #hyd-solitaire .solitaire-table {
    min-width: 0;
    min-height: 280px;
    padding: 10px 6px 17px;
  }

  #hyd-solitaire :is(.solitaire-top, .solitaire-columns) {
    gap: 4px;
  }

  #hyd-solitaire .solitaire-top {
    margin-bottom: 14px;
  }

  #hyd-solitaire .solitaire-corner {
    left: 1px;
    top: 1px;
    gap: 1px;
    padding: 0 1px;
    font-size: 14px;
  }

  #hyd-solitaire .solitaire-corner i {
    font-size: 13px;
  }

  #hyd-solitaire .corner-bottom {
    left: auto;
    top: auto;
    right: 1px;
    bottom: 1px;
  }

  #hyd-solitaire .solitaire-face-photo {
    inset: 18px 3px;
    width: calc(100% - 6px);
    height: calc(100% - 36px);
  }

  #hyd-solitaire .solitaire-pips {
    inset: 18px 3px;
    font-size: 28px;
  }

  #hyd-solitaire .solitaire-back-mark {
    width: 24px;
    height: 34px;
    font-size: 23px;
    outline-offset: 2px;
  }

  #hyd-solitaire .solitaire-slot {
    font-size: 22px;
  }
}

/* Touch screens and phone widths, as for the window controls: the sheet's buttons and name box give
   a 44px target, and 16px text stops iOS Safari zooming in when the box takes focus. The toolbar and
   photo-bar buttons keep their size; "leaderboard" gets a clear 44px strip, so its row stays level. */
@media (max-width: 620px), (any-pointer: coarse) {
  #hyd-solitaire .solitaire-sheet-actions > button {
    min-height: 44px;
  }

  #hyd-solitaire .solitaire-save input {
    height: 44px;
    font-size: 16px;
  }

  #hyd-solitaire .solitaire-toolbar > [data-sol-board] {
    position: relative;
  }

  #hyd-solitaire .solitaire-toolbar > [data-sol-board]::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 44px;
    transform: translateY(-50%);
  }

  /* The score is as wide from move 0 as its widest text (999 moves, every card home), so the
     toolbar takes one row or two for the window's width and never changes rows during a game. The
     hidden copy has no height and is not read out. */
  #hyd-solitaire .solitaire-score {
    text-align: right;
  }

  #hyd-solitaire .solitaire-score::after {
    content: '999 moves · 52/52 home';
    display: block;
    height: 0;
    overflow: hidden;
    visibility: hidden;
  }
}

/* Reduced motion: the wildcard has lower specificity than the class rules inside the dialog, so
   !important is what makes it cancel their animations and transitions. */
@media (prefers-reduced-motion: reduce) {
  #hyd-solitaire * {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Aqua title bar (owner, 21 oct: the same bar as flyovers & u-turns, option B). The site’s blue Aqua glass under
   faint pinstripes, a rim of the same blue, the title in dark blue ink over a white emboss, centred; red and yellow
   round discs. Copied from hyd-flyovers.css and scoped to this window. On a phone the bar is slim (36 px) and each
   disc is drawn at 24 px in a 44 × 44 target (the rest of the target is a transparent border). --- */
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-titlebar {
  border: 0;
  border-bottom: 1px solid #6896ba;
  background:
    repeating-linear-gradient(0deg, #ffffff17 0 1px, #68686809 1px 2px),
    linear-gradient(#e3f5ff, #aed8f7 49%, #78b5e2 50%, #a2d2f5);
  box-shadow: inset 0 1px #fff;
  color: #143f62;
}
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-titlebar h2 {
  color: #143f62;
  font: 700 12px/1.2 var(--desktop-font, 'Lucida Grande', Tahoma, sans-serif);
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 1px #fff8;
}
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  justify-content: normal;
  min-height: 30px;
  padding: 3px 9px;
}
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-title-spacer {
  width: auto;
}
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 4px;
  width: auto;
  height: 24px;
}
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls [data-sol-close] {
  box-sizing: border-box;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid #aa514a;
  border-radius: 50%;
  background: radial-gradient(ellipse at 40% 15%, #ffdcd4 0%, #ed867a 45%, #cf645c 74%, #f6a499 100%);
  color: #792f2a;
  box-shadow: inset 0 1px #ffece7, 0 1px #fffc;
  font: 16px/1 Arial, sans-serif;
  text-shadow: none;
}
html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls [data-sol-minimise] {
  box-sizing: border-box;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid #a17a2b;
  border-radius: 50%;
  color: #6b4a0a;
  background: radial-gradient(ellipse at 40% 15%, #fff3c0, #f2ce65 45%, #d7a637 74%, #ffe292);
  box-shadow: inset 0 1px #fff3c0, 0 1px #fffc;
  font: 16px/1 Arial, sans-serif;
  text-shadow: none;
}

@media (max-width: 620px), (pointer: coarse) and (max-height: 450px) {
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-titlebar {
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls {
    width: auto;
    height: 44px;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-title-spacer {
    display: block;
    width: auto;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls > button::before {
    top: 12px;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-titlebar {
    position: relative;
    z-index: 1;
    min-height: 36px;
    padding: 0 4px;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls {
    gap: 0;
    margin: 0 0 -8px;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls button,
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls [data-sol-close],
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls [data-sol-minimise] {
    box-sizing: border-box;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    border-width: 6px 10px 14px;
    border-color: transparent;
    border-radius: 22px / 18px 18px 26px 26px;
    background-clip: padding-box;
    box-shadow:
      inset 0 0 0 1px #aa514a,
      inset 0 2px #ffece7;
    font-size: 15px;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-window-controls [data-sol-minimise] {
    border-color: transparent;
    background-clip: padding-box;
    box-shadow:
      inset 0 0 0 1px #a17a2b,
      inset 0 2px #fff3c0;
  }
  html[data-theme] body dialog#hyd-solitaire[open] .solitaire-titlebar h2 {
    font-size: 15px;
  }
}
