/* ===============================
   THEME
================================ */


:root {
    --bg: #F8FAFC;
    --text: #0a1222;
    --muted: #55627a;
    --border: #0056d2;
    --glow: rgba(34, 211, 238, .16);
    --red: #ff2a2a;
    --redGlow: rgba(255, 42, 42, .35);
    --orange: #ff8c00;
    --orangeGlow: rgba(255, 140, 0, .35);
    --green: #22c55e;
    --greenGlow: rgba(34, 197, 94, .35);
    --warnBg: rgba(255, 42, 42, .08);
    --warnBorder: rgba(255, 42, 42, .45);
    --softBorder: rgba(34, 211, 238, .22);

}

.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(135deg, #080d19 0%, #0a1628 50%, #0d1a2d 100%);
}

/* Canvas element */
#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Optional: Gradient overlay orbs for extra depth */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
    animation: pulse-glow 4s ease-in-out infinite;
}

.glow-orb.cyan {
    background: #00d4ff;
    width: 400px;
    height: 400px;
    top: 20%;
    right: -100px;
}

.glow-orb.purple {
    background: #a855f7;
    width: 350px;
    height: 350px;
    bottom: 20%;
    left: -100px;
    animation-delay: 2s;
}

/* Floating dots decoration */
.floating-dot {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    animation: float 6s ease-in-out infinite;
}

.floating-dot.dot-1 {
    width: 8px;
    height: 8px;
    background: #00d4ff;
    bottom: 30px;
    left: 30px;
    animation-delay: 0s;
}

.floating-dot.dot-2 {
    width: 4px;
    height: 4px;
    background: #a855f7;
    bottom: 60px;
    left: 60px;
    animation-delay: 0.5s;
}

.floating-dot.dot-3 {
    width: 6px;
    height: 6px;
    background: #00d4ff;
    top: 120px;
    right: 60px;
    animation-delay: 1s;
}

.floating-dot.dot-4 {
    width: 4px;
    height: 4px;
    background: #a855f7;
    top: 180px;
    right: 120px;
    animation-delay: 1.5s;
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.1;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ===== GLASS CARD STYLES (bonus) ===== */
.glass-card {
    background: linear-gradient(135deg,
    rgba(13, 26, 45, 0.6),
    rgba(8, 13, 25, 0.8)
    );
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(0, 212, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
    transparent,
    rgba(0, 212, 255, 0.5),
    rgba(168, 85, 247, 0.5),
    transparent
    );
}

/* Hover effect for all buttons */
button,
.icon-btn,
.generate-btn,
.change-btn,
.cancel-btn {
    cursor: pointer !important;
}

/* Toast for the LEFT panel (Copying original text) */
.left-copy-toast {
    position: absolute;
    top: 10px;
    right: 60px;
    background: rgba(34, 211, 238, 0.9);
    color: #000;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    animation: fadeIn 0.3s;
}
a {
    font-weight: bold;
    color: #efe8e8;
    -webkit-text-decoration: inherit;
    text-decoration: inherit;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

* {
    box-sizing: border-box;
}

/* ===============================
   HERO
================================ */
.main {
    min-height: 40vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 22px 0 10px;
    position: relative;
    z-index: 1;
}

.main, .builder-wrap, .revised-wrap {
    position: relative;
    z-index: 2;
}

.hero-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    margin: 0;
    width: min(1100px, 100%);
    padding: 0 16px;
}

h1 {
    text-transform: uppercase;
    font-size: clamp(2.1rem, 4.2vw, 3rem);
    color: var(--text);
}

/* ===== Glitch title (light theme) ===== */
.glitch {
    position: relative;
    display: inline-block;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1;
    isolation: isolate;
}

.glitch-light {
    color: #b8c5e4;
    text-shadow: 0 10px 35px rgba(2, 6, 23, .18);
    animation: glitch-skew 3s infinite;
}

.glitch-light::before,
.glitch-light::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: transparent;
    pointer-events: none;
}

.glitch-light::before {
    transform: translateX(-2px);
    text-shadow: -4px 0 #D3273E;
    clip-path: inset(0 0 0 0);
    animation: noise-1 2.8s linear infinite alternate-reverse, glitch-skew 5s 0.05s infinite;
    opacity: .9;
}

.glitch-light::after {
    transform: translateX(2px);
    text-shadow: 4px 0 #41B6E6;
    clip-path: inset(0 0 0 0);
    animation: noise-2 3.1s linear infinite alternate-reverse, glitch-skew 5s infinite;
    opacity: .85;
}

