/* Tefsir Çarkı · DERS for Youth paleti
   Düzen: sol sahnede çark + buton, sağda canlı katılımcı ve tefsir listesi. */
:root {
  /* Marka dolguları (her iki temada aynı) */
  --navy: #25375F; --teal: #3AADA3; --clay: #B85C38; --amber: #C8922F;
  --olive: #6B7C51; --sand: #D4B896; --cloud: #F4F1EB;
  --deep-navy: #1A2540; --deep-clay: #9F4F30; --deep-olive: #5C6B46;
  --deep-teal: #26716A; --slate: #33404E;

  /* Anlamsal (açık tema) */
  --surface: #F4F1EB; --surface-raised: #FAF9F6; --surface-tint: #EDE6D8;
  --line: #E2DDD5; --line-strong: #877F73;
  --ink: #25375F; --ink-body: #3A3530; --ink-muted: #67615C;
  --text-teal: #26716A; --text-clay: #9F4F30; --text-amber: #84601F;
  --action: #25375F; --action-hover: #1A2540; --on-action: #F4F1EB;
  --action-warm: #9F4F30; --action-warm-hover: #843F25; --on-action-warm: #F4F1EB;
  --focus: #26716A; --success: #26716A; --warning: #84601F; --danger: #B23A2A;
  --disabled-bg: #E2DDD5; --disabled-ink: #67615C;
  --wheel-rim: #25375F; --scrim: rgba(26, 37, 64, .55);
  --shadow-card: 0 8px 24px rgba(37, 55, 95, .08);
  --shadow-float: inset 0 1px 0 rgba(255,255,255,.8), 0 20px 48px rgba(37, 55, 95, .18);

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 10px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px; --r-pill: 9999px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #25375F; --surface-raised: #33404E; --surface-tint: #1A2540;
    --line: #44526A; --line-strong: #8190A9;
    --ink: #F4F1EB; --ink-body: #F4F1EB; --ink-muted: #B6BECC;
    --text-teal: #56D8CC; --text-clay: #F0A57D; --text-amber: #F4C430;
    --action: #F4F1EB; --action-hover: #E9D3BA; --on-action: #1A2540;
    --action-warm: #F0A57D; --action-warm-hover: #F5BE9F; --on-action-warm: #1A2540;
    --focus: #56D8CC; --success: #56D8CC; --warning: #F4C430; --danger: #E4988E;
    --disabled-bg: #44526A; --disabled-ink: #B6BECC;
    --wheel-rim: #1A2540; --scrim: rgba(10, 15, 28, .7);
    --shadow-card: 0 8px 24px rgba(0,0,0,.28);
    --shadow-float: inset 0 1px 0 rgba(255,255,255,.06), 0 20px 48px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--surface); color: var(--ink-body);
  font: 400 16px/1.55 var(--sans); letter-spacing: .01em;
  min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow {
  font: 500 12px/16px var(--sans); letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-teal);
}
.link { color: var(--text-teal); font-weight: 600; text-underline-offset: 3px; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--r-sm); padding: 12px 20px; cursor: pointer;
  font: 600 14px/20px var(--sans); letter-spacing: .01em;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.btn:disabled { cursor: not-allowed; background: var(--disabled-bg); color: var(--disabled-ink); box-shadow: none; }
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:not(:disabled):hover { background: var(--action-hover); }
.btn-warm { background: var(--action-warm); color: var(--on-action-warm); }
.btn-warm:not(:disabled):hover { background: var(--action-warm-hover); }
.btn-outline { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn-outline:not(:disabled):hover { background: var(--surface-tint); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn-danger.is-confirm, .btn-danger:not(:disabled):hover { background: var(--danger); color: var(--surface-raised); }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ---------- Form ---------- */
label { display: block; font: 600 14px/20px var(--sans); color: var(--ink); margin-bottom: 8px; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--surface-raised); border: 1.5px solid var(--line-strong);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
.field-msg { min-height: 20px; font-size: 13px; line-height: 19px; color: var(--danger); margin-top: 8px; }
.field-msg.is-info { color: var(--text-amber); }
.field-msg.is-ok { color: var(--success); }

/* ---------- Giriş sayfası ---------- */
.entry {
  position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 48px 16px;
}
.entry-discs span { position: absolute; border-radius: 50%; pointer-events: none; }
.entry-discs span:nth-child(1) { width: 520px; height: 520px; background: var(--teal); opacity: .16; top: -180px; right: -160px; }
.entry-discs span:nth-child(2) { width: 300px; height: 300px; background: var(--clay); opacity: .14; bottom: -90px; left: -80px; }
.entry-discs span:nth-child(3) { width: 120px; height: 120px; background: var(--amber); opacity: .28; bottom: 18%; right: 14%; }
.entry-card {
  position: relative; width: 100%; max-width: 440px;
  background: var(--surface-raised); border-radius: var(--r-xl); padding: 40px 32px 32px;
  box-shadow: var(--shadow-float); display: grid; gap: 16px;
}
.entry-card h1 { font: 400 clamp(48px, 11vw, 72px)/1 var(--serif); letter-spacing: -.02em; }
.entry-card h1 em { color: var(--text-clay); }
.entry-card .lead { font-size: 17px; line-height: 26px; color: var(--ink-body); }
.entry-card form { display: grid; margin-top: 8px; }
.entry-card .btn { width: 100%; padding-block: 14px; font-size: 15px; }
.entry-foot { font-size: 13px; color: var(--ink-muted); text-align: center; }
.entry-card .entry-admin { width: auto; justify-self: center; padding: 8px 14px; font-size: 13px; text-decoration: none; }

/* ---------- Üst bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line);
}
.brand { display: grid; gap: 2px; }
.brand-name { font: 400 28px/1 var(--serif); color: var(--ink); }
.me { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.me-label { font: 500 12px/16px var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-muted); }
.me-name { font-weight: 600; color: var(--ink); }

/* ---------- Çark sayfası ---------- */
.wheel-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px;
  max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 48px;
}
.stage { display: flex; flex-direction: column; align-items: center; gap: 20px; min-width: 0; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
  border-radius: var(--r-pill); font: 600 13px/18px var(--sans);
  background: var(--surface-tint); color: var(--ink-muted);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill[data-status=open] { color: var(--success); }
.status-pill[data-status=open] .dot { animation: pulse 1.6s ease-in-out infinite; }
.status-pill[data-status=closed] { color: var(--text-clay); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.wheel-wrap {
  position: relative; width: min(100%, 500px); aspect-ratio: 1; max-width: 100%;
}
.wheel-wrap canvas#wheel { width: 100%; height: 100%; display: block; filter: drop-shadow(0 18px 36px rgba(37,55,95,.22)); }
.pointer {
  position: absolute; left: 50%; top: -6px; width: 44px; height: 54px; transform: translateX(-50%);
  transform-origin: 50% 20%; z-index: 2;
}
.pointer svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 6px rgba(26,37,64,.35)); }
.pointer.tick { animation: tick .12s ease-out; }
@keyframes tick { 0% { transform: translateX(-50%) rotate(0); } 40% { transform: translateX(-50%) rotate(-16deg); } 100% { transform: translateX(-50%) rotate(0); } }
.hub {
  position: absolute; left: 50%; top: 50%; width: 19%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--navy); color: var(--cloud);
  display: grid; place-items: center; font: 400 clamp(16px, 3.6vw, 24px)/1 var(--serif);
  box-shadow: 0 0 0 5px var(--cloud), 0 6px 16px rgba(26,37,64,.35);
}

