:root {
  --bg: #050711;
  --card-bg: #101522;
  --accent: #56ccf2;
  --accent-strong: #2f80ed;
  --danger: #ff4b6a;
  --success: #41f19a;
  --text-main: #f5f7ff;
  --text-muted: #8b92b8;
  --border-soft: rgba(255, 255, 255, 0.06);
  --radius-xl: 24px;
  --radius-pill: 999px;
  --transition-med: 0.3s ease-out;
  --content-max-width: min(94%, 460px);
}

/* RESET */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top, #171c3b 0, #050711 55%, #020308 100%);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100dvh;
}

/* APP SHELL */

.app-shell {
  width: min(430px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  padding: 10px;
  border-radius: 40px;
  background: radial-gradient(circle at top left, #2b2f4a, #050711 55%);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.03),
    0 18px 60px rgba(0, 0, 0, 0.9);
  position: relative;
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 20px;
  border-radius: 0 0 20px 20px;
  background: rgba(0, 0, 0, 0.7);
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 30px;
  background: radial-gradient(circle at top, #171c3b 0, #080a16 55%, #05050b 100%);
  overflow: hidden;
  padding: 48px 14px 16px;
  padding-top: calc(48px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

.btn-withdraw-all {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #8b1e3f);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  z-index: 30;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-withdraw-all:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
}

/* SCREENS */

.screen {
  position: absolute;
  inset: 0;
  padding: 28px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity var(--transition-med),
    transform var(--transition-med);
  padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)); /* leave room for in-shell nav */
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ========== THEME COLORS FOR EACH STEP ========== */

.theme-stake .bubble-field {
  background:
    radial-gradient(circle at top, rgba(86, 204, 242, 0.28), transparent 55%),
    radial-gradient(circle at bottom, rgba(144, 224, 239, 0.16), transparent 60%),
    #050713;
}

.theme-leverage .bubble-field {
  background:
    radial-gradient(circle at top, rgba(255, 159, 67, 0.3), transparent 55%),
    radial-gradient(circle at bottom, rgba(255, 71, 87, 0.2), transparent 60%),
    #050713;
}

.theme-sl .bubble-field {
  background:
    radial-gradient(circle at top, rgba(255, 75, 106, 0.35), transparent 55%),
    radial-gradient(circle at bottom, rgba(255, 107, 129, 0.24), transparent 60%),
    #050713;
}

.theme-tp .bubble-field {
  background:
    radial-gradient(circle at top, rgba(65, 241, 154, 0.32), transparent 55%),
    radial-gradient(circle at bottom, rgba(120, 255, 180, 0.22), transparent 60%),
    #050713;
}

.theme-platform .bubble-field {
  background:
    radial-gradient(circle at top, rgba(181, 126, 255, 0.34), transparent 55%),
    radial-gradient(circle at bottom, rgba(116, 185, 255, 0.22), transparent 60%),
    #050713;
}

/* HEADER */

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-orb {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background:
    conic-gradient(from 210deg, #2f80ed, #56ccf2, #41f19a, #f2994a, #2f80ed);
  padding: 2px;
  box-shadow:
    0 0 40px rgba(47, 128, 237, 0.65),
    0 0 55px rgba(65, 241, 154, 0.55);
}

.logo-orb.small {
  width: 46px;
  height: 46px;
}

.logo-orb.danger {
  background:
    conic-gradient(from 210deg, #ff4b6a, #ffc371, #ff9a9e, #ff4b6a);
}

.logo-orb.success {
  background:
    conic-gradient(from 210deg, #41f19a, #56ccf2, #a7ff83, #41f19a);
}

.logo-orb-inner {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 10%, #3a78ff, #050814 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 10px;
  color: var(--text-main);
}

/* BUBBLE FIELD */

.bubble-field {
  margin-top: 18px;
  flex: 1 1 auto;
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 12px;
  justify-items: center;
  align-items: center;
  z-index: 1;
  min-height: 320px;
}

/* grid decoration */
.bubble-field::before {
  content: "";
  position: absolute;
  inset: -30%;
  background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 0.5px, transparent 0);
  background-size: 22px 22px;
  opacity: 0.25;
  pointer-events: none;
}

.ai-field {
  position: relative;
}
.market-chart-shell {
  position: relative;
}


.step-footer {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  padding-bottom: 32px;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

/* ========== BUBBLE STYLE (with one-time drop + idle float) ========== */

.bubble-choice {
  position: relative;
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  padding: 4px;
  z-index: 2;
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    filter 0.18s ease-out;
  animation:
    dropInOnce 0.6s ease-out,
    floatIdle 4s ease-in-out infinite 0.6s;
}
.bubble-choice.selected {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.75), 0 0 20px rgba(255,255,255,0.4);
  transform: scale(1.03);
}

.theme-stake .bubble-choice {
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.9), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(86,204,242,0.95), transparent 50%),
    rgba(27,35,66,0.95);
}

.theme-leverage .bubble-choice {
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.9), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(255,183,77,0.95), transparent 50%),
    rgba(60,25,40,0.95);
}

.theme-sl .bubble-choice {
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.9), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(255,118,140,0.95), transparent 50%),
    rgba(75,10,26,0.95);
}

