/* ─── Tokens (ported from the original app.css) ─────────────────────────────── */
:root {
  --Text-Accent-Lime: #dbfe02;
  --dark-grey: #171a1e;
  --color-grey: #b9c7d4;
  --border-radius: 5px;
  --primary-color: linear-gradient(
    104deg,
    #dbfe02 2.24%,
    #caff19 15.93%,
    #b8ff28 30.59%,
    #a5ff36 44.28%,
    #91ff42 57.97%,
    #7cff4e 71.65%,
    #63ff5a 86.31%,
    #4f6 100%
  );
  --background-one: linear-gradient(102deg, #363d43 1.91%, #282d32 102.78%), #22262b;
  --background-two: linear-gradient(0deg, rgba(34, 38, 43, 0.6) 0%, rgba(34, 38, 43, 0.6) 100%),
    linear-gradient(104deg, #363d43 1.86%, #282d32 100%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  color: var(--color-grey);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  min-height: 100vh;
  background: url('/assets/bg.jpg') #171a1e 50% / cover no-repeat;
  background-attachment: fixed;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}
button:not(:disabled) {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ─── Page layout ──────────────────────────────────────────────────────────────── */
.page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.game-card {
  width: 100%;
  max-width: 1100px;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
}

.layout {
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .layout {
    flex-direction: row;
  }
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────────── */
aside#sidebar {
  width: 100%;
}
@media (min-width: 1024px) {
  aside#sidebar {
    width: 320px;
    flex: 0 0 320px;
  }
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 12px;
  box-shadow: 0 5px 10px 5px rgba(0, 0, 0, 0.4);
  background: var(--background-one);
  border-radius: var(--border-radius);
  border: 1px solid rgba(70, 79, 89, 0.6);
}

.field {
  position: relative;
}

.row {
  display: flex;
}
.gap1 {
  gap: 4px;
}
.flex1 {
  flex: 1;
}
.relative {
  position: relative;
}

.background-two {
  background: var(--background-two);
}
.b-radius {
  border-radius: var(--border-radius);
}
.content-mode {
  padding: 6px;
}

.prime-label {
  display: block;
  color: #b9c7d4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.55px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Buttons */
.bt {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: var(--border-radius);
  color: var(--color-grey);
  transition: background 0.12s, color 0.12s;
}
.button-selectable {
  height: 36px;
}
.button-selectable:hover:not(:disabled) {
  background: rgba(70, 79, 89, 0.6);
}
.button-selectable.active,
.button-selectable:active:not(:disabled) {
  background: var(--primary-color);
  color: var(--dark-grey);
}
.bt-mode.active {
  background: rgba(70, 79, 89, 0.6);
  color: var(--Text-Accent-Lime);
}

.button-drop-ball {
  background: var(--primary-color);
  color: var(--dark-grey);
  height: 40px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--border-radius);
}
.button-drop-ball:hover:not(:disabled) {
  filter: brightness(1.05);
}
.button-drop-ball.autobet {
  background: #eab308;
  color: var(--dark-grey);
}

/* Bet amount */
.bet-amount-content {
  background: var(--background-two);
  border-radius: var(--border-radius);
  padding: 6px;
  height: 46px;
  overflow: hidden;
  display: flex;
}
.bet-amount-content-input {
  position: relative;
  flex: 1;
}
.bet-amount-content-input input {
  padding-left: 36px;
  outline: none;
  height: 100%;
  width: 100%;
  color: #fff;
  font-size: 13px;
}
.bet-amount-content-input .coin {
  position: absolute;
  top: 50%;
  left: 6px;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
}
.bet-amount-content-input .coin img {
  width: 18px;
  height: 18px;
}
.bet-amount-content button {
  border-radius: 5px;
  background: rgba(70, 79, 89, 0.6);
  flex: 1;
  max-width: 32px;
  height: 32px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-grey);
}
.bet-amount-content button:last-child {
  margin-left: 6px;
}
.bet-amount-content button:active:not(:disabled) {
  background: var(--primary-color);
  color: var(--dark-grey);
}

/* Number inputs */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
  border-radius: var(--border-radius);
  background: var(--background-two);
  border: none;
  height: 100%;
}
input.error {
  outline: 1px solid #ef4444;
}

.field-error {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.25;
  color: #f87171;
  min-height: 14px;
}
.balance-text {
  margin: 4px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

/* Risk */
.risk-row {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: var(--border-radius);
  background: var(--background-two);
}
.risk-row .button-selectable {
  padding: 8px 12px;
  font-size: 13px;
}

/* Select */
.select-wrap {
  position: relative;
}
.ui-select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 40px 8px 12px;
  font-size: 14px;
  appearance: none;
  border: 1px solid rgba(70, 79, 89, 0.6);
  border-radius: var(--border-radius);
  background: var(--background-two);
  color: #fff;
  cursor: pointer;
  transition: border-color 0.12s;
}
.ui-select:hover:not(:disabled),
.ui-select:focus {
  border-color: rgba(185, 199, 212, 0.5);
}
.ui-select:focus {
  outline: none;
  color: var(--Text-Accent-Lime);
}
.ui-select option {
  color: #fff;
  background: #22262b;
}
.select-wrap .caret {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  pointer-events: none;
  color: #64748b;
  display: flex;
}

/* Auto bet infinity hint */
.infinity {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: #94a3b8;
  font-weight: 700;
  pointer-events: none;
}
#autoBetInput {
  width: 100%;
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  color: #fff;
  border: 2px solid #475569;
}

/* ─── Board ─────────────────────────────────────────────────────────────────────── */
.board-area {
  position: relative;
  flex: 1;
}
.board-col {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 16px;
}
.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 760 / 570;
}
.board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border: 6px solid rgba(100, 116, 139, 0.3);
  border-top-color: #64748b;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Bins */
.bins {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 28px;
}
.bins-inner {
  display: flex;
  gap: 1%;
}
.bin {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  border-radius: 6px;
}
@media (max-width: 1023px) {
  .bins {
    height: 14px;
  }
  .bin {
    font-size: 8px;
  }
}

/* Last wins */
.lastwins-pos {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
}
.last-wins {
  display: flex;
  flex-direction: column;
  width: 48px;
  overflow: hidden;
  border-radius: 6px;
  font-size: 14px;
}
.last-win {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
@media (max-width: 1023px) {
  .last-wins {
    width: 28px;
    font-size: 9px;
  }
}

/* ─── Modals ────────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}
.modal {
  width: 100%;
  max-width: 420px;
  margin: 20px;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #1f2937;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
.modal h2 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}
.modal p {
  margin: 8px 0 0;
  font-size: 14px;
  color: #d1d5db;
}
.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}
.modal-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}
.modal-actions button:hover {
  background: #3b82f6;
}
