/* styles.css is what the coin flip page adds to the shared theme
   (web/sdk/theme.css, docs/design/ui.md), after the mines page (G700): the
   coin, its stage and the two side buttons. The header, the bet panel, the
   toast, the history, the fairness panel and the layout are the theme's;
   colours, durations and radii are its tokens. The coin is CSS 3D: app.js
   sets its rotateY to coin.js's stopAngle for the side the server sent and
   the transition takes --dur-slow. */

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-16);
  line-height: var(--lh);
}

h1,
h2 {
  margin: 0;
}

.side h2 {
  font-size: var(--fs-14);
  color: var(--muted);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

/* The header carries Exit after "Fairness": the balance and both buttons
   sit together on the right. */
.app > header .balance {
  margin-left: auto;
}

/* ---- board ------------------------------------------------------------ */

.board {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.coin-stage {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: radial-gradient(ellipse at center, var(--panel-2) 0%, var(--panel) 70%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  perspective: 900px;
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.coin-stage.win {
  border-color: var(--win);
  box-shadow: 0 0 var(--space-5) var(--win);
}

.coin-stage.lose {
  border-color: var(--lose);
}

.coin {
  position: relative;
  width: min(45%, 220px);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transform: rotateY(var(--angle, 0deg));
  transition: transform var(--dur-slow) var(--ease);
}

.coin .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.coin .face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.coin .tails {
  transform: rotateY(180deg);
}

.result {
  margin: 0;
  min-height: 1.5em;
  text-align: center;
  font-size: var(--fs-20);
  font-weight: 600;
}

.error {
  margin: 0;
  color: var(--lose);
  text-align: center;
}

.notice {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent-2);
}

.closed {
  text-align: center;
}

/* ---- side buttons ----------------------------------------------------- */

.sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.sides .btn {
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  min-height: 88px;
  padding: var(--space-2);
  font-size: var(--fs-16);
  font-weight: 600;
}

.sides .btn img {
  width: 40px;
  height: 40px;
}

.sides .btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- widths ----------------------------------------------------------- */

@media (max-width: 767px) {
  .coin-stage {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .sides .btn {
    min-height: 64px;
  }

  .sides .btn img {
    width: 28px;
    height: 28px;
  }

  .app > header .btn {
    padding-inline: var(--space-2);
  }
}