.theme-tp .bubble-choice {
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.9), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(120,255,180,0.95), transparent 50%),
    rgba(12,60,40,0.95);
}

.theme-platform .bubble-choice {
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.9), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(181,126,255,0.95), transparent 50%),
    rgba(50,25,80,0.95);
}

/* ghost bubble */
.bubble-ghost {
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,0.7), transparent 55%),
    rgba(25,30,50,0.9) !important;
}

/* click feedback */
.bubble-choice:active {
  transform: translateY(2px) scale(0.96);
}

/* LABEL */
.bubble-label {
  text-shadow: 0 0 8px rgba(0,0,0,0.7);
}

/* SUMMARY BUBBLES */

.summary-bubbles {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.summary-inline {
  flex-wrap: nowrap;
  justify-content: space-between;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
}
.summary-inline::-webkit-scrollbar { display: none; }

.summary-bubble {
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(15, 20, 35, 0.95);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-inline .summary-bubble {
  flex: 1;
  min-width: 86px;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  white-space: nowrap;
}

/* summary color accents */
.summary-stake     { background: radial-gradient(circle, rgba(86,204,242,0.6), transparent 70%); }
.summary-leverage  { background: radial-gradient(circle, rgba(255,159,67,0.6), transparent 70%); }
.summary-sl        { background: radial-gradient(circle, rgba(255,75,106,0.6), transparent 70%); }
.summary-tp        { background: radial-gradient(circle, rgba(65,241,154,0.6), transparent 70%); }
.summary-platform  { background: radial-gradient(circle, rgba(181,126,255,0.6), transparent 70%); }

.summary-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
}

.summary-value {
  font-size: 13px;
  font-weight: 700;
}

/* BUTTONS */

.summary-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-inline-actions {
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
}

.summary-inline-actions button {
  flex: 1;
  min-width: 0;
  height: 42px;
  white-space: nowrap;
}

.wallet-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.wallet-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wallet-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255, 75, 106, 0.08);
  transition: background var(--transition-med), box-shadow var(--transition-med);
}

.wallet-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wallet-status-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.wallet-status-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.wallet-panel-actions {
  display: flex;
  gap: 10px;
}

.wallet-balance {
  margin: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.wallet-panel-actions button {
  flex: 1;
}

.wallet-deposit {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-deposit-title {
  font-weight: 700;
  font-size: 13px;
}

.wallet-deposit-addr {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
  margin-top: -4px;
}

.wallet-deposit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deposit-input-wrap {
  position: relative;
  width: 100%;
}

.deposit-input {
  width: 100%;
  height: 44px;
  padding-right: 52px;
  padding-left: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
  color: var(--text-main);
  -moz-appearance: textfield;
}

.deposit-input::-webkit-outer-spin-button,
.deposit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.deposit-input-wrap::after {
  content: "USDC";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
}

.wallet-deposit-form .btn-primary {
  height: 44px;
  border-radius: 12px;
  width: 100%;
  padding: 0 12px;
  justify-content: center;
  text-align: center;
}

.wallet-deposit-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.wallet-deposit-guide {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deposit-guide-quick {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
}

.guide-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e8ecff;
}
.guide-line::before {
  content: "•";
  color: var(--text-muted);
  font-weight: 700;
}

.guide-status {
  color: var(--text-muted);
  padding: 0 2px;
}

.progress-track {
  display: none;
}

.deposit-guide-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: nowrap;
}

#deposit-countdown {
  flex: 1;
}

#deposit-refresh-btn {
  width: auto;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}

.fees-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 6px;
}

.fees-row #btn-pay-fees {
  width: auto;
  padding: 10px 14px;
  border-radius: 12px;
}

