﻿/* MOBILE-FIRST UI
   - Defaults tuned for small screens
   - Larger screens enhance via @media (min-width: 768px)
*/
:root {
    --bg: #0b0c0f;
    --fg: #e7eaf0;
    --muted: #9aa3b2;
    --card: #11131a;
    --border: #2a2f3a;
    --accent: #60a5fa;
    --radius: 14px;
    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
    -webkit-text-size-adjust: 100%;
}

.wrap {
    width: 100%;
    max-width: 720px; /* caps width on tablets/desktops */
    margin: 0 auto;
    padding: var(--space-2);
}

header {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.row {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    gap: var(--space-1);
}

/* Buttons: large tap targets on mobile (≥44px) */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 12px; /* comfy touch area */
    min-height: 44px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #161a24;
    color: var(--fg);
    cursor: pointer;
    width: 100%; /* full-width on phones */
}

    .btn.secondary {
        background: #1a1f2a;
    }

    .btn:active {
        transform: translateY(1px);
    }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

    .card .head {
        padding: var(--space-2) var(--space-3);
        border-bottom: 1px solid var(--border);
        font-weight: 600;
    }

    .card .body {
        padding: var(--space-3);
    }

.alert {
    border: 1px solid #4d2121;
    background: #1a0f12;
    color: #ffdada;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

iframe.sanitized {
    width: 100%;
    min-height: 70vh; /* tall enough for reading on phones */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
}

.share {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-1);
}

.input {
    width: 100%;
    padding: 12px;
    background: #0e1117;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Sender chips */
.addr {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 6px;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #121521;
    line-height: 1.1;
    font-size: 13px;
}

    .addr a {
        color: var(--fg);
        text-decoration: none;
    }

        .addr a:hover {
            text-decoration: underline;
        }

/* Larger screens: lay out buttons horizontally, tighten sizes */
@media (min-width: 768px) {
    header {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .row {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        grid-template-columns: none;
        gap: var(--space-1);
    }

    .btn {
        width: auto;
        padding: 10px 12px;
    }

    .share {
        grid-template-columns: 1fr auto;
    }
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-1);
}

.btn.active {
    outline: 2px solid var(--accent);
    outline-offset: 0;
}

@media (min-width: 768px) {
    .btn-group {
        grid-template-columns: repeat(3, max-content);
    }
}

/* Shadow host inside the Message card when using inline mode */
.shadow-host {
    display: block;
    /* ensure long content wraps and respects the card padding */
    overflow: hidden;
}