:root {
  --bg: #06101d;
  --card: #0d1a2f;
  --text: #f4f8ff;
  --muted: #94a8c7;
  --accent: #ffd257;
  --green: #20d486;
  --red: #ff5b6d;
  --line: rgba(255, 255, 255, 0.11);
  --blue: #69a7ff;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #173d68 0, var(--bg) 48%, #020711 100%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  overflow-x: hidden;
}
body {
  touch-action: manipulation;
}
.app {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: 16px 12px 28px;
}
.hero {
  text-align: center;
  padding: 7px 4px 13px;
}
.badge {
  display: inline-flex;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 12px 0 8px;
  font-size: clamp(28px, 8vw, 44px);
  line-height: 0.96;
}
p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 15px;
}
.game-card {
  position: relative;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(22, 42, 72, 0.98), rgba(8, 18, 32, 0.99));
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  padding: 14px;
  overflow: hidden;
}
.game-card:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 210, 87, 0.12), transparent 42%);
  pointer-events: none;
}
.topbar,
.balance-row,
.status-row,
.progress,
.hint,
.cta,
.retry {
  position: relative;
  z-index: 2;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.topbar strong,
.price {
  display: block;
  font-size: 20px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.price {
  color: var(--green);
  font-weight: 1000;
  padding: 8px 11px;
  border-radius: 14px;
  background: rgba(32, 212, 134, 0.11);
  border: 1px solid rgba(32, 212, 134, 0.22);
}
.balance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 9px;
}
.balance-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 10px;
}
.balance-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}
.balance-card b {
  font-size: 18px;
}
.status-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
  margin-bottom: 9px;
}
.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 13px;
  padding: 8px 6px;
  text-align: center;
  color: #dbe7ff;
  font-size: 12px;
}
.pill b {
  color: #fff;
}
.timer b {
  color: var(--accent);
}
.progress {
  display: flex;
  gap: 6px;
  margin: 0 2px 10px;
}
.dot {
  height: 9px;
  flex: 1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.dot.current {
  background: rgba(255, 210, 87, 0.55);
}
.dot.win {
  background: rgba(32, 212, 134, 0.88);
}
.dot.loss {
  background: rgba(255, 91, 109, 0.84);
}
.chart-wrap {
  position: relative;
  height: min(70vw, 390px);
  min-height: 330px;
  border-radius: 22px;
  background: #061321;
  border: 1px solid var(--line);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.target-zone {
  position: absolute;
  border: 2px dashed rgba(255, 210, 87, 0.9);
  background: rgba(255, 210, 87, 0.075);
  border-radius: 14px;
  box-shadow:
    inset 0 0 30px rgba(255, 210, 87, 0.08),
    0 0 0 0 rgba(255, 210, 87, 0.18);
  animation: pulseTarget 1.05s infinite;
}
.target-zone.pro {
  border-width: 1px;
  border-radius: 8px;
  background: rgba(105, 167, 255, 0.08);
  border-color: rgba(105, 167, 255, 0.9);
}
.target-zone.success {
  border-style: solid;
  border-color: var(--green);
  background: rgba(32, 212, 134, 0.12);
  animation: none;
}
.target-zone.fail {
  border-color: var(--red);
  background: rgba(255, 91, 109, 0.1);
  animation: none;
}
@keyframes pulseTarget {
  50% {
    box-shadow:
      inset 0 0 30px rgba(255, 210, 87, 0.12),
      0 0 0 9px rgba(255, 210, 87, 0.055);
  }
}
.floating-piece {
  position: absolute;
  left: 18px;
  bottom: 18px;
  border-radius: 16px;
  background: #0d2038;
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.45),
    0 0 0 5px rgba(255, 210, 87, 0.1);
  cursor: grab;
  touch-action: none;
  overflow: hidden;
  z-index: 4;
}
.floating-piece.pro {
  border-width: 1px;
  border-radius: 10px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.48),
    0 0 0 4px rgba(105, 167, 255, 0.1);
}
.floating-piece:active {
  cursor: grabbing;
}
.floating-piece.locked {
  pointer-events: none;
  border-color: var(--green);
  box-shadow:
    0 0 0 5px rgba(32, 212, 134, 0.18),
    0 18px 38px rgba(0, 0, 0, 0.38);
}
.market-flash,
.auto-badge {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 6;
  color: white;
  font-weight: 1000;
  font-size: 12px;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 9px 12px;
  box-shadow: 0 10px 28px rgba(255, 91, 109, 0.28);
}
.market-flash {
  background: rgba(255, 91, 109, 0.94);
}
.auto-badge {
  background: rgba(105, 167, 255, 0.94);
  box-shadow: 0 10px 28px rgba(105, 167, 255, 0.28);
}
.stream-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}
.float-sum {
  position: absolute;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 1000;
  font-size: 15px;
  animation: floatUp 0.72s ease-out forwards;
  white-space: nowrap;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.36));
}
.float-sum.win {
  color: #062013;
  background: rgba(43, 235, 151, 0.94);
}
.float-sum.loss {
  color: #fff;
  background: rgba(255, 91, 109, 0.95);
}
@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.82);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -62px) scale(1.12);
  }
}
.hint {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: #dbe7ff;
  font-size: 14px;
  text-align: center;
}
.cta,
.retry,
.modal-box button,
.modal-box #regBtn {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 15px 16px;
  margin-top: 12px;
  font-size: 16px;
  font-weight: 1000;
  cursor: pointer;
}
.cta,
.modal-box button,
.modal-box #regBtn {
  display: block;
  text-align: center;
  text-decoration: none;

  color: #111827;
  background: linear-gradient(180deg, #ffe277, #ffbe29);
  box-shadow: 0 12px 26px rgba(255, 190, 41, 0.24);
}
.retry {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}
.hidden {
  display: none !important;
}
.smallprint {
  margin: 12px 6px 0;
  color: rgba(219, 231, 255, 0.64);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}