.wallet-deposit-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.wallet-deposit-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-primary,
.btn-ghost {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(120deg, #ff9ff3, #54a0ff, #5f27cd);
  color: #050711;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}

/* STATUS */
.summary-status {
  margin-top: 6px;
  text-align: center;
  font-size: 11px;
}

/* Summary flow cards */
.progress-ribbon {
  display: flex;
  gap: 8px;
  margin: 10px 0 6px;
}

.ribbon-step {
  flex: 1;
  text-align: center;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
}

.ribbon-step.active {
  color: var(--text-main);
  border-color: rgba(255,255,255,0.2);
  background: linear-gradient(120deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
}

.summary-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
}

.summary-card {
  border: none;
  background: transparent;
}

.summary-card-header {
  display: none;
}

.summary-card-chevron {
  transition: transform 0.2s ease;
}

.summary-card.open .summary-card-chevron {
  transform: rotate(180deg);
}

.summary-card-body {
  display: none;
  padding: 0;
}

.summary-card.open .summary-card-body {
  display: block;
}

/* ========== ANIMATIONS ========== */

/* 1) One-time DROP only when entering screen */
@keyframes dropInOnce {
  0% { transform: translateY(-40px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* 2) Smooth idle floating (no more drop) */
@keyframes floatIdle {
  0%   { transform: translateY(2px); }
  50%  { transform: translateY(-4px); }
  100% { transform: translateY(2px); }
}


/* ===============================
   GAME SCREEN (CANDLE MODE)
================================ */

.theme-game {
  background: radial-gradient(circle at top, #2b2f4a, #080a16 60%, #05050b);
}

.game-layout {
  flex: 1;
  display: grid;
  grid-template-rows: 4% 71% minmax(0, 4%) minmax(0, 8.5%);
  gap: 0;
  min-height: 0;
  width: 100%;
}
.game-layout > * {
  width: 100%;
  min-height: 0;
}
.game-layout > .pnl-header,
.game-layout > .chart-zone,
.game-layout > .command-zone,
.game-layout > .basket-zone {
  min-height: 0;
  height: 100%;
}
.pnl-header {
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: stretch;
}
.chart-zone,
.command-zone,
.basket-zone {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.command-zone {
  min-height: 0;
  overflow: hidden;
  padding-bottom: 4px;
  position: relative;
  z-index: 1;
  height: 100%;
  max-height: 100%;
  padding: 0;
  margin: 0;
}
.basket-zone {
  padding-top: 6px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.game-header {
  padding: 2px 0 6px;
  display: flex;
  justify-content: center;
}

.pnl-gauge {
  width: 100%;
  max-width: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(7, 10, 20, 0.95));
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  box-shadow: 0 18px 45px rgba(3, 5, 15, 0.85);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  margin: 0;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.pnl-gauge-title {
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.pnl-gauge-main {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
}

.pnl-gauge-percent {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pnl-gauge-usd {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
}

.pnl-gauge-stake {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.pnl-gauge-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,75,106,0.9), rgba(255,240,0,0.85) 45%, rgba(65,241,154,0.95));
  overflow: hidden;
}

.pnl-gauge-track::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
}

.pnl-gauge-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff, rgba(241, 244, 255, 0.9) 65%, #a0b4ff 100%);
  box-shadow: 0 0 20px rgba(255,255,255,0.65);
  animation: pnlPulse 1.6s ease-in-out infinite;
}

.pnl-gauge-legend {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

@keyframes pnlPulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* MAIN ZONE */
.game-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding-top: 4px;
}

/* MARKET SECTION */
.market-section {
  flex: 1 1 auto;
  position: relative;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.market-switch {
  position: absolute;
  top: 2px;
  right: 10px;
  display: flex;
  gap: 6px;
  display: none;
}

.switch-btn {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  transition: 0.2s;
}

.controls-strip .selector .btn-quit-ai,
.controls-strip .selector .btn-order-mode {
  padding: 6px 8px;
  font-size: 11px;
  min-height: 0;
}

.switch-btn.active {
  background: linear-gradient(120deg, #56ccf2, #41f19a);
  color: #050711;
  font-weight: 700;
}

.market-view {
  margin-top: 8px;
  height: calc(100% - 8px);
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.market-mode {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  touch-action: pan-x pan-y;
}

.market-mode.active {
  display: flex;
  justify-content: center;
  align-items: stretch;
  height: 100%;
}

.market-mode.active > .market-chart-shell {
  flex: 1;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.market-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  pointer-events: none;
  text-align: center;
  padding: 0 16px;
}

/* Market chart shell */
.market-chart-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 50%, rgba(90,130,255,0.08), rgba(10,12,20,0.9));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.02),
    0 8px 24px rgba(0,0,0,0.7),
    inset 0 0 18px rgba(0,0,0,0.45);
  overflow: hidden;
  padding: 0;
  touch-action: pan-x pan-y;
  cursor: grab;
}

.market-chart-shell.market-card-nudge {
  animation: graphNudge 1.2s ease-in-out 1;
}

.market-chart-shell.market-card-swipe-left {
  animation: graphSwipeLeft 0.4s ease-out forwards;
}

.market-chart-shell.market-card-swipe-right {
  animation: graphSwipeRight 0.4s ease-out forwards;
}

@keyframes graphNudge {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-8px); }
  50%  { transform: translateX(8px); }
  75%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

@keyframes graphSwipeLeft {
  0%   { transform: translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateX(-140%) rotate(calc(-1 * var(--swipe-tilt, 8deg))); opacity: 0; }
}

@keyframes graphSwipeRight {
  0%   { transform: translateX(0) rotate(0deg); opacity: 1; }
  100% { transform: translateX(140%) rotate(var(--swipe-tilt, 8deg)); opacity: 0; }
}

.market-chart-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(87,113,255,0.12), rgba(0,0,0,0), rgba(62,255,178,0.12));
  filter: blur(18px);
  opacity: 0.9;
  pointer-events: none;
}

#market-chart {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: 14px;
  box-shadow: inset 0 0 28px rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.06);
}

