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

:root {
  --blue-primary: #2196F3;
  --blue-dark: #1565C0;
  --blue-gradient: linear-gradient(180deg, #42A5F5 0%, #1E88E5 50%, #1565C0 100%);
  --green-btn: linear-gradient(180deg, #66BB6A 0%, #43A047 50%, #2E7D32 100%);
  --green-text: #2E7D32;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --text-dark: #1a237e;
  --text-muted: #78909C;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background: #81D4FA;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  overflow: hidden;
}

/* ── Background Scene ── */
.bg-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #4FC3F7 0%, #81D4FA 40%, #B3E5FC 70%);
}

.bg-clouds {
  position: absolute;
  top: 8%;
  left: 0;
  right: 0;
  height: 80px;
  background:
    radial-gradient(ellipse 60px 30px at 20% 50%, rgba(255,255,255,0.7) 0%, transparent 70%),
    radial-gradient(ellipse 80px 35px at 55% 40%, rgba(255,255,255,0.6) 0%, transparent 70%),
    radial-gradient(ellipse 50px 25px at 85% 55%, rgba(255,255,255,0.5) 0%, transparent 70%);
}

.bg-palm-left {
  position: absolute;
  bottom: 28%;
  left: -20px;
  width: 120px;
  height: 200px;
  background:
    radial-gradient(ellipse 50px 80px at 60% 20%, #388E3C 0%, transparent 70%),
    radial-gradient(ellipse 40px 70px at 30% 30%, #43A047 0%, transparent 70%),
    radial-gradient(ellipse 35px 60px at 70% 40%, #2E7D32 0%, transparent 70%);
  transform: rotate(-15deg);
}

.bg-palm-right {
  position: absolute;
  bottom: 30%;
  right: -10px;
  width: 90px;
  height: 160px;
  background:
    radial-gradient(ellipse 40px 70px at 40% 25%, #388E3C 0%, transparent 70%),
    radial-gradient(ellipse 35px 55px at 65% 35%, #43A047 0%, transparent 70%);
  transform: rotate(10deg);
}

.bg-beach {
  position: absolute;
  bottom: 12%;
  left: 0;
  right: 0;
  height: 18%;
  background: linear-gradient(180deg, #FFF9C4 0%, #FFE082 40%, #FFCC80 100%);
  border-radius: 50% 50% 0 0 / 20px 20px 0 0;
}

.bg-ocean {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 14%;
  background: linear-gradient(180deg, #4DD0E1 0%, #00ACC1 50%, #0097A7 100%);
}

.bg-ocean::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 16px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.3) 0px,
    rgba(255,255,255,0.3) 20px,
    transparent 20px,
    transparent 40px
  );
  border-radius: 50%;
  animation: wave 3s ease-in-out infinite;
}

.bg-surf {
  position: absolute;
  bottom: 16%;
  right: 8%;
  width: 80px;
  height: 60px;
  opacity: 0.7;
}

.bg-surf::before {
  content: '🏄';
  font-size: 40px;
  position: absolute;
}

@keyframes wave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}

/* ── Header ── */
.header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  min-height: 52px;
}

.header-back {
  position: absolute;
  left: 12px;
  top: calc(var(--safe-top) + 12px);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.25);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s, background 0.15s;
}

.header-back:active {
  transform: scale(0.92);
  background: rgba(255,255,255,0.4);
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
  letter-spacing: 0.3px;
}

/* ── Hero (background) ── */
.hero {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 24px;
  height: calc(100% - 64px - var(--safe-top));
}

.hero-card {
  width: 100%;
  max-width: 300px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}


.robux-diamond-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.robux-amount-label {
  font-size: 15px;
  font-weight: 900;
  color: #E65100;
  text-align: center;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}

.robux-diamond {
  display: block;
  filter: drop-shadow(0 3px 6px rgba(165, 120, 42, 0.35));
}

.modal-icon.robux-diamond-wrap,
.avatar-fallback.robux-diamond-wrap {
  margin-bottom: 4px;
}

.hero-coin,
.robux-diamond-wrap.hero-area {
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 8px rgba(249, 168, 37, 0.4));
}

.hero-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.hero-amount {
  display: inline-block;
  padding: 8px 20px;
  background: linear-gradient(135deg, #FFD54F, #FFA726);
  border-radius: 50px;
  font-size: 18px;
  font-weight: 900;
  color: #E65100;
  box-shadow: 0 4px 12px rgba(255, 167, 38, 0.35);
}

.reward-icon {
  font-size: 56px;
  margin-bottom: 8px;
  line-height: 1;
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 32px 24px 28px;
  box-shadow: var(--card-shadow);
  text-align: center;
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-icon, .avatar-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-wrap {
  border-radius: 20px;
  overflow: hidden;
  background: #ECEFF1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

.avatar-img.hidden { display: none; }

.modal-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 8px;
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.subscribe-text {
  text-align: left;
  font-size: 13.5px;
  line-height: 1.55;
}

.text-green {
  color: var(--green-text);
  font-weight: 800;
}

/* ── Input ── */
.input-group {
  margin-bottom: 16px;
}

.input-field {
  width: 100%;
  padding: 14px 20px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  background: #fff;
  border: 2px solid #E0E0E0;
  border-radius: 50px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}

.input-field::placeholder {
  color: #B0BEC5;
  font-weight: 500;
}

.input-field:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

/* ── Buttons ── */
.btn {
  width: 100%;
  padding: 16px 24px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
  filter: brightness(0.95);
}

.btn-primary {
  background: var(--blue-gradient);
  box-shadow: 0 4px 16px rgba(33, 150, 243, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-success {
  background: var(--green-btn);
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Channel List ── */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.channel-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-primary);
  background: #fff;
  border: 2px solid #E3F2FD;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: visible;
}

.channel-btn-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel-sticker {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}

.channel-sticker-gem {
  animation: gemShine 2s ease-in-out infinite;
}

@keyframes gemShine {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 2px 6px rgba(196,77,255,0.4)); }
  50% { transform: scale(1.08) rotate(3deg); filter: drop-shadow(0 4px 12px rgba(255,107,157,0.6)); }
}

.channel-btn-text {
  flex: 1;
  text-align: left;
  line-height: 1.3;
}

.channel-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #FF5722, #FF9800);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(255, 87, 34, 0.4);
}

.channel-badge-pulse {
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.channel-btn-reward {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFF3E0 50%, #FCE4EC 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 2px rgba(255, 152, 0, 0.5),
    0 4px 16px rgba(255, 107, 157, 0.25);
  color: #E65100;
  animation: rewardGlow 2.5s ease-in-out infinite;
}

@keyframes rewardGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,152,0,0.4), 0 4px 12px rgba(255,107,157,0.2); }
  50% { box-shadow: 0 0 0 2px rgba(255,152,0,0.8), 0 6px 20px rgba(196,77,255,0.35); }
}

