<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_main">

    <!-- STOPPED STATE -->
    <LinearLayout
        android:id="@+id/stopped_panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:gravity="center"
        android:paddingStart="160dp"
        android:paddingEnd="160dp">

        <ImageView
            android:layout_width="72dp"
            android:layout_height="72dp"
            android:src="@drawable/ic_launcher"
            android:contentDescription="@null"
            android:layout_marginBottom="24dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:textColor="@color/teal_accent"
            android:textSize="64sp"
            android:textStyle="bold"
            android:letterSpacing="0.08"
            android:layout_marginBottom="12dp"
            android:fontFamily="sans-serif" />

        <TextView
            android:id="@+id/tagline_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/tagline"
            android:textColor="@color/text_secondary"
            android:textSize="28sp"
            android:layout_marginBottom="24dp" />

        <!-- Transient status (root probing / permission denial). Always
             present so the layout doesn't reflow when text appears. -->
        <TextView
            android:id="@+id/status_text"
            android:layout_width="wrap_content"
            android:layout_height="32dp"
            android:gravity="center"
            android:textColor="@color/text_secondary"
            android:textSize="20sp"
            android:layout_marginBottom="32dp"
            tools:text="Checking root access…" />

        <Button
            android:id="@+id/toggle_button"
            style="@style/Widget.LedGrab.Button.Primary"
            android:layout_width="320dp"
            android:layout_height="72dp"
            android:text="@string/btn_start"
            android:textSize="22sp"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:nextFocusDown="@+id/autostart_check" />

        <CheckBox
            android:id="@+id/autostart_check"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="32dp"
            android:text="@string/autostart_label"
            android:textColor="@color/text_secondary"
            android:textSize="20sp"
            android:buttonTint="@color/teal_accent"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:nextFocusUp="@id/toggle_button" />
    </LinearLayout>

    <!-- Version at bottom (always visible — looks polished on TV idle). -->
    <TextView
        android:id="@+id/version_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|center_horizontal"
        android:layout_marginBottom="32dp"
        android:textColor="@color/text_hint"
        android:textSize="18sp"
        tools:text="v0.1.0" />

    <!-- RUNNING STATE — deferred-inflate via ViewStub so first paint is
         cheaper and the inflater doesn't measure two competing layouts. -->
    <ViewStub
        android:id="@+id/running_panel_stub"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inflatedId="@+id/running_panel"
        android:layout="@layout/panel_running"
        android:visibility="gone" />
</FrameLayout>