.market-symbol-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dde4ed 0%, #c3cedb 35%, #7a889b 70%, #e8eff7 100%);
  border: 1px solid rgba(255,255,255,0.22);
  color: #0b121c;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  box-shadow:
    0 0 14px rgba(180,200,220,0.65),
    0 0 22px rgba(160,180,220,0.45),
    inset 0 0 12px rgba(255,255,255,0.25);
  text-shadow: 0 0 8px rgba(255,255,255,0.55);
}

.placeholder-chart,
.placeholder-ai {
  opacity: 0.4;
  font-size: 16px;
}

/* Final PNL popup */
.final-pnl-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(6px);
  z-index: 999;
}
.final-pnl-popup.hidden {
  display: none;
}
.final-pnl-card {
  min-width: 260px;
  padding: 18px 22px;
  border-radius: 18px;
  background: radial-gradient(circle at 25% 25%, rgba(255,255,255,0.08), rgba(20,30,45,0.92));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.45),
    0 0 20px rgba(110,160,255,0.45),
    inset 0 0 16px rgba(255,255,255,0.08);
  text-align: center;
  color: #e5ecff;
}
.final-pnl-title {
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 6px;
}
.final-pnl-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(255,255,255,0.35);
}
.final-pnl-btn {
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  background: linear-gradient(135deg, #ff7bd1, #7fc6ff);
  color: #0b111d;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 12px rgba(120,200,255,0.5);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.final-pnl-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.final-pnl-btn.hidden {
  display: none;
}

/* AI panel */
.ai-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 10px;
}

.ai-tabs {
  display: flex;
  gap: 10px;
}

.ai-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.04);
  color: #dce6ff;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}
