:root {
    color-scheme: dark;
    --yellow: #ffdc28;
    --cyan: #46c8ff;
    --dark: #080808;
    --line: #262626;
    --button: #161616;
    --text: #e4e4e4;
    --muted: #8a8a8a;
}

html, body {
    margin: 0;
    background: #000;
    color: var(--text);
    font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
    -webkit-tap-highlight-color: transparent;
    /* no zoom on a double tap: iOS took two quick taps on a button for one; pinching still zooms */
    touch-action: manipulation;
}

#app {
    max-width: 480px;
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

button {
    font: inherit;
    color: var(--text);
    background: var(--button);
    border: 1px solid #333;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
}

button:active {
    background: #262626;
}

button:disabled {
    opacity: 0.35;
}

/* ---- the page frame (shell/pages.js) */

header {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 10px;
}

header h1 {
    flex: 1;
    margin: 0;
    font-size: 19px;
    color: var(--yellow);
}

header .back {
    width: 40px;
    height: 40px;
    font-size: 28px;
    line-height: 1;
    border: none;
    background: none;
}

header .back[hidden] {
    display: none;
}

header .action button {
    height: 40px;
    padding: 0 14px;
}

main {
    flex: 1;
    padding: 0 12px 20px;
}

/* ---- the screen before a device is linked (shell/app.js) */

.connect {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
}

.connect h1 {
    margin: 0;
    font-size: 34px;
    color: var(--yellow);
}

.connect p {
    margin: 0;
    color: var(--muted);
}

.connect .status {
    min-height: 1.4em;
    color: var(--text);
}

.connect .demos {
    max-width: 360px;
    line-height: 1.6;
}

.connect .demos a {
    color: var(--cyan);
    white-space: nowrap;
}

/* what a browser needs for Web Bluetooth */
.connect .help {
    max-width: 360px;
    margin: 24px 0 0;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted);
    text-align: left;
}

.connect .help b {
    color: var(--text);
    font-weight: 600;
}

.connect .help a {
    color: var(--cyan);
}

.connect .help code {
    overflow-wrap: anywhere;
}

button.primary {
    min-width: 200px;
    height: 60px;
    margin-top: 16px;
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    background: var(--cyan);
    border: none;
}

/* ---- the settings pages */

.list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list li {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    border-bottom: 1px solid var(--line);
}

.list .label {
    flex: 1;
    font-size: 17px;
}

.list .value {
    min-width: 74px;
    text-align: center;
    font-weight: 700;
    color: var(--cyan);
    font-variant-numeric: tabular-nums;
}

.list button.small {
    width: 46px;
    height: 44px;
    font-size: 24px;
    line-height: 1;
}

.list li.link {
    cursor: pointer;
}

.list .chev {
    font-size: 26px;
    color: var(--muted);
    padding-right: 6px;
}

.seg {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid #333;
    border-radius: 10px;
}

.seg button {
    min-width: 58px;
    height: 44px;
    border: none;
    border-radius: 0;
}

.seg button[aria-pressed="true"] {
    color: var(--dark);
    background: var(--cyan);
    font-weight: 700;
}

select {
    height: 44px;
    padding: 0 10px;
    font: inherit;
    color: var(--cyan);
    background: var(--button);
    border: 1px solid #333;
    border-radius: 10px;
}
