/*
 * Pulse's own surfaces: the chart with its side buttons docked to the right,
 * the leverage tabs, the first-run art and the provably-fair panel. The page
 * layout is /core/layout.css; the shared pieces
 * (money buttons included) are /core/kit.css. The values are wisdom-games'
 * Tailwind classes from x/XApp.tsx, written out.
 */

/* Pulse's petal: the brand word and the menu */
:root {
  --accent-color: var(--destructive);
}

/* ---- the board: the chart with the side buttons docked to its right ---- */

/* the side buttons' shadows reach past the board's edges */
.shell-board {
  overflow: visible;
}
.pulse-row {
  position: absolute;
  inset: 0 0 14px 0;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

/* THE plot frame: the borderless card the chart lives in */
.chart-wrap {
  position: relative;
  min-width: 0;
  flex: 1 1 0%;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.06));
}
.chart-host {
  position: absolute;
  inset: 0;
}

/* The lime glow over the plot follows the canvas washes' P&L grammar: only
   while money is down, pooling at the top for ▲ and at the bottom for ▼,
   where that player's money grows. */
.pulse-row--wash-up .chart-wrap {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--success) 20%, transparent), color-mix(in srgb, var(--success) 6%, transparent) 55%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.06));
}
.pulse-row--wash-down .chart-wrap {
  background:
    linear-gradient(0deg, color-mix(in srgb, var(--success) 20%, transparent), color-mix(in srgb, var(--success) 6%, transparent) 55%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.06));
}

/* the docked column: two halves, or one full-height cashout */
.pulse-sides {
  display: flex;
  width: 178px;
  min-width: 0;
  flex: none;
  flex-direction: column;
  gap: 10px;
}
.pulse-sides > button {
  min-height: 0;
  flex: 1 1 0%;
}
/* a disabled side lets the press through to the column, which answers with
   the error cue */
.pulse-side:disabled {
  pointer-events: none;
}

