/* Screen Time Lock on the web (Spec-Screen-Time-Lock-Web §2): the app's own palette ("Made of the logo", Theme.swift),
   light and dark; Satoshi Bold for headings, the system font for everything else, sized by iOS's Dynamic Type where
   Safari offers it; grouped lists like iOS Settings; laid out for an iPhone SE first. */
@font-face { font-family: "Satoshi"; src: url("/fonts/Satoshi-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
    color-scheme: light dark;
    --canvas: #faf6ee;
    --paper: #ffffff;
    --panel: #f3ecdc;
    --ink: #15211a;
    --secondary: #5b675f;
    --line: rgba(21, 33, 26, 0.10);
    --accent: #80d20f;
    --on-accent: #15211a;
    --accent-text: #3d7a06;
    --alert: #c03d34;
    --orange: #eb8909;
    --leaf: #5c940c;
    /* Outlines of buttons and fields: the palette's tertiary, 3:1 or better on canvas and paper (WCAG 1.4.11). */
    --edge: #858e87;
    --focus: #3d7a06;
    --radius: 12px;
    --gutter: 16px;
    --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --display: "Satoshi", var(--body);
}
@media (prefers-color-scheme: dark) {
    :root {
        --canvas: #0a0f0b;
        --paper: #151d17;
        --panel: #1c2718;
        --ink: #e9f2e4;
        --secondary: #9aa59d;
        --line: rgba(233, 242, 228, 0.12);
        --on-accent: #0a1406;
        --accent-text: #9ad12a;
        --alert: #da6860;
        --leaf: #81bd12;
        --edge: #6f7a72;
        --focus: #9ad12a;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
body { font-family: var(--body); font-size: 17px; line-height: 1.35; -webkit-font-smoothing: antialiased; }
@supports (font: -apple-system-body) { body { font: -apple-system-body; } }

main {
    display: block; max-width: 560px; margin: 0 auto; outline: none;
    padding: max(20px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
        max(32px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}

h1 { font-family: var(--display); font-weight: 700; font-size: 1.76em; line-height: 1.15; margin: 8px 0 6px; letter-spacing: -0.01em; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.3em; line-height: 1.2; margin: 16px 0 6px; }
/* A label above a block: caption, semibold, secondary, sentence case (QA.md's labels above a block). */
h3 { font-size: 0.76em; font-weight: 600; color: var(--secondary); margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.secondary { color: var(--secondary); }
.small { font-size: 0.85em; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* The header: the logo, the title and, under it, the line that says where you are. */
.top { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.top img { width: 40px; height: 40px; }
.top .back {
    margin-left: -10px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--accent-text);
    font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.top .back svg { width: 12px; height: 20px; }

/* Grouped lists, as in iOS Settings: paper on the canvas, hairlines between rows, a footer note on the canvas. */
.group { background: var(--paper); border-radius: var(--radius); overflow: hidden; margin: 0 0 8px; }
.group > * + * { border-top: 0.5px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 11px 16px; }
.row .grow { flex: 1; min-width: 0; }
.row-link {
    width: 100%; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 11px 16px;
}
.row-link .grow { flex: 1; min-width: 0; }
.row-link .chevron { width: 8px; height: 14px; color: var(--secondary); flex: none; }
.row-link .value { color: var(--secondary); }
.icon { width: 22px; height: 22px; flex: none; color: var(--secondary); }
.card { background: var(--paper); border-radius: var(--radius); padding: 16px; margin: 0 0 8px; }
.footer { color: var(--secondary); font-size: 0.85em; margin: 6px 16px 16px; }
.footer.flush { margin-left: 0; margin-right: 0; }
.status-word { font-family: var(--display); font-weight: 700; font-size: 1.3em; }
.section { margin-top: 24px; }

/* Buttons: the main action is the accent with ink words, at the SE's big button height; a second action is paper. */
button { font: inherit; }
.primary, .secondary-button {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px;
    border-radius: 999px; padding: 12px 20px; font-weight: 600; cursor: pointer; margin: 12px 0 8px; text-align: center;
}
.primary { background: var(--accent); color: var(--on-accent); border: 1px solid transparent; }
.secondary-button { background: var(--paper); color: var(--ink); border: 1px solid var(--edge); }
.primary:disabled, .secondary-button:disabled { background: var(--panel); color: var(--secondary); border-color: var(--line); cursor: default; }
.text-button {
    border: 0; background: none; color: var(--accent-text); font-weight: 600; cursor: pointer; padding: 10px 0;
    min-height: 44px; text-align: left;
}
.destructive { color: var(--alert); }
.button-row { display: flex; gap: 8px; }
.button-row > * { flex: 1; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }

/* Fields */
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type="email"], input[type="text"], input[type="number"], input[type="password"], select {
    width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--edge);
    background: var(--paper); color: var(--ink); font: inherit;
}
input::placeholder { color: var(--secondary); }

/* Messages (QA.md's warnings and errors, the app's NoticeText): ink words beside a mark, never coloured words. The circle
   mark is orange for an error or a note, never a triangle; a done message has the leaf check. Red is only for
   destructive words (.destructive). */
.message { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; color: var(--ink); }
.message svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.message.error svg, .message.note svg { color: var(--orange); }
.message.done svg { color: var(--leaf); }

/* The passcode: four large digits, read one by one. */
/* The code style (QA.md): SF Pro bold with fixed-width digits, not a monospaced face. */
.digits { font-family: var(--body); font-size: 2.4em; letter-spacing: 0.35em; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; margin: 8px 0; }
.chips { display: flex; gap: 6px; margin: 4px 0 12px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--panel); color: var(--secondary); font-size: 0.85em; font-weight: 600; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.step { font-family: var(--display); font-size: 2em; font-weight: 700; text-align: center; margin: 12px 0 4px; }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0; }
.grid span { text-align: center; padding: 8px 0; background: var(--panel); border-radius: 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.1em; }
@media (max-width: 340px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.shapes { display: flex; gap: 16px; justify-content: center; margin: 8px 0; }
.shapes figure { margin: 0; text-align: center; }
.shapes svg { width: 96px; height: 96px; }
.countdown { font-family: var(--display); font-size: 2.6em; font-weight: 700; text-align: center; margin: 8px 0; font-variant-numeric: tabular-nums; }
.words { margin: 8px 0 12px 20px; padding: 0; }
.words li { padding: 4px 0; font-weight: 600; }
.copy-field { display: flex; align-items: center; gap: 8px; }
.copy-field .value { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
dialog { border: 0; border-radius: 14px; padding: 20px; max-width: min(340px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog .actions { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* No inline styles: the content policy refuses them. */
.strong { font-weight: 700; }
label.inline { margin: 0; font-weight: 400; }
.footer-action { margin-left: 12px; }
.short-field { width: 120px; flex: none; }
.stepper {
    width: 44px; height: 44px; flex: none; border-radius: 999px; border: 1px solid var(--edge); background: var(--paper);
    color: var(--ink); font-size: 1.3em; line-height: 1; cursor: pointer;
}
/* Progress is the accent on a panel track. */
.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--panel); }
.meter::-webkit-progress-bar { background: var(--panel); border-radius: 999px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* A switch, as the app's: the accent when on, the knob white. */
input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 51px; height: 31px; margin: 0; border: 0;
    border-radius: 999px; background: var(--edge); cursor: pointer; transition: background-color 0.2s;
}
input[type="checkbox"]::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s;
}
input[type="checkbox"]:checked { background: var(--accent); }
input[type="checkbox"]:checked::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { input[type="checkbox"], input[type="checkbox"]::after { transition: none; } }

/* A view toggle: a segmented control, so it doesn't compete with the screen's one green action. */
.segmented { display: flex; gap: 2px; padding: 2px; margin: 12px 0 8px; background: var(--panel); border-radius: 999px; }
.segment {
    flex: 1; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ink);
    font-weight: 600; cursor: pointer;
}
.segment[aria-pressed="true"] { background: var(--paper); box-shadow: 0 1px 3px rgba(21, 33, 26, 0.25), 0 0 0 0.5px var(--line); }
select { width: auto; min-width: 140px; }
