/* AI Text Detector — compact professional widget */
.tool-widget:has(.aid-app) {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.aid-app {
    --aid-accent: #00aeef;
    --aid-accent-2: #38bdf8;
    --aid-human: #34d399;
    --aid-ai: #f59e0b;
    --aid-ai-hot: #ef4444;
    --aid-card: rgba(15, 23, 42, 0.82);
    --aid-border: rgba(148, 163, 184, 0.16);
    margin: 0;
}

.aid-shell {
    border: 1px solid var(--aid-border);
    border-radius: 20px;
    background:
        radial-gradient(ellipse 80% 50% at 0% 0%, rgba(0,174,239,.14), transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(167,139,250,.08), transparent 45%),
        linear-gradient(180deg, #111827 0%, #0b1220 100%);
    padding: 1.15rem 1.2rem 1.35rem;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
}

.aid-trust {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: 1rem;
}
.aid-trust-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--aid-border);
    background: rgba(2, 8, 20, .45);
    font-size: .72rem;
    font-weight: 700;
    color: #cbd5e1;
}
.aid-trust-item svg { color: var(--aid-accent-2); flex-shrink: 0; }

.aid-hero-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.aid-kicker {
    margin: 0 0 .3rem;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--aid-accent-2);
}
.aid-hero-text {
    margin: 0;
    max-width: 42rem;
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.5;
}
.aid-hero-samples { display: flex; flex-wrap: wrap; gap: .45rem; }
.aid-chip {
    border: 1px solid var(--aid-border);
    background: rgba(15,23,42,.65);
    color: #e2e8f0;
    border-radius: 999px;
    padding: .42rem .8rem;
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
}
.aid-chip:hover {
    border-color: rgba(0,174,239,.45);
    background: rgba(0,174,239,.12);
    transform: translateY(-1px);
}
.aid-chip--ai:hover {
    border-color: rgba(245,158,11,.5);
    background: rgba(245,158,11,.12);
}

.aid-top-grid {
    display: grid;
    grid-template-columns: 1.25fr .85fr;
    gap: .9rem;
    margin-bottom: .85rem;
}

.aid-card {
    background: var(--aid-card);
    border: 1px solid var(--aid-border);
    border-radius: 16px;
    padding: 1rem 1.05rem;
}
.aid-card h3 {
    margin: 0 0 .7rem;
    font-size: .98rem;
    font-weight: 800;
}