.ai-tab.active {
  background: linear-gradient(120deg, #7af3c8, #58a2ff);
  color: #0a0f1a;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}

.ai-stage {
  flex: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  background: radial-gradient(circle at 50% 50%, rgba(90,130,255,0.08), rgba(10,12,20,0.9));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 18px rgba(0,0,0,0.45);
}

.ai-field {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 240px;
  z-index: 1;
  overflow: hidden;
  touch-action: manipulation;
}

.ai-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  font-size: 14px;
}
.pnl-positive {
  color: #41f19a;
  text-shadow: 0 0 6px rgba(65,241,154,0.6);
}

.pnl-negative {
  color: #ff4b6a;
  text-shadow: 0 0 6px rgba(255,75,106,0.6);
}
.basket-bubble-bottom {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 78px;                 /* largeur stable */
  height: 18px;                    /* hauteur verrouillée */

  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";

  white-space: nowrap;
}
.basket-bubble {
  contain: layout paint;
}

.ai-bubble {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #e8f2ff;
  touch-action: manipulation;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 0 16px rgba(0,0,0,0.45), 0 0 12px rgba(255,255,255,0.22);
  transition: top 0.7s ease, left 0.7s ease, width 0.35s ease, height 0.35s ease, transform 0.7s ease, filter 0.25s ease, box-shadow 0.7s ease;
  overflow: visible;
  background: rgba(15,20,32,0.75);
  border: 1px solid rgba(120,200,255,0.18);
}
.ai-bubble::before {
  content: "";
  position: absolute;
  top: -10%;
  left: 8%;
  width: 80%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.28), rgba(255,255,255,0));
  pointer-events: none;
}
.ai-bubble::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(120,200,255,0.4), rgba(0,0,0,0));
  filter: blur(8px);
  opacity: 0.8;
  animation: aiGlow 5s linear infinite;
}
.ai-bubble-inner {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: aiFloat 4.2s ease-in-out infinite alternate, aiPulse 6s ease-in-out infinite;
}
.ai-bubble.perf-up {
  animation: flashUp 0.9s ease-in-out;
}
.ai-bubble.perf-down {
  animation: flashDown 0.9s ease-in-out;
}
.ai-bubble.target {
  outline: 2px solid rgba(255,255,255,0.65);
  box-shadow: 0 0 20px rgba(255,255,255,0.5);
}
.ai-bubble .ai-perf {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.75;
}
.ai-bubble.gain {
  border: 1px solid rgba(80,255,170,0.65);
  box-shadow: 0 0 14px rgba(80,255,170,0.35), 0 0 6px rgba(0,0,0,0.4);
}
.ai-bubble.loss {
  border: 1px solid rgba(255,80,120,0.65);
  box-shadow: 0 0 14px rgba(255,45,85,0.35), 0 0 6px rgba(0,0,0,0.4);
}
.ai-bubble.gain .ai-perf { color: #41f19a; }
.ai-bubble.loss .ai-perf { color: #ff4b6a; }
.ai-bubble:hover {
  transform: translateY(-2px) scale(1.05);
  filter: brightness(1.1);
}

@keyframes aiFloat {
  0% { transform: translate(-1px, -6px); }
  50% { transform: translate(2px, 0px); }
  100% { transform: translate(-2px, 6px); }
}
@keyframes aiGlow {
  0% { opacity: 0.5; }
  50% { opacity: 0.9; }
  100% { opacity: 0.5; }
}
@keyframes aiPulse {
  0% { box-shadow: 0 0 16px rgba(0,0,0,0.35), 0 0 10px rgba(255,255,255,0.25); }
  50% { box-shadow: 0 0 22px rgba(90,180,255,0.55), 0 0 16px rgba(255,255,255,0.35); }
  100% { box-shadow: 0 0 16px rgba(0,0,0,0.35), 0 0 10px rgba(255,255,255,0.25); }
}
@keyframes flashUp {
  0% { box-shadow: 0 0 12px rgba(0,0,0,0.3), 0 0 8px rgba(255,255,255,0.2); }
  50% { box-shadow: 0 0 24px rgba(0,255,160,0.9), 0 0 18px rgba(255,255,255,0.4); }
  100% { box-shadow: 0 0 12px rgba(0,0,0,0.3), 0 0 8px rgba(255,255,255,0.2); }
}

/* Cannon */
.ai-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 6px 10px 6px;
  margin-bottom: 8px;
  min-height: 64px;
  max-height: 64px;
  position: relative;
  z-index: 2;
}
.ai-controls.middle {
  padding: 6px 10px 6px;
  background: transparent;
  border-top: none;
  border-bottom: none;
}
.selector {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
  justify-content: center;
}
.selector-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.selector-label {
  display: none;
}

.selector .btn-quit-ai,
.selector .btn-order-mode {
  width: 100%;
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  color: #0c0d15;
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.selector .btn-quit-ai {
  background: linear-gradient(135deg, #ff6b9e, #ff2d55);
}
.selector .btn-order-mode {
  background: linear-gradient(135deg, #41f19a, #1fc771);
}
.selector .btn-quit-ai:hover,
.selector .btn-order-mode:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.selector .btn-quit-ai.busy,
.selector .btn-quit-ai:disabled,
.selector .btn-order-mode:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.mh-wait {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(40,120,255,0.08), rgba(8,10,18,0.94));
  z-index: 3;
}
.mh-wait.hidden {
  display: none;
}
.mh-wait-text {
  font-size: 15px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
}
.radar {
  position: relative;
  width: 180px;
  height: 180px;
}
.radar-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(100,200,255,0.25);
  border-radius: 50%;
}
.radar-ring.ring2 { inset: 12px; }
.radar-ring.ring3 { inset: 24px; }
.radar-sweep {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(0,255,200,0.4), rgba(0,255,200,0.02) 45deg, rgba(0,0,0,0) 60deg, rgba(0,0,0,0));
  animation: radar-spin 2s linear infinite;
  filter: drop-shadow(0 0 12px rgba(0,255,200,0.4));
}
.radar-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #41f1c2;
  top: 12px;
  left: calc(50% - 4.5px);
  box-shadow: 0 0 14px rgba(65,241,194,0.9);
}
@keyframes radar-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.mh-wait-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #dde4ed 0%, #c3cedb 35%, #7a889b 70%, #e8eff7 100%);
  border: 1px solid rgba(255,255,255,0.28);
  color: #0b121c;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow:
    0 0 14px rgba(180,200,220,0.65),
    0 0 22px rgba(160,180,220,0.45),
    inset 0 0 12px rgba(255,255,255,0.3);
  text-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* Layout for game controls and shared basket */
