:root {
    color-scheme: light;
    --bg: #f4f6f1;
    --panel: #ffffff;
    --text: #172118;
    --muted: #5c675e;
    --line: #dce3d7;
    --green: #238636;
    --green-hover: #1b742d;
    --red: #c73b35;
    --red-text: #fff8f7;
    --focus: #1f6feb;
    --shadow: 0 18px 45px rgba(23, 33, 24, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(135deg, rgba(35, 134, 54, 0.10), transparent 36%),
        linear-gradient(315deg, rgba(199, 59, 53, 0.08), transparent 38%),
        var(--bg);
    color: var(--text);
}

.page-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.button-panel {
    width: min(100%, 460px);
    padding: 26px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.1;
    font-weight: 700;
}

.status-message {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.3;
    text-align: right;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.button-panel {
    position: relative;
}

.pin-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 26px;
    background: rgba(244, 246, 241, 0.86);
    border-radius: 8px;
}

.pin-overlay[hidden] {
    display: none;
}

.pin-dialog {
    width: min(100%, 320px);
    display: grid;
    gap: 10px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.pin-dialog h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
}

.pin-context {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.pin-dialog label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.pin-dialog input {
    min-width: 0;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--text);
    font-size: 1.15rem;
}

.pin-dialog input:focus {
    border-color: var(--focus);
    outline: 3px solid rgba(31, 111, 235, 0.18);
}

.pin-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.unlock-button,
.cancel-button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    min-width: 96px;
    height: 48px;
    padding: 0 18px;
}

.unlock-button {
    background: var(--text);
    color: #ffffff;
}

.cancel-button {
    background: #e9eee5;
    color: var(--text);
}

.unlock-button:hover {
    background: #000000;
}

.cancel-button:hover {
    background: var(--line);
}

.unlock-button:disabled,
.cancel-button:disabled {
    cursor: wait;
    opacity: 0.68;
}

.pin-error,
.setup-message {
    margin: 0;
    color: var(--red);
    font-size: 0.92rem;
    line-height: 1.35;
}

.daily-button {
    min-height: 118px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 16px;
    background: var(--green);
    color: #ffffff;
    font-size: clamp(1.1rem, 2.8vw, 1.35rem);
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16);
}

.daily-button:hover:not(:disabled) {
    background: var(--green-hover);
    transform: translateY(-1px);
}

.daily-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.daily-button:disabled {
    cursor: not-allowed;
    transform: none;
}

.daily-button.is-done {
    background: var(--red);
    color: var(--red-text);
}

.daily-button.is-loading {
    opacity: 0.72;
    cursor: wait;
}

.daily-button-wide {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc((100% - 14px) / 2);
}

@media (max-width: 420px) {
    .button-panel {
        padding: 20px;
    }

    .panel-header {
        align-items: start;
        flex-direction: column;
        gap: 8px;
    }

    .status-message {
        text-align: left;
    }

    .button-grid {
        gap: 10px;
    }

    .daily-button {
        min-height: 96px;
        padding: 12px;
    }

    .pin-overlay {
        padding: 20px;
    }
}
