@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Orbitron:wght@500;600&display=swap');

:root {
  color-scheme: dark;
  --bg: #050813;
  --glass: rgba(13, 19, 40, 0.65);
  --glass-border: rgba(90, 150, 255, 0.25);
  --text: #e7f2ff;
  --muted: #8ba4c7;
  --accent: #2b7cff;
  --accent-strong: #3aa3ff;
  --accent-hot: #ff4fd8;
  --shadow: 0 20px 45px rgba(14, 16, 40, 0.45);
  --radius: 20px;
  --transition: 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, rgba(24, 40, 80, 0.4), transparent 55%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

a {
  color: inherit;
  text-decoration: none;
}

canvas#particle-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  position: relative;
  width: min(480px, 100vw);
  min-height: 100vh;
  padding: clamp(1rem, 2vw, 1.25rem) clamp(0.75rem, 3vw, 1.5rem) clamp(5.5rem, 7vw, 6rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 1;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.brand-caption {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(43, 124, 255, 0.18), rgba(58, 163, 255, 0.12));
  color: var(--text);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.icon-button:hover {
  box-shadow: 0 12px 24px rgba(34, 85, 200, 0.35);
}

.icon-button:active {
  transform: scale(0.92);
}

.icon-button.close {
  position: absolute;
  top: 0.85rem;
  inset-inline-end: 0.85rem;
  font-size: 1.5rem;
  background: transparent;
  box-shadow: none;
}

.icon-gear,
.icon-button.close::before {
  content: '';
}

.icon-gear {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  position: relative;
}

.icon-gear::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(43, 124, 255, 0.7);
  animation: spin 6s linear infinite;
}

.icon-button.close::before {
  content: '\00d7';
  font-size: 1.5rem;
  line-height: 1;
}

.balances {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.85rem;
}

.balance-card {
  position: relative;
  padding: 0.75rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(20, 26, 48, 0.9), rgba(14, 18, 34, 0.8));
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.balance-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(59, 146, 255, 0.2);
  pointer-events: none;
}

.balance-card .label {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.balance-card .value {
  font-size: 1.25rem;
  font-weight: 600;
}

.content {
  flex: 1 1 auto;
  display: grid;
  position: relative;
}

.tab-page {
  display: none;
  flex-direction: column;
  gap: 1rem;
  animation: fadeSlide 200ms ease;
}

.tab-page.active {
  display: flex;
}

.wheel-card {
  padding: 1.2rem 1.5rem 1.5rem;
  display: grid;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.wheel-wrapper {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
}

.wheel {
  width: clamp(160px, 60vw, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(58, 163, 255, 0.3), transparent 60%), rgba(12, 18, 36, 0.85);
  border: 2px solid rgba(56, 129, 255, 0.45);
  position: relative;
  animation: spin 6s linear infinite;
  box-shadow: inset 0 0 35px rgba(66, 150, 255, 0.3);
}

.wheel::before,
.wheel::after {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 2px dashed rgba(90, 200, 255, 0.3);
  animation: spin 12s linear infinite reverse;
}

.wheel::after {
  inset: 24%;
  border-style: solid;
  border-color: rgba(255, 79, 216, 0.35);
  animation-duration: 8s;
}

.wheel-center {
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 146, 255, 0.5), rgba(10, 14, 25, 0.9));
  box-shadow: 0 0 25px rgba(59, 146, 255, 0.5);
}

.wheel-core {
  position: absolute;
  inset: 44%;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 79, 216, 0.9), rgba(43, 124, 255, 0.9));
  animation: pulse 1.8s ease-in-out infinite;
}

.wheel.turbo {
  animation-duration: 3.5s;
  border-color: rgba(255, 79, 216, 0.6);
  box-shadow: inset 0 0 40px rgba(255, 79, 216, 0.4);
}

.hashrate {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
}

.hashrate.shake {
  animation: shake 0.4s linear infinite;
}

