Dough Git

commit

Updates

commit
1d3018e99883226b2e3a338813133a4ad6de55c4
author
Clove Twilight <[email protected]>
date
2026-10-30 00:24

diff --git a/api-helper/README.md b/api-helper/README.md
index 0ff50fd..b98bdb3 100644
--- a/api-helper/README.md
+++ b/api-helper/README.md
@@ -1,14 +1,15 @@
 # Device Reporter
 
-A little Android app that quietly tells your own API how your Pixel is doing — battery,
+A little Android app that quietly tells your own API how your phone is doing — battery,
 charging, low-power mode, Wi-Fi, Bluetooth earbuds, and roughly where it is. It's the
-free, self-hosted answer to those paid "battery status" apps, built for one phone: mine.
+free, self-hosted answer to those paid "battery status" apps, built for one phone: mine
+(currently a Galaxy S26 Ultra on One UI 9, but it's plain Android 8+).
 
 Under the hood it just POSTs to your endpoint with the fields in the query string and your
 secret key in a header (no request body):
 
 ```
-POST https://doughmination.uk/v2/devices?device=pixel&level=25&charging=1&lpm=0&wifi=Home
+POST https://doughmination.uk/v2/devices?device=phone&level=25&charging=1&lpm=0&wifi=Home
 X-Battery-Key: <your key>
 ```
 
@@ -19,27 +20,31 @@ picture every time without clobbering anything it didn't mean to.
 
 It reports the moment something interesting happens, plus a heartbeat every five minutes:
 
-- You join or leave a Wi-Fi network → sends the SSID (or `wifi=0` when you're off Wi-Fi).
+- You join or leave a Wi-Fi network, or hop between networks → sends the SSID (or `wifi=0`
+  when you're off Wi-Fi).
 - You plug in or unplug the charger.
 - Battery Saver flips on or off.
 - Your chosen Bluetooth earbuds connect or disconnect.
 - Every 5 minutes regardless, as a battery check — and this one also includes your location.
+  It's an alarm, so it fires even while the phone is asleep in your pocket.
 
 ## What each field means
 
 - **device** — whatever name you set in the app.
 - **level** — battery percentage, 0–100.
-- **charging** — `1` plugged in, `0` on battery.
-- **lpm** — `1`/`0` from Android's Battery Saver.
+- **charging** — `1` plugged in, `0` on battery. This is "charger attached", not "battery
+  filling up", so Samsung's battery protection (stop at 80/85%) still reads as `1`.
+- **lpm** — `1`/`0` from Battery Saver (One UI calls it Power saving).
 - **wifi** — the network name when connected, or `0` when you're not.
-- **watch** — a manual switch. An Apple Watch can't pair to a Pixel, so there's nothing to
+- **watch** — a manual switch. An Apple Watch can't pair with Android, so there's nothing to
   detect automatically; flip it yourself if you ever want `watch=1`.
 - **airpods** — `1`/`0` based on a Bluetooth device you choose. Tap **Select AirPods device**,
   pick your buds from the paired list, and the app remembers them and reports when they
   connect or drop.
-- **location** — sent on the 5-minute heartbeat only. The app takes your last-known GPS fix
-  and turns it into readable text like `London, England, United Kingdom` (never raw
-  coordinates). If it can't get a location, it just leaves the field out.
+- **location** — sent on the 5-minute heartbeat only. The app takes your last-known fix
+  (asking for a fresh one if that's over 10 minutes old) and turns it into readable text
+  like `London, England, United Kingdom` (never raw coordinates). If it can't get a
+  location, it just leaves the field out.
 
 Every value is URL-encoded, so spaces, commas, and symbols in a network name or place name
 travel safely.
@@ -47,23 +52,34 @@ travel safely.
 ## The settings screen
 
 Base URL (defaults to `https://doughmination.uk/v2`), your **X-Battery-Key**, and a device
-name. Below that: the manual **watch** switch, an **AirPods** toggle with a device picker,
-and buttons to **Save**, **Start**/**Stop** the service, and **Send a test report now** —
-the test button shows you the exact URL it sent and whether the server liked it. Your key
-lives only on the phone; it's never baked into the APK.
+name (defaults to `phone`; set it to whatever your API expects). Below that: the manual
+**watch** switch, an **AirPods** toggle with a device picker, a **Background** panel that
+shows which of the three keep-alive settings below are still missing (with a button for
+each), and buttons to **Start**/**Stop** reporting, **Save**, and **Send test** — the test
+shows you the exact URL it sent and whether the server liked it. Your key lives only on the
+phone; it's never baked into the APK.
+
+It wears the same colours and IBM Plex Sans as doughmination.gay, and its icon is the
+doughnut family's: bat-winged doughnut over a phone sending signal. The source art is
+`art/icon.svg`; run `./art/render-icons.sh` (needs `rsvg-convert`) after changing it.
 
 ## Permissions, and why
 
 - **Location (fine)** — Android won't hand over the Wi-Fi name or your location without it.
   Location services need to be switched on, too.
-- **Background location ("Allow all the time")** — so the 5-minute heartbeat can still read
-  your location when the app isn't open. When you tap Start, Android will ask; pick
-  all-the-time or the location field only fills while the app is in front.
+- **Background location ("Allow all the time")** — so reports sent while the app is closed
+  can still read the Wi-Fi name and your location. Tap **Allow** next to *Location* and pick
+  all-the-time on the screen Android opens.
 - **Notifications** — the background service shows one quiet, permanent notification. Android
   requires it, and it doubles as a handy "last report was OK at 14:32" status line.
 - **Bluetooth** — to list your paired devices and notice when the earbuds come and go.
-- **Battery** — set the app to **Unrestricted** (Settings → Apps → Device Reporter → Battery)
-  or Android may throttle the 5-minute timer.
+- **Battery** — tap **Allow** next to *Battery* to make the app **Unrestricted**, or One UI
+  will freeze it once the screen's been off a while. Samsung also keeps its own sleeping-app
+  lists: check Settings → Battery → Background usage limits and make sure Device Reporter
+  isn't under *Sleeping apps* or *Deep sleeping apps* (adding it to *Never auto sleeping
+  apps* is safest).
+- **Alarms & reminders** — tap **Allow** next to *On-time heartbeat*. Without it Android
+  still sends the heartbeat, but while the phone is idle the gap can stretch to ~10 minutes.
 
 ## Getting the APK
 
@@ -79,7 +95,7 @@ and publishes it as the latest Release. This is the one to actually keep on your
 (If you'd rather, pushing a `v*` tag from your terminal does the exact same thing.)
 
 A minute later, your repo's **Releases** page has `device-reporter-v1.0.0.apk` sitting at the
-top marked "Latest". Download it straight onto the Pixel.
+top marked "Latest". Download it straight onto the phone.
 
 ### One-time signing setup
 
@@ -116,12 +132,14 @@ updates that install over an existing copy. That's it; tag a version and the rel
 ./gradlew assembleRelease   # falls back to the debug key if no signing secrets are set
 ```
 
-## Installing on the Pixel
+## Installing on the phone
 
 Copy the APK over (or download it directly on the phone), open it, and allow installing from
-unknown sources if prompted. Launch **Device Reporter**, put in your key, hit **Save**, then
-**Start reporting service**, and say yes to the location, notification, and Bluetooth prompts.
-Tap **Send test report now** to make sure the server hears it.
+unknown sources if prompted. Launch **Device Reporter**, put in your key and device name,
+say yes to the location, notification, and Bluetooth prompts, then tap **Allow** on anything
+in the *Background* panel that isn't green. Hit **Start reporting**, then **Send test** to
+make sure the server hears it. Reporting comes back on its own after a reboot or an update,
+unless you stopped it.
 
 ## How it's laid out
 
@@ -131,7 +149,8 @@ app/src/main/java/uk/doughmination/devicereporter/
   Prefs.kt             saved configuration
   DeviceState.kt       reads battery / charging / lpm / wifi / location
   Reporter.kt          builds the URL and sends it (with the X-Battery-Key header)
-  ReporterService.kt   the always-on service: event triggers + 5-minute timer
-  BootReceiver.kt      brings the service back after a reboot
+  ReporterService.kt   the always-on service: event triggers + 5-minute alarm
+  BootReceiver.kt      brings the service back after a reboot or app update
+art/icon.svg                  launcher icon source; render-icons.sh rebuilds the PNGs
 .github/workflows/build.yml   builds the debug APK and publishes signed releases
 ```
diff --git a/api-helper/app/build.gradle.kts b/api-helper/app/build.gradle.kts
index b21850f..f70448f 100644
--- a/api-helper/app/build.gradle.kts
+++ b/api-helper/app/build.gradle.kts
@@ -5,14 +5,14 @@ plugins {
 
 android {
     namespace = "uk.doughmination.devicereporter"
-    compileSdk = 34
+    compileSdk = 35
 
     defaultConfig {
         applicationId = "uk.doughmination.devicereporter"
         minSdk = 26
-        targetSdk = 34
-        versionCode = 1
-        versionName = "1.0"
+        targetSdk = 35
+        versionCode = 2
+        versionName = "1.1"
     }
 
     signingConfigs {
@@ -56,8 +56,10 @@ android {
 }
 
 dependencies {
-    implementation("androidx.core:core-ktx:1.13.1")
+    implementation("androidx.core:core-ktx:1.15.0")
+    implementation("androidx.activity:activity-ktx:1.9.3")
     implementation("androidx.appcompat:appcompat:1.7.0")
+    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
     implementation("com.google.android.material:material:1.12.0")
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
+    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
 }
diff --git a/api-helper/app/src/main/AndroidManifest.xml b/api-helper/app/src/main/AndroidManifest.xml
index 96187d3..ea4dd90 100644
--- a/api-helper/app/src/main/AndroidManifest.xml
+++ b/api-helper/app/src/main/AndroidManifest.xml
@@ -8,11 +8,13 @@
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
-    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
     <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
     <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
     <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
+    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
 
     <application
         android:allowBackup="true"
@@ -24,17 +26,27 @@
 
         <activity
             android:name=".MainActivity"
-            android:exported="true">
+            android:exported="true"
+            android:launchMode="singleTop"
+            android:windowSoftInputMode="adjustResize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
 
+        <!--
+            specialUse rather than dataSync: from Android 15 a dataSync service may only run
+            6 hours a day and can't be started from BOOT_COMPLETED, which breaks an always-on reporter.
+        -->
         <service
             android:name=".ReporterService"
             android:exported="false"
-            android:foregroundServiceType="dataSync" />
+            android:foregroundServiceType="specialUse">
+            <property
+                android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
+                android:value="Continuously reports this device's own battery, network and location state to the owner's server" />
+        </service>
 
         <receiver
             android:name=".BootReceiver"
@@ -42,6 +54,9 @@
             <intent-filter>
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
             </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
+            </intent-filter>
         </receiver>
 
     </application>
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/BootReceiver.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/BootReceiver.kt
index ed364a0..e3132d0 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/BootReceiver.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/BootReceiver.kt
@@ -4,12 +4,18 @@ import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 
-/** Restarts the reporting service after a reboot, if the user had configured it. */
+/**
+ * Restarts the reporting service after a reboot or an app update (installing a new APK
+ * kills the running service), if the user had it switched on.
+ */
 class BootReceiver : BroadcastReceiver() {
     override fun onReceive(context: Context, intent: Intent) {
-        if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
-            if (Prefs(context).isConfigured()) {
-                ReporterService.start(context)
+        when (intent.action) {
+            Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MY_PACKAGE_REPLACED -> {
+                val prefs = Prefs(context)
+                if (prefs.reportingEnabled && prefs.isConfigured()) {
+                    ReporterService.start(context)
+                }
             }
         }
     }
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/DeviceState.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/DeviceState.kt
index b5bfb34..1c6a093 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/DeviceState.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/DeviceState.kt
@@ -12,10 +12,14 @@ import android.net.NetworkCapabilities
 import android.net.wifi.WifiManager
 import android.os.BatteryManager
 import android.os.Build
+import android.os.CancellationSignal
 import android.os.PowerManager
+import android.os.SystemClock
 import androidx.core.content.ContextCompat
 import android.Manifest
 import java.util.Locale
+import java.util.concurrent.CountDownLatch
+import java.util.concurrent.TimeUnit
 
 /**
  * Immutable snapshot of the fields the API accepts.
@@ -33,22 +37,29 @@ data class Snapshot(
     val location: String?   // reverse-geocoded "City, Region, Country"; null => omit
 )
 
+/** Wi-Fi state as tracked by the service's network callback. */
+data class WifiState(val connected: Boolean, val ssid: String?)
+
 object DeviceState {
 
+    /** A last-known fix older than this gets refreshed before geocoding. */
+    private const val STALE_FIX_MS = 10 * 60 * 1000L
+    private const val FRESH_FIX_TIMEOUT_S = 20L
+
     fun batteryLevel(ctx: Context): Int {
         val bm = ctx.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
         return bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
     }
 
-    fun isCharging(ctx: Context): Boolean {
-        val bm = ctx.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            return bm.isCharging
-        }
+    /**
+     * True when a charger is attached. Deliberately "plugged in" rather than
+     * [BatteryManager.isCharging]: with Samsung's battery protection (stop at 80/85%)
+     * the phone sits plugged in but not charging, and the API's `charging` means plugged in.
+     */
+    fun isPluggedIn(ctx: Context): Boolean {
         val intent: Intent? = ctx.registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
-        val status = intent?.getIntExtra(BatteryManager.EXTRA_STATUS, -1) ?: -1
-        return status == BatteryManager.BATTERY_STATUS_CHARGING ||
-            status == BatteryManager.BATTERY_STATUS_FULL
+        val plugged = intent?.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) ?: 0
+        return plugged != 0
     }
 
     fun isPowerSave(ctx: Context): Boolean {
@@ -56,7 +67,7 @@ object DeviceState {
         return pm.isPowerSaveMode
     }
 
-    /** True if wifi is the active, validated network. */
+    /** True if wifi is the active network. */
     fun isWifiConnected(ctx: Context): Boolean {
         val cm = ctx.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
         val net = cm.activeNetwork ?: return false
@@ -64,19 +75,23 @@ object DeviceState {
         return caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
     }
 
+    /** Strips the quotes Android wraps SSIDs in; null for the placeholders it uses when withholding them. */
+    fun cleanSsid(raw: String?): String? {
+        val ssid = raw?.trim('"') ?: return null
+        return if (ssid.isBlank() || ssid == "<unknown ssid>" || ssid == "0x") null else ssid
+    }
+
     /**
-     * Current wifi SSID, or null if unavailable/disconnected.
-     * On Android 10+ this requires ACCESS_FINE_LOCATION and location services on;
-     * the OS returns "<unknown ssid>" when it will not disclose the name.
+     * Current wifi SSID, or null if unavailable/disconnected. Fallback for when the
+     * service's network callback isn't running (e.g. a test report from the app).
+     * Requires ACCESS_FINE_LOCATION and location services on.
      */
     @Suppress("DEPRECATION")
     fun wifiSsid(ctx: Context): String? {
         if (!isWifiConnected(ctx)) return null
         return try {
             val wm = ctx.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
-            val raw = wm.connectionInfo?.ssid ?: return null
-            val ssid = raw.trim('"')
-            if (ssid.isBlank() || ssid == "<unknown ssid>" || ssid == "0x") null else ssid
+            cleanSsid(wm.connectionInfo?.ssid)
         } catch (e: Exception) {
             null
         }
@@ -89,34 +104,67 @@ object DeviceState {
             PackageManager.PERMISSION_GRANTED
     }
 
+    private fun providers(lm: LocationManager): List<String> {
+        val all = ArrayList<String>()
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) all.add(LocationManager.FUSED_PROVIDER)
+        all.add(LocationManager.NETWORK_PROVIDER)
+        all.add(LocationManager.GPS_PROVIDER)
+        all.add(LocationManager.PASSIVE_PROVIDER)
+        return all.filter { p -> runCatching { lm.isProviderEnabled(p) }.getOrDefault(false) }
+    }
+
     /** Freshest last-known fix across the available providers, or null. */
-    private fun lastKnownLocation(ctx: Context): Location? {
-        if (!hasLocationPermission(ctx)) return null
-        val lm = ctx.getSystemService(Context.LOCATION_SERVICE) as? LocationManager ?: return null
-        val providers = listOf(
-            LocationManager.GPS_PROVIDER,
-            LocationManager.NETWORK_PROVIDER,
-            LocationManager.PASSIVE_PROVIDER
-        )
+    private fun lastKnownLocation(lm: LocationManager): Location? {
         var best: Location? = null
-        for (p in providers) {
+        for (p in providers(lm)) {
             val loc = try {
-                if (lm.isProviderEnabled(p)) lm.getLastKnownLocation(p) else null
+                lm.getLastKnownLocation(p)
             } catch (e: SecurityException) {
                 null
             }
-            if (loc != null && (best == null || loc.time > best!!.time)) best = loc
+            if (loc != null && (best == null || loc.elapsedRealtimeNanos > best.elapsedRealtimeNanos)) best = loc
         }
         return best
     }
 
     /**
-     * Reverse-geocodes the last-known location into "City, Region, Country".
-     * Blocking (Geocoder) — call from a background thread. Returns null if
+     * Asks for one fresh fix (Android 11+), waiting up to [FRESH_FIX_TIMEOUT_S].
+     * City-level text is all we send, so any non-GPS provider's accuracy is plenty.
+     */
+    private fun freshLocation(ctx: Context, lm: LocationManager): Location? {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) return null
+        val provider = providers(lm).firstOrNull { it != LocationManager.PASSIVE_PROVIDER } ?: return null
+        val latch = CountDownLatch(1)
+        var result: Location? = null
+        val signal = CancellationSignal()
+        return try {
+            lm.getCurrentLocation(provider, signal, ContextCompat.getMainExecutor(ctx)) { loc ->
+                result = loc
+                latch.countDown()
+            }
+            if (!latch.await(FRESH_FIX_TIMEOUT_S, TimeUnit.SECONDS)) signal.cancel()
+            result
+        } catch (e: SecurityException) {
+            null
+        }
+    }
+
+    private fun bestLocation(ctx: Context): Location? {
+        if (!hasLocationPermission(ctx)) return null
+        val lm = ctx.getSystemService(Context.LOCATION_SERVICE) as? LocationManager ?: return null
+        val last = lastKnownLocation(lm)
+        val ageMs = last?.let { (SystemClock.elapsedRealtimeNanos() - it.elapsedRealtimeNanos) / 1_000_000 }
+        if (last != null && ageMs != null && ageMs < STALE_FIX_MS) return last
+        return freshLocation(ctx, lm) ?: last
+    }
+
+    /**
+     * Reverse-geocodes the device's location into "City, Region, Country".
+     * Blocking (fresh fix + Geocoder) — call from a background thread. Returns null if
      * permission/location/geocoder is unavailable.
      */
     fun locationString(ctx: Context): String? {
-        val loc = lastKnownLocation(ctx) ?: return null
+        val loc = bestLocation(ctx) ?: return null
         if (!Geocoder.isPresent()) return null
         return try {
             val geocoder = Geocoder(ctx, Locale.getDefault())
@@ -136,16 +184,23 @@ object DeviceState {
 
     /**
      * Full current state, honouring user prefs for watch/airpods.
-     * [includeLocation] adds the reverse-geocoded location (used on the 5-min timer).
+     * [includeLocation] adds the reverse-geocoded location (used on the 5-min heartbeat).
+     * [wifi] is the service's tracked state; without it wifi is read directly.
      */
-    fun snapshot(ctx: Context, prefs: Prefs, includeLocation: Boolean = false): Snapshot {
-        val connected = isWifiConnected(ctx)
+    fun snapshot(
+        ctx: Context,
+        prefs: Prefs,
+        includeLocation: Boolean = false,
+        wifi: WifiState? = null
+    ): Snapshot {
+        val connected = wifi?.connected ?: isWifiConnected(ctx)
+        val ssid = if (wifi != null) wifi.ssid else if (connected) wifiSsid(ctx) else null
         return Snapshot(
             device = prefs.deviceName,
             level = batteryLevel(ctx).takeIf { it in 0..100 },
-            charging = isCharging(ctx),
+            charging = isPluggedIn(ctx),
             lpm = isPowerSave(ctx),
-            wifi = if (connected) wifiSsid(ctx) else null,
+            wifi = if (connected) ssid else null,
             wifiConnected = connected,
             watch = prefs.watchConnected,
             airpods = if (prefs.airpodsEnabled) prefs.airpodsConnected else null,
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt
index 4557d3b..878e10a 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/MainActivity.kt
@@ -1,20 +1,39 @@
 package uk.doughmination.devicereporter
 
 import android.Manifest
+import android.annotation.SuppressLint
 import android.bluetooth.BluetoothManager
 import android.content.Context
+import android.content.Intent
+import android.content.SharedPreferences
 import android.content.pm.PackageManager
+import android.content.res.ColorStateList
+import android.graphics.Color
+import android.net.Uri
 import android.os.Build
 import android.os.Bundle
+import android.os.PowerManager
+import android.provider.Settings
+import android.view.View
 import android.widget.Button
 import android.widget.EditText
 import android.widget.TextView
 import android.widget.Toast
+import androidx.activity.SystemBarStyle
+import androidx.activity.enableEdgeToEdge
 import androidx.activity.result.contract.ActivityResultContracts
-import androidx.appcompat.app.AlertDialog
+import androidx.annotation.ColorRes
 import androidx.appcompat.app.AppCompatActivity
 import androidx.core.content.ContextCompat
-import com.google.android.material.switchmaterial.SwitchMaterial
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import androidx.core.view.updatePadding
+import androidx.lifecycle.lifecycleScope
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
+import com.google.android.material.materialswitch.MaterialSwitch
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
 
 class MainActivity : AppCompatActivity() {
 
@@ -23,19 +42,65 @@ class MainActivity : AppCompatActivity() {
     private lateinit var inputBaseUrl: EditText
     private lateinit var inputApiKey: EditText
     private lateinit var inputDevice: EditText
-    private lateinit var switchWatch: SwitchMaterial
-    private lateinit var switchAirpods: SwitchMaterial
+    private lateinit var switchWatch: MaterialSwitch
+    private lateinit var switchAirpods: MaterialSwitch
     private lateinit var textAirpodsDevice: TextView
     private lateinit var textStatus: TextView
+    private lateinit var textServiceState: TextView
+    private lateinit var textBattery: TextView
+    private lateinit var textLocation: TextView
+    private lateinit var textAlarms: TextView
+    private lateinit var btnBattery: Button
+    private lateinit var btnLocation: Button
+    private lateinit var btnAlarms: Button
+    private lateinit var btnStart: Button
+    private lateinit var btnStop: Button
 
+    // Background location has to be asked for on its own, after foreground location is
+    // granted, so the foreground request chains into it.
     private val permissionLauncher =
-        registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { }
+        registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { granted ->
+            if (granted[Manifest.permission.ACCESS_FINE_LOCATION] == true) requestBackgroundLocation()
+            refreshBackgroundRows()
+        }
+
+    private val backgroundLocationLauncher =
+        registerForActivityResult(ActivityResultContracts.RequestPermission()) { refreshBackgroundRows() }
+
+    private val prefsListener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
+        if (key == Prefs.KEY_LAST_REPORT) runOnUiThread { showLastReport() }
+    }
 
     override fun onCreate(savedInstanceState: Bundle?) {
+        enableEdgeToEdge(
+            statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
+            navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
+        )
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
         prefs = Prefs(this)
 
+        // Edge-to-edge: keep content clear of the status bar, camera cutout, nav bar and keyboard.
+        val content = findViewById<View>(R.id.content)
+        val basePadTop = content.paddingTop
+        val basePadBottom = content.paddingBottom
+        val basePadStart = content.paddingStart
+        val basePadEnd = content.paddingEnd
+        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.scroll)) { _, insets ->
+            val bars = insets.getInsets(
+                WindowInsetsCompat.Type.systemBars() or
+                    WindowInsetsCompat.Type.displayCutout() or
+                    WindowInsetsCompat.Type.ime()
+            )
+            content.updatePadding(
+                left = basePadStart + bars.left,
+                top = basePadTop + bars.top,
+                right = basePadEnd + bars.right,
+                bottom = basePadBottom + bars.bottom
+            )
+            insets
+        }
+
         inputBaseUrl = findViewById(R.id.inputBaseUrl)
         inputApiKey = findViewById(R.id.inputApiKey)
         inputDevice = findViewById(R.id.inputDevice)
@@ -43,31 +108,58 @@ class MainActivity : AppCompatActivity() {
         switchAirpods = findViewById(R.id.switchAirpods)
         textAirpodsDevice = findViewById(R.id.textAirpodsDevice)
         textStatus = findViewById(R.id.textStatus)
+        textServiceState = findViewById(R.id.textServiceState)
+        textBattery = findViewById(R.id.textBattery)
+        textLocation = findViewById(R.id.textLocation)
+        textAlarms = findViewById(R.id.textAlarms)
+        btnBattery = findViewById(R.id.btnBattery)
+        btnLocation = findViewById(R.id.btnLocation)
+        btnAlarms = findViewById(R.id.btnAlarms)
+        btnStart = findViewById(R.id.btnStart)
+        btnStop = findViewById(R.id.btnStop)
 
         loadIntoViews()
 
         findViewById<Button>(R.id.btnSelectAirpods).setOnClickListener { pickAirpodsDevice() }
         findViewById<Button>(R.id.btnSave).setOnClickListener { saveFromViews(); toast("Saved") }
-        findViewById<Button>(R.id.btnStart).setOnClickListener {
+        btnStart.setOnClickListener {
             saveFromViews()
             if (!prefs.isConfigured()) {
                 toast("Set a base URL and device name first")
             } else {
                 requestRuntimePermissions()
-                requestBackgroundLocationIfNeeded()
+                prefs.reportingEnabled = true
                 ReporterService.start(this)
-                textStatus.text = "Service started."
+                // The service flips isRunning in onCreate, a moment after this returns.
+                btnStart.post { refreshServiceState() }
             }
         }
-        findViewById<Button>(R.id.btnStop).setOnClickListener {
+        btnStop.setOnClickListener {
+            prefs.reportingEnabled = false
             ReporterService.stop(this)
-            textStatus.text = "Service stopped."
+            refreshServiceState()
         }
         findViewById<Button>(R.id.btnTest).setOnClickListener { sendTestReport() }
+        btnBattery.setOnClickListener { requestBatteryExemption() }
+        btnLocation.setOnClickListener { requestLocation() }
+        btnAlarms.setOnClickListener { requestExactAlarms() }
 
         requestRuntimePermissions()
     }
 
+    override fun onResume() {
+        super.onResume()
+        prefs.registerListener(prefsListener)
+        refreshServiceState()
+        refreshBackgroundRows()
+        showLastReport()
+    }
+
+    override fun onPause() {
+        prefs.unregisterListener(prefsListener)
+        super.onPause()
+    }
+
     private fun loadIntoViews() {
         inputBaseUrl.setText(prefs.baseUrl)
         inputApiKey.setText(prefs.apiKey)
@@ -80,23 +172,154 @@ class MainActivity : AppCompatActivity() {
     private fun saveFromViews() {
         prefs.baseUrl = inputBaseUrl.text.toString().trim().ifBlank { Prefs.DEFAULT_BASE_URL }
         prefs.apiKey = inputApiKey.text.toString().trim()
-        prefs.deviceName = inputDevice.text.toString().trim().ifBlank { "pixel" }
+        prefs.deviceName = inputDevice.text.toString().trim().ifBlank { Prefs.DEFAULT_DEVICE }
         prefs.watchConnected = switchWatch.isChecked
         prefs.airpodsEnabled = switchAirpods.isChecked
     }
 
+    // --- status ------------------------------------------------------------
+
+    private fun refreshServiceState() {
+        val running = ReporterService.isRunning
+        btnStart.visibility = if (running) View.GONE else View.VISIBLE
+        btnStop.visibility = if (running) View.VISIBLE else View.GONE
+        setPill(textServiceState, if (running) "Reporting" else "Stopped", if (running) R.color.ok else R.color.muted)
+    }
+
+    private fun showLastReport() {
+        val last = prefs.lastReport
+        if (last.isNotBlank()) textStatus.text = last
+    }
+
+    private fun setPill(view: TextView, text: String, @ColorRes color: Int) {
+        val c = ContextCompat.getColor(this, color)
+        view.text = text
+        view.setTextColor(c)
+        view.compoundDrawablesRelative[0]?.setTint(c)
+    }
+
+    /** One UI needs all three of these for the service to keep running and report on time. */
+    private fun refreshBackgroundRows() {
+        val pm = getSystemService(PowerManager::class.java)
+        val unrestricted = pm.isIgnoringBatteryOptimizations(packageName)
+        setRow(
+            textBattery, btnBattery, unrestricted,
+            ok = "Allowed",
+            missing = "One UI may stop the service while the screen's off"
+        )
+
+        val fine = has(Manifest.permission.ACCESS_FINE_LOCATION)
+        val background = Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ||
+            has(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
+        setRow(
+            textLocation, btnLocation, fine && background,
+            ok = "Allowed",
+            missing = if (!fine) "Needed for the Wi-Fi name and location" else "Only while open: background reports won't have Wi-Fi name or location"
+        )
+
+        setRow(
+            textAlarms, btnAlarms, ReporterService.canScheduleExact(this),
+            ok = "Allowed: every 5 minutes, even asleep",
+            missing = "Without it, idle gaps can stretch to ~10 minutes"
+        )
+    }
+
+    private fun setRow(hint: TextView, button: Button, granted: Boolean, ok: String, missing: String) {
+        hint.text = if (granted) ok else missing
+        hint.setTextColor(ContextCompat.getColor(this, if (granted) R.color.ok else R.color.warn))
+        button.visibility = if (granted) View.GONE else View.VISIBLE
+    }
+
+    // --- permissions -------------------------------------------------------
+
+    private fun has(permission: String) =
+        ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
+
+    private fun requestRuntimePermissions() {
+        val needed = ArrayList<String>()
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
+            !has(Manifest.permission.POST_NOTIFICATIONS)
+        ) needed.add(Manifest.permission.POST_NOTIFICATIONS)
+
+        if (!has(Manifest.permission.ACCESS_FINE_LOCATION)) {
+            needed.add(Manifest.permission.ACCESS_FINE_LOCATION)
+            needed.add(Manifest.permission.ACCESS_COARSE_LOCATION)
+        }
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
+            !has(Manifest.permission.BLUETOOTH_CONNECT)
+        ) needed.add(Manifest.permission.BLUETOOTH_CONNECT)
+
+        if (needed.isNotEmpty()) permissionLauncher.launch(needed.toTypedArray())
+    }
+
+    private fun requestLocation() {
+        when {
+            !has(Manifest.permission.ACCESS_FINE_LOCATION) -> permissionLauncher.launch(
+                arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)
+            )
+            else -> requestBackgroundLocation(explain = true)
+        }
+    }
+
+    /**
+     * Android sends background location to its own settings page ("Allow all the time").
+     * Once the user has declined it there, the request does nothing, so go to app settings.
+     */
+    private fun requestBackgroundLocation(explain: Boolean = false) {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return
+        if (has(Manifest.permission.ACCESS_BACKGROUND_LOCATION)) return
+        val ask = {
+            if (shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_BACKGROUND_LOCATION) || !explain) {
+                backgroundLocationLauncher.launch(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
+            } else {
+                openAppSettings()
+            }
+        }
+        MaterialAlertDialogBuilder(this)
+            .setTitle("Location all the time")
+            .setMessage(
+                "Reports sent while the app is closed need location to include your Wi-Fi name " +
+                    "and city. On the next screen, choose \"Allow all the time\"."
+            )
+            .setPositiveButton("Continue") { _, _ -> ask() }
+            .setNegativeButton("Not now", null)
+            .show()
+    }
+
+    private fun requestBatteryExemption() {
+        val intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
+            .setData(Uri.parse("package:$packageName"))
+        runCatching { startActivity(intent) }.onFailure { openAppSettings() }
+    }
+
+    private fun requestExactAlarms() {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return
+        val intent = Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM)
+            .setData(Uri.parse("package:$packageName"))
+        runCatching { startActivity(intent) }.onFailure { openAppSettings() }
+    }
+
+    private fun openAppSettings() {
+        startActivity(
+            Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:$packageName"))
+        )
+    }
+
+    // --- airpods -----------------------------------------------------------
+
     private fun updateAirpodsLabel() {
         textAirpodsDevice.text = if (prefs.airpodsAddress.isNotBlank()) {
-            "AirPods device: ${prefs.airpodsLabel} (${prefs.airpodsAddress})"
+            "${prefs.airpodsLabel} · ${prefs.airpodsAddress}"
         } else {
-            "No AirPods device selected"
+            "No device selected"
         }
     }
 
+    @SuppressLint("MissingPermission") // BLUETOOTH_CONNECT is checked first; SecurityException is caught
     private fun pickAirpodsDevice() {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
-            ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT)
-            != PackageManager.PERMISSION_GRANTED
+            !has(Manifest.permission.BLUETOOTH_CONNECT)
         ) {
             permissionLauncher.launch(arrayOf(Manifest.permission.BLUETOOTH_CONNECT))
             toast("Grant Bluetooth permission, then tap again")
@@ -122,8 +345,8 @@ class MainActivity : AppCompatActivity() {
         }
 
         val names = bonded.map { runCatching { it.name }.getOrNull() ?: it.address }.toTypedArray()
-        AlertDialog.Builder(this)
-            .setTitle("Select AirPods device")
+        MaterialAlertDialogBuilder(this)
+            .setTitle("Choose your AirPods")
             .setItems(names) { _, which ->
                 val chosen = bonded[which]
                 prefs.airpodsAddress = chosen.address
@@ -137,6 +360,8 @@ class MainActivity : AppCompatActivity() {
             .show()
     }
 
+    // --- test --------------------------------------------------------------
+
     private fun sendTestReport() {
         saveFromViews()
         if (!prefs.isConfigured()) {
@@ -144,52 +369,15 @@ class MainActivity : AppCompatActivity() {
             return
         }
         textStatus.text = "Sending test report…"
-        Thread {
-            val snap = DeviceState.snapshot(this, prefs, includeLocation = true)
-            val url = Reporter.buildUrl(prefs, snap)
-            val result = Reporter.report(prefs, snap)
-            runOnUiThread {
-                textStatus.text = buildString {
-                    append(if (result.ok) "Test OK\n" else "Test FAILED: ${result.message}\n")
-                    append("\nRequest:\n$url")
-                }
+        lifecycleScope.launch {
+            val (url, result) = withContext(Dispatchers.IO) {
+                val snap = DeviceState.snapshot(this@MainActivity, prefs, includeLocation = true)
+                Reporter.buildUrl(prefs, snap) to Reporter.report(prefs, snap)
+            }
+            textStatus.text = buildString {
+                append(if (result.ok) "Test OK\n" else "Test FAILED: ${result.message}\n")
+                append("\nRequest:\n$url")
             }
-        }.start()
-    }
-
-    private fun requestRuntimePermissions() {
-        val needed = ArrayList<String>()
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
-            ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)
-            != PackageManager.PERMISSION_GRANTED
-        ) needed.add(Manifest.permission.POST_NOTIFICATIONS)
-
-        if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
-            != PackageManager.PERMISSION_GRANTED
-        ) needed.add(Manifest.permission.ACCESS_FINE_LOCATION)
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
-            ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT)
-            != PackageManager.PERMISSION_GRANTED
-        ) needed.add(Manifest.permission.BLUETOOTH_CONNECT)
-
-        if (needed.isNotEmpty()) permissionLauncher.launch(needed.toTypedArray())
-    }
-
-    /**
-     * Background location must be requested on its own, and only after foreground
-     * location is already granted (Android opens the "Allow all the time" screen).
-     */
-    private fun requestBackgroundLocationIfNeeded() {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return
-        val fineGranted = ContextCompat.checkSelfPermission(
-            this, Manifest.permission.ACCESS_FINE_LOCATION
-        ) == PackageManager.PERMISSION_GRANTED
-        val bgGranted = ContextCompat.checkSelfPermission(
-            this, Manifest.permission.ACCESS_BACKGROUND_LOCATION
-        ) == PackageManager.PERMISSION_GRANTED
-        if (fineGranted && !bgGranted) {
-            permissionLauncher.launch(arrayOf(Manifest.permission.ACCESS_BACKGROUND_LOCATION))
         }
     }
 
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/Prefs.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/Prefs.kt
index 940ced4..a0f03cc 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/Prefs.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/Prefs.kt
@@ -1,6 +1,7 @@
 package uk.doughmination.devicereporter
 
 import android.content.Context
+import android.content.SharedPreferences
 
 /**
  * Thin wrapper around SharedPreferences holding all user configuration.
@@ -18,10 +19,10 @@ class Prefs(context: Context) {
         set(v) = sp.edit().putString(KEY_API_KEY, v).apply()
 
     var deviceName: String
-        get() = sp.getString(KEY_DEVICE, "pixel") ?: "pixel"
+        get() = sp.getString(KEY_DEVICE, DEFAULT_DEVICE) ?: DEFAULT_DEVICE
         set(v) = sp.edit().putString(KEY_DEVICE, v).apply()
 
-    /** Manual toggle: an Apple Watch cannot pair to a Pixel, so the user sets this by hand. */
+    /** Manual toggle: an Apple Watch cannot pair with Android, so the user sets this by hand. */
     var watchConnected: Boolean
         get() = sp.getBoolean(KEY_WATCH, false)
         set(v) = sp.edit().putBoolean(KEY_WATCH, v).apply()
@@ -44,10 +45,29 @@ class Prefs(context: Context) {
         get() = sp.getBoolean(KEY_AIRPODS_CONNECTED, false)
         set(v) = sp.edit().putBoolean(KEY_AIRPODS_CONNECTED, v).apply()
 
+    /** True while the user wants reporting on; boot/update only restart the service if so. */
+    var reportingEnabled: Boolean
+        get() = sp.getBoolean(KEY_REPORTING, false)
+        set(v) = sp.edit().putBoolean(KEY_REPORTING, v).apply()
+
+    /** Outcome of the most recent report, shown on the settings screen. */
+    var lastReport: String
+        get() = sp.getString(KEY_LAST_REPORT, "") ?: ""
+        set(v) = sp.edit().putString(KEY_LAST_REPORT, v).apply()
+
     fun isConfigured(): Boolean = baseUrl.isNotBlank() && deviceName.isNotBlank()
 
+    fun registerListener(l: SharedPreferences.OnSharedPreferenceChangeListener) =
+        sp.registerOnSharedPreferenceChangeListener(l)
+
+    fun unregisterListener(l: SharedPreferences.OnSharedPreferenceChangeListener) =
+        sp.unregisterOnSharedPreferenceChangeListener(l)
+
     companion object {
         const val DEFAULT_BASE_URL = "https://doughmination.uk/v2"
+        const val DEFAULT_DEVICE = "phone"
+
+        const val KEY_LAST_REPORT = "last_report"
 
         private const val KEY_BASE_URL = "base_url"
         private const val KEY_API_KEY = "api_key"
@@ -57,5 +77,6 @@ class Prefs(context: Context) {
         private const val KEY_AIRPODS_ADDR = "airpods_addr"
         private const val KEY_AIRPODS_LABEL = "airpods_label"
         private const val KEY_AIRPODS_CONNECTED = "airpods_connected"
+        private const val KEY_REPORTING = "reporting_enabled"
     }
 }
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/Reporter.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/Reporter.kt
index 71b537f..4073703 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/Reporter.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/Reporter.kt
@@ -6,8 +6,8 @@ import java.net.URL
 import java.net.URLEncoder
 
 /**
- * Sends a device-state snapshot to the API as an HTTP GET:
- *   GET {baseUrl}/devices?device=...&level=...  with header  X-Battery-Key: {key}
+ * Sends a device-state snapshot to the API as a body-less HTTP POST:
+ *   POST {baseUrl}/devices?device=...&level=...  with header  X-Battery-Key: {key}
  *
  * The API updates only the fields supplied and leaves the rest untouched,
  * so sending a full snapshot on every event is safe.
diff --git a/api-helper/app/src/main/java/uk/doughmination/devicereporter/ReporterService.kt b/api-helper/app/src/main/java/uk/doughmination/devicereporter/ReporterService.kt
index 81d873b..74fd4e1 100644
--- a/api-helper/app/src/main/java/uk/doughmination/devicereporter/ReporterService.kt
+++ b/api-helper/app/src/main/java/uk/doughmination/devicereporter/ReporterService.kt
@@ -1,30 +1,41 @@
 package uk.doughmination.devicereporter
 
+import android.Manifest
+import android.annotation.SuppressLint
+import android.app.AlarmManager
 import android.app.Notification
 import android.app.NotificationChannel
 import android.app.NotificationManager
+import android.app.PendingIntent
 import android.app.Service
+import android.bluetooth.BluetoothAdapter
 import android.bluetooth.BluetoothDevice
+import android.bluetooth.BluetoothManager
+import android.bluetooth.BluetoothProfile
 import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
+import android.content.pm.PackageManager
+import android.content.pm.ServiceInfo
 import android.net.ConnectivityManager
 import android.net.Network
 import android.net.NetworkCapabilities
 import android.net.NetworkRequest
+import android.net.wifi.WifiInfo
 import android.os.Build
 import android.os.IBinder
 import android.os.PowerManager
+import android.os.SystemClock
 import android.util.Log
+import androidx.annotation.RequiresApi
 import androidx.core.app.NotificationCompat
+import androidx.core.app.ServiceCompat
+import androidx.core.content.ContextCompat
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.Job
 import kotlinx.coroutines.SupervisorJob
 import kotlinx.coroutines.cancel
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.isActive
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.sync.Mutex
 import kotlinx.coroutines.sync.withLock
@@ -35,22 +46,28 @@ import java.util.Locale
 
 /**
  * Always-on foreground service. Reports device state on:
- *   - wifi connect / disconnect          (ConnectivityManager callback)
- *   - charger connect / disconnect       (ACTION_POWER_CONNECTED/DISCONNECTED)
- *   - power-save (lpm) toggle            (ACTION_POWER_SAVE_MODE_CHANGED)
- *   - chosen bluetooth device conn/disc  (ACL_CONNECTED/DISCONNECTED -> airpods)
- *   - every 5 minutes                    (periodic battery check)
+ *   - wifi connect / disconnect / network change  (ConnectivityManager callback)
+ *   - charger connect / disconnect                (ACTION_POWER_CONNECTED/DISCONNECTED)
+ *   - power-save (lpm) toggle                     (ACTION_POWER_SAVE_MODE_CHANGED)
+ *   - chosen bluetooth device conn/disc           (ACL_CONNECTED/DISCONNECTED -> airpods)
+ *   - every 5 minutes                             (AlarmManager heartbeat, with location)
+ *
+ * The heartbeat is an alarm rather than a coroutine delay: a sleeping CPU doesn't run
+ * timers, so a delay loop stalls for as long as the screen is off and the phone dozes.
  */
 class ReporterService : Service() {
 
     private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
     private val reportMutex = Mutex()
     private lateinit var prefs: Prefs
-    private var periodicJob: Job? = null
 
     private var cm: ConnectivityManager? = null
     private var netCallback: ConnectivityManager.NetworkCallback? = null
 
+    // Wifi networks currently up, with their SSID (null when the OS withholds it).
+    private val wifiNetworks = HashMap<Network, String?>()
+    @Volatile private var wifiState: WifiState? = null
+
     private var lastStatus: String = "starting…"
 
     // Charger + power-save changes.
@@ -77,13 +94,23 @@ class ReporterService : Service() {
                 }
             if (device?.address != prefs.airpodsAddress) return
             when (intent.action) {
-                BluetoothDevice.ACTION_ACL_CONNECTED -> {
-                    prefs.airpodsConnected = true
-                    reportNow("airpods connected")
+                BluetoothDevice.ACTION_ACL_CONNECTED -> setAirpods(true, "airpods connected")
+                BluetoothDevice.ACTION_ACL_DISCONNECTED -> setAirpods(false, "airpods disconnected")
+            }
+        }
+    }
+
+    // Our own heartbeat alarm and the notification's Stop action.
+    private val controlReceiver = object : BroadcastReceiver() {
+        override fun onReceive(context: Context, intent: Intent) {
+            when (intent.action) {
+                ACTION_HEARTBEAT -> {
+                    scheduleHeartbeat()
+                    reportNow("periodic 5-min", includeLocation = true)
                 }
-                BluetoothDevice.ACTION_ACL_DISCONNECTED -> {
-                    prefs.airpodsConnected = false
-                    reportNow("airpods disconnected")
+                ACTION_STOP -> {
+                    prefs.reportingEnabled = false
+                    stopSelf()
                 }
             }
         }
@@ -93,17 +120,24 @@ class ReporterService : Service() {
         super.onCreate()
         prefs = Prefs(this)
         createChannel()
-        startForeground(NOTIF_ID, buildNotification("Reporting service running"))
+        ServiceCompat.startForeground(
+            this,
+            NOTIF_ID,
+            buildNotification("Reporting service running"),
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+                ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
+            } else {
+                0
+            }
+        )
+        isRunning = true
         registerReceivers()
-        startPeriodic()
-        reportNow("service start")
+        syncAirpodsState()
+        scheduleHeartbeat()
+        reportNow("service start", includeLocation = true)
     }
 
     override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
-        if (intent?.action == ACTION_STOP) {
-            stopSelf()
-            return START_NOT_STICKY
-        }
         // Restart if killed by the system.
         return START_STICKY
     }
@@ -111,8 +145,9 @@ class ReporterService : Service() {
     override fun onBind(intent: Intent?): IBinder? = null
 
     override fun onDestroy() {
+        isRunning = false
         unregisterReceivers()
-        periodicJob?.cancel()
+        getSystemService(AlarmManager::class.java).cancel(heartbeatIntent())
         scope.cancel()
         super.onDestroy()
     }
@@ -125,21 +160,30 @@ class ReporterService : Service() {
             addAction(Intent.ACTION_POWER_DISCONNECTED)
             addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED)
         }
-        registerReceiver(powerReceiver, powerFilter)
+        // System broadcasts still reach NOT_EXPORTED receivers; other apps can't spoof them.
+        ContextCompat.registerReceiver(this, powerReceiver, powerFilter, ContextCompat.RECEIVER_NOT_EXPORTED)
 
         val btFilter = IntentFilter().apply {
             addAction(BluetoothDevice.ACTION_ACL_CONNECTED)
             addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED)
         }
-        registerReceiver(bluetoothReceiver, btFilter)
+        ContextCompat.registerReceiver(this, bluetoothReceiver, btFilter, ContextCompat.RECEIVER_NOT_EXPORTED)
+
+        val controlFilter = IntentFilter().apply {
+            addAction(ACTION_HEARTBEAT)
+            addAction(ACTION_STOP)
+        }
+        ContextCompat.registerReceiver(this, controlReceiver, controlFilter, ContextCompat.RECEIVER_NOT_EXPORTED)
 
         cm = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
         val request = NetworkRequest.Builder()
             .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
             .build()
-        val cb = object : ConnectivityManager.NetworkCallback() {
-            override fun onAvailable(network: Network) = reportNow("wifi connected")
-            override fun onLost(network: Network) = reportNow("wifi disconnected")
+        // Android 12+ redacts the SSID from callbacks unless we ask for location info.
+        val cb = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+            WifiCallback(ConnectivityManager.NetworkCallback.FLAG_INCLUDE_LOCATION_INFO)
+        } else {
+            WifiCallback()
         }
         netCallback = cb
         cm?.registerNetworkCallback(request, cb)
@@ -148,66 +192,201 @@ class ReporterService : Service() {
     private fun unregisterReceivers() {
         runCatching { unregisterReceiver(powerReceiver) }
         runCatching { unregisterReceiver(bluetoothReceiver) }
+        runCatching { unregisterReceiver(controlReceiver) }
         netCallback?.let { cb -> runCatching { cm?.unregisterNetworkCallback(cb) } }
     }
 
-    // --- periodic ----------------------------------------------------------
+    /**
+     * Tracks wifi from the callback itself instead of asking for the active network,
+     * which lags behind: right after onAvailable the active network can still be mobile data.
+     * Only reports when the connected state or the SSID actually changes, since
+     * onCapabilitiesChanged also fires for signal-strength updates.
+     */
+    private inner class WifiCallback : ConnectivityManager.NetworkCallback {
+        constructor() : super()
+
+        @RequiresApi(Build.VERSION_CODES.S)
+        constructor(flags: Int) : super(flags)
+
+        override fun onCapabilitiesChanged(network: Network, caps: NetworkCapabilities) {
+            val ssid = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+                DeviceState.cleanSsid((caps.transportInfo as? WifiInfo)?.ssid)
+            } else {
+                DeviceState.wifiSsid(this@ReporterService)
+            }
+            updateWifi("wifi connected") { wifiNetworks[network] = ssid }
+        }
+
+        override fun onLost(network: Network) {
+            updateWifi("wifi disconnected") { wifiNetworks.remove(network) }
+        }
+    }
+
+    private fun updateWifi(reason: String, change: () -> Unit) {
+        val (previous, next) = synchronized(wifiNetworks) {
+            change()
+            val next = WifiState(wifiNetworks.isNotEmpty(), wifiNetworks.values.firstOrNull { it != null })
+            val previous = wifiState
+            wifiState = next
+            previous to next
+        }
+        if (previous != next) reportNow(if (next.connected) reason else "wifi disconnected")
+    }
+
+    // --- bluetooth ---------------------------------------------------------
 
-    private fun startPeriodic() {
-        periodicJob?.cancel()
-        periodicJob = scope.launch {
-            while (isActive) {
-                delay(PERIOD_MS)
-                reportNow("periodic 5-min", includeLocation = true)
+    private fun setAirpods(connected: Boolean, reason: String) {
+        if (prefs.airpodsConnected == connected) return
+        prefs.airpodsConnected = connected
+        reportNow(reason)
+    }
+
+    /**
+     * The ACL broadcasts only tell us about changes, so on start ask the audio
+     * profiles whether the chosen device is already connected.
+     */
+    @SuppressLint("MissingPermission")
+    private fun syncAirpodsState() {
+        if (!prefs.airpodsEnabled || prefs.airpodsAddress.isBlank()) return
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
+            ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_CONNECT)
+            != PackageManager.PERMISSION_GRANTED
+        ) return
+        val adapter: BluetoothAdapter = getSystemService(BluetoothManager::class.java)?.adapter ?: return
+        if (!adapter.isEnabled) {
+            setAirpods(false, "bluetooth off")
+            return
+        }
+        // Connected on either profile counts; decide once both have answered (on the main thread).
+        val profiles = listOf(BluetoothProfile.A2DP, BluetoothProfile.HEADSET)
+        var pending = profiles.size
+        var connected = false
+        fun answered(isConnected: Boolean) {
+            connected = connected || isConnected
+            if (--pending == 0) setAirpods(connected, "airpods state on start")
+        }
+        for (profile in profiles) {
+            val asked = adapter.getProfileProxy(this, object : BluetoothProfile.ServiceListener {
+                override fun onServiceConnected(p: Int, proxy: BluetoothProfile) {
+                    val isConnected = runCatching {
+                        proxy.connectedDevices.any { it.address == prefs.airpodsAddress }
+                    }.getOrDefault(false)
+                    adapter.closeProfileProxy(p, proxy)
+                    answered(isConnected)
+                }
+
+                override fun onServiceDisconnected(p: Int) {}
+            }, profile)
+            if (!asked) answered(false)
+        }
+    }
+
+    // --- heartbeat ---------------------------------------------------------
+
+    private fun heartbeatIntent(): PendingIntent = PendingIntent.getBroadcast(
+        this,
+        0,
+        Intent(ACTION_HEARTBEAT).setPackage(packageName),
+        PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
+    )
+
+    /**
+     * One alarm at a time, re-armed each time it fires. Exact alarms (if the user has
+     * allowed them) fire on time even in Doze; without that permission Android may stretch
+     * the gap to roughly 10 minutes while the phone is idle.
+     */
+    private fun scheduleHeartbeat() {
+        val am = getSystemService(AlarmManager::class.java)
+        val at = SystemClock.elapsedRealtime() + PERIOD_MS
+        val pi = heartbeatIntent()
+        try {
+            if (canScheduleExact(this)) {
+                am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, at, pi)
+            } else {
+                am.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, at, pi)
             }
+        } catch (e: SecurityException) {
+            am.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, at, pi)
         }
     }
 
     // --- reporting ---------------------------------------------------------
 
     private fun reportNow(reason: String, includeLocation: Boolean = false) {
+        // A broadcast only keeps the CPU awake until onReceive returns; hold it until the
+        // request finishes. The timeout is a backstop in case something hangs.
+        val wakeLock = getSystemService(PowerManager::class.java)
+            .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "DeviceReporter:report")
+            .apply { acquire(WAKELOCK_TIMEOUT_MS) }
         scope.launch {
-            // Serialise reports so overlapping events don't race.
-            reportMutex.withLock {
-                if (!prefs.isConfigured()) {
-                    updateNotification("Not configured — open the app")
-                    return@withLock
-                }
-                val snap = DeviceState.snapshot(this@ReporterService, prefs, includeLocation)
-                val result = withContext(Dispatchers.IO) { Reporter.report(prefs, snap) }
-                val stamp = SimpleDateFormat("HH:mm:ss", Locale.getDefault()).format(Date())
-                lastStatus = if (result.ok) {
-                    "$stamp OK ($reason)"
-                } else {
-                    "$stamp FAIL ${result.message} ($reason)"
-                }
-                Log.i(TAG, lastStatus)
-                updateNotification(lastStatus)
+            try {
+                // Serialise reports so overlapping events don't race.
+                reportMutex.withLock { report(reason, includeLocation) }
+            } finally {
+                if (wakeLock.isHeld) wakeLock.release()
             }
         }
     }
 
+    private suspend fun report(reason: String, includeLocation: Boolean) {
+        if (!prefs.isConfigured()) {
+            updateNotification("Not configured — open the app")
+            return
+        }
+        val result = withContext(Dispatchers.IO) {
+            val snap = DeviceState.snapshot(this@ReporterService, prefs, includeLocation, wifiState)
+            Reporter.report(prefs, snap)
+        }
+        val stamp = SimpleDateFormat("HH:mm:ss", Locale.getDefault()).format(Date())
+        lastStatus = if (result.ok) {
+            "$stamp OK ($reason)"
+        } else {
+            "$stamp FAIL ${result.message} ($reason)"
+        }
+        Log.i(TAG, lastStatus)
+        prefs.lastReport = lastStatus
+        updateNotification(lastStatus)
+    }
+
     // --- notification ------------------------------------------------------
 
     private fun createChannel() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-            val channel = NotificationChannel(
-                CHANNEL_ID,
-                "Device Reporter",
-                NotificationManager.IMPORTANCE_LOW
-            ).apply { description = "Background device-state reporting" }
-            val nm = getSystemService(NotificationManager::class.java)
-            nm.createNotificationChannel(channel)
+        val channel = NotificationChannel(
+            CHANNEL_ID,
+            "Device Reporter",
+            NotificationManager.IMPORTANCE_LOW
+        ).apply {
+            description = "Background device-state reporting"
+            setShowBadge(false)
         }
+        getSystemService(NotificationManager::class.java).createNotificationChannel(channel)
     }
 
     private fun buildNotification(text: String): Notification {
+        val open = PendingIntent.getActivity(
+            this,
+            0,
+            Intent(this, MainActivity::class.java).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),
+            PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
+        )
+        val stop = PendingIntent.getBroadcast(
+            this,
+            1,
+            Intent(ACTION_STOP).setPackage(packageName),
+            PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
+        )
         return NotificationCompat.Builder(this, CHANNEL_ID)
             .setContentTitle("Device Reporter")
             .setContentText(text)
-            .setSmallIcon(android.R.drawable.stat_sys_upload)
+            .setSmallIcon(R.drawable.ic_stat_report)
+            .setColor(ContextCompat.getColor(this, R.color.accent))
+            .setContentIntent(open)
+            .addAction(0, "Stop", stop)
             .setOngoing(true)
             .setOnlyAlertOnce(true)
+            .setShowWhen(false)
+            .setCategory(NotificationCompat.CATEGORY_SERVICE)
+            .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
             .build()
     }
 
@@ -221,20 +400,25 @@ class ReporterService : Service() {
         private const val CHANNEL_ID = "device_reporter"
         private const val NOTIF_ID = 1001
         private const val PERIOD_MS = 5 * 60 * 1000L
-        const val ACTION_STOP = "uk.doughmination.devicereporter.STOP"
+        private const val WAKELOCK_TIMEOUT_MS = 60 * 1000L
+        private const val ACTION_HEARTBEAT = "uk.doughmination.devicereporter.HEARTBEAT"
+        private const val ACTION_STOP = "uk.doughmination.devicereporter.STOP"
+
+        /** Whether the service is up in this process; the settings screen shows it. */
+        @Volatile
+        var isRunning = false
+            private set
+
+        fun canScheduleExact(context: Context): Boolean =
+            Build.VERSION.SDK_INT < Build.VERSION_CODES.S ||
+                context.getSystemService(AlarmManager::class.java).canScheduleExactAlarms()
 
         fun start(context: Context) {
-            val intent = Intent(context, ReporterService::class.java)
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-                context.startForegroundService(intent)
-            } else {
-                context.startService(intent)
-            }
+            ContextCompat.startForegroundService(context, Intent(context, ReporterService::class.java))
         }
 
         fun stop(context: Context) {
-            val intent = Intent(context, ReporterService::class.java).apply { action = ACTION_STOP }
-            context.startService(intent)
+            context.stopService(Intent(context, ReporterService::class.java))
         }
     }
 }
diff --git a/api-helper/app/src/main/res/color/switch_thumb.xml b/api-helper/app/src/main/res/color/switch_thumb.xml
new file mode 100644
index 0000000..e25f2b9
--- /dev/null
+++ b/api-helper/app/src/main/res/color/switch_thumb.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@color/on_accent" android:state_checked="true" />
+    <item android:color="@color/muted" />
+</selector>
diff --git a/api-helper/app/src/main/res/color/switch_track.xml b/api-helper/app/src/main/res/color/switch_track.xml
new file mode 100644
index 0000000..f4860aa
--- /dev/null
+++ b/api-helper/app/src/main/res/color/switch_track.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@color/accent" android:state_checked="true" />
+    <item android:color="@color/field" />
+</selector>
diff --git a/api-helper/app/src/main/res/color/switch_track_outline.xml b/api-helper/app/src/main/res/color/switch_track_outline.xml
new file mode 100644
index 0000000..4f02a36
--- /dev/null
+++ b/api-helper/app/src/main/res/color/switch_track_outline.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@color/accent" android:state_checked="true" />
+    <item android:color="@color/line" />
+</selector>
diff --git a/api-helper/app/src/main/res/drawable/bg_card.xml b/api-helper/app/src/main/res/drawable/bg_card.xml
index 9e7d2d1..6cdd606 100644
--- a/api-helper/app/src/main/res/drawable/bg_card.xml
+++ b/api-helper/app/src/main/res/drawable/bg_card.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
-    <solid android:color="@color/surface0" />
-    <stroke android:width="1dp" android:color="@color/surface2" />
-    <corners android:radius="10dp" />
+    <solid android:color="@color/raised" />
+    <stroke android:width="1dp" android:color="@color/line" />
+    <corners android:radius="16dp" />
 </shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_code.xml b/api-helper/app/src/main/res/drawable/bg_code.xml
new file mode 100644
index 0000000..eb69534
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/bg_code.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <solid android:color="@color/field" />
+    <stroke android:width="1dp" android:color="@color/line" />
+    <corners android:radius="12dp" />
+</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_input.xml b/api-helper/app/src/main/res/drawable/bg_input.xml
index 6f7d52e..ee5ab41 100644
--- a/api-helper/app/src/main/res/drawable/bg_input.xml
+++ b/api-helper/app/src/main/res/drawable/bg_input.xml
@@ -2,16 +2,16 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_focused="true">
         <shape android:shape="rectangle">
-            <solid android:color="@color/surface0" />
-            <stroke android:width="1dp" android:color="@color/pink" />
-            <corners android:radius="9dp" />
+            <solid android:color="@color/field" />
+            <stroke android:width="1dp" android:color="@color/accent" />
+            <corners android:radius="12dp" />
         </shape>
     </item>
     <item>
         <shape android:shape="rectangle">
-            <solid android:color="@color/surface0" />
-            <stroke android:width="1dp" android:color="@color/surface2" />
-            <corners android:radius="9dp" />
+            <solid android:color="@color/field" />
+            <stroke android:width="1dp" android:color="@color/line" />
+            <corners android:radius="12dp" />
         </shape>
     </item>
 </selector>
diff --git a/api-helper/app/src/main/res/drawable/bg_badge_post.xml b/api-helper/app/src/main/res/drawable/bg_pill.xml
similarity index 50%
rename from api-helper/app/src/main/res/drawable/bg_badge_post.xml
rename to api-helper/app/src/main/res/drawable/bg_pill.xml
index c291e49..23ab35b 100644
--- a/api-helper/app/src/main/res/drawable/bg_badge_post.xml
+++ b/api-helper/app/src/main/res/drawable/bg_pill.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- Status pill; MainActivity tints it ok / warn / bad. -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
-    <solid android:color="#26f9e2af" />
-    <stroke android:width="1dp" android:color="#59f9e2af" />
-    <corners android:radius="5dp" />
+    <solid android:color="#1fffffff" />
+    <corners android:radius="999dp" />
 </shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_pill_key.xml b/api-helper/app/src/main/res/drawable/bg_pill_key.xml
deleted file mode 100644
index 98c7b5f..0000000
--- a/api-helper/app/src/main/res/drawable/bg_pill_key.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
-    <solid android:color="#00000000" />
-    <stroke android:width="1dp" android:color="#66c9a9f0" />
-    <corners android:radius="20dp" />
-</shape>
diff --git a/api-helper/app/src/main/res/drawable/bg_status.xml b/api-helper/app/src/main/res/drawable/bg_status.xml
deleted file mode 100644
index c544b38..0000000
--- a/api-helper/app/src/main/res/drawable/bg_status.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
-    <solid android:color="@color/mantle" />
-    <stroke android:width="1dp" android:color="@color/surface2" />
-    <corners android:radius="8dp" />
-</shape>
diff --git a/api-helper/app/src/main/res/drawable/dot.xml b/api-helper/app/src/main/res/drawable/dot.xml
new file mode 100644
index 0000000..5612bc7
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/dot.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
+    <solid android:color="@android:color/white" />
+    <size android:width="8dp" android:height="8dp" />
+</shape>
diff --git a/api-helper/app/src/main/res/drawable/ic_launcher_foreground.xml b/api-helper/app/src/main/res/drawable/ic_launcher_foreground.xml
deleted file mode 100644
index 5d1f6e6..0000000
--- a/api-helper/app/src/main/res/drawable/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="108dp"
-    android:height="108dp"
-    android:viewportWidth="108"
-    android:viewportHeight="108">
-    <path
-        android:fillColor="#FFFFFF"
-        android:pathData="M42,30h24a6,6 0,0 1,6 6v36a6,6 0,0 1,-6 6h-24a6,6 0,0 1,-6 -6v-36a6,6 0,0 1,6 -6zM48,26h12v4h-12z" />
-    <path
-        android:fillColor="#0B6E4F"
-        android:pathData="M42,38h24v28h-24z" />
-    <path
-        android:fillColor="#FFFFFF"
-        android:pathData="M42,58h24v8h-24z" />
-</vector>
diff --git a/api-helper/app/src/main/res/drawable/ic_launcher_monochrome.xml b/api-helper/app/src/main/res/drawable/ic_launcher_monochrome.xml
new file mode 100644
index 0000000..86cd913
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/ic_launcher_monochrome.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Silhouette of art/icon.svg: doughnut over a phone sending signal. Kept inside the 66dp safe zone. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <!-- doughnut -->
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:fillType="evenOdd"
+        android:pathData="M54,25a16,16 0,1 1,0 32a16,16 0,1 1,0 -32zM54,35a6,6 0,1 0,0 12a6,6 0,1 0,0 -12z" />
+    <!-- wings -->
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M39.5,36C35,32.5 30.5,31 26.5,30.8C28,33.5 27.8,36 26.6,38.2C29.2,37.3 30.6,38.8 30.3,41.6C32.3,40.2 34.3,41.1 34.8,44.2C36,43 37.5,43 39,44Z" />
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M68.5,36C73,32.5 77.5,31 81.5,30.8C80,33.5 80.2,36 81.4,38.2C78.8,37.3 77.4,38.8 77.7,41.6C75.7,40.2 73.7,41.1 73.2,44.2C72,43 70.5,43 69,44Z" />
+    <!-- phone -->
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:fillType="evenOdd"
+        android:pathData="M51,61h6a3,3 0,0 1,3 3v14a3,3 0,0 1,-3 3h-6a3,3 0,0 1,-3 -3v-14a3,3 0,0 1,3 -3zM51,64.5v13h6v-13z" />
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M52.2,72.5h3.6v3.6h-3.6z" />
+    <!-- signal -->
+    <path
+        android:pathData="M64,65.5a8,8 0,0 1,0 11M44,65.5a8,8 0,0 0,0 11M68,62a13,13 0,0 1,0 18M40,62a13,13 0,0 0,0 18"
+        android:strokeWidth="2.4"
+        android:strokeColor="#FFFFFFFF"
+        android:strokeLineCap="round" />
+</vector>
diff --git a/api-helper/app/src/main/res/drawable/ic_stat_report.xml b/api-helper/app/src/main/res/drawable/ic_stat_report.xml
new file mode 100644
index 0000000..138b018
--- /dev/null
+++ b/api-helper/app/src/main/res/drawable/ic_stat_report.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Status-bar icon: phone sending signal. White on transparent, tinted by the system. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:fillType="evenOdd"
+        android:pathData="M10,4h4a2,2 0,0 1,2 2v12a2,2 0,0 1,-2 2h-4a2,2 0,0 1,-2 -2v-12a2,2 0,0 1,2 -2zM10,6.5v11h4v-11z" />
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M11,12.5h2v3.5h-2z" />
+    <path
+        android:pathData="M18.5,8.5a5,5 0,0 1,0 7M5.5,8.5a5,5 0,0 0,0 7"
+        android:strokeWidth="1.8"
+        android:strokeColor="#FFFFFFFF"
+        android:strokeLineCap="round" />
+</vector>
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans.xml b/api-helper/app/src/main/res/font/ibm_plex_sans.xml
new file mode 100644
index 0000000..3d240ea
--- /dev/null
+++ b/api-helper/app/src/main/res/font/ibm_plex_sans.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- IBM Plex Sans, the same cut doughmination.gay serves (SIL OFL 1.1). -->
+<font-family xmlns:android="http://schemas.android.com/apk/res/android">
+    <font android:font="@font/ibm_plex_sans_regular" android:fontStyle="normal" android:fontWeight="400" />
+    <font android:font="@font/ibm_plex_sans_medium" android:fontStyle="normal" android:fontWeight="500" />
+    <font android:font="@font/ibm_plex_sans_semibold" android:fontStyle="normal" android:fontWeight="600" />
+    <font android:font="@font/ibm_plex_sans_bold" android:fontStyle="normal" android:fontWeight="700" />
+</font-family>
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_bold.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_bold.ttf
new file mode 100644
index 0000000..7f2c4d5
Binary files /dev/null and b/api-helper/app/src/main/res/font/ibm_plex_sans_bold.ttf differ
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_medium.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_medium.ttf
new file mode 100644
index 0000000..4e82959
Binary files /dev/null and b/api-helper/app/src/main/res/font/ibm_plex_sans_medium.ttf differ
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_regular.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_regular.ttf
new file mode 100644
index 0000000..6df0ff4
Binary files /dev/null and b/api-helper/app/src/main/res/font/ibm_plex_sans_regular.ttf differ
diff --git a/api-helper/app/src/main/res/font/ibm_plex_sans_semibold.ttf b/api-helper/app/src/main/res/font/ibm_plex_sans_semibold.ttf
new file mode 100644
index 0000000..2346904
Binary files /dev/null and b/api-helper/app/src/main/res/font/ibm_plex_sans_semibold.ttf differ
diff --git a/api-helper/app/src/main/res/layout/activity_main.xml b/api-helper/app/src/main/res/layout/activity_main.xml
index 3137f16..5c4b3c8 100644
--- a/api-helper/app/src/main/res/layout/activity_main.xml
+++ b/api-helper/app/src/main/res/layout/activity_main.xml
@@ -1,131 +1,90 @@
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/scroll"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/base"
+    android:clipToPadding="false"
     android:fillViewport="true">
 
     <LinearLayout
+        android:id="@+id/content"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:padding="20dp">
+        android:paddingHorizontal="20dp"
+        android:paddingTop="24dp"
+        android:paddingBottom="32dp">
 
-        <!-- Header -->
-        <LinearLayout
-            android:layout_width="wrap_content"
+        <!-- Hero, after web's .eyebrow / h1 / .subtitle -->
+        <TextView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:baselineAligned="false">
-
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="Device Reporter"
-                android:textColor="@color/text"
-                android:textSize="22sp"
-                android:textStyle="bold"
-                android:fontFamily="monospace" />
-
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="."
-                android:textColor="@color/pink"
-                android:textSize="22sp"
-                android:textStyle="bold"
-                android:fontFamily="monospace" />
-        </LinearLayout>
+            android:text="doughmination.uk"
+            android:textAllCaps="true"
+            android:textColor="@color/accent"
+            android:textSize="12sp"
+            android:textStyle="bold"
+            android:letterSpacing="0.14" />
 
         <TextView
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="4dp"
-            android:text="Reports this device's state to your Doughmination API."
-            android:textColor="@color/subtext0"
-            android:textSize="13sp"
-            android:fontFamily="monospace" />
+            android:text="Device Reporter"
+            android:textColor="@color/text"
+            android:textSize="34sp"
+            android:textStyle="bold"
+            android:letterSpacing="-0.03" />
 
-        <!-- Endpoint chip, echoing the /docs cards -->
-        <LinearLayout
+        <TextView
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:layout_marginTop="16dp"
-            android:background="@drawable/bg_card"
-            android:padding="14dp">
+            android:layout_marginTop="2dp"
+            android:text="Tells your API how this phone is doing."
+            android:textColor="@color/muted"
+            android:textSize="16sp" />
 
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="horizontal"
-                android:gravity="center_vertical"
-                android:baselineAligned="false">
+        <TextView
+            android:id="@+id/textServiceState"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="14dp"
+            android:background="@drawable/bg_pill"
+            app:drawableStartCompat="@drawable/dot"
+            android:drawablePadding="8dp"
+            android:gravity="center_vertical"
+            android:paddingHorizontal="12dp"
+            android:paddingVertical="5dp"
+            android:text="Stopped"
+            android:textColor="@color/muted"
+            android:textSize="13sp"
+            android:fontFamily="@font/ibm_plex_sans_medium" />
 
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:background="@drawable/bg_badge_post"
-                    android:paddingHorizontal="8dp"
-                    android:paddingVertical="2dp"
-                    android:text="POST"
-                    android:textColor="@color/yellow"
-                    android:textSize="12sp"
-                    android:textStyle="bold"
-                    android:fontFamily="monospace" />
-
-                <TextView
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:layout_marginStart="10dp"
-                    android:text="/v2/devices"
-                    android:textColor="@color/text"
-                    android:textSize="14sp"
-                    android:textStyle="bold"
-                    android:fontFamily="monospace" />
-
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:background="@drawable/bg_pill_key"
-                    android:paddingHorizontal="8dp"
-                    android:paddingVertical="2dp"
-                    android:text="key"
-                    android:textColor="@color/mauve"
-                    android:textSize="11sp"
-                    android:fontFamily="monospace" />
-            </LinearLayout>
+        <!-- Endpoint -->
+        <LinearLayout
+            style="@style/Panel"
+            android:layout_marginTop="24dp">
 
             <TextView
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginTop="9dp"
-                android:text="Only 'device' is required; supplied fields are updated. Sends the X-Battery-Key header."
-                android:textColor="@color/subtext1"
-                android:textSize="13sp"
-                android:fontFamily="monospace" />
+                android:fontFamily="monospace"
+                android:text="POST /v2/devices"
+                android:textColor="@color/text"
+                android:textSize="14sp"
+                android:textStyle="bold" />
+
+            <TextView
+                style="@style/RowHint"
+                android:layout_marginTop="6dp"
+                android:text="Only device is required; the API updates just the fields it receives. Your key goes in the X-Battery-Key header." />
         </LinearLayout>
 
         <!-- Configuration -->
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="22dp"
-            android:layout_marginBottom="10dp"
-            android:text="CONFIGURATION"
-            android:textColor="@color/pink"
-            android:textSize="12sp"
-            android:letterSpacing="0.08"
-            android:fontFamily="monospace" />
+        <TextView style="@style/Eyebrow" android:text="Configuration" />
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:background="@drawable/bg_card"
-            android:padding="14dp">
+        <LinearLayout style="@style/Panel" android:paddingTop="4dp">
 
             <TextView style="@style/FieldLabel" android:text="Base URL" />
 
@@ -148,67 +107,50 @@
             <EditText
                 android:id="@+id/inputDevice"
                 style="@style/FieldInput"
-                android:hint="pixel"
+                android:hint="phone"
                 android:inputType="text" />
         </LinearLayout>
 
         <!-- Peripherals -->
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="22dp"
-            android:layout_marginBottom="10dp"
-            android:text="PERIPHERALS"
-            android:textColor="@color/pink"
-            android:textSize="12sp"
-            android:letterSpacing="0.08"
-            android:fontFamily="monospace" />
+        <TextView style="@style/Eyebrow" android:text="Peripherals" />
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:background="@drawable/bg_card"
-            android:padding="14dp">
+        <LinearLayout style="@style/Panel">
 
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal"
-                android:gravity="center_vertical">
+                android:gravity="center_vertical"
+                android:minHeight="48dp"
+                android:orientation="horizontal">
 
-                <TextView
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:text="Watch connected (manual)"
-                    android:textColor="@color/subtext1"
-                    android:textSize="14sp"
-                    android:fontFamily="monospace" />
+                <TextView style="@style/RowLabel" android:text="Watch connected" />
 
-                <com.google.android.material.switchmaterial.SwitchMaterial
+                <com.google.android.material.materialswitch.MaterialSwitch
                     android:id="@+id/switchWatch"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content" />
             </LinearLayout>
 
+            <TextView
+                style="@style/RowHint"
+                android:text="Manual: an Apple Watch can't pair with Android, so flip this yourself." />
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:layout_marginVertical="14dp"
+                android:background="@color/line" />
+
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal"
                 android:gravity="center_vertical"
-                android:layout_marginTop="6dp">
+                android:minHeight="48dp"
+                android:orientation="horizontal">
 
-                <TextView
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:text="AirPods (Bluetooth) reporting"
-                    android:textColor="@color/subtext1"
-                    android:textSize="14sp"
-                    android:fontFamily="monospace" />
+                <TextView style="@style/RowLabel" android:text="Report AirPods" />
 
-                <com.google.android.material.switchmaterial.SwitchMaterial
+                <com.google.android.material.materialswitch.MaterialSwitch
                     android:id="@+id/switchAirpods"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content" />
@@ -216,110 +158,180 @@
 
             <TextView
                 android:id="@+id/textAirpodsDevice"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="6dp"
-                android:text="No AirPods device selected"
-                android:textColor="@color/subtext0"
-                android:textSize="12sp"
-                android:fontFamily="monospace" />
+                style="@style/RowHint"
+                android:text="No device selected" />
 
             <com.google.android.material.button.MaterialButton
                 android:id="@+id/btnSelectAirpods"
-                style="@style/Widget.MaterialComponents.Button.OutlinedButton"
+                style="@style/Button.Small"
+                android:layout_marginTop="10dp"
+                android:text="Choose Bluetooth device" />
+        </LinearLayout>
+
+        <!-- Background: what One UI needs to leave the service alone -->
+        <TextView style="@style/Eyebrow" android:text="Background" />
+
+        <LinearLayout style="@style/Panel">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:minHeight="48dp"
+                android:orientation="horizontal">
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:text="Battery: unrestricted"
+                        android:textColor="@color/text"
+                        android:textSize="15sp" />
+
+                    <TextView
+                        android:id="@+id/textBattery"
+                        style="@style/RowHint"
+                        android:text="Checking…" />
+                </LinearLayout>
+
+                <com.google.android.material.button.MaterialButton
+                    android:id="@+id/btnBattery"
+                    style="@style/Button.Small"
+                    android:layout_marginStart="12dp"
+                    android:text="Allow" />
+            </LinearLayout>
+
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="10dp"
-                android:text="Select AirPods device"
-                android:textColor="@color/mauve"
-                android:fontFamily="monospace"
-                app:cornerRadius="9dp"
-                app:strokeColor="@color/mauve"
-                app:rippleColor="@color/surface2" />
+                android:gravity="center_vertical"
+                android:minHeight="48dp"
+                android:orientation="horizontal">
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:text="Location: all the time"
+                        android:textColor="@color/text"
+                        android:textSize="15sp" />
+
+                    <TextView
+                        android:id="@+id/textLocation"
+                        style="@style/RowHint"
+                        android:text="Checking…" />
+                </LinearLayout>
+
+                <com.google.android.material.button.MaterialButton
+                    android:id="@+id/btnLocation"
+                    style="@style/Button.Small"
+                    android:layout_marginStart="12dp"
+                    android:text="Allow" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="10dp"
+                android:gravity="center_vertical"
+                android:minHeight="48dp"
+                android:orientation="horizontal">
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:text="On-time heartbeat"
+                        android:textColor="@color/text"
+                        android:textSize="15sp" />
+
+                    <TextView
+                        android:id="@+id/textAlarms"
+                        style="@style/RowHint"
+                        android:text="Checking…" />
+                </LinearLayout>
+
+                <com.google.android.material.button.MaterialButton
+                    android:id="@+id/btnAlarms"
+                    style="@style/Button.Small"
+                    android:layout_marginStart="12dp"
+                    android:text="Allow" />
+            </LinearLayout>
+
+            <TextView
+                style="@style/RowHint"
+                android:layout_marginTop="14dp"
+                android:text="On Samsung, also keep this app off the sleeping lists: Settings › Battery › Background usage limits." />
         </LinearLayout>
 
         <!-- Actions -->
         <com.google.android.material.button.MaterialButton
-            android:id="@+id/btnSave"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="20dp"
-            android:text="Save settings"
-            android:textColor="@color/base"
-            android:textAllCaps="false"
-            android:fontFamily="monospace"
-            app:backgroundTint="@color/pink"
-            app:cornerRadius="9dp" />
+            android:id="@+id/btnStart"
+            style="@style/Button.Primary"
+            android:layout_marginTop="28dp"
+            android:text="Start reporting" />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btnStop"
+            style="@style/Button.Danger"
+            android:layout_marginTop="28dp"
+            android:text="Stop reporting"
+            android:visibility="gone" />
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:orientation="horizontal"
             android:layout_marginTop="8dp"
-            android:baselineAligned="false">
+            android:baselineAligned="false"
+            android:orientation="horizontal">
 
             <com.google.android.material.button.MaterialButton
-                android:id="@+id/btnStart"
+                android:id="@+id/btnSave"
+                style="@style/Button.Raised"
                 android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
                 android:layout_marginEnd="4dp"
-                android:text="Start"
-                android:textColor="@color/base"
-                android:textAllCaps="false"
-                android:fontFamily="monospace"
-                app:backgroundTint="@color/green"
-                app:cornerRadius="9dp" />
+                android:layout_weight="1"
+                android:text="Save" />
 
             <com.google.android.material.button.MaterialButton
-                android:id="@+id/btnStop"
+                android:id="@+id/btnTest"
+                style="@style/Button.Raised"
                 android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
                 android:layout_marginStart="4dp"
-                android:text="Stop"
-                android:textColor="@color/base"
-                android:textAllCaps="false"
-                android:fontFamily="monospace"
-                app:backgroundTint="@color/red"
-                app:cornerRadius="9dp" />
+                android:layout_weight="1"
+                android:text="Send test" />
         </LinearLayout>
 
-        <com.google.android.material.button.MaterialButton
-            android:id="@+id/btnTest"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:text="Send test report now"
-            android:textColor="@color/base"
-            android:textAllCaps="false"
-            android:fontFamily="monospace"
-            app:backgroundTint="@color/yellow"
-            app:cornerRadius="9dp" />
-
         <!-- Status -->
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="22dp"
-            android:layout_marginBottom="10dp"
-            android:text="LAST REPORT"
-            android:textColor="@color/pink"
-            android:textSize="12sp"
-            android:letterSpacing="0.08"
-            android:fontFamily="monospace" />
+        <TextView style="@style/Eyebrow" android:text="Last report" />
 
         <TextView
             android:id="@+id/textStatus"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@drawable/bg_status"
-            android:padding="12dp"
-            android:text="Idle."
-            android:textColor="@color/subtext1"
-            android:textSize="12sp"
+            android:background="@drawable/bg_code"
             android:fontFamily="monospace"
-            android:textIsSelectable="true" />
+            android:padding="14dp"
+            android:text="Nothing sent yet."
+            android:textColor="@color/lede"
+            android:textIsSelectable="true"
+            android:textSize="12sp" />
 
     </LinearLayout>
 </ScrollView>
diff --git a/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index a8a8fa5..745e61e 100644
--- a/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
     <background android:drawable="@color/ic_launcher_background" />
-    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+    <foreground android:drawable="@mipmap/ic_launcher_foreground" />
+    <!-- Used by themed icons (Android 13+, One UI's "Themed icons"). -->
+    <monochrome android:drawable="@drawable/ic_launcher_monochrome" />
 </adaptive-icon>
diff --git a/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index a8a8fa5..0000000
--- a/api-helper/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
-    <background android:drawable="@color/ic_launcher_background" />
-    <foreground android:drawable="@drawable/ic_launcher_foreground" />
-</adaptive-icon>
diff --git a/api-helper/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/api-helper/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..91d120e
Binary files /dev/null and b/api-helper/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ
diff --git a/api-helper/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/api-helper/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..dd0b79d
Binary files /dev/null and b/api-helper/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ
diff --git a/api-helper/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/api-helper/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..3db82c4
Binary files /dev/null and b/api-helper/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ
diff --git a/api-helper/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/api-helper/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..0052c66
Binary files /dev/null and b/api-helper/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ
diff --git a/api-helper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/api-helper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..d73f8a0
Binary files /dev/null and b/api-helper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/api-helper/app/src/main/res/values/colors.xml b/api-helper/app/src/main/res/values/colors.xml
index bc98c17..4b1d691 100644
--- a/api-helper/app/src/main/res/values/colors.xml
+++ b/api-helper/app/src/main/res/values/colors.xml
@@ -1,23 +1,19 @@
 <resources>
-    <!-- Doughmination "info dark" palette, mirrored from the /docs page. -->
-    <color name="base">#0a0b10</color>
-    <color name="mantle">#070810</color>
-    <color name="crust">#050609</color>
-    <color name="surface0">#12141c</color>
-    <color name="surface1">#1b1e2a</color>
-    <color name="surface2">#232838</color>
-    <color name="overlay1">#6b7391</color>
-    <color name="subtext0">#9aa3c2</color>
-    <color name="subtext1">#c9cfe0</color>
-    <color name="text">#f4f6fb</color>
+    <!-- doughmination.gay tokens, mirrored from web's theme.css (and pastebin/reviewer's app extras). -->
+    <color name="bg">#0b0a0d</color>
+    <color name="raised">#09ffffff</color>      <!-- rgb(255 255 255 / 3.5%) -->
+    <color name="line">#17ffffff</color>        <!-- rgb(255 255 255 / 9%) -->
+    <color name="field">#40000000</color>       <!-- rgb(0 0 0 / 25%) -->
+    <color name="text">#ece9ef</color>
+    <color name="lede">#cfc9d6</color>
+    <color name="muted">#a49eab</color>
+    <color name="accent">#eb459e</color>
+    <color name="accent_dim">#24eb459e</color>  <!-- rgb(235 69 158 / 14%) -->
+    <color name="on_accent">#1a0611</color>
 
-    <color name="pink">#f5a9b8</color>
-    <color name="mauve">#c9a9f0</color>
-    <color name="red">#f38ba8</color>
-    <color name="peach">#fab387</color>
-    <color name="yellow">#f9e2af</color>
-    <color name="green">#a6e3a1</color>
-    <color name="blue">#89b4fa</color>
+    <color name="ok">#7fd98b</color>
+    <color name="warn">#f2c46d</color>
+    <color name="bad">#ff8a9a</color>
 
-    <color name="ic_launcher_background">#0a0b10</color>
+    <color name="ic_launcher_background">#0b0a0d</color>
 </resources>
diff --git a/api-helper/app/src/main/res/values/styles.xml b/api-helper/app/src/main/res/values/styles.xml
index a03c39f..1544f02 100644
--- a/api-helper/app/src/main/res/values/styles.xml
+++ b/api-helper/app/src/main/res/values/styles.xml
@@ -1,24 +1,110 @@
 <resources>
 
+    <!-- web's .eyebrow: small, accent, tracked-out caps -->
+    <style name="Eyebrow">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_marginTop">28dp</item>
+        <item name="android:layout_marginBottom">10dp</item>
+        <item name="android:textColor">@color/accent</item>
+        <item name="android:textSize">12sp</item>
+        <item name="android:textStyle">bold</item>
+        <item name="android:textAllCaps">true</item>
+        <item name="android:letterSpacing">0.14</item>
+    </style>
+
+    <!-- pastebin's .panel: raised surface, hairline, 1rem corners -->
+    <style name="Panel">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:orientation">vertical</item>
+        <item name="android:background">@drawable/bg_card</item>
+        <item name="android:paddingHorizontal">20dp</item>
+        <item name="android:paddingVertical">16dp</item>
+    </style>
+
     <style name="FieldLabel">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_marginTop">12dp</item>
-        <item name="android:layout_marginBottom">4dp</item>
-        <item name="android:textColor">@color/pink</item>
-        <item name="android:textSize">12sp</item>
-        <item name="android:fontFamily">monospace</item>
+        <item name="android:layout_marginBottom">6dp</item>
+        <item name="android:textColor">@color/muted</item>
+        <item name="android:textSize">13sp</item>
+        <item name="android:fontFamily">@font/ibm_plex_sans_medium</item>
     </style>
 
     <style name="FieldInput">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
+        <item name="android:minHeight">48dp</item>
         <item name="android:background">@drawable/bg_input</item>
-        <item name="android:padding">12dp</item>
+        <item name="android:paddingHorizontal">14dp</item>
+        <item name="android:paddingVertical">10dp</item>
         <item name="android:textColor">@color/text</item>
-        <item name="android:textColorHint">@color/overlay1</item>
+        <item name="android:textColorHint">@color/muted</item>
+        <item name="android:textSize">15sp</item>
+        <item name="android:fontFamily">@font/ibm_plex_sans</item>
+        <item name="android:importantForAutofill">no</item>
+        <item name="android:singleLine">true</item>
+    </style>
+
+    <style name="RowLabel">
+        <item name="android:layout_width">0dp</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_weight">1</item>
+        <item name="android:textColor">@color/text</item>
+        <item name="android:textSize">15sp</item>
+    </style>
+
+    <style name="RowHint">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:textColor">@color/muted</item>
+        <item name="android:textSize">13sp</item>
+    </style>
+
+    <!-- pastebin's button.primary -->
+    <style name="Button.Primary" parent="Widget.Material3.Button">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:minHeight">52dp</item>
+        <item name="android:textAllCaps">false</item>
+        <item name="android:textSize">15sp</item>
+        <item name="android:fontFamily">@font/ibm_plex_sans_semibold</item>
+        <item name="android:textColor">@color/on_accent</item>
+        <item name="backgroundTint">@color/accent</item>
+        <item name="cornerRadius">12dp</item>
+    </style>
+
+    <!-- pastebin's plain button: raised surface + hairline, accent ring on press -->
+    <style name="Button.Raised" parent="Widget.Material3.Button.OutlinedButton">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:minHeight">52dp</item>
+        <item name="android:textAllCaps">false</item>
         <item name="android:textSize">15sp</item>
-        <item name="android:fontFamily">monospace</item>
+        <item name="android:textColor">@color/text</item>
+        <item name="backgroundTint">@color/raised</item>
+        <item name="strokeColor">@color/line</item>
+        <item name="rippleColor">@color/accent_dim</item>
+        <item name="cornerRadius">12dp</item>
+    </style>
+
+    <style name="Button.Danger" parent="Button.Raised">
+        <item name="android:textColor">@color/bad</item>
+    </style>
+
+    <style name="Button.Small" parent="Button.Raised">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:minHeight">40dp</item>
+        <item name="android:textSize">13sp</item>
+        <item name="android:paddingHorizontal">14dp</item>
+    </style>
+
+    <style name="Switch" parent="Widget.Material3.CompoundButton.MaterialSwitch">
+        <item name="thumbTint">@color/switch_thumb</item>
+        <item name="trackTint">@color/switch_track</item>
+        <item name="trackDecorationTint">@color/switch_track_outline</item>
     </style>
 
 </resources>
diff --git a/api-helper/app/src/main/res/values/themes.xml b/api-helper/app/src/main/res/values/themes.xml
index 8ff384c..933afd2 100644
--- a/api-helper/app/src/main/res/values/themes.xml
+++ b/api-helper/app/src/main/res/values/themes.xml
@@ -1,17 +1,32 @@
 <resources>
-    <style name="Theme.DeviceReporter" parent="Theme.MaterialComponents.NoActionBar">
-        <item name="android:windowBackground">@color/base</item>
-        <item name="android:statusBarColor">@color/mantle</item>
-        <item name="android:navigationBarColor">@color/base</item>
-        <item name="colorPrimary">@color/pink</item>
-        <item name="colorOnPrimary">@color/base</item>
-        <item name="colorSecondary">@color/pink</item>
-        <item name="colorOnSecondary">@color/base</item>
-        <item name="colorControlActivated">@color/pink</item>
-        <item name="colorControlNormal">@color/subtext0</item>
-        <item name="android:textColor">@color/text</item>
+    <!-- Edge-to-edge is set up in MainActivity; the system bars are transparent over @color/bg. -->
+    <style name="Theme.DeviceReporter" parent="Theme.Material3.Dark.NoActionBar">
+        <item name="android:windowBackground">@color/bg</item>
+        <item name="colorPrimary">@color/accent</item>
+        <item name="colorOnPrimary">@color/on_accent</item>
+        <item name="colorPrimaryContainer">@color/accent_dim</item>
+        <item name="colorOnPrimaryContainer">@color/text</item>
+        <item name="colorSecondary">@color/accent</item>
+        <item name="colorOnSecondary">@color/on_accent</item>
+        <item name="colorSurface">@color/bg</item>
+        <item name="colorOnSurface">@color/text</item>
+        <item name="colorOnSurfaceVariant">@color/muted</item>
+        <item name="colorOutline">@color/line</item>
+        <item name="colorError">@color/bad</item>
         <item name="android:textColorPrimary">@color/text</item>
-        <item name="android:textColorHint">@color/overlay1</item>
-        <item name="android:fontFamily">monospace</item>
+        <item name="android:textColorSecondary">@color/muted</item>
+        <item name="android:textColorHint">@color/muted</item>
+        <item name="android:fontFamily">@font/ibm_plex_sans</item>
+        <item name="fontFamily">@font/ibm_plex_sans</item>
+        <item name="materialSwitchStyle">@style/Switch</item>
+        <item name="alertDialogTheme">@style/Dialog</item>
+        <item name="materialAlertDialogTheme">@style/Dialog</item>
+    </style>
+
+    <style name="Dialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
+        <item name="colorSurface">#17151b</item>
+        <item name="colorSurfaceContainerHigh">#17151b</item>
+        <item name="colorPrimary">@color/accent</item>
+        <item name="android:fontFamily">@font/ibm_plex_sans</item>
     </style>
 </resources>
diff --git a/api-helper/art/icon.svg b/api-helper/art/icon.svg
new file mode 100644
index 0000000..79947aa
--- /dev/null
+++ b/api-helper/art/icon.svg
@@ -0,0 +1,78 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
+  <title>Doughmination Device Reporter</title>
+  <!-- palette: #0b0c1c ink · #1c1f42 navy · #383dcd blue · #565b9d indigo
+       #7491ce sky · #929cc0 periwinkle · #cfd7f3 ice · #f1e4ea blush -->
+  <defs>
+    <clipPath id="ring">
+      <path clip-rule="evenodd" d="M0 0H512V512H0Z M198 250a58 58 0 1 0 116 0a58 58 0 1 0 -116 0Z"/>
+    </clipPath>
+  </defs>
+
+  <!-- reporting: the phone broadcasting its state up to the doughnut -->
+  <path d="M256 300V340" stroke="#0b0c1c" stroke-width="32" stroke-linecap="round"/>
+  <path d="M256 300V340" stroke="#565b9d" stroke-width="16" stroke-linecap="round"/>
+  <g fill="none" stroke-linecap="round">
+    <path d="M314 362A64 64 0 0 1 314 448" stroke="#0b0c1c" stroke-width="32"/>
+    <path d="M198 362A64 64 0 0 0 198 448" stroke="#0b0c1c" stroke-width="32"/>
+    <path d="M346 336A104 104 0 0 1 346 474" stroke="#0b0c1c" stroke-width="32"/>
+    <path d="M166 336A104 104 0 0 0 166 474" stroke="#0b0c1c" stroke-width="32"/>
+    <path d="M314 362A64 64 0 0 1 314 448" stroke="#7491ce" stroke-width="16"/>
+    <path d="M198 362A64 64 0 0 0 198 448" stroke="#7491ce" stroke-width="16"/>
+    <path d="M346 336A104 104 0 0 1 346 474" stroke="#383dcd" stroke-width="16"/>
+    <path d="M166 336A104 104 0 0 0 166 474" stroke="#383dcd" stroke-width="16"/>
+  </g>
+  <g>
+    <rect x="216" y="330" width="80" height="150" rx="18" fill="#383dcd" stroke="#0b0c1c" stroke-width="10"/>
+    <rect x="228" y="350" width="56" height="106" rx="7" fill="#0b0c1c"/>
+    <rect x="249" y="338" width="14" height="5" rx="2.5" fill="#0b0c1c"/>
+    <!-- battery bars -->
+    <rect x="238" y="424" width="36" height="20" rx="4" fill="#cfd7f3"/>
+    <rect x="238" y="398" width="36" height="20" rx="4" fill="#929cc0"/>
+    <rect x="238" y="372" width="36" height="20" rx="4" fill="#565b9d"/>
+    <rect x="250" y="464" width="12" height="5" rx="2.5" fill="#0b0c1c"/>
+  </g>
+
+  <!-- doughnut = the origin -->
+  <g transform="translate(256 192) scale(.72) translate(-256 -250)">
+    <!-- bat wings -->
+    <g fill="#1c1f42" stroke="#0b0c1c" stroke-width="12" stroke-linejoin="round">
+      <path d="M140 170 C80 120 20 100 -36 96 C-14 134 -18 168 -34 198 C2 186 22 206 18 246 C46 226 74 238 80 282 C100 262 124 266 140 286 Z"/>
+      <path d="M 372 170 C 432 120 492 100 548 96 C 526 134 530 168 546 198 C 510 186 490 206 494 246 C 466 226 438 238 432 282 C 412 262 388 266 372 286 Z"/>
+    </g>
+    <g fill="none" stroke="#565b9d" stroke-width="6" stroke-linecap="round">
+      <path d="M128 182 C70 140 10 118 -26 108"/>
+      <path d="M384 182 C442 140 502 118 538 108"/>
+    </g>
+
+    <g clip-path="url(#ring)">
+      <circle cx="256" cy="260" r="180" fill="#0b0c1c"/>
+      <circle cx="256" cy="250" r="180" fill="#0b0c1c"/>
+      <circle cx="256" cy="260" r="170" fill="#565b9d"/>
+      <circle cx="256" cy="250" r="170" fill="#929cc0"/>
+      <!-- black glaze -->
+      <path d="M394 250 L395 254 L395 257 L396 261 L396 265 L396 268 L395 272 L394 276 L393 279 L392 283 L390 286 L388 289 L386 292 L384 295 L382 298 L380 301 L378 304 L375 307 L373 310 L371 313 L369 316 L368 318 L366 321 L365 325 L363 328 L362 332 L363 337 L368 345 L375 357 L375 363 L364 358 L356 355 L351 355 L347 357 L345 359 L342 362 L339 364 L336 366 L332 368 L329 369 L326 371 L323 373 L320 376 L319 382 L320 394 L322 408 L320 417 L311 405 L302 392 L296 384 L291 380 L287 378 L283 379 L280 379 L277 381 L273 382 L270 383 L267 384 L263 386 L260 388 L256 394 L252 404 L247 413 L244 403 L241 394 L237 391 L234 389 L230 388 L227 387 L223 386 L220 384 L217 382 L214 381 L210 379 L207 378 L203 379 L196 385 L186 398 L174 411 L173 403 L179 384 L182 370 L183 363 L181 359 L178 357 L175 356 L172 354 L168 353 L165 351 L162 349 L158 348 L155 346 L151 345 L145 345 L135 348 L121 354 L118 350 L127 338 L134 330 L135 324 L135 320 L135 316 L134 312 L133 309 L133 305 L132 301 L132 298 L131 294 L129 291 L125 289 L114 288 L108 285 L117 279 L123 275 L125 271 L124 267 L123 264 L122 261 L120 257 L119 254 L118 250 L117 246 L117 243 L116 239 L116 235 L116 232 L117 228 L118 224 L119 221 L120 217 L122 214 L124 211 L126 208 L128 205 L130 202 L132 199 L134 196 L137 193 L139 190 L141 187 L143 184 L144 182 L146 179 L148 175 L149 172 L150 169 L152 166 L153 162 L155 159 L157 156 L158 152 L160 149 L163 146 L165 143 L167 141 L170 138 L173 136 L176 134 L180 132 L183 131 L186 130 L190 129 L194 128 L197 127 L201 127 L205 126 L208 126 L212 125 L215 125 L219 124 L222 123 L225 123 L229 122 L232 121 L235 119 L239 118 L242 117 L245 116 L249 114 L252 113 L256 112 L260 111 L263 111 L267 110 L271 110 L274 110 L278 111 L282 112 L285 113 L289 114 L292 116 L295 118 L298 120 L301 122 L304 124 L307 126 L310 128 L313 131 L316 133 L319 135 L322 137 L324 138 L327 140 L331 142 L334 143 L337 144 L340 146 L344 147 L347 149 L350 151 L354 152 L357 154 L360 157 L363 159 L365 161 L368 164 L370 167 L372 170 L374 174 L375 177 L376 180 L377 184 L378 188 L379 191 L379 195 L380 199 L380 202 L381 206 L381 209 L382 213 L383 216 L383 219 L384 223 L385 226 L387 229 L388 233 L389 236 L390 239 L392 243 L393 246Z" fill="#0b0c1c" transform="translate(0 8)"/>
+      <path d="M394 250 L395 254 L395 257 L396 261 L396 265 L396 268 L395 272 L394 276 L393 279 L392 283 L390 286 L388 289 L386 292 L384 295 L382 298 L380 301 L378 304 L375 307 L373 310 L371 313 L369 316 L368 318 L366 321 L365 325 L363 328 L362 332 L363 337 L368 345 L375 357 L375 363 L364 358 L356 355 L351 355 L347 357 L345 359 L342 362 L339 364 L336 366 L332 368 L329 369 L326 371 L323 373 L320 376 L319 382 L320 394 L322 408 L320 417 L311 405 L302 392 L296 384 L291 380 L287 378 L283 379 L280 379 L277 381 L273 382 L270 383 L267 384 L263 386 L260 388 L256 394 L252 404 L247 413 L244 403 L241 394 L237 391 L234 389 L230 388 L227 387 L223 386 L220 384 L217 382 L214 381 L210 379 L207 378 L203 379 L196 385 L186 398 L174 411 L173 403 L179 384 L182 370 L183 363 L181 359 L178 357 L175 356 L172 354 L168 353 L165 351 L162 349 L158 348 L155 346 L151 345 L145 345 L135 348 L121 354 L118 350 L127 338 L134 330 L135 324 L135 320 L135 316 L134 312 L133 309 L133 305 L132 301 L132 298 L131 294 L129 291 L125 289 L114 288 L108 285 L117 279 L123 275 L125 271 L124 267 L123 264 L122 261 L120 257 L119 254 L118 250 L117 246 L117 243 L116 239 L116 235 L116 232 L117 228 L118 224 L119 221 L120 217 L122 214 L124 211 L126 208 L128 205 L130 202 L132 199 L134 196 L137 193 L139 190 L141 187 L143 184 L144 182 L146 179 L148 175 L149 172 L150 169 L152 166 L153 162 L155 159 L157 156 L158 152 L160 149 L163 146 L165 143 L167 141 L170 138 L173 136 L176 134 L180 132 L183 131 L186 130 L190 129 L194 128 L197 127 L201 127 L205 126 L208 126 L212 125 L215 125 L219 124 L222 123 L225 123 L229 122 L232 121 L235 119 L239 118 L242 117 L245 116 L249 114 L252 113 L256 112 L260 111 L263 111 L267 110 L271 110 L274 110 L278 111 L282 112 L285 113 L289 114 L292 116 L295 118 L298 120 L301 122 L304 124 L307 126 L310 128 L313 131 L316 133 L319 135 L322 137 L324 138 L327 140 L331 142 L334 143 L337 144 L340 146 L344 147 L347 149 L350 151 L354 152 L357 154 L360 157 L363 159 L365 161 L368 164 L370 167 L372 170 L374 174 L375 177 L376 180 L377 184 L378 188 L379 191 L379 195 L380 199 L380 202 L381 206 L381 209 L382 213 L383 216 L383 219 L384 223 L385 226 L387 229 L388 233 L389 236 L390 239 L392 243 L393 246Z" fill="#1c1f42"/>
+      <!-- glaze sheen -->
+      <path d="M150 196 A118 118 0 0 1 238 134" fill="none" stroke="#565b9d" stroke-width="12" stroke-linecap="round"/>
+      <path d="M330 159C331.7 174.3 331.7 174.3 340.2 176C331.7 177.7 331.7 177.7 330 187.9C328.3 177.7 328.3 177.7 319.8 176C328.3 174.3 328.3 174.3 330 159Z" fill="#cfd7f3"/>
+      <rect x="342" y="258" width="28" height="8" rx="4" fill="#7491ce" transform="rotate(-50 356 262)"/>
+      <path d="M300 319C301.7 334.3 301.7 334.3 310.2 336C301.7 337.7 301.7 337.7 300 347.9C298.3 337.7 298.3 337.7 289.8 336C298.3 334.3 298.3 334.3 300 319Z" fill="#f1e4ea"/>
+      <rect x="198" y="334" width="28" height="8" rx="4" fill="#7491ce" transform="rotate(20 212 338)"/>
+      <path d="M162 265C163.7 280.3 163.7 280.3 172.2 282C163.7 283.7 163.7 283.7 162 293.9C160.3 283.7 160.3 283.7 151.8 282C160.3 280.3 160.3 280.3 162 265Z" fill="#cfd7f3"/>
+      <rect x="154" y="194" width="28" height="8" rx="4" fill="#f1e4ea" transform="rotate(40 168 198)"/>
+      <path d="M232 133C233.7 148.3 233.7 148.3 242.2 150C233.7 151.7 233.7 151.7 232 161.9C230.3 151.7 230.3 151.7 221.8 150C230.3 148.3 230.3 148.3 232 133Z" fill="#7491ce"/>
+      <rect x="278" y="142" width="28" height="8" rx="4" fill="#f1e4ea" transform="rotate(60 292 146)"/>
+      <rect x="136" y="232" width="28" height="8" rx="4" fill="#7491ce" transform="rotate(95 150 236)"/>
+      <rect x="358" y="208" width="28" height="8" rx="4" fill="#cfd7f3" transform="rotate(-30 372 212)"/>
+    </g>
+    <circle cx="256" cy="250" r="63" fill="none" stroke="#0b0c1c" stroke-width="10"/>
+    <circle cx="256" cy="250" r="58" fill="none" stroke="#565b9d" stroke-width="6"/>
+  </g>
+
+  <!-- crescent moon + stars -->
+  <g transform="translate(52 -58)">
+    <path d="M404 370A50 50 0 1 0 404 470A65 65 0 0 1 404 370Z" fill="#cfd7f3" stroke="#0b0c1c" stroke-width="10" stroke-linejoin="round" transform="rotate(-25 404 420)"/>
+  </g>
+  <path d="M72 368C75.96 408.04 75.96 408.04 98.4 412C75.96 415.96 75.96 415.96 72 442.8C68.04 415.96 68.04 415.96 45.6 412C68.04 408.04 68.04 408.04 72 368Z" fill="#7491ce" stroke="#0b0c1c" stroke-width="8" stroke-linejoin="round"/>
+  <path d="M470 250C473.0 277.0 473.0 277.0 488 280C473.0 283.0 473.0 283.0 470 301C467.0 283.0 467.0 283.0 452 280C467.0 277.0 467.0 277.0 470 250Z" fill="#f1e4ea" stroke="#0b0c1c" stroke-width="6" stroke-linejoin="round"/>
+</svg>
diff --git a/api-helper/art/render-icons.sh b/api-helper/art/render-icons.sh
new file mode 100755
index 0000000..0e087e7
--- /dev/null
+++ b/api-helper/art/render-icons.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Renders art/icon.svg into the adaptive launcher foreground at every density.
+# Needs rsvg-convert (librsvg). Run from the repo root: ./art/render-icons.sh
+set -euo pipefail
+
+res=app/src/main/res
+tmp=$(mktemp --suffix=.svg)
+trap 'rm -f "$tmp"' EXIT
+
+# The foreground layer is 108dp; keep the art inside the ~66dp the launcher mask shows.
+{
+	echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 108">'
+	echo '<g transform="translate(19 19) scale(0.1367)">'
+	sed -e '1d' -e '$d' art/icon.svg
+	echo '</g></svg>'
+} > "$tmp"
+
+for pair in mdpi:108 hdpi:162 xhdpi:216 xxhdpi:324 xxxhdpi:432; do
+	dpi=${pair%%:*}
+	px=${pair##*:}
+	mkdir -p "$res/mipmap-$dpi"
+	rsvg-convert -w "$px" -h "$px" "$tmp" -o "$res/mipmap-$dpi/ic_launcher_foreground.png"
+done
diff --git a/api-helper/build.gradle.kts b/api-helper/build.gradle.kts
index 017d909..c7ad754 100644
--- a/api-helper/build.gradle.kts
+++ b/api-helper/build.gradle.kts
@@ -1,4 +1,4 @@
 plugins {
-    id("com.android.application") version "8.5.2" apply false
-    id("org.jetbrains.kotlin.android") version "1.9.24" apply false
+    id("com.android.application") version "8.7.3" apply false
+    id("org.jetbrains.kotlin.android") version "2.0.21" apply false
 }
diff --git a/api-helper/gradle/wrapper/gradle-wrapper.properties b/api-helper/gradle/wrapper/gradle-wrapper.properties
index 09523c0..e2847c8 100644
--- a/api-helper/gradle/wrapper/gradle-wrapper.properties
+++ b/api-helper/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
 networkTimeout=10000
 validateDistributionUrl=true
 zipStoreBase=GRADLE_USER_HOME