@keyframes glitch-skew {
    0%, 100% {
        transform: none;
    }
    1% {
        transform: skewX(18deg) skewY(-2deg);
    }
    2% {
        transform: none;
    }
    53% {
        transform: none;
    }
    54% {
        transform: skewX(-14deg) skewY(1deg);
    }
    55% {
        transform: none;
    }
}

@keyframes noise-1 {
    0% {
        clip-path: inset(12% 0 76% 0);
    }
    5% {
        clip-path: inset(65% 0 18% 0);
    }
    10% {
        clip-path: inset(28% 0 55% 0);
    }
    15% {
        clip-path: inset(80% 0 6% 0);
    }
    20% {
        clip-path: inset(8% 0 84% 0);
    }
    25% {
        clip-path: inset(52% 0 33% 0);
    }
    30% {
        clip-path: inset(2% 0 90% 0);
    }
    35% {
        clip-path: inset(72% 0 10% 0);
    }
    40% {
        clip-path: inset(40% 0 45% 0);
    }
    45% {
        clip-path: inset(88% 0 4% 0);
    }
    50% {
        clip-path: inset(18% 0 70% 0);
    }
    55% {
        clip-path: inset(60% 0 22% 0);
    }
    60% {
        clip-path: inset(6% 0 86% 0);
    }
    65% {
        clip-path: inset(34% 0 50% 0);
    }
    70% {
        clip-path: inset(78% 0 8% 0);
    }
    75% {
        clip-path: inset(22% 0 62% 0);
    }
    80% {
        clip-path: inset(92% 0 2% 0);
    }
    85% {
        clip-path: inset(46% 0 38% 0);
    }
    90% {
        clip-path: inset(14% 0 74% 0);
    }
    95% {
        clip-path: inset(70% 0 12% 0);
    }
    100% {
        clip-path: inset(26% 0 58% 0);
    }
}

@keyframes noise-2 {
    0% {
        clip-path: inset(78% 0 8% 0);
    }
    5% {
        clip-path: inset(10% 0 82% 0);
    }
    10% {
        clip-path: inset(58% 0 20% 0);
    }
    15% {
        clip-path: inset(24% 0 60% 0);
    }
    20% {
        clip-path: inset(90% 0 3% 0);
    }
    25% {
        clip-path: inset(36% 0 44% 0);
    }
    30% {
        clip-path: inset(6% 0 88% 0);
    }
    35% {
        clip-path: inset(66% 0 16% 0);
    }
    40% {
        clip-path: inset(18% 0 72% 0);
    }
    45% {
        clip-path: inset(84% 0 5% 0);
    }
    50% {
        clip-path: inset(30% 0 52% 0);
    }
    55% {
        clip-path: inset(2% 0 92% 0);
    }
    60% {
        clip-path: inset(74% 0 9% 0);
    }
    65% {
        clip-path: inset(44% 0 36% 0);
    }
    70% {
        clip-path: inset(12% 0 78% 0);
    }
    75% {
        clip-path: inset(62% 0 18% 0);
    }
    80% {
        clip-path: inset(20% 0 66% 0);
    }
    85% {
        clip-path: inset(88% 0 4% 0);
    }
    90% {
        clip-path: inset(40% 0 42% 0);
    }
    95% {
        clip-path: inset(8% 0 86% 0);
    }
    100% {
        clip-path: inset(70% 0 12% 0);
    }
}

/* Roller */
.roller {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    height: 3.2rem;
    min-width: 280px;
    color: rgb(34 211 238 / 80%);;
    line-height: 1.25;
}

.roller #rolltext {
    position: relative;
    will-change: transform;
    animation: slideY 10.5s ease-in-out infinite;
}

@keyframes slideY {
    0%, 40% {
        transform: translateY(0);
    }
    50%, 90% {
        transform: translateY(-1.35em);
    }
    100% {
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .roller {
        font-size: 30px;
        height: 1.35em;
        overflow: hidden;
    }

    #rolltext {
        white-space: nowrap;
        line-height: 1.35;
        animation: slideYMobile 10s ease-in-out infinite;
    }

    @keyframes slideYMobile {
    0%, 40% {
        transform: translateY(0);
    }
    50%, 90% {
        transform: translateY(-1.25em);
    }
    100% {
        transform: translateY(0);
    }
}
}

/* ===============================
   LAYOUT + PANELS
================================ */
.builder-wrap {
    max-width: 1300px;
    margin: 22px auto 18px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1.25fr .85fr;
    gap: 18px;
}

