/* ==========================================================================
   Dashboard — light analytics shell. Fixed rail on the left, panels on the
   right, and a CSS-drawn sparkline for every game's last seven days.
   ========================================================================== */

:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --line: #e3e8f0;
    --ink: #131a2b;
    --dim: #6b7690;
    --brand: #4338ca;
    --brand-2: #6366f1;
    --green: #059669;
    --amber: #d97706;
    --wa: #16a34a;
    --rail: 232px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }

/* ---------------------------------------------------------------- shell */

.shell { display: flex; min-height: 100vh; }

.side {
    position: sticky;
    top: 0;
    flex: 0 0 var(--rail);
    align-self: flex-start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    background: #10162b;
    color: #cdd5e6;
}

.logo { display: flex; align-items: center; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.logo .mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; height: 34px; background: linear-gradient(135deg, var(--brand-2), #a855f7); border-radius: 9px; color: #fff; font-size: 16px; font-weight: 700; }
.logo .lname { font-size: 15px; font-weight: 700; color: #fff; word-break: break-word; }

.snav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.snav a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; color: #a7b1c9; font-size: 14px; }
.snav a .i { width: 16px; color: #6b7796; font-size: 12px; text-align: center; }
.snav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.snav a.on { background: var(--brand); color: #fff; }
.snav a.on .i { color: #fff; }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-foot p { color: #7c87a3; font-size: 12px; }

.main { flex: 1; min-width: 0; padding: 22px 24px 44px; }

/* -------------------------------------------------------------- topbar */

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; word-break: break-word; }
.topbar p { color: var(--dim); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 6px 14px; background: #fff; border: 1px solid var(--line); border-radius: 20px; color: var(--dim); font-size: 13px; font-weight: 600; }
.pill i { width: 7px; height: 7px; background: var(--green); border-radius: 50%; animation: beat 1.8s ease-in-out infinite; }
@keyframes beat { 50% { opacity: .3; transform: scale(.75); } }

.notice { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 11px 15px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; color: #9a3412; font-size: 14px; }
.notice a { color: #9a3412; font-weight: 600; }

/* --------------------------------------------------------------- panels */

.panel { margin-bottom: 16px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.panel-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-h h3 { font-size: 15px; font-weight: 700; }
.panel-h a { margin-left: auto; font-size: 13px; font-weight: 600; }

.top-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.top-grid .panel { margin-bottom: 16px; }

.ptag { display: inline-block; padding: 3px 10px; background: #eef2ff; border-radius: 20px; color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }

/* Game names carry the weight in this template — they are the label users scan for. */
.gname-xl { margin-top: 10px; font-size: 30px; font-weight: 800; letter-spacing: -.5px; word-break: break-word; }
.gname-lg { margin-top: 10px; font-size: 24px; font-weight: 800; letter-spacing: -.4px; word-break: break-word; }

.hero { background: linear-gradient(135deg, #ffffff, #f5f3ff); }
.hero-num { margin: 4px 0; font-size: 66px; font-weight: 800; line-height: 1; letter-spacing: -3px; color: var(--brand); }
.hero-sub { color: var(--dim); font-size: 14px; }
.hero-sub b { color: var(--ink); }

/* Pending headline: a loading skeleton, which reads as "data on its way". */
.skel { display: flex; gap: 8px; margin: 12px 0 8px; }
.skel i { width: 46px; height: 58px; border-radius: 10px; background: linear-gradient(90deg, #e8eaf3 25%, #f3f4fa 37%, #e8eaf3 63%); background-size: 400% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.next .ntime { margin: 2px 0 6px; font-size: 22px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.next .nsub { color: var(--dim); font-size: 14px; }
.next .nsub b { color: var(--ink); }

/* ---------------------------------------------------------------- table */

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl thead th { color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f8f9ff; }

.td-name { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.td-time { color: var(--dim); font-variant-numeric: tabular-nums; }
.td-prev { color: var(--dim); font-size: 16px; font-variant-numeric: tabular-nums; }
.td-now b { font-size: 22px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.tlink { font-size: 13px; font-weight: 600; }
tr.is-wait { background: #fffbf4; }

/* Sparkline: one bar per day, height scaled from the declared number. */
.spark { display: inline-flex; align-items: flex-end; gap: 3px; height: 30px; }
.spark i { width: 7px; height: var(--h, 10%); background: linear-gradient(180deg, var(--brand-2), #a5b4fc); border-radius: 2px 2px 0 0; transform-origin: bottom; animation: grow .5s ease backwards; }
.spark i.empty { height: 3px; background: var(--line); }
@keyframes grow { from { transform: scaleY(0); } }

/* Pending cell: three dots loading, no words. */
.chip-wait { display: inline-flex; align-items: center; gap: 4px; padding: 7px 10px; background: #fef3c7; border-radius: 20px; }
.chip-wait i { width: 6px; height: 6px; background: var(--amber); border-radius: 50%; animation: bounce 1.2s ease-in-out infinite; }
.chip-wait i:nth-child(2) { animation-delay: .15s; }
.chip-wait i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* -------------------------------------------------------------- columns */

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .panel { margin-bottom: 16px; }

/* Timeline: vertical rule with a dot per game. */
.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: flex; align-items: baseline; gap: 10px; padding: 9px 0; }
.tl-dot { position: absolute; left: -21px; top: 15px; width: 11px; height: 11px; background: #fff; border: 2px solid var(--line); border-radius: 50%; }
.timeline li.done .tl-dot { background: var(--green); border-color: var(--green); }
.tl-time { flex: 0 0 74px; color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.tl-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; word-break: break-word; }
.tl-res { flex: 0 0 auto; color: var(--dim); font-size: 13px; }
.timeline li.done .tl-res { color: var(--green); font-size: 18px; font-weight: 800; }

.rate { margin-bottom: 10px; color: var(--brand); font-size: 14px; font-weight: 700; }
.plist { list-style: none; }
.plist li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 14px; }
.plist li span { font-weight: 600; }
.plist li i { flex: 1; border-bottom: 1px dotted var(--line); }
.plist b { color: var(--dim); font-variant-numeric: tabular-nums; }
.note { margin-top: 10px; color: var(--dim); font-size: 13px; }

.btn { display: inline-block; margin: 12px 6px 0 0; padding: 10px 20px; background: var(--wa); border-radius: 9px; color: #fff; font-size: 14px; font-weight: 600; }
.btn.tg { background: #0ea5e9; }

.rt-date { font-weight: 600; }
.rt-dash { color: #c8cfdd; }
.rec td { text-align: center; }
.rec th { text-align: center; }
.rec th:first-child, .rec td:first-child { text-align: left; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.step { padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.step-ico { font-size: 24px; }
.step b { display: block; margin-top: 6px; font-size: 15px; }
.step span { color: var(--dim); font-size: 13.5px; }

/* ------------------------------------------------------------------- faq */

.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-q { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 13px 0; background: none; border: 0; color: var(--ink); font-family: inherit; font-size: 14.5px; font-weight: 600; text-align: left; cursor: pointer; }
.faq-ico { color: var(--brand); font-size: 18px; font-style: normal; transition: transform .25s ease; }
.faq-item.open .faq-ico { transform: rotate(45deg); }
.faq-a { display: none; padding-bottom: 13px; color: var(--dim); font-size: 14px; }
.faq-item.open .faq-a { display: block; }

.article h4 { margin-bottom: 9px; font-size: 17px; font-weight: 700; }
.article p { margin-bottom: 10px; color: #414a63; font-size: 14.5px; }
.article p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- footer */

.foot { padding: 20px 2px; border-top: 1px solid var(--line); }
.foot .fname { font-size: 15px; font-weight: 700; }
.foot p { margin-top: 5px; color: var(--dim); font-size: 13px; word-break: break-word; }

.fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; background: var(--wa); border-radius: 15px; box-shadow: 0 8px 22px rgba(22, 163, 74, .35); color: #fff; }

/* ------------------------------------------------------------ chart page */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filters select, .filters input { padding: 9px 11px; background: #fff; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font-family: inherit; font-size: 14px; }
.btn-sm { display: inline-block; padding: 9px 18px; background: var(--brand); border: 0; border-radius: 9px; color: #fff; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-sm.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }

@media (max-width: 900px) {
    .top-grid, .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .shell { flex-direction: column; }

    /* The rail becomes a full-width strip. min-width:0 is what stops the
       scrolling nav row from widening the aside past the viewport. */
    .side { position: static; flex: none; width: 100%; min-width: 0; height: auto; padding: 12px 14px; }
    .logo { min-width: 0; }
    .snav { flex-direction: row; min-width: 0; overflow-x: auto; margin-top: 10px; }
    .snav a { flex: 0 0 auto; }
    .side-foot { display: none; }
    .main { padding: 16px 14px 40px; }
    .hero-num { font-size: 52px; }
    .gname-xl { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; }
    .spark i { transform: none; }
}