.accrual {
  display: grid;
  place-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.accrual .accrual-value {
  font-size: 1.35rem;
  font-family: 'Orbitron', sans-serif;
  color: var(--text);
}

.turbo-hint {
  font-size: 0.75rem;
  text-align: center;
  color: var(--muted);
}

.wheel-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.btn {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.35);
  inset: 0;
  transition: transform 0.4s, opacity 0.5s;
}

.btn:active::after {
  transform: scale(1);
  opacity: 0;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #05152b;
  box-shadow: 0 12px 30px rgba(59, 146, 255, 0.5);
}

.btn.primary:hover {
  box-shadow: 0 16px 35px rgba(64, 180, 255, 0.6);
}

.btn.ghost {
  background: rgba(36, 52, 92, 0.45);
  color: var(--text);
  border: 1px solid rgba(76, 140, 255, 0.35);
}

.invite,
.tasks,
.shop,
.partners,
.friends-hero,
.commission,
.friends-list,
.wallet,
.history {
  padding: 1rem 1.2rem;
  display: grid;
  gap: 0.75rem;
}

.invite {
  align-items: center;
  grid-template-columns: auto max-content;
}

.invite p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 0.75rem;
}

.share-btn {
  border: none;
  border-radius: 18px;
  height: 52px;
  background: linear-gradient(135deg, rgba(43, 124, 255, 0.18), rgba(60, 163, 255, 0.12));
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* Icon layer for share buttons */
.share-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

/* Individual platforms */
.share-btn[data-share="telegram"]::before {
  background-image: url("./assets/icons/telegram.svg");
}
.share-btn[data-share="whatsapp"]::before {
  background-image: url("./assets/icons/whatsapp.svg");
}
.share-btn[data-share="messenger"]::before {
  background-image: url("./assets/icons/messenger.svg");
}
.share-btn[data-share="line"]::before {
  background-image: url("./assets/icons/line.svg");
}
.share-btn[data-share="x"]::before {
  width: 20px;
  height: 20px;
  background-image: url("./assets/icons/x.svg");
}
.share-btn[data-share="link"]::before {
  width: 22px;
  height: 22px;
  background-image: url("./assets/icons/link.svg");
}

.share-btn span {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.6), rgba(43, 124, 255, 0.3) 45%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.share-btn:hover span,
.share-btn:focus-visible span {
  opacity: 0.8;
}

.tasks header,
.shop header,
.partners header,
.history header,
.friends-list header,
.wallet header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.tasks-status {
  font-size: 0.8rem;
  color: var(--muted);
}

#tasks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.task-item {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(22, 30, 60, 0.6);
  border: 1px solid rgba(72, 120, 255, 0.2);
}

.task-item .title {
  font-weight: 500;
}

.task-item .meta {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.shop-card {
  position: relative;
  padding: 0.9rem;
  border-radius: 16px;
  background: rgba(20, 32, 66, 0.75);
  border: 1px solid rgba(58, 126, 255, 0.25);
  display: grid;
  gap: 0.5rem;
  min-height: 150px;
}

.shop-card .title {
  font-size: 1rem;
  font-weight: 600;
}

.shop-card .price {
  font-size: 0.9rem;
  color: var(--muted);
}

.shop-card .cta {
  margin-top: auto;
  justify-self: start;
}

.shop-card .badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  background: var(--accent-hot);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0 14px 0 8px;
  letter-spacing: 0.08em;
}

.partners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.partners-grid img {
  width: 100%;
  border-radius: 14px;
  opacity: 0.85;
  transition: transform var(--transition), opacity var(--transition);
}

.partners-grid img:hover {
  transform: translateY(-4px);
  opacity: 1;
}