.channel-btn-reward .channel-btn-text {
  font-weight: 800;
}

.channel-btn:active {
  background: #E3F2FD;
  transform: scale(0.98);
}

.channel-btn-reward:active {
  background: linear-gradient(135deg, #FFE082, #FFCCBC);
}

.channel-btn.subscribed {
  border-color: #A5D6A7;
  color: var(--green-text);
}

/* ── iOS Alert ── */
.ios-alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.2s ease;
}

.ios-alert-backdrop.hidden { display: none; }

.ios-alert {
  width: 100%;
  max-width: 270px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 14px;
  overflow: hidden;
  text-align: center;
  animation: iosPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iosPop {
  from { opacity: 0; transform: scale(1.1); }
  to { opacity: 1; transform: scale(1); }
}

.ios-alert-message {
  padding: 20px 16px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #000;
  line-height: 1.45;
}

.ios-alert-btn {
  width: 100%;
  padding: 14px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  color: var(--blue-primary);
  background: transparent;
  border: none;
  border-top: 0.5px solid rgba(0,0,0,0.12);
  cursor: pointer;
  transition: background 0.15s;
}

.ios-alert-btn:active {
  background: rgba(0,0,0,0.05);
}

/* ── Loader ── */
.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.2);
}

.loader-overlay.hidden { display: none; }

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 360px) {
  .modal-card { padding: 24px 18px 22px; }
  .modal-title { font-size: 21px; }
  .btn { padding: 14px 20px; font-size: 14px; }
}

@media (min-height: 800px) {
  .hero-card { padding: 36px 28px; }
}
