
:root {
    color-scheme: light;

    --page-bg: #eff1eb;
    --surface: #fafbf7;
    --surface-muted: #f3f5ef;

    --text: #2e3932;
    --muted: #5f6a61;

    --border: #d9ded5;

    --accent: #587260;
    --accent-hover: #4e6353;
    --accent-soft: #e8eee7;

    --danger-bg: #f7e9e5;
    --danger-text: #93483f;

    --warning-bg: #f6f0df;
    --warning-text: #79643a;

    --safe-bg: #e8efe7;
    --safe-text: #42654a;

    --radius: 8px;

    /* Form-field borders (3:1 or more) and the keyboard focus ring (3:1 or more). */
    --control-border: #7f8a80;
    --focus-ring: #1d4e89;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

[hidden] {
    display: none !important;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

a {
    color: var(--accent-hover);
    overflow-wrap: anywhere;
}

/* Header */

.site-header {
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    width: min(100% - 40px, 1050px);
    min-height: 68px;
    margin: 0 auto;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    padding: 0;
    border: 0;
    background: transparent;

    color: var(--text);
    font-size: 1.08rem;
    font-weight: 700;
}

.brand-mark {
    display: grid;
    place-items: center;

    width: 32px;
    height: 32px;

    border-radius: 6px;

    background: var(--accent);
    color: white;

    font-size: 1rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-button {
    padding: 8px 12px;

    border: 0;
    border-radius: 5px;

    background: transparent;
    color: var(--muted);

    font-size: 0.88rem;
    font-weight: 600;
}

.nav-button:hover,
.nav-button.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

/* Main container */

.app-shell {
    width: min(100% - 40px, 960px);
    margin: 0 auto;
    padding: 37px 0 28px;
}

.view {
    width: 100%;
}

.eyebrow {
    margin: 0 0 8px;

    color: var(--muted);

    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

.welcome-section {
    max-width: 670px;
    margin-bottom: 36px;
}

.welcome-section h1,
.workspace-heading h1 {
    margin: 0;

    color: var(--text);

    font-size: clamp(2rem, 5vw, 2.7rem);
    font-weight: 700;

    letter-spacing: -0.04em;
    line-height: 1.2;
}

.welcome-description {
    max-width: 560px;
    margin: 13px 0 0;

    color: var(--muted);
    font-size: 1.04rem;
}

/* Section headings */

.section-heading {
    margin-bottom: 17px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.25rem;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.91rem;
}

.workspace-heading {
    margin: 22px 0 22px;
}

.workspace-heading p:not(.eyebrow) {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 0.96rem;
}

/* Home tool cards */

.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;

    width: 100%;
    min-height: 154px;
    padding: 21px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--surface);
    color: var(--text);

    text-align: left;

    transition:
        border-color 0.15s ease,
        background-color 0.15s ease;
}

.tool-card:hover {
    border-color: #aab9a9;
    background: #fcfdf9;
}

.tool-card:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

.tool-icon {
    display: grid;
    place-items: center;

    flex: 0 0 43px;

    width: 43px;
    height: 43px;

    border-radius: 7px;

    background: var(--accent-soft);
    color: var(--accent-hover);
}

.tool-icon svg {
    width: 23px;
    height: 23px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-text {
    font-size: 1.05rem;
    font-weight: 700;
}

.tool-card-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.tool-card-content strong {
    font-size: 1.03rem;
}

.tool-card-content > span:not(.tool-action) {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.tool-action {
    margin-top: 7px;
    color: var(--accent-hover);
    font-size: 0.82rem;
    font-weight: 700;
}

/* Home information */

.home-note,
.notice-panel {
    margin-top: 22px;
    padding: 16px 18px;

    border: 1px solid var(--border);
    border-radius: 6px;

    background: var(--surface-muted);
}

.home-note strong,
.notice-panel strong {
    font-size: 0.91rem;
}

.home-note p,
.notice-panel p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.home-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;

    margin-top: 29px;
    padding-top: 21px;

    border-top: 1px solid var(--border);
}

.home-bottom strong {
    font-size: 0.94rem;
}

.home-bottom p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Back button */

.back-button {
    display: inline-flex;
    align-items: center;

    margin: 0 0 5px;
    padding: 7px 0;

    border: 0;
    background: transparent;

    color: var(--accent-hover);
    font-size: 0.88rem;
    font-weight: 600;
}

.back-button:hover {
    text-decoration: underline;
}

/* Panels */

.panel,
.results-panel {
    padding: 24px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--surface);
}

.results-panel {
    margin-top: 17px;
}

/* Labels and inputs */

.field-group {
    margin: 15px 0;
}

label {
    display: block;
    margin-bottom: 7px;

    color: var(--text);
    font-size: 0.91rem;
    font-weight: 600;
}

input:not([type="file"]),
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 11px 13px;

    border: 1px solid var(--control-border);
    border-radius: 5px;

    background: var(--surface-muted);
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgb(88 114 96 / 15%);
}

input::placeholder,
textarea::placeholder {
    color: #66706a;
}

textarea {
    min-height: 170px;
    resize: vertical;
    line-height: 1.55;
}

select {
    cursor: pointer;
}

/* File inputs */

input[type="file"] {
    width: 100%;
    max-width: 100%;
    color: var(--muted);
    font-size: 0.85rem;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 8px 11px;

    border: 1px solid var(--border);
    border-radius: 4px;

    background: var(--surface);
    color: var(--text);

    cursor: pointer;
}

/* Input footer */

.input-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;

    margin: 8px 0 15px;
}