.friends-hero {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.friends-hero p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.commission {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.commission p {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
}

.friends-list table,
.history table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.friends-list thead,
.history thead {
  position: sticky;
  top: 0;
  background: rgba(12, 20, 42, 0.9);
  backdrop-filter: blur(12px);
}

.friends-list th,
.friends-list td,
.history th,
.history td {
  padding: 0.5rem 0.25rem;
  text-align: start;
  border-bottom: 1px solid rgba(63, 110, 220, 0.15);
}

.friends-list tbody tr:nth-child(even),
.history tbody tr:nth-child(even) {
  background: rgba(15, 24, 52, 0.35);
}

.empty {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.wallet-balances {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  background: rgba(26, 38, 70, 0.7);
  color: var(--text);
  cursor: pointer;
}

.wallet-actions {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.74);
  backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform var(--transition);
  z-index: 5;
}

.settings-panel.open {
  transform: translateY(0);
}

.settings-panel .settings-body {
  display: grid;
  gap: 1rem;
}

.settings-panel select {
  background: rgba(24, 36, 68, 0.9);
  border: 1px solid rgba(80, 140, 255, 0.35);
  border-radius: 12px;
  color: var(--text);
  padding: 0.65rem 0.75rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.74);
  backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 10;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal.open {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  position: relative;
  max-width: 400px;
  width: 100%;
  padding: 1.25rem 1.5rem 1.75rem;
  display: grid;
  gap: 1rem;
}

.booster-packages {
  display: grid;
  gap: 0.75rem;
}

.booster-card {
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: rgba(20, 28, 56, 0.85);
  border: 1px solid rgba(68, 140, 255, 0.25);
  display: grid;
  gap: 0.4rem;
  transition: transform var(--transition), border var(--transition);
}

.booster-card.active {
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 15px 30px rgba(59, 146, 255, 0.3);
}

.booster-card .title {
  font-weight: 600;
}

.booster-card .meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.booster-quantity {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(24, 36, 68, 0.7);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

.stepper button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, rgba(43, 124, 255, 0.3), rgba(58, 163, 255, 0.2));
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.form-group {
  display: grid;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-group input,
.form-group select {
  border-radius: 12px;
  border: 1px solid rgba(82, 140, 255, 0.3);
  padding: 0.65rem 0.75rem;
  background: rgba(14, 22, 44, 0.8);
  color: var(--text);
  font-size: 0.95rem;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: rgba(5, 12, 28, 0.88);
  border: 1px solid rgba(70, 138, 255, 0.35);
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  font-size: 0.85rem;
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
  z-index: 20;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 2rem));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0.35rem;
  border-radius: 999px;
}

.tab-link {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tab-link img {
  width: 26px;
  height: 26px;
}

.tab-link.active {
  background: rgba(34, 78, 200, 0.35);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(60, 158, 255, 0.45);
}

.guard {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.92);
  backdrop-filter: blur(18px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 8;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition), visibility var(--transition);
}

.guard.visible {
  visibility: visible;
  opacity: 1;
}

.guard-card {
  max-width: 360px;
  padding: 1.5rem;
  text-align: center;
  display: grid;
  gap: 1rem;
}

.guard-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

.guard-logo {
  width: 72px;
  justify-self: center;
}

@media (max-width: 420px) {
  .app-shell {
    padding-bottom: 6.5rem;
  }
  .invite {
    grid-template-columns: 1fr;
  }
  .friends-hero,
  .commission {
    grid-template-columns: 1fr;
  }
}

body[dir='rtl'] {
  direction: rtl;
}

body[dir='rtl'] .balance-card,
body[dir='rtl'] .shop-card,
body[dir='rtl'] .task-item {
  text-align: right;
}

body[dir='rtl'] .shop-card .badge {
  border-radius: 14px 0 8px 0;
  inset-inline-start: -4px;
  inset-inline-end: auto;
}

body[dir='rtl'] .guard-card,
body[dir='rtl'] .modal-content,
body[dir='rtl'] .settings-panel {
  text-align: right;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-1px);
  }
  75% {
    transform: translateX(1px);
  }
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
