/* Announcement scripts on top of Blades. The token structure follows the FTC
   QR help sheet: a neutral dark screen palette, and a warm paper light
   scheme. */

:root {
    color-scheme: dark light;
    --bg: #000000;
    --fg: #f2f2f2;
    --muted: #b0b0b0;
    --border: #6b6b6b;
    --primary: #f2f2f2;
    --on-primary: #000000;
    --accent: #d8d8d8;
    --accent-bg: #1a1a1a;
    --accent-border: #666666;
    --danger: #e0a092;
    --cell-bg: #111111;
    --cell-border: #333333;
    --highlight-bg: #1a1a1a;
    --radius: 6px;
    --radius-sm: 3px;
    --field-height: 3.125rem;
    --space-1: 0.25rem;
    --space-4: 1rem;

    --pico-background-color: var(--bg);
    --pico-color: var(--fg);
    --pico-muted-color: var(--muted);
    --pico-primary: var(--accent);
    --pico-primary-background: var(--primary);
    --pico-primary-border: var(--primary);
    --pico-primary-inverse: var(--on-primary);
    --pico-border-width: 1px;
    --pico-border-radius: var(--radius);
    --pico-font-size: 100%;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --bg: #f4ebdc;
        --fg: #10262b;
        --muted: #556b70;
        --border: #5f747c;
        --primary: #003947;
        --on-primary: #fff8e7;
        --accent: #2c5535;
        --accent-bg: #ebdab7;
        --accent-border: #2c5535;
        --danger: #8a4038;
        --cell-bg: #f5eedf;
        --cell-border: #d8c9a8;
        --highlight-bg: #eee9a5;
    }
}

* {
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 0.5rem;
}

.app-lockup {
    width: min(9rem, 30vw);
    height: auto;
}

.app-header h1 {
    margin: 0;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    line-height: 1.15;
}

.app-subtitle {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.app-frame {
    max-width: 46rem;
    margin: 0 auto;
    padding: 0.5rem 1rem 3rem;
}

h2 {
    margin: 1.25rem 0 0.75rem;
    font-size: 1.25rem;
}

h3 {
    margin: 1.25rem 0 0.5rem;
    font-size: 1.05rem;
}

.pill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.6rem;
}

.pill-button,
button {
    min-height: var(--field-height);
    padding: 0.65rem 1rem;
    border: 1px solid var(--cell-border);
    border-radius: var(--radius);
    background: var(--cell-bg);
    color: var(--fg);
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
}

button:hover,
.pill-button:hover {
    border-color: var(--accent);
}

button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button.secondary {
    background: transparent;
    color: var(--muted);
}

.choice-button[data-tone="yellow"] {
    border-color: #e0c341;
}

.choice-button[data-tone="orange"] {
    border-color: #e08a3c;
}

.choice-button[data-tone="red"] {
    border-color: #c44a44;
}

.choice-button[data-tone="blue"] {
    border-color: #4a7fc4;
}

.rule-list {
    display: grid;
    gap: 0.5rem;
    padding: 0;
    margin: 0.75rem 0 0;
    list-style: none;
}

.rule-tile {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    align-items: baseline;
}

.rule-code {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.rule-description {
    flex: 1;
}

.selected-rule {
    margin: 0.4rem 0 0.6rem;
    padding: 0.5rem 0.7rem;
    border-left: 3px solid var(--accent);
    background: var(--accent-bg);
    font-weight: 600;
}

.wizard-step {
    margin-top: 0.5rem;
}

.context-helper {
    margin: 0.5rem 0;
    color: var(--muted);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.9rem;
}

.checkbox-row input {
    width: auto;
    min-height: auto;
}

label {
    display: block;
    margin: 0.9rem 0 0.3rem;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    min-height: var(--field-height);
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--cell-border);
    border-radius: var(--radius-sm);
    background: var(--cell-bg);
    color: var(--fg);
    font: inherit;
}

textarea {
    min-height: 7rem;
    resize: vertical;
}

textarea.script-preview,
.script-preview {
    white-space: pre-wrap;
    line-height: 1.45;
    color: var(--fg);
}

.match-number-input {
    max-width: 12rem;
    margin: 0.25rem 0 0.9rem;
}

fieldset {
    margin: 1rem 0;
    padding: 0.5rem 0.8rem 0.8rem;
    border: 1px solid var(--cell-border);
    border-radius: var(--radius);
}

fieldset label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    color: var(--fg);
}

fieldset input[type="radio"] {
    width: auto;
    min-height: auto;
}

legend {
    padding: 0 0.35rem;
    color: var(--muted);
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.1rem 0;
}

.script-output {
    margin: 1rem 0;
    padding: 1rem 1.1rem;
    border-left: 4px solid var(--accent);
    background: var(--cell-bg);
    font-size: 1.25rem;
    line-height: 1.5;
}

.result-reminder {
    margin: 0.6rem 0;
    color: var(--muted);
}

.result-note {
    margin: 0.6rem 0;
    color: var(--muted);
}

.notice {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
}

.form-error {
    margin: 0.75rem 0;
    color: var(--danger);
    font-weight: 600;
}

.fatal {
    max-width: 40rem;
    margin: 3rem auto;
    padding: 0 1rem;
}

.fatal-detail {
    color: var(--danger);
    overflow-wrap: anywhere;
}