.helper-text,
#characterCount {
    color: var(--muted);
    font-size: 0.79rem;
}

.helper-text {
    margin: 6px 0 12px;
}

#characterCount {
    white-space: nowrap;
}

/* Buttons */

.primary-button,
.secondary-button,
.text-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;

    min-height: 42px;
    padding: 9px 15px;

    border: 1px solid var(--border);
    border-radius: 5px;

    font-weight: 600;
    text-align: center;
}

.primary-button {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.primary-button:hover:not(:disabled) {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.secondary-button {
    background: var(--surface);
    color: var(--text);
}

.secondary-button:hover:not(:disabled) {
    background: var(--accent-soft);
}

.text-button {
    min-height: 34px;
    padding: 6px 10px;

    background: transparent;
    color: var(--accent-hover);

    font-size: 0.82rem;
}

.text-button:hover {
    background: var(--accent-soft);
}

.full-width {
    width: 100%;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 14px;
}

.form-actions .primary-button {
    flex: 1 1 200px;
}

/* Samples */

.sample-area {
    margin: 15px 0;
}

.sample-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.sample-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

/* Status and errors */

.status-message {
    min-height: 1.2em;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.error-message {
    margin: 13px 0 0;
    padding: 11px 13px;

    border: 1px solid #e5cbc5;
    border-radius: 5px;

    background: #fbf2ef;
    color: #87463e;

    font-size: 0.9rem;
}

/* Screenshot */

.image-preview-container {
    margin: 15px 0;
}

.image-preview-container img {
    display: block;
    width: 100%;
    max-height: 350px;
    object-fit: contain;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: white;
}

.extracted-area {
    margin-top: 23px;
    padding-top: 17px;
    border-top: 1px solid var(--border);
}

.extracted-area textarea {
    margin-bottom: 12px;
}

/* Voice */

.record-box {
    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 6px;

    background: var(--surface-muted);
}

.record-indicator {
    display: flex;
    align-items: center;
    gap: 8px;

    color: var(--muted);
    font-size: 0.88rem;
}

#recordDot {
    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: #6f7d70;
}

#recordDot.recording {
    background: #a6534b;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.35;
    }
}

