:root {
  --bg: var(--tg-theme-bg-color, #0f1020);
  --text: var(--tg-theme-text-color, #f4f4f9);
  --hint: var(--tg-theme-hint-color, #9a9ab3);
  --link: var(--tg-theme-link-color, #8b7bff);
  --button: var(--tg-theme-button-color, #7c6cff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.10);
  --accent: #ffb84d;
  --success: #37d67a;
  --danger: #ff5c7a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at 20% -10%, #2a1b5e 0%, #100e26 45%, #0b0a1a 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ---------- SPLASH ---------- */
#splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0b0a1a;
  z-index: 999;
}
.splash-ticket {
  font-size: 64px;
  animation: floaty 1.6s ease-in-out infinite;
}
.splash-text {
  color: var(--hint);
  font-size: 14px;
  letter-spacing: 0.04em;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-14px) rotate(6deg); }
}

/* ---------- LAYOUT ---------- */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 84px;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}
.app-header h1 {
  font-size: 20px;
  margin: 0;
  background: linear-gradient(90deg, #ffffff, #b9aaff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.admin-badge {
  background: linear-gradient(90deg, #ffb84d, #ff7a59);
  color: #1a1a1a;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

#views { padding: 8px 20px 20px; flex: 1; }

.view { display: none; animation: viewIn 0.35s ease; }
.view.active { display: block; }
@keyframes viewIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- CARDS ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
}

.hero-card {
  text-align: center;
  padding: 30px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(124,108,255,0.35), rgba(255,184,77,0.15));
  border: 1px solid var(--card-border);
  margin-bottom: 18px;
}
.hero-emoji {
  font-size: 46px;
  animation: bounce 2.2s ease-in-out infinite;
  margin-bottom: 10px;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.08); }
}
.hero-card p { color: var(--text); font-size: 15px; line-height: 1.5; margin: 0; }

.pre-wrap { white-space: pre-wrap; line-height: 1.6; }

/* ---------- BUTTONS ---------- */
.primary-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--button), #a78bff);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 20px rgba(124,108,255,0.35);
}
.primary-btn:active { transform: scale(0.97); }

.ghost-btn {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
}
.ghost-btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.ghost-btn:active { transform: scale(0.97); }

/* ---------- ODEME ---------- */
.amount-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}
.amount-row strong { color: var(--accent); font-size: 20px; }

.method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}
.method-row:last-child { border-bottom: none; }
.method-row .m-label { font-size: 13px; color: var(--hint); }
.method-row .m-value { font-size: 13px; word-break: break-all; }
.method-row input[type="radio"] { accent-color: var(--button); width: 18px; height: 18px; }
.copy-btn {
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 8px;
}

.status-card { text-align: center; }
.pulse-dot {
  width: 14px; height: 14px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255,184,77,0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,184,77,0.6); }
  70% { box-shadow: 0 0 0 14px rgba(255,184,77,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,184,77,0); }
}
.ticket-reveal { animation: popIn 0.5s cubic-bezier(.34,1.56,.64,1); }
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.7); }
  100% { opacity: 1; transform: scale(1); }
}
.ticket-icon { font-size: 40px; }
.ticket-code {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-top: 8px;
  color: var(--success);
}

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(15,16,32,0.92);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 8px);
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--hint);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border-radius: 12px;
  transition: color 0.2s ease;
}
.nav-btn span { font-size: 18px; }
.nav-btn.active { color: var(--text); background: rgba(124,108,255,0.18); }

/* ---------- ADMIN ---------- */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.admin-tab-btn {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--hint);
  font-size: 12px;
}
.admin-tab-btn.active { background: var(--button); color: #fff; border-color: transparent; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 14px;
}
.list-item .li-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.list-item .li-name { font-weight: 600; }
.list-item .li-meta { color: var(--hint); font-size: 12px; line-height: 1.5; }
.li-actions { display: flex; gap: 8px; margin-top: 10px; }
.li-actions button {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 600;
}
.btn-approve { background: var(--success); color: #06301a; }
.btn-reject { background: var(--danger); color: #3a0410; }
.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.status-pill.approved { background: rgba(55,214,122,0.2); color: var(--success); }
.status-pill.rejected { background: rgba(255,92,122,0.2); color: var(--danger); }

#admin-ayarlar label, #admin-cekilis label {
  display: block;
  font-size: 12px;
  color: var(--hint);
  margin: 12px 0 6px;
}
#admin-ayarlar input, #admin-ayarlar textarea, #admin-cekilis input, #admin-cekilis textarea, #admin-cekilis select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}
.method-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.method-edit-row input { flex: 1; }
.method-edit-row button {
  border: none;
  background: rgba(255,92,122,0.15);
  color: var(--danger);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 16px;
}
.empty-note { text-align: center; color: var(--hint); font-size: 13px; margin-top: 20px; }

/* ---------- BANNERS ---------- */
.banner-img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--card-border);
}