.win-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}
.modal-box {
  width: min(100%, 368px);
  text-align: center;
  padding: 25px 18px 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, #172846, #0b1527);
  border: 1px solid var(--line);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.55);
}
.coin {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: #3b2600;
  background: radial-gradient(circle at 30% 25%, #fff3a0, #ffc533 65%, #c37f00);
  font-size: 34px;
  font-weight: 1000;
  box-shadow: 0 12px 35px rgba(255, 197, 51, 0.28);
}
.coin.loss {
  color: #fff;
  background: radial-gradient(circle at 30% 25%, #ff9bab, #ff5b6d 65%, #8f1830);
}
.modal-box h2 {
  margin: 0 0 8px;
  font-size: 26px;
}
.modal-box p {
  font-size: 15px;
}
.modal-box.final {
  outline: 2px solid rgba(255, 210, 87, 0.35);
}
.modal-box.loss-style {
  outline: 2px solid rgba(255, 91, 109, 0.35);
}
@media (max-width: 380px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }
  .chart-wrap {
    min-height: 310px;
  }
  .pill {
    font-size: 11px;
    padding: 7px 4px;
  }
  .balance-card b {
    font-size: 16px;
  }
}

.chart-offer {
  position: absolute;
  inset: 18px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(10, 26, 45, 0.94), rgba(4, 10, 20, 0.96));
  border: 1px solid rgba(255, 210, 87, 0.42);
  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.55),
    inset 0 0 70px rgba(255, 210, 87, 0.08);
  backdrop-filter: blur(6px);
  animation: offerIn 0.34s ease-out both;
}
.chart-offer:before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.chart-offer.register {
  border-color: rgba(32, 212, 134, 0.46);
  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.55),
    inset 0 0 70px rgba(32, 212, 134, 0.08);
}
.offer-kicker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  margin-bottom: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 210, 87, 0.14);
  color: var(--accent);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chart-offer.register .offer-kicker {
  background: rgba(32, 212, 134, 0.13);
  color: var(--green);
}
.chart-offer h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  font-size: clamp(22px, 6vw, 34px);
  line-height: 1.05;
}
.chart-offer p {
  position: relative;
  z-index: 1;
  max-width: 360px;
  color: #dbe7ff;
  font-size: 14px;
}
.offer-btn {
  position: relative;
  z-index: 1;
  width: min(100%, 320px);
  border: 0;
  border-radius: 17px;
  padding: 15px 14px;
  margin-top: 16px;
  color: #111827;
  background: linear-gradient(180deg, #ffe277, #ffbe29);
  box-shadow: 0 14px 30px rgba(255, 190, 41, 0.28);
  font-size: 15px;
  font-weight: 1000;
  cursor: pointer;
}
.chart-offer.register .offer-btn {
  background: linear-gradient(180deg, #40f0a0, #18b873);
  box-shadow: 0 14px 30px rgba(32, 212, 134, 0.24);
}
@keyframes offerIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.auto-piece-clone {
  position: absolute;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: #0d2038;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.44),
    0 0 0 3px rgba(105, 167, 255, 0.16);
  z-index: 8;
  pointer-events: none;
  overflow: hidden;
}
.auto-piece-clone.win.placed {
  border-color: var(--green);
  box-shadow:
    0 0 0 4px rgba(32, 212, 134, 0.2),
    0 12px 28px rgba(0, 0, 0, 0.44);
}
.auto-piece-clone.loss.placed {
  border-color: var(--red);
  box-shadow:
    0 0 0 4px rgba(255, 91, 109, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.44);
  filter: grayscale(0.25);
}
@media (max-width: 380px) {
  .chart-offer {
    inset: 12px;
    padding: 14px;
  }
  .offer-btn {
    padding: 13px 12px;
  }
  .chart-offer p {
    font-size: 13px;
  }
}

.drag-guide {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.drag-guide.hidden-guide {
  opacity: 0;
}
.guide-dot {
  display: none !important;
}
.guide-path {
  position: absolute;
  left: var(--guide-start-x, 70px);
  top: var(--guide-start-y, 260px);
  width: var(--guide-distance, 180px);
  height: 0;
  border-top: 3px dashed rgba(255, 210, 87, 0.88);
  border-radius: 999px;
  filter: drop-shadow(0 0 8px rgba(255, 210, 87, 0.46));
  transform-origin: left center;
  transform: rotate(var(--guide-angle, -28deg));
  opacity: 0.92;
}

.guide-finger {
  position: absolute;
  left: calc(var(--guide-start-x, 70px) - 21px);
  top: calc(var(--guide-start-y, 260px) - 21px);
  font-size: 42px;
  line-height: 1;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.45));
  animation: fingerDrag 3.7s cubic-bezier(0.45, 0, 0.2, 1) infinite;
  transform-origin: 70% 80%;
  will-change: transform, opacity;
}
.guide-label {
  position: absolute;
  right: 14px;
  top: 18px;
  max-width: 190px;
  padding: 9px 11px;
  border-radius: 14px;
  background: rgba(255, 210, 87, 0.94);
  color: #1b1400;
  font-size: 13px;
  font-weight: 1000;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
  animation: labelPulse 2.2s ease-in-out infinite;
}
@keyframes fingerDrag {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.92;
  }
  10% {
    transform: translate(0, 0) scale(0.9);
    opacity: 1;
  }
  62% {
    transform: translate(var(--guide-dx, 190px), var(--guide-dy, -120px)) scale(0.9);
    opacity: 1;
  }
  76% {
    transform: translate(var(--guide-dx, 190px), var(--guide-dy, -120px)) scale(1.02);
    opacity: 0.86;
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.65;
  }
}
@keyframes labelPulse {
  50% {
    transform: translateY(-2px);
  }
}
@media (max-width: 380px) {
  .guide-label {
    font-size: 12px;
    max-width: 160px;
  }
  .guide-finger {
    font-size: 38px;
    left: calc(var(--guide-start-x, 70px) - 19px);
    top: calc(var(--guide-start-y, 260px) - 19px);
  }
}

.quizOpt {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f5f5f5;
  color: #222;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0;
  width: 100%;
  text-align: left;
}
.quizOpt .radio {
  width: 18px;
  height: 18px;
  border: 2px solid #888;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 18px;
  background: white;
}
.quizOpt:hover {
  background: #ececec;
}