.record-timer {
    margin: 11px 0;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.separator {
    display: flex;
    align-items: center;
    gap: 13px;

    margin: 19px 0;

    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.separator::before,
.separator::after {
    flex: 1;
    height: 1px;
    background: var(--border);
    content: "";
}

.notice-panel {
    color: var(--text);
    font-size: 0.87rem;
}

.notice-panel p {
    margin-top: 6px;
}

/* Link results */

.link-results {
    margin-top: 19px;
    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: var(--surface-muted);
}

.link-results h3 {
    margin: 18px 0 7px;
    font-size: 0.94rem;
}

.link-results ul {
    padding-left: 21px;
}

.link-results li {
    margin: 7px 0;
    overflow-wrap: anywhere;
}

.results-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;

    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

/* Analysis results */

.results-topline h1 {
    margin: 0;
    font-size: 1.65rem;
}

.risk-badge {
    display: inline-block;
    padding: 5px 10px;

    border-radius: 4px;

    font-size: 0.74rem;
    font-weight: 700;
}

.risk-dangerous {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.risk-suspicious {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.risk-safe {
    background: var(--safe-bg);
    color: var(--safe-text);
}

.category-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 7px 12px;
    margin-top: 16px;
}

.category-label {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

#scamCategory {
    font-size: 0.93rem;
}

.result-section {
    margin-top: 25px;
}

.result-section h2 {
    margin: 0 0 11px;
    font-size: 1.08rem;
}

.result-section h3 {
    margin: 0 0 9px;
    font-size: 0.97rem;
}

.explanation {
    margin: 0;
    color: #354239;
    font-size: 0.97rem;
}

/* Manipulation sequence */

.sequence-list {
    display: grid;
    gap: 10px;
}

.sequence-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;

    padding: 13px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: var(--surface-muted);
}

.sequence-number {
    display: grid;
    place-items: center;

    flex: 0 0 27px;

    width: 27px;
    height: 27px;

    border-radius: 50%;

    background: var(--accent-soft);
    color: var(--accent-hover);

    font-size: 0.82rem;
    font-weight: 700;
}

.sequence-card h3 {
    margin: 0 0 4px;
}

.sequence-card p {
    margin: 4px 0;
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.sequence-quote {
    color: #766747 !important;
}

/* Evidence */

.evidence-box {
    margin-bottom: 14px;
    padding: 13px 15px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: var(--surface-muted);
    color: #425047;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    font-size: 0.92rem;
    line-height: 1.7;
}

.evidence-highlight {
    padding: 1px 2px;
    border-radius: 2px;

    background: #e9e0b9;
    color: #493f21;
}

.evidence-cards {
    display: grid;
    gap: 11px;
}

.evidence-card {
    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: var(--surface);
}

.evidence-card h3 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.83rem;
}

.evidence-card blockquote {
    margin: 0 0 10px;
    padding-left: 11px;

    border-left: 3px solid var(--accent);

    color: #354239;
    overflow-wrap: anywhere;
}

.evidence-card p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.tactic-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tactic-chip {
    display: inline-block;
    padding: 4px 8px;

    border: 1px solid #d3ddd2;
    border-radius: 4px;

    background: var(--accent-soft);
    color: #45604d;

    font-size: 0.77rem;
    font-weight: 600;
}

.no-data-message {
    margin: 0;
    padding: 12px 14px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: var(--surface-muted);
    color: var(--muted);

    font-size: 0.89rem;
}

/* Next steps */

.next-steps {
    margin: 0;
    padding-left: 22px;
    color: #425047;
}

.next-steps li {
    margin: 8px 0;
    padding-left: 3px;
    overflow-wrap: anywhere;
}

/* Emergency actions */

.emergency-box {
    padding: 15px;

    border: 1px solid var(--border);
    border-radius: 6px;

    background: var(--surface-muted);
}

.emergency-box h3 {
    margin-top: 0;
}

.emergency-box ol {
    padding-left: 21px;
}

.emergency-box li {
    margin: 7px 0;
}

#emergencyActions {
    margin-top: 15px;
    padding: 12px;

    border-left: 3px solid var(--danger-text);

    background: var(--danger-bg);
    color: #62433e;

    font-size: 0.89rem;
}

/* Suggested response */

.safe-reply {
    margin: 0;
    padding: 13px 15px;

    border-left: 3px solid var(--accent);

    background: var(--surface-muted);
    color: #536357;
}

/* Reports */

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.report-actions button {
    flex: 1 1 130px;
}

/* History */

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.history-list {
    display: grid;
    gap: 11px;
}

.history-card {
    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: var(--surface-muted);
}

.history-card h2,
.history-card h3 {
    margin: 0;
    font-size: 0.91rem;
}

.history-card p {
    margin: 5px 0;
    color: var(--muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* Guide */

.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.guide-card {
    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 6px;

    background: var(--surface);
}

.guide-card h2 {
    margin: 0 0 7px;
    font-size: 1rem;
}

.guide-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.guide-reporting a {
    display: inline-block;
    margin-top: 10px;
    font-weight: 600;
}

/* Footer */

.site-footer {
    padding: 20px 2px 0;
    color: #5f6a61;
    font-size: 0.78rem;
}

.site-footer p {
    margin: 3px 0;
}

/* Keyboard focus */

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

/* Mobile */

@media (max-width: 640px) {

    .header-inner {
        width: calc(100% - 28px);
        min-height: 62px;
        gap: 9px;
    }

    .main-nav {
        gap: 2px;
    }

    .nav-button {
        padding: 7px 8px;
        font-size: 0.78rem;
    }

    .app-shell {
        width: calc(100% - 28px);
        padding: 25px 0 20px;
    }

    .welcome-section {
        margin-bottom: 27px;
    }

    .welcome-section h1,
    .workspace-heading h1 {
        font-size: 2rem;
    }

    .welcome-description {
        font-size: 0.94rem;
    }

    .tool-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tool-card {
        min-height: 118px;
        padding: 16px;
        gap: 13px;
    }

    .tool-icon {
        flex-basis: 39px;
        width: 39px;
        height: 39px;
    }

    .home-bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .home-bottom button {
        width: 100%;
    }

    .panel,
    .results-panel {
        padding: 16px;
    }

    .workspace-heading {
        margin: 17px 0;
    }

    textarea {
        min-height: 165px;
        font-size: 0.94rem;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions button {
        width: 100%;
        flex: 1 1 auto;
    }

    .sample-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .results-topline {
        align-items: flex-start;
    }

    .report-actions {
        flex-direction: column;
    }

    .report-actions button {
        width: 100%;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    .history-header {
        align-items: stretch;
        flex-direction: column;
    }

    .history-header button {
        width: 100%;
    }

    .record-box {
        padding: 13px;
    }

}

@media (max-width: 380px) {

    .header-inner {
        width: calc(100% - 20px);
    }

    .brand {
        gap: 6px;
        font-size: 0.96rem;
    }

    .nav-button {
        padding: 6px;
        font-size: 0.73rem;
    }

    .app-shell {
        width: calc(100% - 22px);
    }

    .panel,
    .results-panel {
        padding: 13px;
    }

    .welcome-section h1,
    .workspace-heading h1 {
        font-size: 1.8rem;
    }

}

/* Print report only */

@media print {

    @page {
        size: A4;
        margin: 15mm;
    }

    body {
        background: white;
        color: black;
    }

    body * {
        visibility: hidden !important;
    }

    #resultsView,
    #resultsView * {
        visibility: visible !important;
    }

    #resultsView {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0;
    }

    .no-print,
    .report-actions,
    .back-button,
    .emergency-box {
        display: none !important;
    }

    .results-panel,
    .evidence-card,
    .sequence-card,
    .evidence-box {
        background: white !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

}
/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */

html {
    width: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    width: 100%;
    min-width: 320px;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

input,
textarea,
select,
button {
    max-width: 100%;
    font: inherit;
}

button,
a {
    touch-action: manipulation;
}

.app-shell,
.app-container,
.page-container {
    width: min(100% - 36px, 1100px);
    margin-inline: auto;
    min-width: 0;
}

#homeView,
#textView,
#imageView,
#voiceView,
#linkView,
#resultsView,
#historyView,
#guideView {
    width: 100%;
    min-width: 0;
}
@media (max-width: 768px) {
    .app-shell,
    .app-container,
    .page-container {
        width: calc(100% - 32px);
        padding-top: 25px;
    }
    .site-header {
        margin-bottom: 20px;
    }
    .site-header h1,
    h1 {
        font-size: clamp(1.9rem, 6vw, 2.4rem);
    }
    .site-header .subtitle,
    .subtitle {
        font-size: 0.98rem;
    }
    .tool-grid,
    .tools-grid,
    .tool-cards,
    .tool-options,
    .feature-grid,
    .result-grid,
    .evidence-grid,
    .breakdown-grid,
    .steps-grid,
    .history-grid,
    .guide-grid,
    .card-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
    .tool-card,
    .tool-option,
    .feature-card,
    .card {
        min-width: 0;
        width: 100%;
    }
    .site-nav,
    .nav-links,
    .top-nav,
    .header-nav,
    .nav-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .workspace-card,
    .tool-workspace,
    .panel,
    .input-panel,
    .results-panel,
    .history-panel,
    .guide-panel,
    .safety-panel {
        padding: 20px;
        min-width: 0;
    }
    .input-footer,
    .form-actions,
    .report-actions,
    .results-topline,
    .category-row,
    .card-actions,
    .tool-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    .form-actions > *,
    .report-actions > *,
    .tool-actions > * {
        flex: 1 1 140px;
    }
    textarea,
    input,
    select {
        width: 100%;
        min-width: 0;
    }
    .table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-wrap table {
        min-width: 560px;
    }
    p,
    li,
    a,
    span {
        overflow-wrap: anywhere;
    }
}
@media (max-width: 520px) {
    .app-shell,
    .app-container,
    .page-container {
        width: calc(100% - 24px);
        padding-top: 20px;
        padding-bottom: 18px;
    }
    h1 {
        font-size: 1.9rem;
    }
    h2 {
        font-size: 1.2rem;
    }
    h3 {
        font-size: 1.05rem;
    }
    .site-header {
        margin-bottom: 18px;
    }
    .tool-grid,
    .tools-grid,
    .tool-cards,
    .tool-options,
    .feature-grid,
    .result-grid,
    .evidence-grid,
    .breakdown-grid,
    .steps-grid,
    .history-grid,
    .guide-grid,
    .card-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .workspace-card,
    .tool-workspace,
    .panel,
    .input-panel,
    .results-panel,
    .history-panel,
    .guide-panel,
    .safety-panel {
        padding: 16px;
        border-radius: 9px;
    }
    .form-actions,
    .report-actions,
    .tool-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }
    .form-actions > *,
    .report-actions > *,
    .tool-actions > * {
        width: 100%;
        min-height: 46px;
    }
    textarea {
        min-height: 170px;
        font-size: 16px;
    }
    input,
    select {
        min-height: 46px;
        font-size: 16px;
    }
    button {
        min-height: 44px;
    }
    .input-footer {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 7px;
    }
    .character-count {
        display: block;
    }
    .results-topline {
        align-items: flex-start;
    }
    .risk-badge {
        white-space: normal;
        text-align: center;
    }
    .seo-intro {
        margin-top: 18px;
    }
    .seo-intro p {
        font-size: 0.92rem;
        line-height: 1.65;
    }
    .site-footer {
        padding: 20px 8px;
        text-align: center;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
.site-footer {
    margin-top: 32px;
    padding: 22px 12px 12px;
    border-top: 1px solid var(--border, #d9ded5);
    color: var(--muted, #68736a);
    text-align: center;
    font-size: 0.88rem;
}
.footer-credit {
    margin: 0;
    font-weight: 500;
}
.footer-credit a {
    color: var(--accent, #587260);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.footer-credit a:hover {
    color: var(--accent-hover, #4e6353);
}
.footer-description {
    margin: 7px 0 0;
    font-size: 0.8rem;
}
.privacy-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin: 0 0 22px;
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 7px;
    background: var(--surface);
}
.privacy-banner strong {
    color: var(--text);
    font-size: 0.92rem;
}
.privacy-banner p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.55;
}
.privacy-banner a {
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}
@media (max-width: 520px) {
    .privacy-banner {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }
}
/* Trust, privacy and result interpretation */
.seo-intro {
    max-width: 760px;
    margin: 28px 0 30px;
    padding: 17px 19px;
    border-left: 3px solid var(--accent);
    background: rgb(250 251 247 / 72%);
    border-radius: 0 7px 7px 0;
}

.seo-intro h2 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.seo-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.privacy-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin: 0 0 25px;
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 7px;
    background: var(--surface);
}

.privacy-banner-copy {
    flex: 1 1 420px;
    min-width: 0;
}

.privacy-banner strong {
    color: var(--text);
    font-size: 0.92rem;
}

.privacy-banner p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.privacy-banner a,
.footer-links a {
    color: var(--accent-hover);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.risk-caveat {
    margin: 12px 0 18px;
    padding: 11px 13px;
    border-radius: 5px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin: 10px 0 0;
}

@media (max-width: 640px) {
    .privacy-banner {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }

    .privacy-banner-copy {
        flex-basis: auto;
    }

    .seo-intro {
        margin: 24px 0 25px;
        padding: 14px;
    }
}
/* --------------------------------------------------
   RESCUE MODE
-------------------------------------------------- */

.rescue-nav-button,
.rescue-primary-button,
.rescue-call-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid #a9574d;
    border-radius: 5px;
    background: #a9574d;
    color: #fff;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.rescue-nav-button {
    min-height: 38px;
    padding: 8px 12px;
}

.rescue-nav-button:hover,
.rescue-nav-button.active,
.rescue-primary-button:hover,
.rescue-call-link:hover {
    border-color: #87433b;
    background: #87433b;
    color: #fff;
}

.home-rescue-entry,
.rescue-alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    border: 1px solid #e2c0b9;
    border-left: 4px solid #a9574d;
    border-radius: 7px;
    background: #fbf1ee;
}

.home-rescue-entry {
    margin: 0 0 30px;
}

.rescue-alert {
    margin: 18px 0;
}

.home-rescue-entry h2 {
    margin: 2px 0 4px;
    color: #653d37;
    font-size: 1.08rem;
}

.home-rescue-entry p:not(.rescue-kicker),
.rescue-alert p {
    margin: 4px 0 0;
    color: #76554f;
    font-size: 0.88rem;
}

.rescue-kicker {
    margin: 0;
    color: #8b4a41;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.09em;
}

.rescue-alert strong {
    color: #653d37;
}

.rescue-alert-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.rescue-alert-actions a:not(.rescue-call-link) {
    color: #87433b;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: underline;
}

.rescue-panel {
    margin-top: 18px;
}

.rescue-section-heading h2 {
    margin: 0 0 5px;
    font-size: 1.2rem;
}

.rescue-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.89rem;
}

.rescue-scenario-grid,
.rescue-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.rescue-option {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
    margin: 0;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-muted);
    cursor: pointer;
}

.rescue-option:has(input:checked) {
    border-color: #a9574d;
    background: #fbf1ee;
}

.rescue-option input[type="checkbox"] {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 3px 0 0;
    accent-color: #a9574d;
}

.rescue-option-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.rescue-option-copy strong {
    color: var(--text);
    font-size: 0.91rem;
    line-height: 1.35;
}

.rescue-option-copy span {
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 400;
    line-height: 1.45;
}

.rescue-selection-hint {
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.rescue-checklist-panel {
    margin: 18px 0;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.rescue-checklist {
    display: grid;
    gap: 13px;
    margin: 17px 0 0;
    padding-left: 25px;
}

.rescue-checklist li {
    padding-left: 4px;
}

.rescue-checklist li::marker {
    color: #a9574d;
    font-weight: 800;
}

.rescue-checklist li strong {
    display: block;
    color: var(--text);
    font-size: 0.93rem;
}

.rescue-checklist li p {
    margin: 4px 0 0;
    color: #59665d;
    font-size: 0.87rem;
    line-height: 1.6;
}

.rescue-privacy-note {
    margin: 15px 0 18px;
    padding: 12px 14px;
    border-left: 3px solid var(--accent);
    border-radius: 0 5px 5px 0;
    background: var(--surface-muted);
    color: #59665d;
    font-size: 0.85rem;
    line-height: 1.6;
}

.rescue-field {
    min-width: 0;
    margin: 12px 0;
}

.rescue-field label {
    margin-bottom: 6px;
}

.rescue-field textarea {
    resize: vertical;
}

.incident-summary-output-wrap {
    margin-top: 18px;
}

#incidentSummaryOutput {
    min-height: 250px;
    background: #f7f8f4;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    line-height: 1.55;
}

.rescue-sources {
    margin: 22px 0 8px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-muted);
}

.rescue-sources h2 {
    margin: 0 0 9px;
    font-size: 0.98rem;
}

.rescue-sources ul {
    margin: 0;
    padding-left: 20px;
}

.rescue-sources li {
    margin: 6px 0;
    font-size: 0.84rem;
}

.rescue-reviewed {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
}

@media (max-width: 640px) {
    .header-inner {
        flex-wrap: wrap;
        padding: 10px 0;
    }

    .main-nav {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 5px;
        width: 100%;
    }

    .nav-button {
        padding: 7px 9px;
        font-size: 0.81rem;
    }

    .rescue-nav-button {
        min-height: 35px;
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .home-rescue-entry,
    .rescue-alert {
        align-items: flex-start;
        flex-direction: column;
    }

    .rescue-alert-actions {
        width: 100%;
    }

    .rescue-scenario-grid,
    .rescue-fields-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rescue-checklist-panel,
    .rescue-panel {
        padding: 17px;
    }
}

/* =========================================
   ACCESSIBILITY
   ========================================= */

/* Text for screen readers only. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Skip link: off screen until it receives keyboard focus. */
.skip-link {
    position: absolute;
    top: 0;
    left: 12px;
    z-index: 1000;
    padding: 12px 18px;
    border-radius: 0 0 6px 6px;
    background: var(--text);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-120%);
}

.skip-link:focus {
    transform: translateY(0);
}

.skip-link:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -6px;
}

/* A group of checkboxes keeps the same grid layout as before. */
fieldset.rescue-scenario-grid {
    margin: 18px 0 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.rescue-option:has(input:focus-visible) {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Touch targets: at least 44 CSS pixels on narrow screens. The whole
   labelled row is the activation area for the situation checkboxes. */
@media (max-width: 640px) {

    .primary-button,
    .secondary-button,
    .text-button,
    .back-button,
    .nav-button,
    .rescue-nav-button,
    .rescue-primary-button,
    .rescue-call-link {
        min-height: 44px;
    }

    .nav-button,
    .rescue-nav-button {
        min-width: 44px;
    }

    .rescue-option {
        min-height: 44px;
    }

    .rescue-option input[type="checkbox"] {
        flex: 0 0 24px;
        width: 24px;
        height: 24px;
    }

}

/* Reflow: allow the red action buttons to wrap on very narrow screens. */
@media (max-width: 400px) {

    .rescue-nav-button,
    .rescue-primary-button,
    .rescue-call-link {
        white-space: normal;
    }

}