/* Phone-first paper layout. Targets stay at least 48px. The spinner uses a transform so it can keep turning while recognition blocks the main thread. */
:root {
    --paper: #f3ecdf;
    --paper-2: #fffaf2;
    --ink: #1c1915;
    --muted: #5c564c;
    --line: #d9d0c0;
    --green: #1f6b4a;
    --green-ink: #ffffff;
    --danger: #8a2e24;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.4;
}

.app {
    max-width: 34rem;
    margin: 0 auto;
    padding: calc(12px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

h1 {
    font-family: Georgia, "Iowan Old Style", Palatino, serif;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 4px;
}

.lede, .hint {
    color: var(--muted);
    margin: 0 0 16px;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 16px;
}

.tab, .big, .action, select, input[type="number"], input[type="text"] {
    min-height: 48px;
    font: inherit;
}

label.big {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.big.ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}

.tab {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    border-radius: 12px;
    padding: 10px 8px;
}

.tab[aria-selected="true"] {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

.card {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    margin: 0 0 14px;
}

.row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.big, .action {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--green);
    padding: 12px 14px;
    cursor: pointer;
}

.big {
    background: var(--green);
    color: var(--green-ink);
    font-weight: 650;
}

.action {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}

.big:disabled, .action:disabled, select:disabled, input:disabled {
    opacity: 0.55;
    cursor: default;
}

label.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 12px;
    font-weight: 600;
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    padding: 8px 12px;
}

.switch {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    font-weight: 600;
}

.switch input {
    width: 1.35rem;
    height: 1.35rem;
    accent-color: var(--green);
}

.choice {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
}

.choice button {
    flex: 1;
}

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

.status {
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 48px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--line);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2.4s; }
}

.facts {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 6px 10px;
    margin: 0 0 12px;
}

.facts dt { color: var(--muted); margin: 0; }
.facts dd { margin: 0; font-weight: 650; }

.log {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.82rem;
    white-space: pre-wrap;
    background: #f7f1e6;
    border-radius: 10px;
    padding: 10px;
    margin: 0 0 12px;
}

.alert {
    background: #f8e8e4;
    color: var(--danger);
    border-radius: 12px;
    padding: 12px;
    margin: 0 0 14px;
}

.file-name {
    font-weight: 650;
    margin: 10px 0 0;
    word-break: break-word;
}

.boot {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

#blazor-error-ui {
    background: #f8e8e4;
    color: var(--ink);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.8rem 1.2rem calc(0.8rem + env(safe-area-inset-bottom));
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
