<?php
$winner_file = __DIR__ . '/pemenang/winners.txt';
$date_info_file = __DIR__ . '/pemenang/winners_date.txt';
$winners = [];

function mask_name($name) {
    $name = trim($name);
    return (function_exists('mb_substr') ? mb_substr($name, 0, 4, 'UTF-8') : substr($name, 0, 4)) . '***';
}

// Judul default
$section_title = 'Daftar Pemenang';

if (is_readable($date_info_file)) {
    $namafile = trim(file_get_contents($date_info_file));
    if (preg_match('/^(\d{2})(\d{2})(\d{4})(?:\.txt)?$/', $namafile, $m)) {
        $dd = $m[1]; $mm = $m[2]; $yyyy = $m[3];
        $dt = DateTime::createFromFormat('Y-m-d', "$yyyy-$mm-$dd");
        if ($dt) {
            $hariMap = [
                'Sunday' => 'MINGGU', 'Monday' => 'SENIN', 'Tuesday' => 'SELASA', 'Wednesday' => 'RABU',
                'Thursday' => 'KAMIS', 'Friday' => 'JUMAT', 'Saturday' => 'SABTU',
            ];
            $bulanMap = [
                '01'=>'Januari','02'=>'Februari','03'=>'Maret','04'=>'April','05'=>'Mei','06'=>'Juni',
                '07'=>'Juli','08'=>'Agustus','09'=>'September','10'=>'Oktober','11'=>'November','12'=>'Desember'
            ];
            $hariID = $hariMap[$dt->format('l')] ?? strtoupper($dt->format('l'));
            $bulanID = $bulanMap[$mm] ?? $mm;
            $section_title = "PEMENANG RODA BONUS $hariID $dd " . strtoupper($bulanID) . " $yyyy";
        }
    }
}

