/*
 * Mateen Labs: social media tools. Builds on tools.css, file-tool.css and text-tools.css (the .tx-* classes) and the site tokens.
 * Mobile first: nothing here may be wider than a 320px screen. Meaning is never carried by colour alone.
 */

.sc-app { min-width: 0; }
.sc-app .tool-editor { min-height: 180px; }

.sc-checked { margin: 14px 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.sc-checked strong { color: var(--text); }

.sc-warn {
    margin: 14px 0;
    padding: 14px 16px 14px 18px;
    border: 1px solid var(--warn-line);
    border-left: 4px solid var(--warn-text);
    border-radius: 10px;
    background: var(--warn-bg);
    color: var(--warn-text);
    font-size: 14px;
    line-height: 1.55;
}

.sc-warn h2 { margin: 0 0 6px; font-size: 16px; }
.sc-warn ul { margin: 0; padding-left: 20px; }
.sc-warn li + li { margin-top: 4px; }

/* ---------- Caption counter ---------- */

.sc-meter-text { margin: 12px 0 6px; font-size: 18px; font-weight: 800; color: var(--text); overflow-wrap: anywhere; }

.sc-meter {
    height: 16px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--panel);
}

.sc-meter-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s ease; }
.sc-meter[data-state="near"] .sc-meter-fill { background: var(--warn-text); }
.sc-meter[data-state="over"] .sc-meter-fill {
    background: repeating-linear-gradient(135deg, var(--err-text) 0, var(--err-text) 8px, var(--err-bg) 8px, var(--err-bg) 12px);
}

.sc-state {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 0;
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sc-state[data-state="ok"] { color: var(--ok-text); }
.sc-state[data-state="near"] { color: var(--warn-text); }
.sc-state[data-state="over"] { color: var(--err-text); }
.sc-state .sc-icon { flex: none; width: 1.4em; text-align: center; }

.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.sc-chips li { max-width: 100%; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.sc-chips li.is-extra { border-color: var(--err-text); color: var(--err-text); text-decoration: underline; }

.sc-cut {
    margin: 8px 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sc-visible { color: var(--text); }
.sc-more { display: inline-block; margin: 0 4px; padding: 0 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; }
.sc-hidden { color: var(--muted); text-decoration: underline dashed; text-underline-offset: 4px; }

.sc-sources summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.sc-sources table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sc-sources th, .sc-sources td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.sc-sources th { color: var(--muted); font-size: 13px; }
.sc-sources a { color: var(--accent-text); }
.sc-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 800; }
.sc-tag.is-approx { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-text); }
.sc-tag.is-doc { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-text); }
.sc-table-wrap { max-width: 100%; overflow-x: auto; }

/* ---------- Fancy text ---------- */

.sc-fancy { display: grid; gap: 8px; margin: 14px 0; padding: 0; list-style: none; }

