/* "Your piece" (look-menu.js): the chip in the bar that shows the player's own piece, and the
   sheet to choose a character and a colour. The bar and the sheet's frame are lobby.css and
   rooms.css. The chip sits after the walking buttons, so the corner at the top keeps the width it
   has always had and covers no more of the posters. */

.look-btn {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1d130e;
  border: 2px solid #5a4030;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.look-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.look-btn .look-face {
  display: grid;
  place-items: center;
  width: 30px;
  height: 36px;
  margin-top: 2px;
}
.look-btn .look-face svg {
  display: block;
}
/* An upright phone has no room for it in the row of buttons: it sits at the left end of the line
   of words above them, which is centred and short. */
@media (orientation: portrait) and (max-width: 560px) {
  .hud-player .bar-player .look-btn {
    position: absolute;
    top: 10px;
    left: max(2vw, env(safe-area-inset-left));
  }
  /* The words keep clear of it on both sides, so they stay centred. */
  .hud-player .bar-player:has(.look-btn) .status {
    padding: 0 52px;
  }
}
/* During a game the piece cannot be changed, so the chip goes, as Rooms does. */
#app.staged .look-btn {
  display: none;
}

.sheet.picker.look-sheet {
  width: min(100%, 560px);
  gap: 10px;
}
.look-sheet > .plain {
  min-height: 44px;
}
.look-label {
  margin: 4px 0 0;
  font: 800 13px/1 var(--ui, inherit);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a5443;
}
.look-cast {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.look-card {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 8px 10px;
  border: 3px solid transparent;
  border-radius: 14px;
  background: #241511;
  color: #fbf3e2;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.look-card .look-pic {
  display: grid;
  place-items: end center;
  height: 100px;
}
.look-name {
  font-weight: 800;
  font-size: 16px;
}
.look-card[aria-pressed="true"] {
  border-color: #f4b453;
  background: #3a2418;
}
.look-colours {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* 44 pixels is the smallest tap target anywhere. */
.look-swatch {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid #1e1410;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.look-swatch[aria-pressed="true"] {
  outline: 3px solid #f4b453;
  outline-offset: 2px;
}
.look-any {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px 0 8px;
  border: 3px solid #1e1410;
  border-radius: 22px;
  background: #ecd9b9;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.look-any.on {
  outline: 3px solid #f4b453;
  outline-offset: 2px;
}
/* A little wheel of colours until a colour of the player's own is chosen; then that colour. */
.look-any-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #1e1410;
  background: conic-gradient(#e0352b, #f4c542, #3fa35a, #3aa9a0, #3b6fd0, #8a5bc4, #d9619a, #e0352b);
}
/* The device's own picker opens from the whole pill: the input covers it and is not drawn. */
.look-any input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.look-any:focus-within {
  outline: 3px solid #1e1410;
  outline-offset: 2px;
}
.look-card[aria-disabled="true"],
.look-swatch[aria-disabled="true"],
.look-any:has(input:disabled) {
  opacity: 0.5;
}
.look-sheet.waiting .look-cast,
.look-sheet.waiting .look-colours {
  opacity: 0.75;
}

/* A phone held sideways has little height: the two lists sit side by side and the pictures are smaller. */
@media (max-height: 520px) {
  .sheet.picker.look-sheet {
    width: min(100%, 720px);
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    column-gap: 16px;
    padding: 14px 16px;
  }
  .look-sheet .picker-head,
  .look-sheet .picker-why,
  .look-sheet > .plain {
    grid-column: 1 / -1;
  }
  .look-sheet .picker-head {
    grid-row: 1;
  }
  .look-sheet .picker-why {
    grid-row: 2;
  }
  .look-sheet > .plain {
    grid-row: 5;
  }
  .look-sheet .picker-title {
    font-size: 22px;
  }
  .look-sheet .look-label:nth-of-type(1) {
    grid-column: 1;
    grid-row: 3;
  }
  /* All four characters on one line: two lines of them would push the title off a sideways phone. */
  .look-sheet .look-cast {
    grid-column: 1;
    grid-row: 4;
    align-self: start;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 6px;
  }
  .look-sheet .look-card {
    padding: 6px 4px 8px;
  }
  .look-sheet .look-name {
    font-size: 14px;
  }
  .look-sheet .look-label:nth-of-type(2) {
    grid-column: 2;
    grid-row: 3;
  }
  .look-sheet .look-colours {
    grid-column: 2;
    grid-row: 4;
    align-self: start;
  }
  .look-card .look-pic {
    height: 70px;
  }
  .look-card .look-pic svg {
    height: 70px;
    width: auto;
  }
}
