/* ============================================================
   Çekiliş — iPad odaklı karanlık tema
   ============================================================ */
:root {
  --bg:        #0d1017;
  --bg-2:      #141926;
  --card:      #171d2b;
  --card-2:    #1e2536;
  --line:      #2a3348;
  --text:      #e9edf7;
  --muted:     #8e9bb5;
  --gold:      #f5c451;
  --gold-dk:   #c99a2e;
  --green:     #35c48a;
  --red:       #ef5f6b;
  --blue:      #5b9dff;
  --radius:    16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body { min-height: 100dvh; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { -webkit-appearance: none; appearance: none; }

/* ---------- Yapı ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13,16,23,.92);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 16px) 10px calc(var(--safe-l) + 16px);
}
.header-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.header-row h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.02em; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

main {
  padding: 18px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 48px) calc(var(--safe-l) + 16px);
  max-width: 1100px; margin: 0 auto;
}

/* ---------- Sekmeler ---------- */
.tabs {
  display: flex; gap: 6px; margin-top: 12px;
  background: var(--bg-2); padding: 5px; border-radius: 14px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tabs button {
  flex: 1 1 auto; min-width: 92px;
  background: transparent; border: 0; border-radius: 10px;
  padding: 11px 12px; font-size: 15px; font-weight: 600; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--card-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* ---------- Kart / liste ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; }
.card p.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; line-height: 1.5; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.tight { gap: 8px; }
.spacer { flex: 1; }

.list-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; cursor: pointer;
}
.list-item:active { background: var(--card-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 18px; font-weight: 650; margin-bottom: 4px; }
.list-item .li-meta { font-size: 13px; color: var(--muted); }
.chev { color: var(--muted); font-size: 22px; }

/* ---------- Butonlar ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  cursor: pointer; min-height: 46px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #221a05; }
.btn.danger  { background: transparent; border-color: rgba(239,95,107,.5); color: var(--red); }
.btn.ghost   { background: transparent; }
.btn.sm      { padding: 8px 12px; min-height: 38px; font-size: 14px; border-radius: 10px; }
.btn.block   { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.icon { padding: 8px 10px; min-height: 38px; min-width: 38px; font-size: 16px; }

/* ---------- Form ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
input[type=text], input[type=number], select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; min-height: 48px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat; padding-right: 40px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label.field { margin-bottom: 0; flex: 1 1 140px; }
.inline-form .narrow { flex: 0 1 110px; }

/* ---------- İstatistik rozetleri ---------- */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  flex: 1 1 120px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat .v { font-size: 26px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.stat.good .v { color: var(--green); }
.stat.warn .v { color: var(--red); }
.stat.gold .v { color: var(--gold); }

/* ---------- Bilet ızgarası ---------- */
.series-block { margin-bottom: 22px; }
.series-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.series-head .name {
  font-size: 17px; font-weight: 700; background: var(--card-2); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 10px;
}
.ticket-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 7px;
}
.tk {
  border: 1px solid var(--line); background: rgba(53,196,138,.13);
  border-radius: 10px; padding: 11px 2px; text-align: center;
  font-size: 14px; font-weight: 650; cursor: pointer; user-select: none;
  font-variant-numeric: tabular-nums;
}
.tk.unsold { background: transparent; color: #5c6884; text-decoration: line-through; border-style: dashed; }
.tk.drawn { background: rgba(245,196,81,.22); border-color: var(--gold-dk); color: var(--gold); }
.tk:active { transform: scale(.94); }

/* ---------- Hediye satırı ---------- */
.prize-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.prize-row:last-child { border-bottom: 0; }
.prize-row .pname { flex: 1; min-width: 0; font-weight: 650; font-size: 17px; }
.prize-row .pmeta { font-size: 13px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.badge {
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.done { color: var(--green); border-color: rgba(53,196,138,.4); background: rgba(53,196,138,.1); }
.badge.pending { color: var(--gold); border-color: rgba(245,196,81,.4); background: rgba(245,196,81,.1); }

/* ---------- Çekiliş ekranı ---------- */
.draw-panel { text-align: center; padding: 26px 18px 30px; }
.draw-display {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: 22px;
  padding: 40px 18px; margin: 18px 0 22px; min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.draw-prize { font-size: clamp(20px, 3.4vw, 32px); font-weight: 700; color: var(--gold); letter-spacing: -.01em; }
.draw-ticket {
  font-size: clamp(64px, 17vw, 190px); font-weight: 850; line-height: .95;
  letter-spacing: -.04em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, #b9c6e2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.draw-ticket.rolling { background: none; -webkit-text-fill-color: var(--muted); color: var(--muted); opacity: .85; }
.draw-ticket.win { -webkit-text-fill-color: transparent; animation: pop .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.draw-empty { color: var(--muted); font-size: 17px; }

.big-draw {
  width: 100%; font-size: 21px; font-weight: 750; padding: 22px; border-radius: 18px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dk)); color: #221a05;
  border: 0; cursor: pointer; letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(245,196,81,.22);
}
.big-draw:active { transform: scale(.985); }
.big-draw[disabled] { opacity: .4; box-shadow: none; pointer-events: none; }

/* ---------- Tam ekran sonuç ---------- */
.stage {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(circle at 50% 40%, #1b2233 0%, #0a0d13 70%);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px);
}
.stage-inner { text-align: center; width: 100%; }
.stage-prize { font-size: clamp(24px, 4.6vw, 54px); font-weight: 700; color: var(--gold); margin-bottom: 18px; }
.stage-ticket {
  font-size: clamp(90px, 26vw, 340px); font-weight: 850; line-height: .92; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, #a9b8d8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stage-ticket.rolling { background: none; -webkit-text-fill-color: #5f6b86; }
.stage-ticket.win { animation: pop .55s cubic-bezier(.2,1.4,.4,1); }
.stage-sub { margin-top: 20px; color: var(--muted); font-size: 16px; }
.stage-close {
  position: absolute; top: calc(var(--safe-t) + 16px); right: calc(var(--safe-r) + 20px);
  background: rgba(255,255,255,.08); border: 0; color: var(--text);
  width: 46px; height: 46px; border-radius: 50%; font-size: 19px; cursor: pointer;
}

/* ---------- Sonuç listesi ---------- */
.result-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.result-row:last-child { border-bottom: 0; }
.result-ticket {
  font-size: 24px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums;
  min-width: 108px; letter-spacing: -.02em;
}
.result-main { flex: 1; min-width: 0; }
.result-main .rn { font-weight: 650; }
.result-main .rt { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- Boş durum ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 12px; }
.empty p { margin: 0 0 20px; line-height: 1.55; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.62);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px; width: 100%; max-width: 440px; max-height: 86dvh; overflow: auto; }
.modal-card h3 { margin: 0 0 14px; font-size: 19px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 28px); transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 13px 20px; border-radius: 999px; z-index: 300; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.45); max-width: 90vw; text-align: center;
}

[hidden] { display: none !important; }

@media print {
  .app-header, .tabs, .btn, .big-draw { display: none !important; }
  html, body { background: #fff; color: #000; }
  .card, .list-item { border-color: #ccc; background: #fff; }
  .result-ticket { color: #000; }
}

/* ---------- Konfeti ---------- */
.confetti {
  position: absolute; top: -24px; width: 10px; height: 16px; border-radius: 2px;
  opacity: .95; pointer-events: none;
  animation-name: fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ---------- Eşitleme rozeti ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 650;
  cursor: pointer; white-space: nowrap; min-height: 36px;
}
.pill:active { transform: scale(.97); }
.pill-synced   { color: var(--green); border-color: rgba(53,196,138,.35); background: rgba(53,196,138,.09); }
.pill-offline  { color: var(--muted); }
.pill-needcode { color: var(--gold);  border-color: rgba(245,196,81,.4);  background: rgba(245,196,81,.1); }
.pill-error    { color: var(--red);   border-color: rgba(239,95,107,.4);  background: rgba(239,95,107,.09); }
.pill-syncing span, .pill-unknown span { opacity: .8; }

/* Dar ekranda rozetin yazısını gizle, sadece simge kalsın */
@media (max-width: 560px) {
  .pill span { display: none; }
  .pill { padding: 7px 10px; }
}