/* ---------- ADET (QUANTITY) ---------- */
.qty-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
}
.qty-stepper button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}
.qty-stepper button:active { transform: scale(0.92); }
#qty-value { font-size: 17px; font-weight: 700; min-width: 20px; text-align: center; }

/* ---------- LEADERBOARD ---------- */
.lb-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.lb-name { font-weight: 600; font-size: 14px; }
.lb-count {
  background: rgba(124,108,255,0.2);
  color: #cfc6ff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.lb-codes {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lb-code-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--hint);
  letter-spacing: 0.03em;
}

.divider { border: none; border-top: 1px solid var(--card-border); margin: 18px 0; }

.banner-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.banner-edit-row input[type="file"] {
  flex: 1;
  min-width: 140px;
  padding: 8px;
  font-size: 12px;
}
.banner-preview {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}
.banner-preview.hidden { display: none; }
.banner-edit-row button[data-remove-banner] {
  border: none;
  background: rgba(255,92,122,0.15);
  color: var(--danger);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}

/* =======================================================
   DUYURU / GERI SAYIM
   ======================================================= */
.countdown-banner {
  background: linear-gradient(135deg, rgba(255,92,122,0.25), rgba(124,108,255,0.25));
  border: 1px solid rgba(255,92,122,0.4);
  border-radius: 18px;
  padding: 14px 16px;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  animation: countdownGlow 2s ease-in-out infinite;
}
.countdown-banner.solo { cursor: default; }
@keyframes countdownGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(255,92,122,0.0); }
  50% { box-shadow: 0 0 24px rgba(255,92,122,0.35); }
}
.countdown-banner-label {
  font-size: 12px;
  font-weight: 700;
  color: #ffd9de;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.countdown-clock {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* =======================================================
   BUYUK CEKILIS (RAFFLE DRAW) ANIMASYONLARI
   ======================================================= */

.draw-caption {
  font-size: 14px;
  color: var(--hint);
  text-align: center;
  min-height: 20px;
  animation: winnerPop 0.4s ease;
}
.draw-intro-title {
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(90deg, #ffb84d, #ff7a9c, #a78bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: introTitlePop 0.7s cubic-bezier(.34,1.56,.64,1);
  text-shadow: none;
}
@keyframes introTitlePop {
  0% { opacity: 0; transform: scale(0.5) translateY(10px); }
  60% { opacity: 1; transform: scale(1.08) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.draw-meta {
  display: flex;
  justify-content: space-around;
  margin: 14px 0;
}
.draw-meta > div { text-align: center; }
.draw-meta span { display: block; font-size: 11px; color: var(--hint); margin-bottom: 4px; }
.draw-meta strong { font-size: 22px; color: var(--accent); }

.hash-note {
  text-align: center;
  font-size: 11px;
  color: var(--hint);
  margin-top: 10px;
  word-break: break-all;
  line-height: 1.6;
}
.hash-note code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 6px;
  color: #cfc6ff;
}

#draw-stage {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0;
  perspective: 800px;
}

.draw-winner-name { font-size: 17px; font-weight: 700; }
.draw-winner-ticket {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--success);
  margin-top: 4px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease; }

.winner-glow-card {
  background: linear-gradient(160deg, rgba(255,184,77,0.22), rgba(124,108,255,0.18));
  border: 1px solid rgba(255,184,77,0.4);
  border-radius: 18px;
  padding: 20px 24px;
  text-align: center;
  box-shadow: 0 0 30px rgba(255,184,77,0.25);
  animation: winnerPop 0.6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes winnerPop {
  0% { opacity: 0; transform: scale(0.6) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.winner-glow-card + .winner-glow-card { margin-top: 10px; }

/* ---------- 1) SLOT MAKINESI ---------- */
.slot-machine {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.slot-reel-wrap {
  height: 58px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--card-border);
  position: relative;
}
.slot-reel-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.5), transparent 30%, transparent 70%, rgba(0,0,0,0.5));
  pointer-events: none;
}
.slot-reel { display: flex; flex-direction: column; will-change: transform; }
.slot-item {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: #cfc6ff;
}
.slot-item.is-winner { color: var(--accent); }

/* ---------- 2) LUKS KART ACMA ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
}
.mystery-card {
  aspect-ratio: 3/4;
  background: linear-gradient(160deg, #3a2f6b, #1c1a33);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  animation: cardJitter 0.5s ease-in-out infinite alternate;
}
@keyframes cardJitter {
  0% { transform: translateY(0) rotate(-2deg); }
  100% { transform: translateY(-4px) rotate(2deg); }
}
.card-flip-wrap {
  width: 160px;
  aspect-ratio: 3/4;
  perspective: 800px;
}
.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 1.3s cubic-bezier(.34,1.56,.64,1);
}
.card-flip-wrap.flipped .card-flip-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
}
.card-face.front {
  background: linear-gradient(160deg, #3a2f6b, #1c1a33);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 34px;
}
.card-face.back {
  background: linear-gradient(160deg, rgba(255,184,77,0.25), rgba(124,108,255,0.2));
  border: 1px solid rgba(255,184,77,0.5);
  transform: rotateY(180deg);
  box-shadow: 0 0 30px rgba(255,184,77,0.3);
}

/* ---------- 3) PIYANGO TOPU (gercekci piyango makinesi) ---------- */
.lottery-machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.lottery-glass {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,0.3), rgba(255,255,255,0.04) 55%, rgba(0,0,0,0.35));
  border: 3px solid rgba(255,255,255,0.28);
  overflow: hidden;
  box-shadow: inset 0 0 26px rgba(0,0,0,0.45), 0 10px 24px rgba(0,0,0,0.35);
}
.lottery-glass-shine {
  position: absolute;
  top: 8%;
  left: 18%;
  width: 34%;
  height: 20%;
  background: rgba(255,255,255,0.35);
  border-radius: 50%;
  filter: blur(6px);
  z-index: 3;
}
.lottery-balls-spin {
  position: absolute;
  inset: 0;
  animation: drumSpin 2.6s linear infinite;
}
@keyframes drumSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.lottery-stand {
  width: 70px;
  height: 14px;
  background: linear-gradient(160deg, #4a3f7a, #2a2450);
  border-radius: 0 0 10px 10px;
  margin-top: -4px;
}
.lottery-ball {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(160deg, #a78bff, #6a4fe0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  box-shadow: inset -3px -3px 6px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.3);
}
.lottery-tube {
  width: 20px;
  height: 60px;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  margin-top: 6px;
}
.lottery-ball.traveling {
  position: absolute;
  left: 50%;
  bottom: -34px;
  transform: translateX(-50%);
  animation: tubeTravel 1.1s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes tubeTravel {
  0% { bottom: -34px; opacity: 1; }
  100% { bottom: 100%; opacity: 1; }
}
.lottery-slot {
  width: 70px;
  height: 10px;
  background: rgba(0,0,0,0.4);
  border-radius: 6px;
  margin-top: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}
.ball-reveal-card {
  animation: winnerPop 0.5s cubic-bezier(.34,1.56,.64,1);
}

/* ---------- 4) GERILIM + PATLAMA ---------- */
.countdown-number {
  font-size: 72px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(255,184,77,0.6);
  animation: countPop 0.5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes countPop {
  0% { opacity: 0; transform: scale(0.4); }
  100% { opacity: 1; transform: scale(1); }
}
.burst-ring {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,184,77,0.9), rgba(255,184,77,0) 70%);
  animation: burstExpand 0.8s ease-out forwards;
}
@keyframes burstExpand {
  0% { transform: scale(0.2); opacity: 1; }
  100% { transform: scale(18); opacity: 0; }
}

/* ---------- GORUNUM RENKLERI (admin) ---------- */
.theme-color-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0 4px;
}
.theme-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.theme-color-label {
  font-size: 13px;
  color: var(--hint);
  min-width: 90px;
}
.color-swatch-list {
  display: flex;
  gap: 8px;
}
.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.color-swatch:active { transform: scale(0.9); }
.color-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255,184,77,0.35);
  transform: scale(1.08);
}

/* ---------- TEHLIKELI ISLEM ALANI (admin) ---------- */
.danger-zone {
  border: 1px solid rgba(255,92,122,0.35);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  background: rgba(255,92,122,0.06);
}
.danger-zone label { color: var(--danger); }
.ghost-btn.danger {
  border-color: rgba(255,92,122,0.45);
  color: var(--danger);
  margin-top: 8px;
}
