:root {
  color-scheme: dark;
  --bg: #10111a;
  --surface: #191b29;
  --surface2: #222438;
  --text: #f5f5fb;
  --muted: #a4a8bd;
  --accent: #9270ff;
  --accent2: #b19bff;
  --border: #303249;
  --green: #4de0a2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at top, #252044, transparent 50%), var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px max(22px, calc((100% - 1000px) / 2));
  border-bottom: 1px solid var(--border);
  background: #10111add;
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(16px);
}
.brand { font-size: 19px; font-weight: 800; }
.admin-link {
  padding: 10px 15px;
  border: 1px solid #514477;
  border-radius: 12px;
  color: var(--accent2);
  font-size: 14px;
  font-weight: 700;
}
.admin-link:hover { background: #29223e; }
.container { width: min(900px, calc(100% - 32px)); margin: 38px auto; }
.hero {
  padding: clamp(25px, 6vw, 48px);
  border: 1px solid #40365e;
  border-radius: 24px;
  background: linear-gradient(130deg, #282044, #1b1c2b 70%);
  box-shadow: 0 18px 70px #0003;
}
.eyebrow { color: var(--accent2); font-size: 11px; font-weight: 800; letter-spacing: 2px; }
h1 { font-size: clamp(30px, 6vw, 46px); letter-spacing: -1.5px; margin: 14px 0; overflow-wrap: anywhere; }
h2 { font-size: 19px; margin: 0; }
.muted { color: var(--muted); }
code {
  background: #30274b;
  border: 1px solid #514477;
  padding: 4px 8px;
  border-radius: 7px;
  color: #d4c6ff;
}
.status {
  display: inline-flex;
  margin-top: 18px;
  padding: 9px 13px;
  border-radius: 10px;
  background: #292b3e;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}
.status.active { color: var(--green); background: #17352f; border-color: #275748; }
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.stat, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
}
.stat span { color: var(--muted); display: block; font-size: 13px; }
.stat strong {
  display: block;
  margin-top: 9px;
  font-size: 36px;
  letter-spacing: -1px;
}
.stat .small-stat { font-size: 19px; letter-spacing: 0; }
.panel { margin-top: 16px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.participants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.participant {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  background: #3a305b;
  color: var(--accent2);
  border-radius: 11px;
  font-weight: 800;
}
.participant-name { overflow-wrap: anywhere; font-weight: 650; font-size: 14px; }
.history { margin-top: 16px; }
.history-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.history-item strong { color: var(--green); }
footer {
  padding: 30px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
button, input { font: inherit; }
button {
  cursor: pointer;
  border: 0;
  border-radius: 11px;
  padding: 12px 16px;
  font-weight: 750;
  background: var(--accent);
  color: white;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: not-allowed; }
input {
  width: 100%;
  padding: 12px 14px;
  margin-top: 7px;
  color: var(--text);
  background: #10111a;
  border: 1px solid var(--border);
  border-radius: 10px;
}
label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0;
}
.form { max-width: 430px; margin: 35px auto; }
.form button { width: 100%; margin-top: 8px; }
.error { color: #ff8585; margin-top: 12px; }
.success { color: var(--green); margin-top: 12px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.admin-actions button.secondary { background: #34364c; }
@media (max-width: 560px) {
  .topbar { padding: 14px 16px; }
  .brand { font-size: 16px; }
  .admin-link { padding: 9px 11px; font-size: 12px; }
  .container { margin: 20px auto; }
  .stats { gap: 10px; }
  .stat, .panel { padding: 16px; }
  .stat strong { font-size: 29px; }
  .stat .small-stat { font-size: 16px; }
  .participants { grid-template-columns: 1fr; }
}

/* 20 saniyelik çekiliş animasyonu */
.draw-animation {
  background-color: #171126;
  background-image: linear-gradient(rgba(10,5,20,.12), rgba(10,5,20,.18)), url("https://media.tenor.com/18Fqk-2PvOEAAAAM/primogems-genshin.gif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin-top: 18px;
  text-align: center;
  overflow: hidden;

  border-color: #6650a5;
}
.draw-animation h2 { margin: 8px 0 20px; }
.draw-reel {
  background: rgba(15, 12, 28, 0.18);
  position: relative;
  isolation: isolate;
  min-height: 100px;
  display: grid;
  place-items: center;
  padding: 20px 12px;
  border: 1px solid #b99aff;
  border-radius: 16px;
  color: #ffffff;
  font-size: clamp(25px, 5vw, 38px);
  font-weight: 850;
  overflow: hidden;
  overflow-wrap: anywhere;
  box-shadow: inset 0 0 35px #9270ff22, 0 0 25px #9270ff18;
}

.draw-reel { position: relative; isolation: isolate; }
.draw-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  filter: blur(2px);
  transform: scale(1.04);
  pointer-events: none;
  z-index: 0;
}
.draw-reel-name {
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 12px #000, 0 0 24px #10111a;
}
.draw-track {
  height: 7px;
  margin-top: 20px;
  border-radius: 99px;
  background: #303249;
  overflow: hidden;
}
.draw-progress {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #9270ff, #d4c6ff);
  box-shadow: 0 0 14px #9270ff;
}
.draw-winner {
  background: rgba(15, 12, 28, 0.18);
  position: relative;
  isolation: isolate;
  margin-top: 20px;
  min-height: 150px;
  padding: 28px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid #b99aff;
  border-radius: 16px;
  color: #ffffff;
  font-size: clamp(23px, 5vw, 36px);
  font-weight: 900;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 8px #000, 0 0 16px #000;
  animation: winner-reveal .7s ease-out both;
}
.draw-winner[hidden] { display: none; }
@keyframes winner-reveal {
  from { opacity: 0; transform: scale(.75); filter: blur(8px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

.obs-link-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.obs-link-row input { flex:1 1 260px; min-width:0; }
.obs-link-panel h2 { margin-top:0; }

/* Çoklu kazanan ayarları */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 12px 0;
}
.setting-check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.setting-check input {
  width: auto;
  margin: 0;
}
@media (max-width: 560px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* Animasyon süresi seçicisi: admin butonlarıyla uyumlu */
.duration-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text, #f5f3ff);
  font-size: 14px;
  font-weight: 600;
}

#draw-duration {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding: 0 36px 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background-color: #303047;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .15s ease, background-color .15s ease;
}

#draw-duration:hover {
  background-color: #3a3955;
  border-color: rgba(196, 181, 253, 0.45);
}

#draw-duration:focus-visible {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
}

#draw-duration option {
  background: #25243a;
  color: #fff;
}

/* Animasyon süresi: etiket üstte, seçim kutusu altta */
.duration-label {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  align-self: stretch;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

#draw-duration {
  box-sizing: border-box;
  width: 112px;
  min-height: 44px;
  height: 44px;
}

/* Animasyon süresi alanını diğer kontrol butonlarıyla hizala */
.admin-actions .duration-label {
  align-self: stretch;
  justify-content: space-between;
  min-height: 64px;
  gap: 6px;
}

.admin-actions #draw-duration {
  width: 112px;
  height: 44px;
  min-height: 44px;
  flex-shrink: 0;
}


/* Animasyon süresi alanı: biraz daha büyük */
.admin-actions .duration-label {
  min-height: 76px;
  min-width: 132px;
  gap: 8px;
  font-size: 14px;
}

.admin-actions #draw-duration {
  width: 132px;
  height: 48px;
  min-height: 48px;
  padding-left: 14px;
  padding-right: 38px;
  font-size: 14px;
  border-radius: 13px;
}

/* Üst çekiliş kontrol satırını daha dengeli yap */
.admin-actions #start-button,
.admin-actions #finish-button,
.admin-actions #logout-button,
.admin-actions button#start-button,
.admin-actions button#finish-button {
  padding: 10px 13px;
  font-size: 14px;
  min-height: 56px;
}

.admin-actions {
  align-items: center;
}


/* Üst kontrol satırının son hizalama ayarı */
.admin-actions {
  align-items: center;
}

.admin-actions .duration-label {
  align-self: center;
  min-height: 56px;
  justify-content: center;
  gap: 7px;
  transform: translateY(-1px);
}

.admin-actions #draw-duration {
  height: 44px;
  min-height: 44px;
}


/* Son mikro hizalama */
.admin-actions .duration-label {
  transform: translateY(-3px);
}

/* Son mikro hizalama */
.admin-actions .duration-label {
  transform: translateY(-3px);
}

.admin-actions .duration-label {
  transform: translateY(-5px);
}

/* Admin paneli: sol menülü yerleşim */
.admin-layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  width: min(1200px, calc(100vw - 40px));
  margin: 28px 0 40px;
}

