﻿.tw-audit-widget{
    --tw-bg:#0a0a0d;
    --tw-card:#111114;
    --tw-card-2:#151518;
    --tw-line:rgba(255,255,255,.06);
    --tw-red:#ff4136;
    --tw-red-2:#c81e1e;
    --tw-red-dim:rgba(255,65,54,.28);
    --tw-green:#3ddc84;
    --tw-amber:#f5a623;
    --tw-text:#f2f2f4;
    --tw-dim:#8b8b93;
    --tw-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --tw-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    font-family: var(--tw-sans);
    display:flex;
    justify-content:center;
    align-items:stretch;
    width:100%;
    height:100%;
    padding: 0;
    background: transparent;
    box-sizing:border-box;
  }
  .tw-audit-widget *{ box-sizing:border-box; }

  .tw-stage{
    position:relative;
    width:100%;
    max-width:none;
    height:100%;
    display:flex;
  }

  /* faint diagonal HUD lines in the backdrop */
  .tw-decor{
    position:absolute;
    inset:-40px;
    pointer-events:none;
    z-index:0;
    overflow:hidden;
    border-radius:32px;
  }
  .tw-decor span{
    position:absolute;
    background: linear-gradient(90deg, transparent, rgba(255,65,54,.18), transparent);
    height:1px;
    width:180%;
    transform-origin:left center;
  }
  .tw-decor span:nth-child(1){ top:8%; left:-40%; transform:rotate(-22deg); }
  .tw-decor span:nth-child(2){ top:52%; left:-30%; transform:rotate(-22deg); opacity:.6; }
  .tw-decor span:nth-child(3){ top:86%; left:-50%; transform:rotate(-22deg); opacity:.4; }

  .tw-card{
    position:relative;
    z-index:1;
    width:100%;
    flex:1;
    display:flex;
    flex-direction:column;
    background: linear-gradient(180deg, var(--tw-card), #0d0d10);
    border:1px solid rgba(255,65,54,.22);
    border-radius:22px;
    padding:24px 26px 26px;
    box-shadow:
      0 0 0 1px rgba(255,255,255,.02) inset,
      0 20px 60px -20px rgba(0,0,0,.7),
      0 0 40px -18px var(--tw-red-dim);
    overflow:hidden;
  }

  /* ---------- header ---------- */
  .tw-header{
    display:flex;
    align-items:flex-start;
    gap:12px;
    margin-bottom:22px;
  }
  .tw-logo{
    width:42px; height:42px; flex:none;
    border-radius:13px;
    display:flex; align-items:center; justify-content:center;
    background: radial-gradient(circle at 30% 25%, var(--tw-red), var(--tw-red-2) 75%);
    box-shadow: 0 6px 18px -6px rgba(255,65,54,.6);
  }
  .tw-logo svg{ width:22px; height:22px; }
  .tw-heading{ flex:1; min-width:0; }
  .tw-title{
    font-size:17px; font-weight:700; color:var(--tw-text);
    letter-spacing:.1px; line-height:1.3;
  }
  .tw-subtitle{
    font-size:12.5px; color:var(--tw-dim); margin-top:2px;
    transition:opacity .25s ease;
    height:16px; overflow:hidden;
  }
  .tw-status{
    display:flex; align-items:center; gap:8px; flex:none; margin-top:4px;
  }
  .tw-refresh{
    width:14px; height:14px; color:var(--tw-dim);
    opacity:0; transform:rotate(0deg);
    transition:opacity .3s ease;
  }
  .tw-refresh.tw-show{ opacity:.8; }
  .tw-dot{
    width:9px; height:9px; border-radius:50%;
    background:var(--tw-red);
    box-shadow:0 0 0 0 rgba(255,65,54,.6);
    animation: tw-pulse 1.6s ease-in-out infinite;
  }
  .tw-dot.tw-amber{ background:var(--tw-amber); box-shadow:0 0 0 0 rgba(245,166,35,.6); animation-name: tw-pulse-amber; }
  .tw-dot.tw-green{ background:var(--tw-green); animation:none; box-shadow:0 0 10px 1px rgba(61,220,132,.6); }
  @keyframes tw-pulse{
    0%{ box-shadow:0 0 0 0 rgba(255,65,54,.55); }
    70%{ box-shadow:0 0 0 7px rgba(255,65,54,0); }
    100%{ box-shadow:0 0 0 0 rgba(255,65,54,0); }
  }
  @keyframes tw-pulse-amber{
    0%{ box-shadow:0 0 0 0 rgba(245,166,35,.55); }
    70%{ box-shadow:0 0 0 7px rgba(245,166,35,0); }
    100%{ box-shadow:0 0 0 0 rgba(245,166,35,0); }
  }

  /* ---------- screens (crossfade + slide) ---------- */
  .tw-body{ position:relative; flex:1; display:flex; flex-direction:column; min-height:0; }
  .tw-screen{
    position:relative;
    opacity:0;
    transform:translateY(6px);
    pointer-events:none;
    transition: opacity .35s ease, transform .35s ease;
    display:none;
  }
  .tw-screen.tw-active{
    display:flex;
    flex-direction:column;
    flex:1;
    opacity:1;
    transform:translateY(0);
  }

  /* ---------- screen 1: input ---------- */
  .tw-url-box{
    display:flex; align-items:center; gap:10px;
    background:var(--tw-card-2);
    border:1px solid var(--tw-line);
    border-radius:14px;
    padding:13px 14px;
    margin-bottom:14px;
  }
  .tw-url-box svg{ width:16px; height:16px; color:var(--tw-dim); flex:none; }
  .tw-url-text{
    font-family:var(--tw-mono);
    font-size:13.5px;
    color:var(--tw-text);
    white-space:nowrap;
    overflow:hidden;
  }
  .tw-cursor{
    display:inline-block;
    width:1.5px; height:14px;
    background:var(--tw-red);
    margin-left:2px;
    vertical-align:-2px;
    animation: tw-blink 1s step-start infinite;
  }
  @keyframes tw-blink{ 50%{ opacity:0; } }

  .tw-btn{
    position:relative;
    width:100%;
    margin-top:auto;
    display:flex; align-items:center; justify-content:center; gap:8px;
    background: linear-gradient(180deg, #ff5a4f, var(--tw-red) 55%, var(--tw-red-2));
    color:#fff;
    font-weight:700; font-size:14px;
    border-radius:14px;
    padding:14px 16px;
    box-shadow: 0 10px 24px -10px rgba(255,65,54,.65);
    overflow:hidden;
  }
  .tw-btn svg{ width:15px; height:15px; }
  .tw-btn::after{
    content:"";
    position:absolute; top:0; bottom:0; left:-60%;
    width:40%;
    background:linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    animation: tw-sheen 2.8s ease-in-out infinite;
  }
  @keyframes tw-sheen{
    0%{ left:-60%; }
    45%{ left:130%; }
    100%{ left:130%; }
  }

  /* ---------- screen 2: analyzing ---------- */
  .tw-url-pill{
    display:flex; align-items:center; gap:8px;
    background:var(--tw-card-2);
    border:1px solid var(--tw-line);
    border-radius:12px;
    padding:10px 13px;
    margin-bottom:16px;
    font-family:var(--tw-mono);
    font-size:13px;
    color:var(--tw-dim);
  }
  .tw-url-pill svg{ width:14px; height:14px; color:var(--tw-dim); }

  .tw-progress-row{
    display:flex; justify-content:space-between; align-items:baseline;
    margin-bottom:8px;
  }
  .tw-progress-label{ font-size:12.5px; color:var(--tw-dim); }
  .tw-progress-pct{ font-size:13px; font-weight:700; color:var(--tw-red); font-variant-numeric: tabular-nums; }
  .tw-progress-track{
    height:5px; border-radius:99px;
    background:var(--tw-card-2);
    overflow:hidden;
    margin-bottom:18px;
  }
  .tw-progress-fill{
    height:100%; width:0%;
    border-radius:99px;
    background: linear-gradient(90deg, var(--tw-red-2), var(--tw-red));
    box-shadow: 0 0 10px 0 rgba(255,65,54,.6);
  }

  .tw-checklist{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:1fr 1fr; gap:2px 14px; }
  .tw-checklist li{
    display:flex; align-items:center; gap:11px;
    padding:9px 4px;
    border-radius:10px;
    transition: background .25s ease;
  }
  .tw-checklist li[data-state="active"]{ background: rgba(255,65,54,.08); }
  .tw-item-icon{
    width:20px; height:20px; flex:none;
    display:flex; align-items:center; justify-content:center;
    color:var(--tw-dim);
    transition: color .25s ease;
  }
  .tw-checklist li[data-state="active"] .tw-item-icon{ color:var(--tw-red); }
  .tw-checklist li[data-state="done"] .tw-item-icon{ color:var(--tw-green); }
  .tw-item-icon svg{ width:16px; height:16px; }
  .tw-item-ping{
    position:relative; width:8px; height:8px; border-radius:50%; background:var(--tw-red);
    display:none;
  }
  .tw-checklist li[data-state="active"] .tw-item-ping{ display:block; animation: tw-pulse 1.1s ease-in-out infinite; }
  .tw-checklist li[data-state="active"] .tw-item-icon svg{ display:none; }
  .tw-item-label{
    flex:1; font-size:13.5px; color:var(--tw-dim); font-weight:500;
    transition:color .25s ease;
  }
  .tw-checklist li[data-state="active"] .tw-item-label{ color:var(--tw-red); font-weight:600; }
  .tw-checklist li[data-state="done"] .tw-item-label{ color:var(--tw-green); }
  .tw-item-status{ width:16px; height:16px; flex:none; color:var(--tw-green); opacity:0; transition:opacity .2s ease; }
  .tw-checklist li[data-state="done"] .tw-item-status{ opacity:1; }
  .tw-item-status svg{ width:16px; height:16px; }

  /* ---------- screen 3: complete ---------- */
  .tw-result-pill{
    display:flex; align-items:center; gap:9px;
    background: rgba(61,220,132,.08);
    border:1px solid rgba(61,220,132,.3);
    border-radius:12px;
    padding:11px 13px;
    margin-bottom:18px;
    font-family:var(--tw-mono);
    font-size:12.5px;
    color:#8be8b3;
  }
  .tw-result-pill svg{ width:15px; height:15px; color:var(--tw-green); flex:none; }

  .tw-scores{
    display:grid;
    grid-template-columns:repeat(4, 1fr);
    gap:8px;
    margin-bottom:16px;
  }
  .tw-score{ display:flex; flex-direction:column; align-items:center; gap:8px; }
  .tw-ring{ width:68px; height:68px; position:relative; }
  .tw-ring svg{ width:100%; height:100%; transform:rotate(-90deg); }
  .tw-ring circle{ fill:none; stroke-width:5; }
  .tw-ring .tw-ring-bg{ stroke:var(--tw-card-2); }
  .tw-ring .tw-ring-fg{
    stroke-linecap:round;
    stroke-dasharray:151;
    stroke-dashoffset:151;
    transition: stroke-dashoffset 1.1s cubic-bezier(.22,.9,.3,1);
  }
  .tw-score[data-color="green"] .tw-ring-fg{ stroke:var(--tw-green); }
  .tw-score[data-color="amber"] .tw-ring-fg{ stroke:var(--tw-amber); }
  .tw-score[data-color="red"] .tw-ring-fg{ stroke:var(--tw-red); }
  .tw-ring-value{
    position:absolute; inset:0;
    display:flex; align-items:center; justify-content:center;
    font-size:15px; font-weight:700; color:var(--tw-text);
    font-variant-numeric: tabular-nums;
  }
  .tw-score-label{ font-size:10.5px; color:var(--tw-dim); text-align:center; line-height:1.2; }

  .tw-global{
    display:flex; align-items:center; justify-content:space-between;
    background:var(--tw-card-2);
    border:1px solid var(--tw-line);
    border-radius:14px;
    padding:14px 16px;
    margin-bottom:16px;
  }
  .tw-global-label{ font-size:13px; color:var(--tw-dim); font-weight:500; }
  .tw-global-right{ display:flex; align-items:center; gap:9px; }
  .tw-global-value{ font-size:17px; font-weight:800; color:var(--tw-text); font-variant-numeric: tabular-nums; }
  .tw-global-value small{ font-size:12px; font-weight:600; color:var(--tw-dim); }
  .tw-badge{
    font-size:11px; font-weight:700; color:#1a1200;
    background: linear-gradient(180deg, #ffcf6b, var(--tw-amber));
    padding:4px 9px; border-radius:99px;
  }

  @media (max-width: 640px){
    .tw-checklist{ grid-template-columns:1fr; }
    .tw-ring{ width:60px; height:60px; }
  }

  @media (prefers-reduced-motion: reduce){
    .tw-audit-widget *{ animation-duration: .001s !important; transition-duration: .2s !important; }
  }
