:root {
    --bg: #0f172a;
    --card: #111827;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #f59e0b;
    --accent-2: #ef4444;
    --ok: #10b981;
    --border: #1f2937;
}

* { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: radial-gradient(circle at top, #1e293b, var(--bg) 55%);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: clip;
}
.page {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
}
.hero { text-align: center; margin-bottom: 24px; }
.hero__badge {
    display: inline-block;
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 12px;
}
.hero h1 { margin: 12px 0 8px; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.hero__lead { color: var(--muted); max-width: 640px; margin: 0 auto; line-height: 1.5; }
.card {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}
.lookup-form { display: contents; }
.lookup-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px;
    row-gap: 12px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}
.lookup-shell__input { grid-column: 1; grid-row: 1; }
.lookup-shell__submit { grid-column: 2; grid-row: 1; }
.lookup-form input,
.lookup-shell__input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0b1220;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    -webkit-appearance: none;
    appearance: none;
}
.lookup-form button, .btn {
    border: none;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #111;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.btn--secondary { background: #334155; color: var(--text); }
.lookup-visual {
    grid-column: 1;
    grid-row: 2;
    width: 90%;
    max-width: 100%;
    min-width: 0;
    min-height: 72px;
    justify-self: center;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(51, 65, 85, 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    background: #0b1220;
}
.lookup-visual img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
}
.lookup-response {
    margin-top: 20px;
    min-width: 0;
}
.lookup-response > .alert:first-child,
.lookup-response > .success-block:first-child {
    margin-top: 0;
}
.alert { margin-top: 20px; padding: 16px; border-radius: 12px; border: 1px solid var(--border); }
.alert h2 {
    margin: 0 0 12px;
    font-size: clamp(1.05rem, 4.5vw, 1.35rem);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.alert--error { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.08); }
.alert--warn { border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.08); }
.alert--neutral { border-color: #334155; background: rgba(148,163,184,0.08); }
.alert.inline { margin-top: 12px; }
.success-block h2 { margin-top: 0; color: var(--ok); font-size: clamp(1.1rem, 4.5vw, 1.45rem); }
.protocol-card {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #243044;
    border-radius: 12px;
    background: #0b1220;
}
.protocol-card h3 { margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.actions .btn { flex: 1 1 160px; }
.config-text {
    width: 100%;
    max-width: 100%;
    min-height: 160px;
    margin-top: 10px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #020617;
    color: #cbd5e1;
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
    resize: vertical;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.qr-wrap { margin: 12px 0; text-align: center; }
.qr-wrap img {
    width: min(220px, 100%);
    height: auto;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}
.instructions { margin-top: 12px; color: var(--muted); }
.instructions summary { cursor: pointer; font-weight: 600; color: var(--text); }
.status-list { padding-left: 20px; margin: 0; }
.status-list li { overflow-wrap: anywhere; }
.wiki h3 { margin-bottom: 8px; overflow-wrap: anywhere; }
.wiki p { line-height: 1.55; }
.wiki a { color: var(--accent); word-break: break-word; }
.proxy-note { margin-top: 24px; padding-top: 16px; border-top: 1px dashed #334155; }
.footer { margin-top: 24px; text-align: center; color: var(--muted); font-size: 13px; }
code {
    background: #1e293b;
    padding: 2px 6px;
    border-radius: 6px;
    word-break: break-all;
}
.instructions ol { padding-left: 20px; }
.instructions li { margin-bottom: 8px; line-height: 1.45; }

@media (max-width: 720px) {
    .page { padding-top: 16px; }
    .hero { margin-bottom: 16px; }
    .card {
        padding: 16px;
        border-radius: 14px;
    }
    .lookup-shell {
        grid-template-columns: 1fr;
        row-gap: 12px;
    }
    .lookup-shell__input { grid-row: 1; }
    .lookup-shell__submit {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
    }
    .lookup-visual {
        grid-column: 1;
        grid-row: 3;
        width: 90%;
    }
    .alert,
    .protocol-card {
        padding: 14px;
    }
    .actions {
        flex-direction: column;
    }
    .actions .btn {
        width: 100%;
        flex: 1 1 auto;
    }
    .config-text {
        min-height: 140px;
        font-size: 12px;
    }
    .instructions summary {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 420px) {
    .lookup-form input {
        padding-inline: 12px;
    }
    .protocol-card header .muted {
        display: block;
        margin-top: 4px;
    }
}