.aid-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .65rem;
}
.aid-card-head h3 { margin: 0; }
.aid-clear-btn {
    border: 1px solid var(--aid-border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: .28rem .65rem;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
}
.aid-clear-btn:hover {
    color: #fff;
    border-color: rgba(239,68,68,.45);
    background: rgba(239,68,68,.12);
}

.aid-textarea {
    width: 100%;
    min-height: 200px;
    max-height: 360px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid var(--aid-border);
    background: rgba(2, 8, 20, .7);
    color: #f8fafc;
    padding: .9rem;
    font: inherit;
    line-height: 1.6;
}
.aid-textarea:focus {
    outline: none;
    border-color: rgba(0,174,239,.55);
    box-shadow: 0 0 0 3px rgba(0,174,239,.14);
}

.aid-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .85rem;
    margin-top: .65rem;
    padding: .55rem .7rem;
    border-radius: 10px;
    background: rgba(2, 8, 20, .45);
    border: 1px solid var(--aid-border);
}
.aid-stat {
    display: flex;
    flex-direction: column;
    min-width: 52px;
}
.aid-stat strong {
    font-size: .95rem;
    font-weight: 800;
    color: var(--aid-accent-2);
    line-height: 1.1;
}
.aid-stat span {
    font-size: .65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.aid-min-hint {
    margin-left: auto;
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
}
.aid-min-hint.is-ready { color: var(--aid-human); }
.aid-min-hint.is-short { color: #fbbf24; }

.aid-input-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}
.aid-analyze-btn {
    min-width: 150px;
    position: relative;
}
.aid-analyze-btn.is-loading {
    pointer-events: none;
    opacity: .85;
}
.aid-analyze-btn.is-loading .aid-btn-label { display: none; }
.aid-analyze-btn.is-loading .aid-btn-loading { display: inline !important; }

.aid-result-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.aid-result-idle {
    padding: .5rem .25rem 0;
}
.aid-idle-ring {
    width: 88px;
    height: 88px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    border: 3px dashed rgba(148,163,184,.28);
    background:
        radial-gradient(circle at 50% 50%, rgba(0,174,239,.12), transparent 65%);
    animation: aidPulse 2.4s ease-in-out infinite;
}
@keyframes aidPulse {
    0%, 100% { transform: scale(1); opacity: .85; }
    50% { transform: scale(1.04); opacity: 1; }
}
.aid-result-idle h3 { margin-bottom: .45rem; }
.aid-result-idle p {
    margin: 0 auto;
    max-width: 16rem;
    color: var(--text-muted);
    font-size: .84rem;
    line-height: 1.5;
}

.aid-gauge-wrap {
    display: flex;
    justify-content: center;
    margin: .15rem 0 .85rem;
}
.aid-gauge {
    --aid-pct: 0;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(#64748b calc(var(--aid-pct) * 1%), rgba(148,163,184,.15) 0);
    position: relative;
    transition: background .55s ease;
}
.aid-gauge::before {
    content: '';
    position: absolute;
    inset: 11px;
    border-radius: 50%;
    background: #0b1220;
    border: 1px solid var(--aid-border);
}
.aid-gauge-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.aid-gauge-inner strong {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}
.aid-gauge-inner span {
    margin-top: .3rem;
    font-size: .68rem;
    color: var(--text-muted);
    font-weight: 600;
}
.aid-gauge.is-human-high,
.aid-gauge.is-human {
    background: conic-gradient(var(--aid-human) calc(var(--aid-pct) * 1%), rgba(148,163,184,.15) 0);
}
.aid-gauge.is-mixed {
    background: conic-gradient(var(--aid-ai) calc(var(--aid-pct) * 1%), rgba(148,163,184,.15) 0);
}
.aid-gauge.is-ai,
.aid-gauge.is-ai-high {
    background: conic-gradient(var(--aid-ai-hot) calc(var(--aid-pct) * 1%), rgba(148,163,184,.15) 0);
}
.aid-gauge.is-scanning {
    background: rgba(148,163,184,.12);
}
.aid-gauge.is-scanning::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--aid-accent);
    border-right-color: rgba(0,174,239,.35);
    animation: aidSpinRing .8s linear infinite;
}
@keyframes aidSpinRing {
    to { transform: rotate(360deg); }
}

