* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #121212;
    --card: #1e1e1e;
    --border: #2f2f2f;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text: #ffffff;
    --muted: #b5b5b5;
}

body {
    margin: 0;
    padding: 20px;
    max-width: 420px;
    margin-inline: auto;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h2 {
    margin: 0 0 20px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #2b2b2b;
    color: white;
    font-size: 16px;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

button {
    width: 100%;
    height: 48px;
    margin-top: 12px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}

button:hover {
    background: var(--primary-hover);
}

button:active {
    transform: scale(.97);
}

#status {
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

/* ---------- D-Pad ---------- */

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    grid-template-rows: repeat(3, 72px);
    justify-content: center;
    gap: 8px;
}

.dpad button {
    width: 72px;
    height: 72px;
    margin: 0;
    border-radius: 18px;
    background: #323232;
    font-size: 28px;
}

.dpad button:hover {
    background: #3d3d3d;
}

.dpad button[data-p="/enter"] {
    background: var(--primary);
    border-radius: 22px;
    font-size: 18px;
    font-weight: 700;
}

.dpad button[data-p="/enter"]:hover {
    background: var(--primary-hover);
}

/* ---------- Home / Back ---------- */

.two-buttons {
    display: flex;
    gap: 12px;
}

.two-buttons button {
    flex: 1;
    margin-top: 0;
}

/* ---------- Rows ---------- */

.row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.row input {
    flex: 1;
}

.row + button {
    margin-top: 0;
}

/* ---------- Advanced ---------- */

details summary {
    cursor: pointer;
    font-weight: 600;
    user-select: none;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: "▶ ";
    color: var(--muted);
}

details[open] summary::before {
    content: "▼ ";
}

details[open] summary {
    margin-bottom: 16px;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ---------- Mobile ---------- */

@media (max-width: 380px) {

    body {
        padding: 16px;
    }

    .dpad {
        grid-template-columns: repeat(3, 64px);
        grid-template-rows: repeat(3, 64px);
    }

    .dpad button {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }

    .dpad button[data-p="/enter"] {
        font-size: 16px;
    }
}