#dashboard {
  width: 100%;
}

#dashboard .admin-layout {
  margin-left: 50%;
  transform: translateX(-50%);
}

.admin-sidebar {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px 12px;
  background: linear-gradient(180deg, #1b1d2d, #151622);
  border: 1px solid var(--border);
  border-radius: 18px;
  min-width: 0;
}

.sidebar-label {
  margin: 4px 10px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: #c6c8d8;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.sidebar-item span {
  width: 22px;
  flex: 0 0 22px;
  color: #a9a0d6;
  text-align: center;
  font-size: 19px;
}

.sidebar-item:hover {
  background: #27263b;
  filter: none;
}

.sidebar-item.active {
  color: #fff;
  background: linear-gradient(100deg, #44346f, #302747);
  border-color: #65518f;
  box-shadow: inset 3px 0 0 var(--accent2);
}

.sidebar-item.active span {
  color: var(--accent2);
}

.sidebar-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 15px 9px 2px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.sidebar-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px #4de0a255;
}

.sidebar-logout {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  color: #ffc0c0;
  background: #38252f;
  border: 1px solid #5b3545;
  text-align: center;
  font-size: 12px;
}

.sidebar-logout:hover {
  background: #4a2b39;
  filter: none;
}

.admin-content {
  min-width: 0;
}

.admin-section[hidden] {
  display: none !important;
}

.admin-section.active {
  display: block;
  animation: adminSectionIn .18s ease-out;
}

.admin-section > .panel:first-child,
.admin-section > .hero:first-child {
  margin-top: 0;
}

.admin-content .hero {
  padding: clamp(22px, 3vw, 36px);
}

@keyframes adminSectionIn {
  from { opacity: .45; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 850px) {
  .admin-layout {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 14px;
    width: calc(100vw - 28px);
  }

  .admin-sidebar {
    padding: 14px 8px;
  }

  .sidebar-item {
    gap: 8px;
    padding: 10px 8px;
    font-size: 12px;
  }

  .admin-content .hero {
    padding: 22px;
  }
}

@media (max-width: 620px) {
  .admin-layout {
    display: flex;
    flex-direction: column;
    width: calc(100vw - 24px);
    gap: 14px;
    margin-top: 16px;
  }

  #dashboard .admin-layout {
    margin-left: 50%;
  }

  .admin-sidebar {
    position: static;
    width: 100%;
    padding: 12px;
  }

  .sidebar-label {
    margin: 2px 5px 5px;
  }

  .admin-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-label,
  .sidebar-footer {
    grid-column: 1 / -1;
  }

  .sidebar-item {
    min-height: 42px;
    font-size: 12px;
  }

  .sidebar-footer {
    margin-top: 8px;
  }

  .admin-content {
    width: 100%;
  }
}

/* Yönetici girişinde yazılan karakterleri görsel olarak gizle */
#login-form #username,
#login-form #password {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: #a78bfa;
  text-shadow: none !important;
}

/* Yönetici giriş alanlarında karakter sayısını ve imleci gizle */
#login-form #username,
#login-form #password {
  caret-color: transparent !important;
  letter-spacing: -1ch !important;
  text-indent: -9999px !important;
}