.aid-verdict {
    margin: 0 0 .85rem;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
}
.aid-verdict.is-human,
.aid-verdict.is-human-high { color: var(--aid-human); }
.aid-verdict.is-ai,
.aid-verdict.is-ai-high { color: #fca5a5; }
.aid-verdict.is-mixed { color: #fcd34d; }

.aid-prob-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    margin-bottom: .55rem;
}
.aid-prob {
    padding: .5rem .55rem;
    border-radius: 10px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    text-align: left;
}
.aid-prob--human {
    background: rgba(52,211,153,.08);
    border-color: rgba(52,211,153,.22);
}
.aid-prob span {
    display: block;
    font-size: .65rem;
    color: var(--text-muted);
    margin-bottom: .12rem;
}
.aid-prob strong { font-size: .95rem; }

.aid-dual-track {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148,163,184,.12);
}
.aid-dual-track-ai {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    transition: width .45s ease;
}
.aid-dual-track-human {
    background: linear-gradient(90deg, #16a34a, #34d399);
    transition: width .45s ease;
}

.aid-details {
    animation: aidFadeIn .35s ease;
}
@keyframes aidFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.aid-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    margin-bottom: .85rem;
}
.aid-metric {
    background: var(--aid-card);
    border: 1px solid var(--aid-border);
    border-radius: 14px;
    padding: .85rem .7rem;
    text-align: center;
}
.aid-metric h4 {
    margin: .5rem 0 .25rem;
    font-size: .82rem;
}
.aid-metric p {
    margin: 0;
    font-size: .74rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.aid-metric-circle {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .9rem;
    border: 3px solid currentColor;
}
.aid-metric-circle--ai { color: #fbbf24; background: rgba(245,158,11,.1); }
.aid-metric-circle--human { color: #34d399; background: rgba(52,211,153,.1); }
.aid-metric-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--aid-accent-2);
    background: rgba(0,174,239,.1);
    border: 1px solid rgba(0,174,239,.2);
}

.aid-bottom-grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.aid-fold {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.aid-fold > summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.15rem;
    font-weight: 800;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    user-select: none;
    border-bottom: 1px solid transparent;
}
.aid-fold[open] > summary {
    border-bottom-color: var(--aid-border);
}
.aid-fold > summary::-webkit-details-marker { display: none; }
.aid-fold-title {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    min-width: 0;
    line-height: 1.3;
}
.aid-fold > summary::after {
    content: '+';
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    line-height: 1;
    color: var(--aid-accent-2);
    background: rgba(0,174,239,.1);
    border: 1px solid rgba(0,174,239,.18);
    flex-shrink: 0;
}
.aid-fold[open] > summary::after { content: '−'; }
.aid-fold-body {
    padding: 1rem 1.15rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
    min-width: 0;
}
.aid-fold-meta {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: .75rem;
    color: var(--text-muted);
    background: rgba(148,163,184,.12);
    border: 1px solid var(--aid-border);
    border-radius: 999px;
    padding: .15rem .5rem;
}

.aid-card-sub {
    margin: 0;
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.aid-models {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .65rem;
}
.aid-model {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: .6rem;
    align-items: center;
}
.aid-model-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: .65rem;
    font-weight: 800;
    color: #fff;
}
.aid-model-logo--gpt { background: #10a37f; }
.aid-model-logo--gemini { background: #4285f4; }
.aid-model-logo--claude { background: #d97706; }
.aid-model-logo--llama { background: #0866ff; }
.aid-model-logo--mistral { background: #ff7000; }
.aid-model-meta { min-width: 0; }
.aid-model-meta strong {
    display: block;
    font-size: .8rem;
    margin-bottom: .25rem;
}
.aid-model-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(148,163,184,.15);
    overflow: hidden;
}
.aid-model-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--aid-accent), var(--aid-accent-2));
    transition: width .45s ease;
}
.aid-model-pct {
    font-size: .8rem;
    font-weight: 800;
    color: var(--aid-accent-2);
    min-width: 2.4rem;
    text-align: right;
}

.aid-meaning {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    min-width: 0;
}
.aid-meaning p {
    margin: 0;
    color: var(--text-muted);
    font-size: .86rem;
    line-height: 1.6;
}
.aid-meaning-title {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    margin: 0;
    font-weight: 800;
    font-size: .95rem;
    line-height: 1.4;
    color: #f8fafc;
}
.aid-note {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: .7rem;
    align-items: start;
    padding: .9rem 1rem;
    border-radius: 12px;
    background: rgba(52,211,153,.08);
    border: 1px solid rgba(52,211,153,.22);
    margin-top: .15rem;
}
.aid-note svg {
    margin-top: .15rem;
    color: var(--aid-human);
    flex-shrink: 0;
}
.aid-note p {
    margin: 0;
    font-size: .8rem;
    color: #cbd5e1;
    line-height: 1.55;
    min-width: 0;
}
.aid-note strong {
    color: #86efac;
    font-weight: 800;
}

.aid-signals-card {
    margin-bottom: 1rem;
}
.aid-signals {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .55rem;
    max-height: 320px;
    overflow: auto;
    padding-right: .15rem;
}
.aid-signal {
    padding: .75rem .85rem;
    border-radius: 10px;
    border: 1px solid var(--aid-border);
    background: rgba(2,8,20,.35);
}
.aid-signal-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: .3rem;
}
.aid-signal-top strong {
    font-size: .86rem;
    line-height: 1.35;
}
.aid-signal p {
    margin: 0;
    font-size: .78rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.aid-signal-impact {
    font-size: .7rem;
    font-weight: 800;
    padding: .15rem .45rem;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}
.aid-signal--ai { border-color: rgba(239,68,68,.28); }
.aid-signal--ai .aid-signal-impact { color: #fca5a5; background: rgba(239,68,68,.12); }
.aid-signal--human { border-color: rgba(52,211,153,.28); }
.aid-signal--human .aid-signal-impact { color: #86efac; background: rgba(52,211,153,.12); }
.aid-signal--neutral .aid-signal-impact { color: var(--text-muted); background: rgba(148,163,184,.12); }

.aid-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-top: .15rem;
}
.aid-actions .btn { min-height: 42px; }

@media (max-width: 980px) {
    .aid-top-grid,
    .aid-bottom-grid { grid-template-columns: 1fr; }
    .aid-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .aid-shell { padding: .9rem; border-radius: 16px; }
    .aid-metric-grid { grid-template-columns: 1fr 1fr; }
    .aid-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        width: 100%;
    }
    .aid-actions .btn {
        flex: none;
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }
    .aid-textarea { min-height: 160px; }
}
