@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --dark: #1b2430;
    --red: #c03028;
    --red-dark: #a02820;
    --gold: #cfa641;
    --bg: #eceae6;
    --card: #fff;
    --border: #e2ded9;
    --border-light: #eee;
    --text: #222;
    --text-sec: #888;
    --text-muted: #aaa;
    --radius: 10px;
    --max-w: 1140px;
    --nav-h: 56px;
    --top-h: 59px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px;
    line-height: 1.6; min-height: 100vh;
    display: flex; flex-direction: column; overflow-x: hidden;
}
body.has-bg {
    background-size: cover !important;
    background-attachment: fixed !important;
    background-position: center center !important;
}
main#root { flex: 1; }
a { color: inherit; text-decoration: none; }

/* ===== Red Line ===== */
.red-line { height: 3px; background: var(--red); position: fixed; top: 0; left: 0; right: 0; z-index: 101; }

/* ===== Navbar (White) ===== */
.navbar {
    background: var(--card); height: var(--nav-h);
    position: fixed; top: 3px; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.navbar-inner {
    max-width: var(--max-w); margin: 0 auto; padding: 0 24px; width: 100%;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; text-decoration: none; }
.nav-brand-logo { height: 36px; max-width: 160px; object-fit: contain; }
.nav-brand-fallback { font-size: 19px; font-weight: 700; color: var(--dark); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
    color: var(--text-sec); font-size: 13px; font-weight: 500;
    padding: 8px 16px; border-radius: 6px; transition: all .2s; position: relative;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.on { color: var(--red); font-weight: 600; }
.nav-links a.on::after {
    content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
    width: 18px; height: 2px; background: var(--red); border-radius: 2px;
}
.nav-clock { color: var(--text-muted); font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav-clock-icon { color: var(--red); font-size: 11px; }
.nav-mobile-toggle { display: none; background: none; border: none; color: var(--dark); font-size: 20px; cursor: pointer; padding: 8px; }

/* Mobile Nav */
.mobile-nav {
    display: none; position: fixed; top: var(--top-h); left: 0; right: 0;
    background: var(--card); padding: 6px 10px; z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
    display: block; color: var(--text-sec); font-size: 13px; font-weight: 500;
    padding: 11px 14px; border-radius: 6px; transition: all .2s;
}
.mobile-nav a:hover { color: var(--text); background: rgba(0,0,0,.02); }
.mobile-nav a.on { color: var(--red); font-weight: 600; background: rgba(192,48,40,.04); }

/* ===== Brand Bar (replaces Hero) ===== */
.brand-bar {
    margin-top: var(--top-h); background: var(--dark);
    padding: 20px 24px;
}
.brand-bar-inner {
    max-width: var(--max-w); margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
}
.brand-bar-title { font-size: 28px; font-weight: 700; color: #fff; white-space: nowrap; flex-shrink: 0; }
.brand-bar-banner { flex: 1; }
.brand-bar-banner img { width: 100%; height: auto; border-radius: 8px; display: block; }

/* ===== Main Content ===== */
.main-content { max-width: var(--max-w); margin: 0 auto; padding: 20px 24px 40px; }

/* ===== Dashboard (Home) ===== */
.dashboard { display: grid; grid-template-columns: 1fr 280px; gap: 20px; }

/* ===== Sidebar ===== */
.sidebar { display: flex; flex-direction: column; gap: 14px; }
.widget { background: var(--card); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--border); }
.widget-title { font-size: 10px; font-weight: 600; color: var(--text-sec); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.side-filter { display: flex; flex-wrap: wrap; gap: 5px; }
.sf-btn {
    padding: 5px 11px; font-size: 11px; font-weight: 500; color: #777;
    background: #f5f3f0; border: 1px solid #ddd; border-radius: 5px;
    cursor: pointer; transition: all .15s; text-decoration: none; display: inline-block;
}
.sf-btn:hover { border-color: #aaa; color: #444; }
.sf-btn.on { background: var(--dark); color: var(--gold); border-color: var(--dark); }
.side-age { display: flex; align-items: center; gap: 10px; }
.side-age-num {
    width: 34px; height: 34px; border: 2px solid var(--red); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: var(--red); flex-shrink: 0;
}
.side-age-txt { font-size: 10px; color: var(--text-muted); line-height: 1.4; }
.side-clock-val { font-size: 18px; font-weight: 700; color: var(--dark); margin-top: 2px; }
.side-clock-tz { font-size: 10px; color: #bbb; margin-top: 2px; }

/* ===== Featured Card (split layout) ===== */
.feat { background: var(--card); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 18px; display: flex; }
.feat-side {
    width: 140px; flex-shrink: 0; background: var(--dark);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px 16px; gap: 8px; text-align: center;
}
.feat-side-tag { font-size: 9px; font-weight: 700; color: var(--red); letter-spacing: 1.5px; text-transform: uppercase; }
.feat-side-day { font-size: 13px; font-weight: 700; color: var(--gold); }
.feat-side-date { font-size: 11px; color: rgba(255,255,255,.45); }
.feat-side-draw { font-size: 20px; font-weight: 800; color: #fff; margin-top: 4px; }
.feat-content { flex: 1; display: flex; flex-direction: column; }
.feat-prizes { padding: 20px 20px 16px; text-align: center; }
.feat-label { font-size: 9px; font-weight: 600; color: var(--red); letter-spacing: 2px; margin-bottom: 10px; }
.feat-digits { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.feat-d {
    width: 54px; height: 58px; display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700; color: #fff;
    background: var(--red); border-radius: 10px;
}
.feat-sub {
    display: flex; justify-content: center; gap: 24px; flex-wrap: wrap;
    padding-top: 14px; border-top: 1px solid var(--border-light);
}
.feat-sub-item { display: flex; align-items: center; gap: 6px; }
.feat-sub-lbl {
    font-size: 10px; font-weight: 700; color: #fff; letter-spacing: 1px;
    background: var(--dark); padding: 3px 9px; border-radius: 4px;
}
.feat-sn {
    width: 34px; height: 36px; display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: var(--dark); background: #f5f3f0; border: 2px solid #d5d0ca; border-radius: 7px;
}
.feat-table { border-top: 2px solid var(--border); flex: 1; }
.feat-th-row { display: grid; grid-template-columns: 1fr 1fr; }
.feat-th { padding: 10px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.feat-th:first-child { background: var(--dark); color: var(--gold); }
.feat-th:last-child { background: #7a3a22; color: #fff; }
.feat-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; border-bottom: 1px solid #eaeaea; }
.feat-row:last-child { border-bottom: none; }
.feat-td { text-align: center; padding: 8px 6px; font-size: 13px; font-weight: 600; color: #333; border-right: 1px solid #eaeaea; letter-spacing: 0.5px; }
.feat-td:nth-child(2) { border-right: 3px solid var(--border); }
.feat-td:last-child { border-right: none; }

/* ===== Previous Card (split layout with table) ===== */
.prev-heading { font-size: 13px; font-weight: 600; color: #999; margin-bottom: 10px; }
.prev-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }
.pc {
    background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
    overflow: hidden; transition: box-shadow .2s; display: flex;
}
.pc:hover { box-shadow: 0 3px 10px rgba(0,0,0,.04); }
.pc-side {
    width: 100px; flex-shrink: 0; background: var(--dark);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 16px 10px; gap: 4px; text-align: center;
}
.pc-day { font-size: 11px; font-weight: 700; color: var(--gold); }
.pc-date { font-size: 10px; color: rgba(255,255,255,.4); }
.pc-draw { font-size: 14px; font-weight: 800; color: #fff; margin-top: 2px; }
.pc-content { flex: 1; display: flex; flex-direction: column; }
.pc-prizes { padding: 12px 14px; text-align: center; }
.pc-prize-label { font-size: 8px; font-weight: 600; color: var(--red); letter-spacing: 2px; margin-bottom: 6px; }
.pc-p1 { display: flex; justify-content: center; gap: 4px; margin-bottom: 10px; }
.pc-p1d {
    width: 34px; height: 36px; display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 700; color: #fff; background: var(--red); border-radius: 6px;
}
.pc-sub { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border-light); }
.pc-smg { display: flex; align-items: center; gap: 3px; }
.pc-smt {
    font-size: 9px; font-weight: 700; color: #fff; letter-spacing: 0.5px;
    background: var(--dark); padding: 2px 7px; border-radius: 3px; margin-right: 2px;
}
.pc-smd {
    width: 22px; height: 24px; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: var(--dark); background: #f5f3f0; border: 1px solid #d5d0ca; border-radius: 4px;
}
.pc-table { border-top: 2px solid var(--border); flex: 1; }
.pc-th-row { display: grid; grid-template-columns: 1fr 1fr; }
.pc-th { padding: 7px; text-align: center; font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.pc-th:first-child { background: var(--dark); color: var(--gold); }
.pc-th:last-child { background: #7a3a22; color: #fff; }
.pc-trow { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; border-bottom: 1px solid #eaeaea; }
.pc-trow:last-child { border-bottom: none; }
.pc-td { text-align: center; padding: 6px 4px; font-size: 12px; font-weight: 600; color: #444; border-right: 1px solid #eaeaea; }
.pc-td:nth-child(2) { border-right: 3px solid var(--border); }
.pc-td:last-child { border-right: none; }

/* ===== Section Header ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 600; color: #555; }
.section-title small { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 8px; }

/* ===== Result Grid (livedraw) ===== */
.result-grid { display: flex; flex-direction: column; gap: 8px; }
.no-results {
    text-align: center; padding: 60px 20px; color: var(--text-sec); font-size: 16px;
    background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
}
.no-results i { font-size: 48px; display: block; margin-bottom: 12px; color: var(--border); }

/* ===== Day Filter (legacy/sticky) ===== */
.day-filter { background: var(--card); border-bottom: 1px solid var(--border); padding: 0 24px; position: sticky; top: var(--top-h); z-index: 50; }
.day-filter-inner { max-width: var(--max-w); margin: 0 auto; display: flex; align-items: center; gap: 4px; padding: 12px 0; overflow-x: auto; }
.day-filter-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-right: 8px; white-space: nowrap; }
.day-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 16px; border: 1px solid var(--border); background: var(--card);
    color: var(--text-sec); font-size: 12px; font-weight: 500;
    border-radius: 6px; cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.day-btn:hover { border-color: #aaa; color: var(--text); }
.day-btn.active { background: var(--dark); color: var(--gold); border-color: var(--dark); }

/* ===== FAB ===== */
.live-draw-fab {
    position: fixed; bottom: 20px; right: 20px; z-index: 999;
    display: flex; align-items: center; gap: 7px;
    padding: 10px 20px; background: var(--red); color: #fff;
    border: none; border-radius: 50px; font-size: 13px; font-weight: 600;
    cursor: pointer; box-shadow: 0 3px 14px rgba(192,48,40,.3);
    transition: transform .2s; text-decoration: none;
}
.live-draw-fab:hover { transform: translateY(-2px); color: #fff; }
.live-dot { width: 6px; height: 6px; background: #fff; border-radius: 50%; animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ===== Footer (Horizontal) ===== */
.footer { background: var(--dark); margin-top: 0; }
.footer-red { height: 3px; background: var(--red); }
.footer-main {
    max-width: var(--max-w); margin: 0 auto; padding: 22px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.fm-brand { display: flex; align-items: center; gap: 14px; }
.fm-brand-name { font-size: 16px; font-weight: 700; color: #fff; }
.fm-sep { width: 1px; height: 24px; background: rgba(255,255,255,.08); }
.fm-tagline { font-size: 11px; color: rgba(255,255,255,.2); }
.fm-links { display: flex; align-items: center; gap: 4px; }
.fm-links a {
    font-size: 12px; color: rgba(255,255,255,.25); padding: 5px 12px;
    border-radius: 4px; transition: all .2s;
}
.fm-links a:hover { color: #fff; background: rgba(255,255,255,.04); }
.fm-age { display: flex; align-items: center; gap: 6px; }
.fm-age-num {
    width: 28px; height: 28px; border: 2px solid var(--red); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: var(--red);
}
.fm-age-txt { font-size: 9px; color: rgba(255,255,255,.15); line-height: 1.3; }
.footer-bottom {
    max-width: var(--max-w); margin: 0 auto; padding: 0 24px 16px;
    border-top: 1px solid rgba(255,255,255,.04); padding-top: 12px;
    font-size: 11px; color: rgba(255,255,255,.1); text-align: center;
}

/* ===== Page Card (about, contact, partner) ===== */
.page-card {
    padding: 28px; line-height: 1.8; font-size: 14px; color: var(--text);
    background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
}
.page-card h2 { color: var(--red); margin-bottom: 14px; font-size: 20px; }
.page-card h3 { color: var(--dark); margin-bottom: 8px; font-size: 16px; }
.page-card p { margin-bottom: 8px; }
.page-card a { color: var(--red); text-decoration: underline; }
.page-card img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ===== Welcome Bar ===== */
.welcome-bar {
    background: var(--dark); color: #fff;
    padding: 14px 20px; font-weight: 700; font-size: 15px; letter-spacing: 1px;
    border-radius: var(--radius); margin: 16px 0; text-align: center;
    border-left: 4px solid var(--red); border-right: 4px solid var(--red);
}

/* ===== Error Page ===== */
.err-page { max-width: 560px; margin: 40px auto; text-align: center; padding: 48px 32px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); }
.err-icon { width: 80px; height: 80px; margin: 0 auto 20px; background: var(--dark); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.err-icon i { font-size: 32px; color: var(--gold); }
.err-code { font-size: 72px; font-weight: 800; letter-spacing: -2px; line-height: 1; color: var(--red); }
.err-title { font-size: 20px; font-weight: 700; color: var(--dark); margin: 4px 0 16px; text-transform: uppercase; letter-spacing: 2px; }
.err-line { width: 60px; height: 3px; background: var(--red); margin: 0 auto 20px; border-radius: 3px; }
.err-msg { font-size: 14px; color: var(--text-sec); line-height: 1.7; max-width: 400px; margin: 0 auto 28px; }
.err-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.err-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px; font-size: 13px; font-weight: 600; border-radius: 6px; transition: all .2s; border: 2px solid var(--dark); color: var(--dark); background: transparent; }
.err-btn:hover { background: var(--dark); color: #fff; }
.err-btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.err-btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.err-ref { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-sec); letter-spacing: 1px; text-transform: uppercase; }
.err-ref span { font-weight: 700; color: var(--red); }

/* ===== Livedraw Compatibility (old class names) ===== */
.result-card {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); margin-bottom: 12px;
}
.result-card.ld-card { max-width: 500px; margin: 0 auto 20px; }
.rc-header, .ld-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--dark); color: #fff;
}
.rc-date { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rc-day { font-size: 10px; font-weight: 600; background: var(--red); color: #fff; padding: 2px 10px; border-radius: 4px; }
.rc-draw { font-size: 12px; color: var(--gold); font-weight: 600; }
.rc-prize-label { text-align: center; font-size: 10px; font-weight: 600; color: var(--red); letter-spacing: 2px; padding: 10px 0 0; }
.rc-prize1 { text-align: center; padding: 16px 8px; }
.ball-row { display: flex; justify-content: center; gap: 8px; }
.ball {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; color: #fff;
    background: var(--red);
}
.ball-sm {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    background: var(--dark);
}
.rc-prize-sub { display: flex; border-top: 1px solid var(--border-light); }
.rc-prize-sub-item { flex: 1; text-align: center; padding: 10px 8px; border-right: 1px solid var(--border-light); }
.rc-prize-sub-item:last-child { border-right: none; }
.rc-prize-sub-label { font-size: 9px; font-weight: 700; color: var(--text-sec); letter-spacing: 1px; margin-bottom: 6px; }
.rc-prize-sub-value { display: flex; justify-content: center; gap: 4px; }
.rc-extras { border-top: 1px solid var(--border-light); }
.rc-extras-header { display: grid; grid-template-columns: 1fr 1fr; }
.rc-extras-header-item { text-align: center; padding: 8px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.rc-extras-header-item:first-child { background: var(--dark); color: var(--gold); }
.rc-extras-header-item:last-child { background: #7a3a22; color: #fff; }
.rc-extras-body { display: grid; grid-template-columns: 1fr 1fr; }
.rc-extras-col { padding: 4px; }
.rc-extras-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.rc-extras-cell { text-align: center; padding: 5px; font-size: 12px; font-weight: 500; color: #555; background: #faf9f7; border-radius: 3px; }

.ld-live-badge {
    background: var(--red); color: #fff;
    font-size: 10px; font-weight: 700; padding: 3px 10px;
    border-radius: 100px; letter-spacing: 1px;
    animation: dotPulse 1.3s ease-in-out infinite;
}
.ld-live-badge i { font-size: 6px; vertical-align: middle; margin-right: 3px; }
.ld-placeholder { opacity: 0.2; }
@keyframes dotPulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.25; transform:scale(0.85); } }
@keyframes ballPop {
    0% { transform: scale(0.3) translateY(12px); opacity: 0; }
    50% { transform: scale(1.12) translateY(-4px); opacity: 1; }
    75% { transform: scale(0.95) translateY(1px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
.ld-revealed { animation: ballPop 0.55s cubic-bezier(0.22, 1.2, 0.36, 1); opacity: 1 !important; }

/* ===== Misc ===== */
.img_blur { max-width: 100%; }
.block { display: inline-block; margin: 2px; }
.banner-img { width: 100%; border-radius: var(--radius); display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sec); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .dashboard { grid-template-columns: 1fr; }
    .sidebar { order: -1; flex-direction: row; flex-wrap: wrap; gap: 10px; }
    .sidebar .widget { flex: 1; min-width: 200px; }
    .brand-bar-inner { flex-direction: column; text-align: center; gap: 16px; }
    .brand-bar-banner { text-align: center; }
    .brand-bar-title { font-size: 26px; }
}
@media (max-width: 640px) {
    .nav-links { display: none; }
    .nav-clock { display: none; }
    .nav-mobile-toggle { display: block; }
    .brand-bar-title { font-size: 20px; }
    .feat { flex-direction: column; }
    .feat-side { width: 100%; flex-direction: row; padding: 14px 16px; gap: 12px; justify-content: flex-start; }
    .feat-d { width: 44px; height: 48px; font-size: 20px; }
    .feat-sub { flex-direction: column; gap: 10px; align-items: center; }
    .pc { flex-direction: column; }
    .pc-side { width: 100%; flex-direction: row; padding: 10px 14px; gap: 10px; justify-content: flex-start; }
    .pc-sub { flex-direction: column; gap: 8px; align-items: center; }
    .fm-links { display: none; }
    .footer-main { justify-content: center; text-align: center; flex-direction: column; gap: 12px; }
    .main-content { padding: 16px 16px 32px; }
    .day-filter-inner { padding: 10px 0; }
    .day-btn { padding: 5px 12px; font-size: 11px; }
    .live-draw-fab { bottom: 16px; right: 16px; padding: 10px 16px; font-size: 12px; }
    .ball { width: 42px; height: 42px; font-size: 20px; }
    .ball-sm { width: 26px; height: 26px; font-size: 13px; }
    .err-page { margin: 20px 12px; padding: 32px 20px; }
    .err-code { font-size: 56px; }
}
