root = Card([header, kpiRow, sessionChart, currencyChart, regionHealth, topItems, crashChart, eventsSection, moderationQueue, experimentsSection, actionsSection], "card", "column", "l")
header = CardHeader("Live-Ops Dashboard", "Real-time game health & operations")
kpiRow = Card([onlineNow, dauMau, revenueToday, arpu], "clear", "row", "m", "stretch", "between")
onlineNow = Card([onlineLabel, onlineValue], "sunk", "column", "xs", "center")
onlineLabel = TextContent("Players Online", "small")
onlineValue = TextContent("247,382", "large-heavy")
dauMau = Card([dauCard, mauCard], "clear", "row", "m")
dauCard = Card([dauLabel, dauValue], "sunk", "column", "xs", "center")
dauLabel = TextContent("DAU", "small")
dauValue = TextContent("1.2M", "large-heavy")
mauCard = Card([mauLabel, mauValue], "sunk", "column", "xs", "center")
mauLabel = TextContent("MAU", "small")
mauValue = TextContent("8.7M", "large-heavy")
revenueToday = Card([revLabel, revValue], "sunk", "column", "xs", "center")
revLabel = TextContent("Revenue Today", "small")
revValue = TextContent("$342,150", "large-heavy")
arpu = Card([arpuLabel, arpuValue], "sunk", "column", "xs", "center")
arpuLabel = TextContent("ARPU (30d)", "small")
arpuValue = TextContent("$4.23", "large-heavy")
sessionChart = Card([sessionHeading, sessionLine], "sunk", "column", "m")
sessionHeading = Heading("Session Length (14d)", "h3")
sessionLine = LineChart(sessionLabels, [sessionSeries], "natural", "Day", "Minutes")
sessionLabels = ["D-13", "D-12", "D-11", "D-10", "D-9", "D-8", "D-7", "D-6", "D-5", "D-4", "D-3", "D-2", "D-1", "Today"]
sessionSeries = Series("Avg Session", [22, 24, 21, 23, 25, 28, 30, 23, 22, 24, 26, 27, 29, 31])
currencyChart = Card([currencyHeading, inflationRadial], "sunk", "column", "m")
currencyHeading = Heading("In-Game Currency Inflation Index", "h3")
inflationRadial = RadialChart(inflationLabels, inflationValues)
inflationLabels = ["Gold", "Gems", "Tokens", "Shards", "Coins"]
inflationValues = [1.0, 1.12, 0.95, 1.08, 1.03]
regionHealth = Card([regionHeading, regionTable], "sunk", "column", "m")
regionHeading = Heading("Server Regions & Health", "h3")
regionTable = Table([regionCol, statusCol, playersCol, latencyCol, cpuCol, memCol])
regionCol = Col("Region", ["US-East", "US-West", "EU-Central", "EU-West", "AP-Southeast", "AP-Northeast", "SA-East", "ME-Central"])
statusCol = Col("Health", ["Healthy", "Healthy", "Degraded", "Healthy", "Healthy", "Critical", "Healthy", "Healthy"])
playersCol = Col("Players", [89200, 67400, 45100, 38900, 52300, 1200, 23400, 18700])
latencyCol = Col("Ping (ms)", [42, 38, 55, 58, 72, 210, 95, 145])
cpuCol = Col("CPU %", [34, 28, 78, 31, 42, 94, 39, 51])
memCol = Col("Mem %", [41, 35, 82, 38, 48, 91, 44, 56])
topItems = Card([itemsHeading, itemsTable], "sunk", "column", "m")
itemsHeading = Heading("Best-Selling Items (7d)", "h3")
itemsTable = Table([itemNameCol, categoryCol, unitsCol, revenueCol, conversionCol])
itemNameCol = Col("Item", ["Battle Pass S12", "Starter Bundle", "Legendary Skin: Phoenix", "10k Gem Pack", "Epic Mount", "Pet: Voidling", "Emote Pack", "Weapon Charm"])
categoryCol = Col("Type", ["Pass", "Bundle", "Cosmetic", "Currency", "Mount", "Pet", "Emote", "Cosmetic"])
unitsCol = Col("Units Sold", [45200, 28900, 12400, 18700, 9800, 15600, 22100, 31400])
revenueCol = Col("Revenue", ["$678,000", "$578,000", "$496,000", "$374,000", "$294,000", "$234,000", "$110,500", "$94,200"])
conversionCol = Col("Conv. %", [18.2, 12.4, 3.1, 6.8, 2.9, 4.2, 5.7, 8.3])
crashChart = Card([crashHeading, crashBar], "sunk", "column", "m")
crashHeading = Heading("Crash Rate by App Version (24h)", "h3")
crashBar = BarChart(crashLabels, [crashSeries], "grouped", "Version", "Crash %")
crashLabels = ["2.1.0", "2.1.1", "2.1.2", "2.2.0", "2.2.1", "2.3.0-rc"]
crashSeries = Series("Crash Rate", [0.12, 0.08, 0.05, 0.15, 0.03, 0.42])
eventsSection = Card([eventsHeading, eventsTabs], "sunk", "column", "m")
eventsHeading = Heading("Live Events", "h3")
eventsTabs = Tabs([runningTab, upcomingTab])
runningTab = TabItem("running", "Running Now", [runningList])
upcomingTab = TabItem("upcoming", "Upcoming", [upcomingList])
runningList = ListBlock([run1, run2, run3], "number")
run1 = ListItem("Double XP Weekend", "Ends in 4h 23m • 2.1M participants", null, "View Details")
run2 = ListItem("Halloween Event: Shadow Realm", "Ends in 3d 12h • 890k participants", null, "View Details")
run3 = ListItem("Clan War Season 4", "Ends in 11d • 340k clans enrolled", null, "View Details")
upcomingList = ListBlock([up1, up2, up3], "number")
up1 = ListItem("Winter Festival", "Starts in 14d • New cosmetics & quests", null, "Configure")
up2 = ListItem("Anniversary Celebration", "Starts in 28d • Legendary rewards", null, "Configure")
up3 = ListItem("Esports Finals Viewer Event", "Starts in 6d • Drops enabled", null, "Configure")
moderationQueue = Card([modHeading, modRow], "sunk", "column", "m")
modHeading = Heading("Moderation Queue", "h3")
modRow = Card([reportsCard, appealsCard], "clear", "row", "l")
reportsCard = Card([reportsIcon, reportsLabel, reportsValue, reportsAction], "sunk", "column", "s", "center")
reportsIcon = Badge("1,247", "destructive")
reportsLabel = TextContent("Player Reports", "small")
reportsValue = TextContent("Awaiting Review", "small-heavy")
reportsAction = Button("Open Queue", null, "primary", "normal", "small")
appealsCard = Card([appealsIcon, appealsLabel, appealsValue, appealsAction], "sunk", "column", "s", "center")
appealsIcon = Badge("382", "warning")
appealsLabel = TextContent("Ban Appeals", "small")
appealsValue = TextContent("Awaiting Review", "small-heavy")
appealsAction = Button("Open Queue", null, "primary", "normal", "small")
experimentsSection = Card([expHeading, expRow], "sunk", "column", "m")
expHeading = Heading("Running Experiments", "h3")
expRow = Card([exp1Card, exp2Card], "clear", "row", "l")
exp1Card = Card([exp1Title, exp1Metric, exp1Lift, exp1Action], "sunk", "column", "m")
exp1Title = TextContent("Exp #42: Matchmaking SBMM Tuning", "small-heavy")
exp1Metric = TextContent("Variant B: +3.2% retention (p=0.02)", "default")
exp1Lift = Tag("Statistically Significant", null, null, "success")
exp1Action = Button("View Full Report", null, "secondary", "normal", "small")
exp2Card = Card([exp2Title, exp2Metric, exp2Lift, exp2Action], "sunk", "column", "m")
exp2Title = TextContent("Exp #43: Daily Reward Restructure", "small-heavy")
exp2Metric = TextContent("Variant A: +1.8% ARPU (p=0.07)", "default")
exp2Lift = Tag("Not Significant", null, null, "warning")
exp2Action = Button("View Full Report", null, "secondary", "normal", "small")
actionsSection = Card([actionsHeading, patchForm, regionFocus, hotfixBtn], "sunk", "column", "m")
actionsHeading = Heading("Operations Actions", "h3")
patchForm = Form("patch-notes", patchButtons, [patchTitleField, patchBodyField, patchSeverityField])
patchTitleField = FormControl("Patch Title", patchTitleInput, "e.g. Hotfix 2.3.1 — Crash Fixes")
patchTitleInput = Input("patch_title", "Hotfix 2.3.1 — Crash Fixes", "text", null, "")
patchBodyField = FormControl("Notes (Markdown)", patchBodyInput, "Changes, fixes, known issues")
patchBodyInput = TextArea("patch_body", "## Fixes\n- Fixed crash on startup for iOS 17.2+\n- Resolved memory leak in clan chat\n\n## Known Issues\n- Minor visual glitch in shop preview", 6, null, "")
patchSeverityField = FormControl("Severity", patchSeveritySelect)
patchSeveritySelect = Select("patch_severity", [sevHotfix, sevPatch, sevMinor], "Select severity")
sevHotfix = SelectItem("hotfix", "Hotfix (immediate)")
sevPatch = SelectItem("patch", "Patch (scheduled)")
sevMinor = SelectItem("minor", "Minor (next release)")
patchButtons = Buttons([patchSaveBtn, patchPreviewBtn])
patchSaveBtn = Button("Save Draft", null, "primary")
patchPreviewBtn = Button("Preview", null, "secondary")
regionFocus = Card([focusLabel, focusSelect], "clear", "row", "m", "center", "start")
focusLabel = TextContent("Focus Region:", "default")
focusSelect = Select("region_focus", [focusAll, focusUSE, focusUSW, focusEUC, focusEUW, focusAPSE, focusAPNE, focusSAE, focusMEC], "All Regions", null, "medium")
focusAll = SelectItem("all", "All Regions")
focusUSE = SelectItem("us-east", "US-East")
focusUSW = SelectItem("us-west", "US-West")
focusEUC = SelectItem("eu-central", "EU-Central")
focusEUW = SelectItem("eu-west", "EU-West")
focusAPSE = SelectItem("ap-southeast", "AP-Southeast")
focusAPNE = SelectItem("ap-northeast", "AP-Northeast")
focusSAE = SelectItem("sa-east", "SA-East")
focusMEC = SelectItem("me-central", "ME-Central")
hotfixBtn = Button("Ship Hotfix Now", ["hotfix-ship"], "primary", "destructive", "large")