:root { --bg:#f4f1ea; --card:#fffaf2; --ink:#171717; --muted:#666; --gold:#d6a93a; --danger:#b3261e; --ok:#206a3b; }
* { box-sizing:border-box; }
body { margin:0; font-family: Inter, Arial, sans-serif; background:linear-gradient(180deg,#f7f2e8,#e9e2d4); color:var(--ink); }
.shell { max-width:920px; margin:0 auto; padding:32px 18px 70px; }
.hero { padding:24px 0; }
.badge { display:inline-block; background:#171717; color:#fff; padding:7px 12px; border-radius:999px; font-size:13px; }
h1 { font-size:48px; margin:18px 0 8px; letter-spacing:-1px; }
p { line-height:1.55; }
.hero p { max-width:720px; color:#333; font-size:18px; }
.card, .result { background:rgba(255,250,242,.92); border:1px solid rgba(0,0,0,.08); border-radius:24px; padding:22px; box-shadow:0 20px 50px rgba(0,0,0,.08); margin-top:18px; }
label { display:block; font-weight:700; margin-bottom:8px; }
textarea { width:100%; min-height:180px; padding:14px; font-size:16px; border-radius:16px; border:1px solid #d5cbbb; resize:vertical; background:#fff; }
input[type=file] { width:100%; padding:14px; border:1px dashed #b8aa97; border-radius:16px; background:#fff; }
.or { text-align:center; color:var(--muted); margin:18px 0; }
button { margin-top:18px; width:100%; border:0; background:#171717; color:#fff; padding:16px 18px; font-size:17px; font-weight:800; border-radius:16px; cursor:pointer; }
button:hover { opacity:.92; }
.small { color:var(--muted); font-size:13px; }
.hidden { display:none; }
.spinner { width:42px; height:42px; border-radius:50%; border:4px solid #ddd; border-top-color:#171717; animation:spin 1s linear infinite; margin:0 auto 12px; }
@keyframes spin { to { transform:rotate(360deg); } }
.grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:16px; }
.pill { background:#fff; padding:12px; border-radius:16px; border:1px solid #eee; }
.pill span { display:block; color:var(--muted); font-size:12px; margin-bottom:4px; }
.pill strong { font-size:16px; }
.importance-hög { color:var(--danger); }
.importance-medel { color:#9b6500; }
.importance-låg { color:var(--ok); }
h2 { margin-top:0; }
h3 { margin:22px 0 8px; }
ul { padding-left:22px; }
.reply { white-space:pre-wrap; background:#fff; padding:14px; border-radius:16px; border:1px solid #eee; }
.error { color:var(--danger); font-weight:700; }
@media (max-width:700px){ h1{font-size:36px}.grid{grid-template-columns:1fr} }
.lang-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.lang-btn {
    border: 1px solid #ddd;
    background: white;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
    width: auto;
    margin-top: 0;
    color: #171717;
}

.lang-btn:hover {
    background: #f2f2f2;
}

.camera-box {
    width: 100%;
    margin-top: 16px;
    overflow: hidden;
}

#cameraCanvas {
    display: none !important;
}

#cameraPreview {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 3 / 4;
    height: auto;
    max-height: 620px;
    object-fit: cover;
    border-radius: 20px;
    margin: 14px 0 0 0;
    background: #111;
}

#cameraPreview.hidden {
    display: none;
}

.camera-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.camera-actions button {
    margin-top: 0;
}

.camera-actions.hidden {
    display: none;
}

.hidden-file {
    display: none;
}

.file-pick-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: #171717;
    color: #fff;
    padding: 16px 18px;
    font-size: 17px;
    font-weight: 800;
    border-radius: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.file-name-text {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.install-banner {
    position: sticky;
    top: 12px;
    z-index: 100;
    background: #171717;
    color: #fff;
    border-radius: 18px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .18);
    margin-bottom: 16px;
}

.install-banner.hidden {
    display: none;
}

.install-banner p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #ddd;
}

.install-banner button {
    width: auto;
    margin-top: 0;
    padding: 10px 14px;
    border-radius: 12px;
    white-space: nowrap;
}

.hero {
    text-align: center;
    padding: 28px 0 18px;
}

.app-logo {
    width: 104px;
    height: 104px;
    border-radius: 26px;
    display: block;
    margin: 0 auto 18px;
    box-shadow: 0 16px 35px rgba(0, 0, 0, .18);
}

.hero h1 {
    margin-top: 0;
}

.hero p {
    margin-left: auto;
    margin-right: auto;
}

.lang-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 8px 0 22px;
}

.result-actions {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.export-mode .result-actions {
    display: none !important;
}

@media print {
    body {
        background: #fff !important;
    }

    body.print-mode>* {
        visibility: hidden !important;
    }

    body.print-mode #result,
    body.print-mode #result * {
        visibility: visible !important;
    }

    body.print-mode #result {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 18px !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        background: #fffaf2 !important;
    }

    .result-actions,
    .install-banner,
    .lang-row,
    .hero,
    .card,
    #loading {
        display: none !important;
    }

    h2,
    h3,
    p,
    li,
    .reply,
    .pill {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

body[dir="rtl"] .reply {
    direction: rtl;
    text-align: right;
    unicode-bidi: isolate;
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.9;
    white-space: normal;
    letter-spacing: 0;
    word-spacing: normal;
}

.ios-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.ios-guide-card {
    width: 100%;
    max-width: 380px;
    background: #fffaf2;
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

.ios-guide-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    display: block;
    margin: 0 auto 14px;
}

.share-icon-demo {
    font-size: 48px;
    margin: 12px 0 18px;
}

.ios-guide-card h2 {
    margin: 0 0 12px;
}

.ios-guide-card ol {
    text-align: left;
    line-height: 1.8;
}

body[dir="rtl"] .ios-guide-card ol {
    text-align: right;
}

.ios-guide-card button {
    margin-top: 14px;
}

.guide-step-image {
    width: 72px;
    display: block;
    margin: 14px auto;
}

.guide-step-image-wide {
    width: 100%;
    max-width: 280px;
    display: block;
    margin: 14px auto;
    border-radius: 12px;
}