.btn-spin {
  min-width: min(100%, 300px); padding: 18px 36px; border-radius: var(--r-pill);
  font: 700 18px/24px var(--sans); letter-spacing: .02em;
  background: var(--action-warm); color: var(--on-action-warm);
  box-shadow: 0 10px 24px rgba(159,79,48,.28);
}
.btn-spin:not(:disabled):hover { background: var(--action-warm-hover); }
.btn-spin:not(:disabled) { animation: ready 2.4s ease-in-out infinite; }
@keyframes ready { 0%,100% { box-shadow: 0 10px 24px rgba(159,79,48,.28), 0 0 0 0 rgba(184,92,56,.35); } 50% { box-shadow: 0 10px 24px rgba(159,79,48,.28), 0 0 0 10px rgba(184,92,56,0); } }
.spin-note { font-size: 14px; color: var(--ink-muted); text-align: center; max-width: 38ch; min-height: 22px; }

.result {
  width: min(100%, 460px); text-align: center; display: grid; gap: 6px;
  background: var(--surface-raised); border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-card); border-top: 4px solid var(--teal);
}
.result.reveal { animation: reveal .6s cubic-bezier(.2,.9,.3,1.2); }
@keyframes reveal { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
.result-name { font: 400 clamp(36px, 7vw, 52px)/1.05 var(--serif); color: var(--ink); }
.result-meta { font-size: 13px; color: var(--ink-muted); }

.side { display: grid; gap: 20px; align-content: start; min-width: 0; }
.panel {
  background: var(--surface-raised); border-radius: var(--r-md); padding: 24px;
  box-shadow: var(--shadow-card); min-width: 0;
}
.panel h2 { font: 600 18px/26px var(--sans); display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.count {
  font: 600 12px/20px var(--sans); min-width: 24px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--surface-tint); color: var(--ink-muted); text-align: center; font-variant-numeric: tabular-nums;
}
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.people li {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 14px; min-width: 0;
}
.people li:last-child { border-bottom: 0; }
.people .pname { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.people .pname small { font-weight: 500; color: var(--text-teal); margin-left: 6px; letter-spacing: .04em; }
.people .ptef { color: var(--text-teal); font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.people .ptef.wait { color: var(--ink-muted); font-weight: 400; }
.people li.new { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--surface-tint); } to { background: transparent; } }
.empty { font-size: 14px; color: var(--ink-muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface-tint); font-size: 13px; color: var(--ink); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: var(--scrim); backdrop-filter: blur(3px);
}
.modal-card {
  width: 100%; max-width: 420px; background: var(--surface-raised); border-radius: var(--r-lg);
  padding: 32px 28px 24px; box-shadow: var(--shadow-float); display: grid; gap: 14px;
  animation: reveal .35s ease-out;
}
.modal-card h2 { font: 400 36px/1.05 var(--serif); }
.intro-list { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.intro-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 15px; line-height: 22px; }
.intro-list li::before {
  content: ""; width: 10px; height: 10px; margin: 6px 0 0 4px; border-radius: 50%; background: var(--teal);
}
.intro-list li:nth-child(2)::before { background: var(--amber); }
.intro-list li:nth-child(3)::before { background: var(--clay); }
.modal-card .btn { width: 100%; padding-block: 14px; margin-top: 4px; }
/* Sonuç ekranı: çark durunca çıkan tefsir büyük gösterilir */
.reveal-card {
  max-width: 480px; text-align: center; padding: 40px 28px 28px; border-top: 6px solid var(--teal);
  animation: pop .55s cubic-bezier(.2,.9,.3,1.25);
}
.reveal-name { font: 400 clamp(44px, 12vw, 72px)/1.02 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
@keyframes pop { 0% { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.04); } 100% { transform: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--surface); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-float);
}
.config-banner {
  background: var(--clay); color: var(--cloud); text-align: center; padding: 10px 16px; font-size: 14px; font-weight: 600;
}

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 55; }

/* ---------- Yönetici ---------- */
.admin { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }
.login-panel { max-width: 420px; margin: 40px auto; display: grid; gap: 12px; }
.login-panel h1 { font: 400 44px/1 var(--serif); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; margin: 4px 0 18px; }
.stat b { display: block; font: 400 40px/1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions + .actions { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.reset-ask { margin-top: 12px; padding: 14px; border-radius: var(--r-md); background: var(--surface-tint); display: grid; gap: 10px; }
.help { font-size: 13px; line-height: 19px; color: var(--ink-muted); margin-top: 12px; }
.tef-list { list-style: none; margin: 16px 0 0; padding: 0; }
.tef-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.tef-list li:last-child { border-bottom: 0; }
.tef-list .tname { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-tint); color: var(--text-teal); white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 500 12px/16px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); padding: 8px 12px 8px 0; border-bottom: 1.5px solid var(--line-strong); }
td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-body); }
td:first-child { font-weight: 600; color: var(--ink); }
td.muted, .panel-head .muted { color: var(--ink-muted); }
.panel-head .muted { font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 200px; width: auto; }

@media (max-width: 900px) {
  .wheel-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .entry-card { padding: 32px 20px 24px; }
  .btn-spin { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
