:root {
    color-scheme: dark;
    --bg: #121410;
    --card: #1a1d16;
    --ink: #f4f1e8;
    --muted: #9c978b;
    --line: #32362b;
    --lime: #d7ef62;
    --danger: #ff5a3c;
    --key: #23271d;
    --key-top: #2b3024;
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background:
        radial-gradient(900px 320px at 50% -80px, rgba(215, 239, 98, 0.18), transparent 68%),
        var(--bg);
}

body {
    margin: 0 auto;
    max-width: 440px;
    min-height: 100vh;
    padding: 28px 18px calc(32px + env(safe-area-inset-bottom));
    background: transparent;
    color: var(--ink);
    font: 16px/1.45 ui-sans-serif, system-ui, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { cursor: default; }

:focus-visible {
    outline: 2px solid var(--lime);
    outline-offset: 2px;
}

.eyebrow {
    margin: 0;
    color: var(--lime);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1 {
    margin: 6px 0 0;
    font-size: 30px;
    line-height: 1.08;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.version {
    min-height: 1.2em;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 6px 0 0;
    padding: 6px 11px 6px 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.18);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.pill.on {
    color: #1c200c;
    background: var(--lime);
    border-color: var(--lime);
}

.pill.on::before { opacity: 1; background: #1c200c; }

.pill.off { color: #c8c2b4; }

.pill.bad {
    color: #ffb4a6;
    border-color: #6a2e24;
    background: #2a130f;
}

.note, .lead { color: var(--muted); }

.lead {
    margin: 14px 0 0;
    max-width: 34em;
}

.note {
    margin: 16px 0 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--line);
}

.warn {
    margin: 16px 0 0;
    padding: 12px 14px;
    border-radius: 14px;
    color: #ffd0c6;
    background: #2a130f;
    border: 1px solid #6a2e24;
}

#pad { margin-top: 22px; }

.row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.row:first-child { margin-top: 0; }

.row button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 72px;
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid #3a3f32;
    background: linear-gradient(180deg, var(--key-top), var(--key));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    font-size: 17px;
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.row button:hover:not(:disabled) {
    border-color: #4d5442;
    background: linear-gradient(180deg, #32382a, #272c21);
}

.row button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: none;
}

.row button.danger {
    background: linear-gradient(180deg, #4a221b, #341610);
    color: #ffe4dc;
    border-color: #6e382e;
}

.row button.danger:hover:not(:disabled) {
    background: linear-gradient(180deg, #55281f, #3c1a13);
}

.row button.wait {
    border-color: #8a9364;
    color: #c8c2b4;
}

.row button.ok {
    border-color: var(--lime);
    box-shadow: 0 0 0 1px var(--lime);
    color: var(--ink);
}

.row button.fail {
    border-color: var(--danger);
    box-shadow: 0 0 0 1px var(--danger);
}

.row button:disabled { opacity: 0.38; }

.empty {
    margin: 0;
    padding: 28px 16px;
    border-radius: 18px;
    border: 1px dashed var(--line);
    color: var(--muted);
    text-align: center;
}

.toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    max-width: 408px;
    margin: 0 auto;
    padding: 13px 14px;
    border-radius: 14px;
    background: #2a130f;
    color: #ffd9d0;
    border: 1px solid #6a2e24;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.confirm {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 9, 7, 0.72);
    backdrop-filter: blur(6px);
}

.confirm[hidden], .toast[hidden], .note[hidden] { display: none; }

.sheet {
    width: min(440px, 100%);
    padding: 20px;
    border-radius: 22px;
    background: #1c1f17;
    border: 1px solid var(--line);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.sheet h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.sheet p { margin: 8px 0 0; color: var(--muted); }

.sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.sheet-actions button {
    flex: 1;
    min-height: 52px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--key);
    font-weight: 650;
}

.sheet-actions button:active:not(:disabled) { transform: translateY(1px); }

.sheet-actions .danger {
    background: var(--danger);
    color: #2a0c07;
    border-color: var(--danger);
}

.home {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 60px);
}

form {
    margin-top: 28px;
    padding: 16px;
    border-radius: 22px;
    background: var(--card);
    border: 1px solid var(--line);
}

label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

input {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 14px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #12140f;
    font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
    font-size: 15px;
    letter-spacing: 0.04em;
}

input:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px rgba(215, 239, 98, 0.18);
}

form button {
    width: 100%;
    margin-top: 12px;
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: var(--lime);
    color: #1c200c;
    font-weight: 700;
}

form button:hover { filter: brightness(1.05); }

form button:active { transform: translateY(1px); }