.controls-strip {
  flex: 0 0 12%;
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  gap: 4px;
  padding: 2px 0;
  width: 100%;
}
.controls-strip .ai-controls {
  width: 100%;
  height: 100%;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}
.command-zone .ai-controls {
  height: 100%;
}
.controls-strip .selector {
  height: 100%;
  justify-content: center;
  padding: 4px 6px;
  gap: 4px;
  flex: 1;
}
.controls-strip .selector-label {
  margin-bottom: 4px;
}

.controls-strip.mh-mode .ai-controls {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 12px;
}
.controls-strip.mh-mode .selector {
  min-width: 110px;
}

.shared-basket {
  flex: 0 0 13%;
  min-height: 13%;
  display: flex;
}
.shared-basket .ai-basket {
  width: 100%;
  min-height: 100%;
  padding: 10px;
  display: flex;
  align-items: center;
}
.shared-basket .basket-mini {
  flex: 1;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  min-height: 64px;
}
.roulette {
  position: relative;
  height: 34px;
  overflow: hidden;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, rgba(120,200,255,0.15), rgba(10,14,22,0.9));
  box-shadow: inset 0 0 12px rgba(0,0,0,0.45);
}
.roulette-wheel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #dff6ff;
  transition: transform 0.5s ease;
}
.roulette-wheel.spin {
  transition: transform 0.8s cubic-bezier(.16,.81,.43,.99);
}
.roulette-pointer {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(145deg, #7cf4ff, #48ffb6);
  box-shadow: 0 0 12px rgba(120,255,200,0.7);
  border: 1px solid rgba(255,255,255,0.5);
  display: none;
}
.selector-side .roulette {
  background: radial-gradient(circle at 50% 40%, rgba(255,80,120,0.15), rgba(10,14,22,0.9));
}
.selector-side .roulette-wheel[data-side="long"] {
  color: #41f19a;
}
.selector-side .roulette-wheel[data-side="short"] {
  color: #ff4b6a;
}

.ai-basket {
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border-top: 1px solid rgba(255,255,255,0.08);
  min-height: 100%;
  max-height: 100%;
  position: relative;
  z-index: 2;
}
.basket-mini {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  height: 100%;
  position: relative;
  z-index: 3;
}
.basket-mini .mini-pos {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 8px 6px 6px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), rgba(20,30,50,0.9));
  color: #e8f2ff;
  box-shadow: 0 0 16px rgba(0,0,0,0.4), 0 0 10px rgba(120,200,255,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 4;
}
.mini-pos.long { border: 1px solid rgba(80,255,170,0.6); }
.mini-pos.short { border: 1px solid rgba(255,80,120,0.6); }
.mini-pos .mini-side {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translate(-50%, 0);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.mini-pos.long .mini-side { color: #41f19a; background: #41f19a; }
.mini-pos.short .mini-side { color: #ff4b6a; background: #ff4b6a; }
.mini-pos .mini-label {
  display: block;
  margin-top: 6px;
  letter-spacing: 0.06em;
}
.mini-pos .mini-perf {
  display: block;
  font-size: 10px;
  opacity: 0.85;
}
.mini-fly {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  transition: transform 0.7s ease, opacity 0.7s ease;
  opacity: 1;
  width: 64px;
  height: 64px;
  border-radius: 999px;
}
.mini-pos.perf-up {
  animation: neonUp 0.8s ease-in-out;
}
.mini-pos.perf-down {
  animation: neonDown 0.8s ease-in-out;
}
.mini-pos::after {
  content: "";
  position: absolute;
  top: -10%;
  left: 10%;
  width: 80%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35), rgba(255,255,255,0));
  opacity: 0.35;
  pointer-events: none;
}
@keyframes neonUp {
  0% { box-shadow: 0 0 16px rgba(0,0,0,0.4), 0 0 10px rgba(120,200,255,0.35); }
  50% { box-shadow: 0 0 24px rgba(65,241,154,0.9), 0 0 16px rgba(255,255,255,0.4); }
  100% { box-shadow: 0 0 16px rgba(0,0,0,0.4), 0 0 10px rgba(120,200,255,0.35); }
}
@keyframes neonDown {
  0% { box-shadow: 0 0 16px rgba(0,0,0,0.4), 0 0 10px rgba(120,200,255,0.35); }
  50% { box-shadow: 0 0 24px rgba(255,75,106,0.9), 0 0 16px rgba(255,255,255,0.4); }
  100% { box-shadow: 0 0 16px rgba(0,0,0,0.4), 0 0 10px rgba(120,200,255,0.35); }
}

.hide-footer-ai .game-footer {
  display: none;
}
@keyframes flashDown {
  0% { box-shadow: 0 0 12px rgba(0,0,0,0.3), 0 0 8px rgba(255,255,255,0.2); }
  50% { box-shadow: 0 0 24px rgba(255,80,120,0.9), 0 0 18px rgba(255,255,255,0.4); }
  100% { box-shadow: 0 0 12px rgba(0,0,0,0.3), 0 0 8px rgba(255,255,255,0.2); }
}

.explosion {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(255,255,255,0));
  box-shadow: 0 0 30px rgba(255,255,255,0.7), 0 0 50px rgba(120,200,255,0.6);
  animation: explode 0.4s ease-out forwards;
}
@keyframes explode {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ===============================
   BUBBLE GAME SECTION (UPDATED)
================================ */

.bubble-section {
  flex: 1;
  min-height: 45%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 8px;
}

/* LEFT / RIGHT baskets 40% each, lane au centre (60px) */

.basket {
  flex: 0 0 40%;
  height: 90%;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.18);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
  pointer-events: auto;
}

