/* Easy mode (BuilderEasyMode): the header's Easy / Full switch, and the tile
   browser that takes the asset panel's place. */

/* Easy / Full switch: two options in one rounded control, on the left of
   the toolbar after its buttons. When the toolbar folds (a phone) it folds
   into the hamburger menu with them (builder.css), at the top of the menu,
   so the game name keeps the middle of the bar. */
.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  margin-left: var(--space-2);
  background: var(--color-background);
  border: var(--border-width) var(--border-style) var(--color-border);
  border-radius: var(--radius-sm);
}

.mode-switch-option {
  height: 25px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-dark);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.mode-switch-option.active {
  background: var(--color-accent);
  color: var(--color-text);
}

:where(html[data-pointer='mouse']) .mode-switch-option:not(.active):hover {
  color: var(--color-text);
}

/* The switch's copy in the hamburger menu: the menu's full width, inset
   --space-1 on every side -- tighter than an item's --space-2 padding, so
   the switch reads as one wide control rather than a row of text; the
   options a finger's size */
.mode-switch-menu {
  display: flex;
  margin: var(--space-1);
}

.mode-switch-menu .mode-switch-option {
  flex: 1;
  height: var(--height-input);
  font-size: var(--font-size);
}

/* The tile browser replaces the asset list and its search footer (its own
   search sits in a footer of the same kind, at the bottom as in Full mode) */
.panel-assets.easy .panel-assets-content,
.panel-assets.easy > .panel-assets-footer {
  display: none;
}

.panel-tiles {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-tiles[hidden] {
  display: none;
}

/* The breadcrumb row and the grid, above the search footer */
.panel-tiles-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
}

/* The breadcrumb, with the checkbox that picks the tiles shown at its
   right (BuilderPanelTiles) */
.panel-tiles-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.panel-tiles-bar .find-breadcrumb-bar {
  flex: 1;
  min-width: 0;
}

/* A tile card is dragged onto the map, or tapped to pick it for painting.
   On touch a picked card, or one held still, drags; a swipe on any other
   scrolls the browser (BuilderEasyDrag); the hold shows no iOS callout. */
.panel-tiles-card {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-touch-callout: none;
}

/* A placed tile is being carried: the browser takes it back (deletes it).
   Hot while the pointer is over it. */
.panel-tiles.drop-delete {
  outline: 2px dashed var(--color-border-light);
  outline-offset: -2px;
}

.panel-tiles.drop-hot {
  outline-color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 15%, transparent);
}

/* The grid's own ground would hide that tint */
.panel-tiles.drop-hot .panel-tiles-grid {
  background: color-mix(in srgb, var(--color-error) 15%, var(--color-background));
}

/* The tile menu: the tiles' name over Rotate, Flip and Delete, floating
   over the selected tiles (BuilderEasyTileMenu sets its transform each
   frame). Clatter Lab's piece menu, in the builder's tokens. */
.easy-tile-menu {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-surface);
  border: var(--border-width) var(--border-style) var(--color-accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-drop);
  white-space: nowrap;
  touch-action: manipulation;
  z-index: var(--z-panel-chrome);
}

.easy-tile-menu[hidden] {
  display: none;
}

/* A long name stops at 200px and ends in "...". A line under it, the
   menu's full width, parts it from the buttons. */
.easy-tile-menu-name {
  align-self: stretch;
  max-width: 200px;
  padding-bottom: var(--space-1);
  border-bottom: var(--border-width) var(--border-style) var(--color-border);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.easy-tile-menu-name:has(span:empty) {
  display: none;
}

/* A shared name is clicked to rename the tiles */
.easy-tile-menu-name .editable {
  cursor: text;
}

.easy-tile-menu-name .form-inst-rename {
  width: 100%;
  text-align: center;
}

.easy-tile-menu-buttons {
  display: flex;
  gap: var(--space-1);
}

/* Easy mode's switches, in the preview's lower left (BuilderEasyMode): Pan
   or Select, showing the one in use; then, while painting, Random, on or
   off. On ones show in the link colour (.active). The group adds no box
   of its own: its buttons sit in the toolbar's row, spaced as its others
   are. */
.easy-tools {
  display: contents;
}

.easy-tools[hidden] {
  display: none;
}

/* Painting places on the square under the pointer: a brush with a small
   crosshair at its tip, as Photoshop's are, and the click point at the
   crosshair's centre (4 20). Drawn 24px, near the system arrow's size.
   White with a black outline, so it shows on any ground; a cursor image
   cannot read the theme's tokens. Crosshair where an image cursor is not
   drawn. None of the map's cursors show in play. */
.panel-preview:not(.play-mode) .preview-canvas-container.easy-placing {
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 32 32'%3E%3Cg transform='translate(6 0.5) scale(0.8)'%3E%3Cpath d='M28.5 3.5 18 14' stroke='black' stroke-width='7' stroke-linecap='round'/%3E%3Cpath d='M28.5 3.5 18 14' stroke='white' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M15 13.5 18.5 17Q18 26 3 29Q6 15 15 13.5Z' fill='white' stroke='black' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M14.5 16.5Q10 20 7 25.5' stroke='black' stroke-width='1' fill='none' stroke-linecap='round'/%3E%3C/g%3E%3Cpath d='M5.33 23.17v7M1.83 26.67h7' stroke='white' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M5.33 23.17v7M1.83 26.67h7' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E")
      4 20,
    crosshair;
}

/* With nothing picked, the map shows what a drag off a tile does: Pan's
   open hand (closed while the map or a tile is held: html.cursor-grabbing
   in style.css), or Select's crosshair for its box. Over a tile, the
   pointing hand, as Full mode shows over a model: a click selects it. */
.panel-preview:not(.play-mode) .preview-canvas-container.easy-pan {
  cursor: grab;
}

.panel-preview:not(.play-mode) .preview-canvas-container.easy-select {
  cursor: crosshair;
}

.panel-preview:not(.play-mode) .preview-canvas-container.easy-over-tile {
  cursor: pointer;
}

/* Painting skips a square whose tile was changed since it was placed
   (BuilderEasyDrag): the pointer says so before the stroke does */
.panel-preview:not(.play-mode) .preview-canvas-container.easy-placing.easy-paint-skips {
  cursor: not-allowed;
}

/* The cards picked for painting */
.panel-tiles-card.picked {
  border-color: var(--color-accent);
  border-width: 3px;
}
