/* styles.css is what the dice page adds to the shared theme
   (web/sdk/theme.css, docs/design/ui.md): the roll, the 0..100 scale with its
   win zone and marker, and the target/direction controls in the bet panel.
   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.
   app.js sets --from/--to on the zone and --x on the marker; the marker's
   600 ms travel (dial.js RollMS) is the transition below. */

[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);
}

.app > header .balance {
  margin-left: auto;
}

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

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

.dice-stage {
  display: grid;
  gap: var(--space-5);
  align-content: center;
  width: 100%;
  max-width: 560px;
  min-height: 280px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  box-sizing: border-box;
  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);
}

.big {
  margin: 0;
  text-align: center;
}

.roll {
  font-family: var(--font-mono);
  font-size: var(--fs-32);
  font-weight: 700;
  transition: color var(--dur) var(--ease);
}

.dice-stage.win .roll {
  color: var(--win);
}

.dice-stage.lose .roll {
  color: var(--lose);
}

.scale {
  position: relative;
  height: 16px;
  margin-bottom: var(--space-5);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--from, 50%);
  right: calc(100% - var(--to, 100%));
  background: var(--win);
  opacity: 0.55;
  border-radius: var(--radius);
  transition:
    left var(--dur-fast) var(--ease),
    right var(--dur-fast) var(--ease);
}

.marker {
  position: absolute;
  top: -8px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid var(--text);
  transform: translateX(calc(var(--x, 0px) - 8px));
  transition: transform 600ms var(--ease);
}

.dice-stage.still .marker,
.dice-stage.still .zone {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .marker,
  .zone,
  .roll {
    transition: none;
  }
}

.ticks {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-12);
  color: var(--muted);
}

.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;
}

/* ---- target and direction --------------------------------------------- */

.choice {
  display: grid;
  gap: var(--space-2);
}

.target-value {
  display: block;
  text-align: center;
  font-size: var(--fs-32);
  font-weight: 700;
}

.choice input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

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

.sides .btn {
  min-height: 48px;
  font-size: var(--fs-16);
  font-weight: 600;
}

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

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

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

@media (max-width: 767px) {
  .dice-stage {
    max-width: none;
    min-height: 220px;
  }
}

@media (max-width: 420px) {
  .app > header .btn {
    padding-inline: var(--space-2);
  }
}