@media (max-width: 992px) {
    .builder-wrap {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: #ffffff; /* Clean white background */
    border: 1px solid rgba(0, 86, 210, 0.1); /* Soft blue border */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease;
}

/* Optional: Slight lift when the user interacts with a panel */
.panel:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.panel {
    background: rgba(255, 255, 255, 0.9); /* High opacity white */
    backdrop-filter: blur(10px); /* Blurs the animation behind it */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    position: relative;
    overflow: hidden;

}

.panel-header {
    padding: 16px 18px 10px;
    border-bottom: 1px solid rgba(34, 211, 238, .16);
}

.panel-title {
    font-weight: 700;
    background: linear-gradient(135deg, #263e5e 0%, #3f35b8 50%, #2d528e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 22px;
}

.panel-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 15px;
}

/* header with copy button */
.panel-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* Inputs */
.hl-wrap {
    position: relative;
    width: 100%;
}

.hl-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 230px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    padding: 16px 18px;
    color: var(--text) !important;
    pointer-events: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
    border: none;
    background: transparent;
    z-index: 0;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.hl-wrap.has-text .hl-layer {
    opacity: 1;
}

/* Hide overlay scrollbars */
.hl-layer::-webkit-scrollbar { width: 0; height: 0; }
.hl-layer { scrollbar-width: none; }

.hl-bad-word {
    background: rgba(255, 42, 42, 0.18);
    border-bottom: 2px solid rgba(255, 42, 42, 0.75);
    border-radius: 3px;
    color: var(--red) !important;
    font-weight: 800;
}

.textarea {
    border: none;
    resize: none;
    width: 100%;
    height: 230px;
    outline: none;
    font-size: 16px;
    line-height: 1.5;
    padding: 16px 18px;
    color: #0a1222 !important;
    -webkit-text-fill-color: #0a1222 !important;
    background: transparent;
    position: relative;
    z-index: 1;
    caret-color: #0a1222;
}

/* keep placeholder visible */
.textarea::placeholder {
    color: rgba(10, 18, 34, 0.55) !important;
    -webkit-text-fill-color: rgba(10, 18, 34, 0.55) !important;
}

/* Revised editor — always black text, no transparent trick needed */
#rewriteText,
.textarea-revised {
    color: #0a1222 !important;
    -webkit-text-fill-color: #0a1222 !important;
    caret-color: #0a1222 !important;
}

/* Word-hint suggestion box */
.word-hint-box {
    margin: 6px 18px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    flex-wrap: wrap;
    animation: fadeIn 0.2s ease;
    line-height: 1.4;
}

.hint-item.hint-high   { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.35);  }
.hint-item.hint-medium { background: rgba(255,140,0,.09);  border-color: rgba(255,140,0,.30);  }
.hint-item.hint-low    { background: rgba(234,179,8,.09);  border-color: rgba(234,179,8,.30);  }
.hint-item.hint-safe   { background: rgba(34,197,94,.10);  border-color: rgba(34,197,94,.30);  }

