﻿
    .prw-wrapper {
        --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
        --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
        display: flex;
        justify-content: center;
        padding: clamp(0px, 5vw, 0px) 20px;
    }

    .prw-panel {
        position: relative;                
        width: 100%;
        max-width: 1100px;
        border-radius: 28px;
        padding: clamp(28px, 5vw, 56px);
        overflow: hidden;
    }

    /* ---------- HERO ---------- */
    .prw-hero { text-align: center; position: relative; z-index: 2; margin-bottom: 36px; padding: 20px 0 10px 0; }
    .hero-ambient-glow {
        position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
        width: 600px; height: 300px; background: radial-gradient(circle, color-mix(in srgb, var(--primary-color) 20%, transparent) 0%, var(--primary-glow) 40%, transparent 70%);
        filter: blur(50px); pointer-events: none; z-index: -1; border-radius: 50%;
    }
    .prw-hero-badge {
        display: inline-flex; align-items: center; gap: 8px;
        font-size: 12px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase;
        color: var(--primary-color); background: var(--primary-light);
        padding: 8px 20px; border-radius: 100px; margin-bottom: 24px;
        border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
        box-shadow: 0 4px 16px color-mix(in srgb, var(--primary-color) 12%, transparent);
        backdrop-filter: blur(8px);
    }
    .badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary-color); box-shadow: 0 0 10px var(--primary-color); animation: pulseDot 2s infinite; }
    @keyframes pulseDot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.6; } }

    .prw-hero-title { font-size: clamp(36px, 5.5vw, 56px); font-weight: 900; line-height: 1.1; letter-spacing: -0.035em; color: var(--text-main); margin-bottom: 18px; }
    .prw-hero-title em { font-style: normal; background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end)); -webkit-background-clip: text; background-clip: text; color: transparent; }
    .prw-hero-desc { font-size: 16px; color: var(--text-muted); font-weight: 500; max-width: 580px; margin: 0 auto 24px auto; line-height: 1.6; }

    .hero-features-belt { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
    .hfb-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-main); background: var(--bg-body); padding: 7px 16px; border-radius: 100px; border: 1px solid var(--border-color); box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
    .hfb-icon { width: 14px; height: 14px; color: var(--primary-color); }

    /* ---------- OPTIONS BAR ---------- */
    .prw-options-bar {
        display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
        margin-bottom: 34px;
    }

    .prw-ob-sep { width: 1px; height: 24px; background: var(--border-color); }
    
    .spg-usage-pill { 
        display: flex; align-items: center; gap: 8px; background: var(--card-bg); 
        padding: 6px 14px; border-radius: 100px; border: 1px solid var(--border-color); 
        font-size: 12px; font-weight: 700; color: var(--text-main); 
        box-shadow: 0 2px 8px rgba(0,0,0,0.02); 
    }
    .sup-dots { display: flex; gap: 4px; }
    .sup-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-color); }
    .sup-dot.used { background: var(--primary-color); }
    .sup-warn { color: #ef4444; font-weight: 800; }

    /* Custom Dropdowns */
    .custom-dropdown-wrapper, .custom-dropdown { position: relative; }
    .cd-trigger {
        display: flex; align-items: center; gap: 8px; background: var(--card-bg); border: 1px solid var(--border-color);
        border-radius: 10px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; color: var(--text-main); cursor: pointer; transition: all 0.2s;
    }
    .cd-trigger:hover { border-color: var(--primary-color); }
    .cd-trigger.open { border-color: var(--primary-color); background: var(--primary-light); color: var(--primary-color); }
    .cd-chevron { width: 13px; height: 13px; color: var(--text-muted); transition: transform 0.2s; margin-left: auto; }
    .cd-trigger.open .cd-chevron { transform: rotate(180deg); }

    .cd-menu {
        position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px; background: var(--card-bg); border: 1px solid var(--border-color);
        border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,0.12); z-index: 200; overflow: hidden;
    }
    .cd-search-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-color); }
    .cd-search-box input { flex: 1; border: none; background: transparent; color: var(--text-main); font-size: 13px; font-weight: 600; outline: none; }
    .cd-list { max-height: 250px; overflow-y: auto; padding: 6px; }
    .cd-list::-webkit-scrollbar { width: 4px; }
    .cd-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
    .cd-group-lbl { padding: 6px 10px; font-size: 10px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
    .cd-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s; font-size: 13px; color: var(--text-main); }
    .cd-item:hover { background: var(--bg-body); }
    .cd-item.selected, .cd-item.active { background: var(--primary-light); color: var(--primary-color); font-weight: 700; }
    .cd-item-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .cd-lang-code { font-family: monospace; font-size: 10px; font-weight: 800; color: var(--text-muted); background: var(--bg-body); padding: 2px 5px; border-radius: 4px; border: 1px solid var(--border-color); flex-shrink: 0; }
    .cd-item.selected .cd-lang-code { color: var(--primary-color); border-color: color-mix(in srgb, var(--primary-color) 40%, transparent); background: var(--card-bg); }
    .cd-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cd-item-main { display: flex; flex-direction: column; gap: 2px; }
    .cd-desc { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
    .cd-check { width: 14px; height: 14px; color: var(--primary-color); margin-left: auto; flex-shrink: 0; }
    .cd-divider { height: 1px; background: var(--border-color); margin: 6px 0; }
    .cd-no-results { padding: 12px; text-align: center; font-size: 12px; color: var(--text-muted); font-style: italic; }

    .dir-btn {
        display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px;
        border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-muted); cursor: pointer; transition: all 0.2s;
    }
    .dir-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
    .dir-btn.active, .dir-btn.rtl { color: var(--primary-color); background: var(--primary-light); border-color: var(--primary-color); }

    /* ---------- STACK CONTAINER UI ---------- */
    .tool-widget { display: flex; flex-direction: column; gap: 20px; margin-bottom: 45px; }
    
    .stack-container { display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 24px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.02); }
    
    /* Draft Box */
    .draft-box { padding: 28px 32px; background: rgba(var(--bg-body-rgb, 245,245,245), 0.5); position: relative; }
    
    .box-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
    .box-title { font-size: 14.5px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
    .box-title.out { color: var(--success, #10b981); }
    
    .ep-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    .ep-btn {
        background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-muted);
        font-size: 11.5px; font-weight: 700; padding: 5px 9px; border-radius: 7px;
        display: inline-flex; align-items: center; gap: 5px; cursor: pointer; transition: all 0.2s;
    }
    .ep-btn:hover { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-light); }
    .ep-btn i, .ep-btn svg { width: 12.5px; height: 12.5px; flex-shrink: 0; }

    /* Variations Pills */
    .var-pills-wrap { display: flex; gap: 4px; background: var(--bg-body); padding: 2px; border-radius: 8px; border: 1px solid var(--border-color); }
    .var-pill-btn {
        padding: 3px 8px; font-size: 11px; font-weight: 800; border: none; background: transparent;
        color: var(--text-muted); border-radius: 6px; cursor: pointer; transition: all 0.15s;
    }
    .var-pill-btn:hover { color: var(--text-main); }
    .var-pill-btn.active { background: var(--primary-color); color: #fff; }

    /* View Mode Toggle (Clean vs Diff) */
    .view-mode-toggle { display: flex; gap: 3px; background: var(--bg-body); padding: 2px; border-radius: 8px; border: 1px solid var(--border-color); }
    .vmt-btn {
        padding: 3px 8px; font-size: 11px; font-weight: 800; border: none; background: transparent;
        color: var(--text-muted); border-radius: 6px; cursor: pointer; transition: all 0.15s;
    }
    .vmt-btn:hover { color: var(--text-main); }
    .vmt-btn.active { background: var(--card-bg); color: var(--primary-color); box-shadow: 0 2px 4px rgba(0,0,0,0.04); }
    
    .draft-input {
        width: 100%; min-height: 160px; background: var(--bg-body); border: 1px solid var(--border-color);
        border-radius: 16px; padding: 18px 20px; padding-bottom: 38px; font-size: 15px; font-weight: 500;
        color: var(--text-main); line-height: 1.7; resize: vertical; outline: none; transition: all 0.2s; font-family: inherit; box-sizing: border-box;
    }
    .draft-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-light); }
    
    .word-counter { position: absolute; bottom: 42px; right: 44px; font-size: 11.5px; font-weight: 800; color: var(--text-muted); background: var(--card-bg); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border-color); transition: all 0.2s; }
    [dir="rtl"] .word-counter { right: auto; left: 44px; }
    .word-counter.over { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.1); }

    /* Control Belt */
    .control-belt {
        display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
        padding: 16px 28px; background: var(--bg-body); border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
    }
    
    /* Tone Pills Bar */
    .tone-pills-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    .tone-pill {
        display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 12px; font-weight: 700;
        border-radius: 8px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-muted);
        cursor: pointer; transition: all 0.15s;
    }
    .tone-pill:hover { border-color: var(--primary-color); color: var(--primary-color); }
    .tone-pill.active { background: var(--primary-light); color: var(--primary-color); border-color: var(--primary-color); font-weight: 800; }
    
    .generate-btn {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end));
        color: #fff; border: none; border-radius: 10px; padding: 10px 22px; font-size: 14px;
        font-weight: 800; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
        transition: transform 0.15s, box-shadow 0.15s; margin-left: auto;
    }
    .generate-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary-color) 35%, transparent); }
    .generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .generate-btn.loading .spin-icon { animation: spin 1s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Revision Box */
    .revision-box { padding: 28px 32px; background: var(--card-bg); transition: box-shadow 0.3s; position: relative; }
    .revision-box.active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary-color) 30%, transparent); }
    
    .output-board {
        width: 100%; min-height: 160px; background: var(--bg-body); border: 1px solid var(--border-color);
        border-radius: 16px; padding: 20px; font-size: 15.5px; font-weight: 500; color: var(--text-main);
        line-height: 1.75; position: relative; white-space: pre-wrap; box-sizing: border-box;
    }
    .output-placeholder { color: var(--text-muted); font-style: italic; opacity: 0.6; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 120px; gap: 10px; text-align: center; font-weight: 700; }

    /* Diff Highlighting */
    .diff-highlight.diff-new {
        background: rgba(16, 185, 129, 0.15); color: #10b981; font-weight: 700;
        padding: 1px 4px; border-radius: 4px; border-bottom: 2px solid #10b981;
    }
    .diff-same { color: var(--text-main); }

    /* Streaming Cursor */
    .streaming-cursor { display: inline-block; width: 6px; height: 16px; background: var(--primary-color); margin-left: 3px; animation: blink 0.8s infinite; vertical-align: middle; }
    [dir="rtl"] .streaming-cursor { margin-left: 0; margin-right: 3px; }
    @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

    /* ---------- STATS STRIP ---------- */
    .stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 45px; }
    .stats-sc { background: var(--card-bg); border-radius: 16px; padding: 18px; border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; text-align: center; }
    .stats-ico { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
    .stats-ico.cr { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
    .stats-ico.cb { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
    .stats-ico.cg { background: rgba(16, 185, 129, 0.1); color: #10b981; }
    .stats-ico.cp { background: var(--primary-light); color: var(--primary-color); }
    .stats-val { font-size: 24px; font-weight: 900; color: var(--text-main); line-height: 1; margin-bottom: 4px; }
    .stats-lbl { font-size: 12px; font-weight: 700; color: var(--text-muted); }

    /* ── Comparison Panel & Analytics ── */
    .comparison-panel {
        background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px;
        padding: 24px; margin-top: 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.02); margin-bottom: 40px;
    }
    .cp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
    .cp-title { font-size: 15px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
    .cp-badge { font-size: 11.5px; font-weight: 800; padding: 4px 12px; border-radius: 100px; }
    .badge-high { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
    .badge-med { background: var(--primary-light); color: var(--primary-color); border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent); }

    .cp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
    .cp-card { background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
    .cpc-header { display: flex; justify-content: space-between; align-items: center; }
    .cpc-title { font-size: 13px; font-weight: 800; color: var(--text-main); }
    .cpc-tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; }
    .cpc-tag.increased { background: var(--primary-light); color: var(--primary-color); }
    .cpc-tag.decreased { background: rgba(236, 72, 153, 0.1); color: var(--pink, #ec4899); }
    .cpc-tag.equal { background: var(--card-bg); color: var(--text-muted); border: 1px solid var(--border-color); }
    .cpc-tag.success { background: rgba(16, 185, 129, 0.1); color: #10b981; }

    .cpc-body { display: flex; flex-direction: column; gap: 8px; }
    .cpc-stat-row { font-size: 12.5px; color: var(--text-muted); display: flex; justify-content: space-between; }
    .cpc-stat-row strong { color: var(--text-main); font-weight: 700; }
    .cpc-progress-bar { width: 100%; height: 6px; background: var(--border-color); border-radius: 100px; overflow: hidden; margin-top: 2px; }
    .cpc-progress-fill { height: 100%; background: var(--primary-color); border-radius: 100px; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
    .cpc-progress-fill.bg-gradient { background: linear-gradient(90deg, var(--primary-color), var(--primary-gradient-end)); }

    /* ---------- HISTORY SECTION ---------- */
    .prw-history-section {
        background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px;
        padding: 22px; margin-bottom: 40px;
    }
    .prw-history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
    .prw-history-title { font-size: 14.5px; font-weight: 800; color: var(--text-main); margin: 0; display: flex; align-items: center; gap: 8px; }
    .prw-clear-btn { background: transparent; border: none; font-size: 12px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
    .prw-clear-btn:hover { color: #ef4444; }

    .prw-history-list { display: flex; flex-direction: column; gap: 8px; }
    .prw-history-item {
        display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
        border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-body);
        cursor: pointer; transition: all 0.2s;
    }
    .prw-history-item:hover { border-color: var(--primary-color); background: var(--card-bg); }
    .prw-history-info { flex: 1; min-width: 0; }
    .prw-history-domain { font-size: 13.5px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .prw-history-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
    .prw-history-badge { background: var(--card-bg); border: 1px solid var(--border-color); padding: 2px 7px; border-radius: 5px; font-weight: 800; color: var(--primary-color); font-size: 10.5px; }
    .prw-history-del-btn {
        background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px;
        border-radius: 6px; transition: all 0.2s;
    }
    .prw-history-del-btn:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

    /* ---------- BENTO BOX FEATURES CLUSTER ---------- */
    .console-features { width: 100%; }
    .bento-features-cluster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
    @media(max-width: 800px) { .bento-features-cluster { grid-template-columns: 1fr; } }
    .bento-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 20px; padding: 24px; position: relative; overflow: hidden; }
    .bc-wide-top { grid-column: span 2; }
    .bc-wide-mid { grid-column: span 2; }
    .bc-tall { grid-row: span 2; }
    @media(max-width: 800px) { .bc-wide-top, .bc-wide-mid, .bc-tall { grid-column: span 1; grid-row: span 1; } }

    .dashed-ring-wrapper { margin-bottom: 14px; }
    .bc-icon-wrapper { width: 40px; height: 40px; border-radius: 11px; background: var(--primary-light); color: var(--primary-color); display: flex; align-items: center; justify-content: center; }
    .bc-icon-wrapper i, .bc-icon-wrapper svg { width: 18px; height: 18px; }
    .bc-title { font-size: 16px; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
    .bc-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; }