.basket-label {
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* zone de pile au fond du panier */
.basket-bubbles {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  align-content: end;
  justify-items: center;
  gap: 8px;
  pointer-events: auto;
  z-index: 2;
}

/* Teintes spécifiques */

.basket-short {
  background: rgba(255,40,90,0.08);
  box-shadow: inset 0 0 18px rgba(255,40,90,0.28);
}

.basket-long {
  background: rgba(50,255,140,0.08);
  box-shadow: inset 0 0 18px rgba(50,255,140,0.28);
}

/* LANE centrale pour la bulle qui tombe */

.bubble-spawn-zone {
  flex: 0 0 60px;         /* ~ lane 60px */
  height: 90%;
  position: relative;
}

/* Bulle qui tombe dans la lane (animée via JS) */

.falling-bubble {
  position: absolute;
  width: 68px;
  height: 68px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(circle at 40% 20%, #7eb6ff, #3a4fff, #0a0f24);
  box-shadow: 0 0 25px rgba(90, 130, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.falling-bubble-text {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 6px rgba(0,0,0,0.6);
}

/* Bulles DANS les paniers : degen mode D */

.basket-bubble {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
  animation:
    basketWiggle 0.35s infinite alternate ease-in-out,
    basketPulse 1.4s infinite ease-in-out;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 3;
}

.basket-bubble-top {
  font-size: 12px;
}
.basket-bubble-bottom {
  font-size: 11px;
  opacity: 0.85;
}

.perf-up {
  animation: basketWiggle 0.35s infinite alternate ease-in-out, basketPulse 1.4s infinite ease-in-out, perfBlinkUp 0.8s ease-in-out;
}

.perf-down {
  animation: basketWiggle 0.35s infinite alternate ease-in-out, basketPulse 1.4s infinite ease-in-out, perfBlinkDown 0.8s ease-in-out;
}

@keyframes perfBlinkUp {
  0% { box-shadow: 0 0 0 rgba(0,0,0,0); }
  50% { box-shadow: 0 0 16px rgba(65, 241, 154, 0.8); }
  100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
}

@keyframes perfBlinkDown {
  0% { box-shadow: 0 0 0 rgba(0,0,0,0); }
  50% { box-shadow: 0 0 16px rgba(255, 75, 106, 0.8); }
  100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
}

/* variantes couleur */
.basket-bubble-short {
  background: radial-gradient(circle at 30% 20%, #ffb3c8, #ff2d55, #7a1027);
  box-shadow: 0 0 14px rgba(255,45,85,0.9);
}

.basket-bubble-long {
  background: radial-gradient(circle at 30% 20%, #c8ffd8, #25da63, #0b6a30);
  box-shadow: 0 0 14px rgba(37,218,99,0.9);
}

/* micro-shake wiggle */
@keyframes basketWiggle {
  0%   { transform: translateX(-1px) rotate(-2deg); }
  50%  { transform: translateX(1px) rotate(2deg); }
  100% { transform: translateX(-1px) rotate(-1deg); }
}

/* neon pulse */
@keyframes basketPulse {
  0%   { filter: brightness(1); }
  50%  { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}


/* ===============================
   FOOTER BUTTONS - DEGEN MODE
================================ */

.game-footer {
  display: none;
}

/* Base degen button */
.btn-degen {
  flex: 1;
  padding: 14px 0;
  border-radius: 999px;
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 700;
  color: #02030a;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: transform 0.15s ease-out;
  position: relative;
  overflow: hidden;
}

/* Pulsing glow */
.btn-degen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  filter: blur(12px);
  opacity: 0.75;
  animation: pulse 2.2s infinite ease-in-out;
}

@keyframes pulse {
  0%   { opacity: 0.5; transform: scale(0.96); }
  50%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0.5; transform: scale(0.96); }
}

/* SHORT - red pink degen */
.btn-short {
  background: linear-gradient(135deg, #ff487a, #ff2d55, #b51b3b);
}
.btn-short::before {
  background: linear-gradient(135deg, #ff89a6, #ff2d55);
}

/* RESET - purple neon */
.btn-reset {
  background: linear-gradient(135deg, #9c3cff, #6f1aff, #3200a8);
}
.btn-reset::before {
  background: linear-gradient(135deg, #d4a6ff, #8f4cff);
}
/* Disable glow animation for RESET button */
.btn-reset::before {
  animation: none !important;
  opacity: 0.6 !important;
}

/* LONG - toxic green */
.btn-long {
  background: linear-gradient(135deg, #44ff7c, #25da63, #118a3a);
}
.btn-long::before {
  background: linear-gradient(135deg, #8cffb9, #25da63);
}

.btn-degen:active {
  transform: scale(0.94);
  filter: brightness(1.2);
} 


/* PNL HEARTBEAT */
@keyframes pnlBeat {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ===============================
   MOBILE RESPONSIVE
================================ */
@media (max-width: 520px) {
  body {
    align-items: stretch;
    padding: 0;
  }
  .app-shell {
    width: 100vw;
    height: 100dvh;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .app-shell::before {
    display: none;
  }
  .app {
    border-radius: 0;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .screen {
    padding: 16px 10px 12px;
    gap: 12px;
  }
  .bubble-field {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 10px;
    justify-items: center;
    max-height: calc(100% - 160px);
    margin-bottom: 42px;
  }
  .bubble-choice {
    max-width: 100px;
  }
  .summary-bubbles {
    gap: 6px;
  }
  .summary-inline {
    flex-wrap: nowrap;
  }
  .summary-inline .summary-bubble {
    min-width: 82px;
    padding: 7px 10px;
  }
  .summary-inline-actions {
    flex-direction: row;
  }
  .summary-inline-actions button {
    height: 40px;
    font-size: 13px;
  }
  .screen[data-step="summary"] {
    padding-top: 24px;
    padding-bottom: 70px;
    gap: 10px;
  }
  .theme-summary .step-header h1 {
    font-size: 24px;
    line-height: 1.1;
  }
  .theme-summary .step-header p {
    font-size: 13px;
    margin-top: 2px;
  }
  .summary-card-header {
    padding: 7px 9px;
  }
  .summary-card-body {
    padding: 0 9px 9px;
  }
  .progress-ribbon {
    gap: 6px;
    margin: 8px 0 4px;
  }
  .ribbon-step {
    font-size: 10px;
    padding: 6px 6px;
  }
  .game-header {
    height: auto;
  }
  .market-chart-shell {
    max-height: 190px;
  }
  .ai-stage {
    grid-template-rows: minmax(0, 1fr);
  }
.ai-field {
  min-height: 220px;
  padding: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--content-max-width);
}
  .ai-controls {
    grid-template-columns: 1fr;
    min-height: unset;
    max-height: none;
  }
  .ai-basket {
    min-height: 90px;
    max-height: none;
  }
  .basket-mini {
    justify-content: flex-start;
    gap: 8px;
  }
  .bubble-section {
    flex-direction: column;
    height: auto;
    gap: 10px;
  }
  .basket {
    width: 100%;
    flex: 0 0 auto;
    height: 160px;
  }
  .bubble-spawn-zone {
    flex: 0 0 70px;
    height: 90px;
  }
  .game-footer {
  padding: 0 8px 6px;
}

  .game-layout {
    grid-template-rows: 4% 71% minmax(0, 4%) minmax(0, 8.5%);
    gap: 0;
  }
}

@media (max-width: 360px) {
  .bubble-choice {
    font-size: 13px;
  }
  .summary-bubble {
    font-size: 12px;
  }
  .selector .btn-quit-ai,
  .selector .btn-order-mode {
    padding: 10px;
  }
}

/* Step navigation buttons */
.step-nav {
  position: absolute;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  z-index: 20;
}
.step-nav.hidden {
  display: none;
}
.step-nav-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #e7ecff;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
}
.step-nav-btn.primary {
  background: linear-gradient(135deg, #7af3c8, #58a2ff);
  color: #0b111d;
  border: none;
}
.step-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
