/*
 * The two column shell with the room on the left, the marker, the profile
 * panel, and the corrections the board needed once real artwork arrived.
 */

/* ----------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  max-width: 1540px;
  margin: 0 auto;
  padding: 14px 14px 0;
  align-items: start;
}

/* Folded away, the room becomes a rail and the board takes the width. */
.shell.chat-hidden {
  grid-template-columns: 42px minmax(0, 1fr);
}

.shell .stage {
  padding: 0;
  max-width: none;
  min-width: 0;
}

/* ------------------------------------------------------------------ chat */

.chat {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: calc(100vh - 58px - 28px);
  position: sticky;
  top: 72px;
  overflow: hidden;
}

.shell.chat-hidden .chat {
  display: none;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 13px;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.chat-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.chat-toggle,
.chat-open {
  border: 1px solid var(--line-2);
  background: var(--bg-deep);
  color: var(--text-faint);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 6px 8px;
}

.chat-toggle:hover,
.chat-open:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

/* The rail that brings it back. */
.chat-open {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  height: 120px;
}

.chat-open-label {
  writing-mode: vertical-rl;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.message {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.message .body {
  min-width: 0;
}

.message .who {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-right: 6px;
}

.message.mine .who {
  color: var(--gold);
}

.message .said {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.message .at {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
}

.chat-empty {
  margin: auto;
  padding: 20px 0;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

.chat-form {
  display: flex;
  gap: 7px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-deep);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.chat-form input:focus {
  border-color: var(--gold-dark);
}

.chat-form .button {
  height: 36px;
}

/* ---------------------------------------------------------------- faces */

/*
 * A face is the player's own picture when they have uploaded one, and a
 * coloured disc with their initials when they have not. Nothing is ever
 * drawn from a third party, and an image that fails to load falls back to the
 * disc rather than leaving a broken frame.
 */
.face {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #0a0f18;
  user-select: none;
}

.face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.face.large {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

/* -------------------------------------------------------------- profile */

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-head .who {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.profile-head .name {
  font-size: 17px;
  font-weight: 600;
}

.profile-head .address {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
}

.photo-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.photo-row input[type='file'] {
  display: none;
}

/* ---------------------------------------------------- the wheel marker */

.wheel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 8px;
}

.wheel-head .phase {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.wheel-head .clock {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}

.wheel-head .clock.small {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}

/*
 * The marker: a thin line with an arrow at each end, and nothing else. The
 * coin under it is never covered.
 */
.marker {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(
    180deg,
    rgba(245, 185, 66, 0) 0%,
    var(--gold) 12%,
    var(--gold) 88%,
    rgba(245, 185, 66, 0) 100%
  );
  z-index: 4;
  pointer-events: none;
}

.marker::before,
.marker::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.marker::before {
  top: -2px;
  border-top: 8px solid var(--gold);
}

.marker::after {
  bottom: -2px;
  border-bottom: 8px solid var(--gold);
}

/* ---------------------------------------------- coins that carry artwork */

/*
 * The dice used to be lifted and enlarged here to fill its circle. It is the
 * one piece of artwork that is not already a coin, so board.css gives it a
 * painted coin of its own instead and sits it inside; enlarging it as well
 * pushed it over the edge.
 */

/* ------------------------------------------------------- footer, brand */

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
}

.footer-brand .brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.footer-brand p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
}

.footer-live {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.footer-top {
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(120px, 1fr));
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .shell,
  .shell.chat-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat {
    position: static;
    height: 380px;
    order: 2;
  }

  .chat-open {
    position: static;
    flex-direction: row;
    height: auto;
    width: fit-content;
  }

  .chat-open-label {
    writing-mode: horizontal-tb;
  }

  .shell .stage {
    order: 1;
  }
}

@media (max-width: 860px) {
  .footer-top {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

/*
 * The account menu.
 *
 * Anchored to the chip, compact, and scrollable inside itself rather than
 * pushing the page around. A menu that grows past the bottom of the window is
 * a menu whose last item cannot be reached.
 */
.account-menu {
  min-width: 180px;
  padding: 5px;
  max-height: min(60vh, 380px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.account-menu button {
  padding: 8px 10px;
  line-height: 1.2;
  font-size: 13px;
}

.account-menu hr {
  margin: 4px 2px;
}

#daily {
  font-weight: 600;
}


/* ==========================================================================
 * Room and board together
 *
 * The room used to take its width out of the board, which left the wheel
 * squeezed on a laptop. Now the board keeps a floor of its own and the room
 * folds itself away when there is not enough glass for both.
 */

.shell {
  grid-template-columns: 300px minmax(680px, 1fr);
  max-width: 1720px;
}

.shell.chat-hidden {
  grid-template-columns: 40px minmax(680px, 1fr);
}

@media (max-width: 1320px) {
  .shell {
    grid-template-columns: 260px minmax(560px, 1fr);
  }
}

/* ---------------------------------------------------------- the boxes */

/*
 * The whole header is the button.
 *
 * A bet is the one thing a player comes here to do, and asking them to hit a
 * word rather than a panel is the kind of detail that reads as broken.
 */
.box-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background 120ms ease;
}

.box-head:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
}

.box-head:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.box-place {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--tint-edge, var(--text));
  line-height: 1.05;
}

.box.solana .box-place {
  color: var(--solana);
}

.box.robinhood .box-place {
  color: var(--robinhood);
}

.box.dice .box-place {
  color: var(--gold);
}

.box-coin {
  width: 40px;
  height: 40px;
}

/* A side you are on this round, and the moment a bet lands on it. */
.box.backed {
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.box.just-bet {
  animation: bet-landed 700ms ease;
}

@keyframes bet-landed {
  0% {
    box-shadow: inset 0 0 0 2px var(--gold);
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
  }
}

/* The amount field asking to be filled in, rather than an error about it. */
.bet-input.asking {
  border-color: var(--gold);
  animation: asking 900ms ease;
}

@keyframes asking {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}

/* ==========================================================================
 * The room floats over the board
 *
 * Opening the chat used to take a column out of the grid, which moved the
 * wheel and resized every coin on it. Now it slides in over the page instead:
 * the board keeps its size and its position whether the room is open or shut,
 * and on a wide screen the panel sits in the margin that was empty anyway.
 *
 * The rail that brings it back is pinned to the same edge, so the control does
 * not move either.
 */

.shell {
  display: block;
  max-width: 1720px;
  margin: 0 auto;
  padding: 14px 14px 0;
}

.chat {
  position: fixed;
  left: 12px;
  top: 104px;
  bottom: 16px;
  width: 320px;
  height: auto;
  z-index: 40;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  transform: translateX(0);
  opacity: 1;
  transition:
    transform 220ms ease,
    opacity 180ms ease;
}

/* Shut, it is parked off the left edge rather than deleted. */
.shell.chat-hidden .chat {
  display: flex;
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
  pointer-events: none;
}

.chat-open {
  position: fixed;
  left: 0;
  top: 46%;
  z-index: 41;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.shell .stage {
  padding: 0;
  max-width: none;
  min-width: 0;
}

@media (max-width: 1180px) {
  .chat {
    position: fixed;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 8px;
    width: auto;
    height: 52vh;
    order: 0;
  }

  .chat-open {
    position: fixed;
    left: 8px;
    bottom: 8px;
    top: auto;
    flex-direction: row;
    height: auto;
    width: fit-content;
    border-radius: var(--radius);
  }
}

/*
 * Open, the room makes room.
 *
 * Floating over the board kept the game the same size but hid a third of it,
 * which is not "still being in the game". So the board is pushed across by
 * exactly the width of the panel instead. Nothing is covered and nothing is
 * cut: the wheel simply shows fewer coins either side of the marker, and the
 * grid of games drops from four cards a row to three.
 *
 * The board has no minimum width anywhere, which is what makes this safe. A
 * floor here is what once pushed the whole page sideways.
 */
.shell {
  padding-left: 346px;
  transition: padding-left 220ms ease;
}

.shell.chat-hidden {
  padding-left: 46px;
}

@media (max-width: 1180px) {
  .shell,
  .shell.chat-hidden {
    padding-left: 14px;
  }
}

/*
 * The footer moves with the board.
 *
 * It sits outside the shell, so without this the open panel covered the first
 * column of links. It is a sibling, which is all the selector needs.
 */
.site-footer {
  padding-left: 346px;
  transition: padding-left 220ms ease;
}

.shell.chat-hidden ~ .site-footer {
  padding-left: 46px;
}

@media (max-width: 1180px) {
  .site-footer,
  .shell.chat-hidden ~ .site-footer {
    padding-left: 16px;
  }
}