.sc-fancy li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.sc-fancy-label { grid-column: 1 / -1; color: var(--muted); font-size: 13px; font-weight: 700; }
.sc-fancy-text { min-width: 0; font-size: 20px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.sc-fancy.is-sample .sc-fancy-text { color: var(--muted); }
.sc-fancy-warn { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Line breaks ---------- */

.sc-methods { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.sc-methods legend { margin-bottom: 4px; padding: 0; font-weight: 700; }
.sc-method { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.sc-method input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.sc-method strong { display: block; font-size: 14px; }
.sc-method span { display: block; color: var(--muted); font-size: 13px; }
.sc-method:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.sc-marked {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--code-bg);
    color: var(--text);
    font: 14px/1.7 var(--mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------- Engagement rate ---------- */

.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 12px; }
.sc-field { display: grid; gap: 4px; min-width: 0; }
.sc-field label { color: var(--text); font-size: 14px; font-weight: 700; }

.sc-field input[type="text"] {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: 600 16px var(--font);
}

.sc-field input[aria-invalid="true"] { border-color: var(--err-text); }
.sc-field .sc-err { margin: 0; color: var(--err-text); font-size: 13px; font-weight: 600; }

.sc-posts { display: grid; gap: 12px; margin: 12px 0; padding: 0; list-style: none; }
.sc-post { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sc-post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.sc-post-head .sc-field { flex: 1 1 180px; }
.sc-rate { font-size: 20px; font-weight: 800; color: var(--accent-text); }

.sc-big { margin: 0; color: var(--accent-text); font-size: clamp(30px, 7vw, 44px); font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sc-sum { margin: 4px 0 12px; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.sc-result { margin: 14px 0; padding: 16px; border: 1px solid var(--line); border-top: 4px solid var(--ok-text); border-radius: var(--radius); background: var(--surface); }
.sc-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }

/* ---------- Safe zones ---------- */

.sc-sz { display: grid; gap: 18px; align-items: start; }
@media (min-width: 900px) { .sc-sz { grid-template-columns: minmax(0, 1fr) minmax(280px, 440px); } }

.sc-canvas-box { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: center; }
.sc-canvas { display: block; width: min(100%, 420px); height: auto; margin: 0 auto; border-radius: 8px; background: #000; box-shadow: var(--shadow-md); }
.sc-zone-list { margin: 10px 0 0; padding: 0; list-style: none; text-align: left; font-size: 14px; }
.sc-zone-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.sc-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.sc-app input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------- Batch K: hashtag formatter, thread splitter, URL cleaner, UTM builder, extractor ---------- */

.sx-fields { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
.sx-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sx-field label { font-weight: 700; font-size: 14px; }
.sx-field input[type="text"], .sx-field input[type="number"], .sx-field select, .sx-field textarea {
    width: 100%; min-height: 44px; box-sizing: border-box; padding: 8px 10px;
    border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit;
}
.sx-field textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.sx-field .opt-help, .sx-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sx-checks { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; border: 0; padding: 0; }
.sx-checks legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 4px; }
.sx-checks label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.sx-checks input { width: 22px; height: 22px; flex: none; }
@media (min-width: 640px) { .sx-fields { grid-template-columns: 1fr 1fr; } .sx-fields .sx-wide { grid-column: 1 / -1; } }

.sx-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sx-card { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; background: var(--panel); min-width: 0; }
.sx-card[data-state="over"] { border-left: 4px solid var(--err-text); }
.sx-card[data-state="bad"] { border-left: 4px solid var(--err-text); }
.sx-card[data-state="changed"] { border-left: 4px solid var(--ok-text); }
.sx-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.sx-card-head button { min-height: 44px; }
.sx-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: inherit; font-size: 15px; line-height: 1.55; }
.sx-url { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
.sx-label { display: block; margin: 8px 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.sx-url del { background: var(--err-bg); color: var(--err-text); text-decoration: line-through; text-decoration-thickness: 2px; border-radius: 3px; }
.sx-url ins { background: var(--ok-bg); color: var(--ok-text); text-decoration: underline; border-radius: 3px; }
.sx-flag { font-weight: 700; }
.sx-flag[data-state="over"], .sx-flag[data-state="bad"] { color: var(--err-text); }
.sx-flag[data-state="ok"] { color: var(--ok-text); }
.sx-flag[data-state="warn"] { color: var(--warn-text); }
.sx-notes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }

.sx-table { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.sx-table caption { text-align: left; font-weight: 700; padding: 4px 0 8px; }
.sx-table th, .sx-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line-strong); overflow-wrap: anywhere; vertical-align: top; }
.sx-table th:first-child, .sx-table td:first-child { width: 28%; }
.sx-table th:last-child, .sx-table td:last-child { width: 22%; text-align: right; }

.sx-sources { font-size: 13px; color: var(--muted); }
.sx-sources a { overflow-wrap: anywhere; }
.sx-sources ul { padding-left: 18px; margin: 4px 0; }