if (is_readable($winner_file)) {
    $lines = file($winner_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line === '' || strpos($line, '=') === false) continue;
        list($rawName, $rawPoint) = explode('=', $line, 2);
        $name = mask_name($rawName);
        $digits = preg_replace('/\D+/', '', $rawPoint);
        $pointInt = (int)$digits;
        $poin = number_format($pointInt, 0, ',', '.');
        $winners[] = ['name' => $name, 'poin' => $poin];
    }
} else {
    $winners[] = ['name' => 'Data***', 'poin' => '0'];
}
?>
<!doctype html>
<html lang="id"><head>
<link rel="icon" href="/event/favicon.ico" sizes="any">
<link rel="icon" type="image/png" sizes="32x32" href="/event/assets/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/event/assets/favicon-16.png">
<link rel="apple-touch-icon" sizes="180x180" href="/event/assets/apple-touch-icon.png">
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Pemenang Roda Bonus | QQMILAN Reward</title>
<style>
body{--accent:#61e24f;--accent-border:#227d2f;--accent-dark:#073617;--accent-glow:rgba(64,255,88,.22)}

:root{
 --bg:#050505;--panel:#0b0908;--panel2:#11100f;--text:#fff8ef;--muted:#c8bdb5;
 --gold:#ffc94a;--gold2:#ff9d00;--line:#3a2c1d;--green:#5dff6c;
 --font:Inter,Arial,sans-serif;--max:1180px;
}
*{box-sizing:border-box}html,body{margin:0;background:#050505;color:var(--text);font-family:var(--font)}
body{background:radial-gradient(900px 520px at 50% -20%,rgba(255,130,0,.12),transparent 60%),linear-gradient(180deg,#080706,#030303 65%,#050403)}
a{text-decoration:none;color:inherit}.shell{width:min(var(--max),calc(100% - 28px));margin:auto}
.topbar{position:sticky;top:0;z-index:100;background:rgba(4,4,4,.95);border-bottom:1px solid #3a2618;backdrop-filter:blur(10px)}
.topbar-inner{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0}
.brand{display:flex;align-items:center;gap:10px}.brand img{width:148px;height:36px;object-fit:contain}.brand span{font-size:10px;color:#f7c45a;letter-spacing:.18em}
.nav{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.nav a{padding:9px 11px;border:1px solid #3d3128;border-radius:8px;background:#0b0a09;font-size:11px;font-weight:800}
.nav a:hover{border-color:#8c641c}.nav .main-link{background:linear-gradient(180deg,#ef291f,#b70d08);border-color:#ff4b3e;color:#fff}
.hero{margin-top:16px;border-radius:18px;overflow:hidden;position:relative;border:1px solid var(--accent-border);background:
 radial-gradient(520px 280px at 78% 42%,var(--accent-glow),transparent 60%),
 linear-gradient(110deg,var(--accent-dark),#090605 68%);min-height:285px}
.hero-inner{padding:28px 34px;position:relative;z-index:2;width:64%}
.crumb{font-size:11px;color:#c9bdb4;margin-bottom:12px}.crumb b{color:var(--accent)}
.kicker{display:inline-flex;padding:7px 11px;border:1px solid var(--accent-border);border-radius:999px;background:rgba(0,0,0,.28);font-size:11px;font-weight:900;color:var(--accent)}
.hero h1{font-size:48px;line-height:1.02;margin:14px 0 8px;letter-spacing:-1.3px}.hero h1 strong{color:var(--accent)}
.hero p{color:#eee;line-height:1.55;margin:0;max-width:560px}
.hero-art{position:absolute;right:5%;top:50%;transform:translateY(-50%);font-size:145px;filter:drop-shadow(0 0 26px var(--accent-glow));z-index:1}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:14px 0}
.stat{padding:14px;border-radius:12px;background:#090807;border:1px solid #28221e}.stat b{display:block;font-size:11px;color:#ccbfb5;margin-bottom:7px}.stat strong{font-size:25px;color:var(--accent)}
.content-grid{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:16px;margin-top:14px}
.panel{border:1px solid #2e251f;border-radius:14px;background:linear-gradient(180deg,#0e0b09,#070606);overflow:hidden}
.panel-head{padding:13px 15px;background:linear-gradient(90deg,var(--accent-dark),#140b08);border-bottom:1px solid var(--accent-border);font-weight:900;color:#fff}
.panel-body{padding:14px}
.winner-table{width:100%;border-collapse:collapse;font-size:12px}.winner-table th,.winner-table td{padding:10px;border-bottom:1px solid #251d18;text-align:left}
.winner-table th{color:#d8cbc2;background:#0b0908}.winner-table td.prize{color:var(--gold);font-weight:900}.winner-table tr:last-child td{border-bottom:0}
.rank{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:linear-gradient(#ffc94a,#8c4600);color:#1e0c00;font-weight:900;font-size:10px}
.side-card{padding:15px;border:1px solid var(--accent-border);border-radius:12px;background:radial-gradient(circle at 90% 0,var(--accent-glow),transparent 35%),#0b0807;margin-bottom:12px}
.side-card h3{margin:0 0 10px;color:var(--accent);font-size:15px}.side-card ul{margin:0;padding-left:18px;color:#ddd;line-height:1.7;font-size:12px}
.cta{display:inline-flex;margin-top:10px;padding:11px 14px;border-radius:9px;background:linear-gradient(180deg,#ffd454,#e29a00);color:#2f1300;font-weight:900;font-size:12px}
.trust{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:16px 0}.trust div{padding:12px;border:1px solid #2d241e;border-radius:10px;background:#090807;text-align:center}.trust b{display:block;color:#f4cb64;font-size:12px}.trust span{font-size:10px;color:#a99c92}
.floating-main{position:fixed;right:12px;top:50%;transform:translateY(-50%);z-index:90;width:90px;padding:12px 8px;border-radius:16px;background:linear-gradient(#6d0a08,#220403);border:1px solid #ffbf38;color:#fff;text-align:center;font-weight:900;font-size:11px;box-shadow:0 0 20px rgba(255,160,0,.22)}
.footer{border-top:1px solid #231b17;margin-top:18px;padding:20px 0 28px;text-align:center;color:#8f8279;font-size:11px}
@media(max-width:900px){.topbar-inner{align-items:flex-start}.nav{max-width:74%}.content-grid{grid-template-columns:1fr}.hero-inner{width:72%}.stats{grid-template-columns:1fr 1fr}.trust{grid-template-columns:1fr 1fr}}
@media(max-width:640px){.topbar-inner{display:block}.nav{max-width:none;justify-content:flex-start;margin-top:8px}.nav a{font-size:9px;padding:7px 8px}.hero-inner{width:100%;padding:22px 18px}.hero h1{font-size:34px}.hero-art{display:none}.stats{grid-template-columns:1fr}.winner-table{font-size:10px}.winner-table th,.winner-table td{padding:8px 5px}.floating-main{top:auto;bottom:12px;right:10px;transform:none;width:auto;border-radius:999px;padding:9px 12px}.trust{grid-template-columns:1fr 1fr}}


/* ===== WINNER GRID FINAL ===== */
.winner-grid{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:10px;
}
.winner-box{
  display:grid;
  grid-template-columns:34px minmax(0,1fr);
  gap:9px;
  align-items:center;
  min-height:64px;
  padding:10px 11px;
  border-radius:10px;
  border:1px solid var(--accent-border);
  background:linear-gradient(180deg,#100d0b,#080706);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}
.winner-box:hover{
  transform:translateY(-1px);
  border-color:var(--accent);
}
.winner-rank{
  width:30px;height:30px;border-radius:50%;
  display:grid;place-items:center;
  background:linear-gradient(#ffd55a,#8a4800);
  color:#1d0d00;font-size:11px;font-weight:900;
}
.winner-box:nth-child(2) .winner-rank{background:linear-gradient(#ddd,#777);color:#111}
.winner-box:nth-child(3) .winner-rank{background:linear-gradient(#ef7a32,#82310f);color:#fff}
.winner-name{font-size:12px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.winner-prize{font-size:12px;font-weight:900;color:var(--gold);margin-top:4px}
@media(max-width:980px){.winner-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:640px){
  .winner-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .winner-box{padding:9px;grid-template-columns:28px minmax(0,1fr);min-height:58px}
  .winner-rank{width:26px;height:26px;font-size:10px}
  .winner-name,.winner-prize{font-size:10px}
}

</style></head><body>

<header class="topbar">
  <div class="shell topbar-inner">
    <a class="brand" href="/event/">
      <img src="/event/assets/logoqqmilan.png" alt="QQMILAN">
      <span>EVENTS WINNER</span>
    </a>
    <nav class="nav">
      <a href="/event/">⌂ Event Center</a>
      <a href="/event/harian/">🎁 Pemenang Bonus Harian 38K</a>
      <a href="/event/bulananturnover/">📈 Pemenang Bonus Turn Over</a>
      <a href="/event/bonusroda/">🎡 Pemenang Roda Bonus</a>
      <a class="main-link" href="https://zaulimi.com/" rel="noopener">MASUK SITUS UTAMA</a>
    </nav>
  </div>
</header>

<a class="floating-main" href="https://zaulimi.com/" rel="noopener">QQMILAN<br>MASUK SITUS UTAMA →</a>
<main class="shell">
<section class="hero">
 <div class="hero-inner"><div class="crumb">QQMILAN › Event › <b>Pemenang Roda Bonus</b></div><div class="kicker">🎡 EVENT RODA BONUS</div>
 <h1>Pemenang <strong>Roda Bonus</strong></h1>
 <p>Daftar pemenang Roda Bonus QQMILAN. Poin dan daftar pemenang mengikuti file aktif dari sistem upload terpusat.</p></div>
 <div class="hero-art">🎡</div>
</section>
<section class="stats">
 <div class="stat"><b>TOTAL PEMENANG</b><strong><?=count($winners)?></strong></div>
 <div class="stat"><b>FORMAT HADIAH</b><strong>Poin</strong></div>
 <div class="stat"><b>STATUS</b><strong>Aktif</strong></div>
</section>
<section class="content-grid">
 <div class="panel"><div class="panel-head">🎡 DAFTAR PEMENANG RODA BONUS</div><div class="panel-body">
 <div class="winner-grid">
<?php $n=1; foreach($winners as $win): ?>
  <div class="winner-box">
    <div class="winner-rank"><?=$n++?></div>
    <div>
      <div class="winner-name"><?=htmlspecialchars($win['name'])?></div>
      <div class="winner-prize"><?=htmlspecialchars($win['poin'])?> Poin</div>
    </div>
  </div>
<?php endforeach;?>
</div></div></div>
 <aside>
  <div class="side-card"><h3>INFORMASI RODA BONUS</h3><ul><li>Data pemenang mengikuti upload aktif</li><li>Nilai hadiah ditampilkan dalam poin</li><li>Riwayat backup tersimpan otomatis</li><li>Update lewat Winner Center Admin</li></ul></div>
  <div class="side-card"><h3>AKSES EVENT</h3><p style="font-size:12px;color:#ddd;line-height:1.5">Buka situs utama QQMILAN melalui tombol di bawah.</p><a class="cta" href="https://zaulimi.com/" rel="noopener">MASUK SITUS UTAMA</a></div>
 </aside>
</section>
<div class="trust"><div><b>LIVE DATA</b><span>List aktif</span></div><div><b>BACKUP</b><span>Riwayat tersimpan</span></div><div><b>TERPUSAT</b><span>Central Admin</span></div><div><b>RESPONSIVE</b><span>Semua perangkat</span></div></div>
<footer class="footer">© 2026 QQMILAN Reward • Pemenang Roda Bonus</footer>
</main></body></html>