/* the side button: stake chip in the corner, arrow and BET, the max payout */
.action__chip {
  position: absolute;
  top: 8px;
  right: 10px;
  border-radius: 9999px;
  background: rgb(0 0 0 / 0.28);
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.action__value {
  display: flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}
/* the F7 triangle sits a touch smaller than the label */
.action__arrow {
  display: flex;
  align-items: center;
  font-size: 0.78em;
  line-height: 1;
}
.action__sub {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  opacity: 0.95;
}
.action__sub strong {
  font-weight: 700;
}

/* ---- the controls: leverage tabs over the stake rack ---- */

/* the config sleeps while a position is live: the round is bought */
.stake-rack.is-asleep {
  pointer-events: none;
  opacity: 0.45;
  filter: saturate(0.65);
}

/* one JOINED control: the 1px gaps between flat segments are the dividers;
   the active tier wears its accent at a 20% tint */
.levtabs {
  display: flex;
  gap: 1px;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.levtab {
  height: 48px;
  min-width: 0;
  flex: 1 1 0%;
  cursor: pointer;
  border: none;
  background: var(--accent);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 16px;
  transition:
    color 200ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.levtab:not(.is-on):enabled:hover {
  background: color-mix(in srgb, var(--accent) 70%, transparent);
}
.levtab:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
/* lime the calm rung, pumpkin the middle, petal the hot one */
.levtab.is-2 {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}
.levtab.is-5 {
  background: color-mix(in srgb, var(--attention) 20%, transparent);
  color: var(--attention);
}
.levtab.is-10 {
  background: color-mix(in srgb, var(--destructive) 20%, transparent);
  color: var(--destructive);
}

@media (max-width: 639.98px) {
  .action__value {
    font-size: 20px;
  }
  .action__sub {
    font-size: 13px;
  }
  .levtab {
    height: 36px;
    font-size: 14px;
  }
}
@media (max-width: 560px) {
  .pulse-sides {
    width: 128px;
  }
  .stake-rack {
    gap: 6px;
    margin: 8px 0 10px;
  }
}

/* a phone on its side: the controls sit beside the board */
@media (orientation: landscape) and (max-height: 500px) {
  .pulse-row {
    bottom: 0;
  }
  .stake-rack {
    margin-bottom: 0;
  }
  .pulse-sides {
    width: 128px;
  }
  /* the halves are short here: keep the label clear of the stake chip */
  .pulse-side {
    padding-top: 32px;
  }
}

/* ---- the first-run card wears Pulse's petal (kit.css draws it white) ---- */

.ftue__card {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--destructive) 35%, transparent),
    0 24px 64px rgba(0, 0, 0, 0.55);
}
.ftue__card::before {
  background-image: linear-gradient(to bottom, color-mix(in srgb, var(--destructive) 18%, transparent), transparent);
}
.ftue__cta,
.ftue__cta:hover {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.ftue__cta:hover {
  filter: brightness(1.05);
}

/* ---- the first-run art: miniatures of Pulse's own chrome ---- */

.art {
  display: flex;
  height: 96px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: var(--radius-xl);
  background: #141416;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08);
}
.art__sides {
  display: flex;
  height: 78%;
  width: 88%;
  gap: 6px;
}
.art__plot {
  flex: 1 1 0%;
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 0.06);
}
.art__col {
  display: flex;
  width: 40px;
  flex-direction: column;
  gap: 4px;
}
.art__up,
.art__down {
  display: flex;
  flex: 1 1 0%;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}
.art__up {
  background: linear-gradient(to bottom right, var(--success), var(--success-deep));
  color: var(--success-foreground);
}
.art__down {
  background: linear-gradient(to bottom right, var(--destructive), var(--destructive-deep));
  color: #fff;
}
.art__lev {
  display: flex;
  width: 88%;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.art__lev > div {
  height: 32px;
  flex: 1 1 0%;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  line-height: 32px;
}
.art__lev-2 {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}
.art__lev-5 {
  background: var(--accent);
  color: var(--foreground);
}
.art__lev-10 {
  background: color-mix(in srgb, var(--destructive) 20%, transparent);
  color: var(--destructive);
}
.art__cash {
  display: flex;
  height: 48px;
  width: 70%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  background: linear-gradient(to bottom right, var(--success), var(--success-deep));
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--success-foreground);
}
.art__cash span {
  font-size: 8px;
  font-weight: 700;
  opacity: 0.8;
}

/* ---- the provably-fair panel ---- */

.fair {
  padding-bottom: 4px;
}
.fair__how {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.625;
  color: #d7dae3;
}
.fair__plain {
  margin: 0;
  font-size: 13px;
  line-height: 1.625;
  color: var(--icon);
}
.fair__wait {
  border-radius: var(--radius-xl);
  background: rgb(255 255 255 / 0.05);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.625;
  color: var(--icon);
}
.fair__round {
  margin-bottom: 12px;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  padding-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
}
.fair__label {
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--icon);
}
.fair-hash {
  margin-bottom: 12px;
}
.fair-hash__value {
  user-select: all;
  -webkit-user-select: all;
  word-break: break-all;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 10px;
  background: rgb(255 255 255 / 0.05);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--heading);
}
.fair__btn {
  margin-top: 4px;
  width: 100%;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--primary);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-foreground);
}
.fair__btn:disabled {
  opacity: 0.6;
}
.fair__btn--retry {
  margin-top: 12px;
}
.fair__error,
.fair__verdict {
  margin-top: 12px;
  border: 1px solid;
  border-radius: var(--radius-xl);
  padding: 10px 14px;
  font-family: var(--font-mono);
}
.fair__error {
  border-color: color-mix(in srgb, var(--destructive) 35%, transparent);
  background: color-mix(in srgb, var(--destructive) 12%, transparent);
  font-size: 13px;
  color: var(--destructive);
}
.fair__verdict {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
}
.fair__verdict.is-ok {
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}
.fair__verdict.is-bad {
  border-color: color-mix(in srgb, var(--destructive) 35%, transparent);
  background: color-mix(in srgb, var(--destructive) 12%, transparent);
  color: var(--destructive);
}
.fair__verdict-txt {
  margin: 8px 0 12px;
  font-size: 13px;
  line-height: 1.625;
  color: var(--icon);
}
.fair-replay {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fair-replay__cell {
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 10px;
  background: rgb(255 255 255 / 0.05);
  padding: 8px 10px;
}
.fair-replay__label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--icon);
}
.fair-replay__price {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
}
.fair-replay__price em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-hover);
}
.fair-replay__note {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--icon);
}
.fair__scope {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--icon);
}