.hint-icon { font-size: 15px; flex-shrink: 0; }
.hint-item.hint-high   .hint-icon { color: #ef4444; }
.hint-item.hint-medium .hint-icon { color: #fb923c; }
.hint-item.hint-low    .hint-icon { color: #eab308; }
.hint-item.hint-safe   .hint-icon { color: #16a34a; }

.hint-msg { flex: 1; color: #991b1b !important; }
.hint-item.hint-medium .hint-msg { color: #9a3412 !important; }
.hint-item.hint-low    .hint-msg { color: #92400e !important; }
.hint-item.hint-safe   .hint-msg { color: #166534 !important; }

.hint-bad  { font-weight: 700; color: #ef4444 !important; }
.hint-item.hint-medium .hint-bad { color: #ea580c !important; }
.hint-item.hint-low    .hint-bad { color: #a16207 !important; }
.hint-item.hint-safe   .hint-bad { color: #16a34a !important; }

.hint-arrow { color: #64748b !important; margin: 0 2px; }

.hint-good { font-weight: 700; color: #16a34a !important; }

.hint-count {
    margin-left: auto;
    font-size: 11px;
    color: rgba(0,0,0,0.4);
    background: rgba(0,0,0,0.07);
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* Live percentage bar */
.live-score-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 4px;
}

.live-score-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    overflow: hidden;
}

.live-score-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease, background 0.3s ease;
    width: 0%;
}

.live-score-bar.bar-safe   { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,.4); }
.live-score-bar.bar-low    { background: #facc15; box-shadow: 0 0 8px rgba(234,179,8,.4); }
.live-score-bar.bar-medium { background: #fb923c; box-shadow: 0 0 8px rgba(251,146,60,.4); }
.live-score-bar.bar-high   { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.4); }

.live-score-text {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
}

.live-score-text.score-safe   { color: #16a34a; }
.live-score-text.score-low    { color: #a16207; }
.live-score-text.score-medium { color: #c2410c; }
.live-score-text.score-high   { color: #dc2626; }

/* Button row under textarea (replaces your old footer) */
.panel-actions {
    padding: 12px 18px 16px;
    display: flex;
    justify-content: flex-start;
}

/* Buttons */
.generate-btn {
    background: #1A2B3C;
    color: #a8c3f8;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 800;
    border: 1px solid rgba(56, 189, 248, .32);
    box-shadow: 0 0 18px rgba(56, 189, 248, .16);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.generate-btn:hover {
    border-color: rgba(56, 189, 248, .60);
    box-shadow: 0 0 26px rgba(56, 189, 248, .22);
}

/* Small icon button (copy) */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, .25);
    background: rgba(34, 211, 238, .06);
    color: #1A2B3C;
    display: grid;
    place-items: center;
}

.icon-btn:hover {
    background: rgba(34, 211, 238, .10);
    border-color: rgba(56, 189, 248, .45);
}

/* ===============================
   LAW ALERT ABOVE LEFT PANEL
================================ */
/* New Floating Law Alert */
.law-alert-container {
    max-width: 1300px;
    margin: 0 auto 24px; /* 24px gap between alert and panels */
    background: #ff2a2a;
    /*#e11d48; */
    border-radius: 20px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    box-shadow: 0 10px 15px -3px rgba(225, 29, 72, 0.3);
    animation: slideDown 0.4s ease-out;
    color: white;
}

.law-alert-icon {
    background: rgba(0, 0, 0, 0.15);
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.law-alert-content {
    flex: 1;
}

.law-alert-title {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 4px;
}

.law-alert-body {
    font-size: 16px;
    line-height: 1.4;
    opacity: 0.9;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.law-alert-body a.law-alert-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.law-alert-body a.law-alert-link:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.4);
}

.law-alert-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.law-alert-close:hover {
    opacity: 1;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure responsiveness */
@media (max-width: 1300px) {
    .law-alert-container {
        margin: 0 20px 24px;
    }
}

@media (max-width: 700px) {
    .law-alert-container {
        padding: 14px 16px;
        gap: 14px;
    }

    .law-alert-body {
        font-size: 14px;
    }

    .law-alert-body a.law-alert-link {
        white-space: normal;
    }
}

/* ===============================
   HIGHLIGHT PREVIEW BOX
================================ */

.hl-bad {
    color: var(--red);
    font-weight: 900;
    text-shadow: 0 0 16px var(--redGlow);
}

/* ===============================
   RESULT SCORE
================================ */
.result-center {
    padding: 16px 18px 18px;
}

.semi-wrap {
    position: relative;
    display: grid;
    place-items: center;
    padding: 10px 0 6px;
    border-radius: 18px;
}

.semi {
    width: 100%;
    max-width: 320px;
    height: auto;
}

.semi-track {
    fill: none;
    stroke: rgba(34, 211, 238, .22);
    stroke-width: 14;
    stroke-linecap: round;
}

.semi-progress {
    fill: none;
    stroke: #1A2B3C;
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset .25s ease, stroke .25s ease;
}

.result-text {
    position: absolute;
    top: 54%;
    transform: translateY(-50%);
    text-align: center;
    width: 100%;
}

.percentage {
    font-size: 46px;
    font-weight: 900;
    color: #0f254a;
    line-height: 1;
}

.explanation {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
    padding: 0 18px;
}

/* Green risk (1-15) */
.risk-low #progress-number {
    color: var(--green) !important;
    text-shadow: 0 0 18px var(--greenGlow);
}

.risk-low .semi-progress {
    stroke: var(--green);
    filter: drop-shadow(0 0 10px var(--greenGlow));
}

/* Orange risk (16-49) */
.risk-medium #progress-number {
    color: var(--orange) !important;
    text-shadow: 0 0 18px var(--orangeGlow);
}

.risk-medium .semi-progress {
    stroke: var(--orange);
    filter: drop-shadow(0 0 10px var(--orangeGlow));
}

/* Red risk (50+) */
.risk-high #progress-number {
    color: var(--red) !important;
    text-shadow: 0 0 18px var(--redGlow);
}

.risk-high .semi-progress {
    stroke: var(--red);
    filter: drop-shadow(0 0 10px var(--redGlow));
}

/* Change button */
.change-row {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.change-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(255, 140, 0, .08);
    border: 1px solid rgba(255, 140, 0, .50);
    color: var(--orange);
    font-weight: 900;
    letter-spacing: .02em;
    user-select: none;
    cursor: default;
}

.change-btn {
    position: relative;
    background: rgba(255, 42, 42, .08);
    border: 1px solid rgba(255, 42, 42, .50);
    color: var(--red);
    border-radius: 999px;
    padding: 12px 16px;
    font-weight: 950;
    letter-spacing: .02em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    isolation: isolate;
}

/* Green button style for low risk */
.change-btn.btn-green {
    background: rgba(34, 197, 94, .08);
    border: 1px solid rgba(34, 197, 94, .50);
    color: var(--green);
}

/* Orange button style for medium risk */
.change-btn.btn-orange {
    background: rgba(255, 140, 0, .08);
    border: 1px solid rgba(255, 140, 0, .50);
    color: var(--orange);
}

.change-btn.pulse-btn {
    animation: btnAggro 0.55s ease-in-out infinite;
    box-shadow: 0 0 18px rgba(255, 42, 42, .35);
}

.change-btn.pulse-btn::before,
.change-btn.pulse-btn::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 999px;
    border: 2px solid rgba(255, 42, 42, .65);
    opacity: 0;
    animation: ringOut 0.9s ease-out infinite;
    z-index: -1;
}

.change-btn.pulse-btn::after {
    animation-delay: .45s;
}

@keyframes btnAggro {
    0% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-2px) scale(1.03) rotate(-1deg);
    }
    50% {
        transform: translateY(1px) scale(1.06) rotate(1deg);
    }
    75% {
        transform: translateY(-1px) scale(1.03) rotate(-1deg);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes ringOut {
    0% {
        transform: scale(1);
        opacity: .85;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* ===============================
   REVISED BIG BOX UNDER PANELS
================================ */
.revised-wrap {
    max-width: 1300px;
    margin: 200px auto 60px;
    padding: 0 20px;
}

.revised-panel {
    border: 1px solid var(--border);
}

.revised-body {
    padding: 14px 18px 18px;
}

.textarea-revised {
    height: 320px;
    border-radius: 14px;
    border: 1px solid var(--softBorder);
    background: rgba(34, 211, 238, .02);
    /* In the main input box we hide textarea text (color: transparent) to render
       highlights via #hlLayer. The revised editor has no overlay, so the text
       must be visible here. */
    color: #000 !important;
    caret-color: #000 !important;
}

.textarea-revised::placeholder {
    color: rgba(0, 0, 0, 0.45) !important;
}

.revised-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.save-btn, .cancel-btn {
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 800;
    border: 1px solid rgba(56, 189, 248, .25);
    background: #0b1220;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cancel-btn {
    background: #1A2B3C;;
    color: #cad9ff;
}

.copy {

    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(34, 211, 238, .25);
    background: rgba(34, 211, 238, .06);
    color: #0b1220;
    font-weight: 800;
    font-size: 13px;
}

/* Toast */
.copy-toast {
    margin-left: 600px;
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(34, 211, 238, .25);
    background: rgba(34, 211, 238, .06);
    color: #0b1220;
    font-weight: 800;
    font-size: 13px;
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .hero-title {
        gap: 10px;
    }

    .glitch {
        letter-spacing: .02em;
    }
}

/* ── Detected bad words panel ── */
.matches-container {
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding-top: 16px;
}

.matches-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    flex-wrap: wrap;
}

.match-item.match-high   { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.25); }
.match-item.match-medium { background: rgba(255,140,0,.08);  border-color: rgba(255,140,0,.22);  }
.match-item.match-low    { background: rgba(234,179,8,.08);  border-color: rgba(234,179,8,.22);  }

.match-word {
    color: #f87171;
    font-weight: 700;
}
.match-item.match-medium .match-word { color: #fb923c; }
.match-item.match-low    .match-word { color: #facc15; }

.match-replacement {
    color: #86efac;
    font-weight: 600;
}

.match-count {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.06);
    padding: 2px 7px;
    border-radius: 20px;
}

.matches-hint {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    text-align: center;
}

/* Loading state */
.generate-btn.loading .btn-text { opacity: 0.5; }
.generate-btn.loading .btn-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
