:root {
    /* macOS Dark Mode Variables */
    --bg-main: #000000;
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.55);
    
    --accent: #0A84FF; /* Apple Blue */
    --accent-hover: #0070E5;
    
    --glass-bg: rgba(30, 30, 30, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-hover: rgba(255, 255, 255, 0.08);
    
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: rgba(255, 255, 255, 0.1);
    
    --divider: rgba(255, 255, 255, 0.1);
    
    /* Mesh Gradients */
    --mesh-1: rgba(14, 88, 235, 0.4);
    --mesh-2: rgba(171, 71, 188, 0.4);
    --mesh-3: rgba(66, 165, 245, 0.3);
}

[data-theme="light"] {
    /* macOS Light Mode Variables */
    --bg-main: #F2F2F7; /* iOS System Gray 6 */
    --text-primary: rgba(0, 0, 0, 0.9);
    --text-secondary: rgba(0, 0, 0, 0.5);
    
    --accent: #007AFF;
    --accent-hover: #0062CC;
    
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.05);
    --card-bg: rgba(255, 255, 255, 0.5);
    --card-hover: rgba(255, 255, 255, 0.8);
    
    --input-bg: rgba(255, 255, 255, 0.5);
    --input-border: rgba(0, 0, 0, 0.08);
    
    --divider: rgba(0, 0, 0, 0.08);
    
    --mesh-1: rgba(153, 192, 255, 0.7);
    --mesh-2: rgba(235, 172, 245, 0.6);
    --mesh-3: rgba(187, 222, 251, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Background macOS abstract mesh */
.apple-bg-blur {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; overflow: hidden;
}
.gradient-mesh {
    position: absolute; border-radius: 50%; filter: blur(140px);
    transition: background-color 1s ease;
}
.mesh-1 { width: 80vw; height: 80vw; background: var(--mesh-1); top: -20%; left: -10%; }
.mesh-2 { width: 70vw; height: 70vw; background: var(--mesh-2); bottom: -10%; right: -20%; }
.mesh-3 { width: 60vw; height: 60vw; background: var(--mesh-3); top: 30%; left: 40%; opacity: 0.8; }

.container { max-width: 1600px; margin: 0 auto; padding: 4rem 3rem; }

.app-header { text-align: center; margin-bottom: 3.5rem; animation: fadeDown 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.header-top { display: flex; justify-content: space-between; align-items: center; max-width: 1000px; margin: 0 auto 2rem auto; }

.badge {
    padding: 0.35rem 0.8rem; border-radius: 8px;
    background: rgba(150, 150, 150, 0.15); border: 1px solid var(--glass-border);
    color: var(--text-secondary); font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
}

.theme-switch-wrapper { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; font-size: 0.85rem; color: var(--text-secondary); }

.app-header h1 {
    font-size: 2.8rem; font-weight: 700; margin-bottom: 0.75rem;
    color: var(--text-primary); letter-spacing: -0.04em;
}
.app-header p { color: var(--text-secondary); font-size: 1.1rem; font-weight: 400; max-width: 700px; margin: 0 auto; line-height: 1.5; }

.router-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both; }
.router-grid > * { min-width: 0; max-width: 100%; }

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
[data-theme="light"] .glass-panel { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04); }

.glass-panel h2 { font-size: 1.4rem; margin-bottom: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }

/* --- DOMAIN SELECTOR --- */
.select-wrapper { position: relative; display: flex; align-items: center; }
.apple-select {
    appearance: none; -webkit-appearance: none;
    width: 100%; padding: 0.85rem 1rem; border-radius: 12px;
    background: var(--input-bg); border: 1px solid var(--input-border);
    color: var(--text-primary); font-family: inherit; font-size: 1.05rem; font-weight: 600;
    outline: none; cursor: pointer; transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.apple-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2); }
.select-chevron { position: absolute; right: 1rem; color: var(--text-secondary); pointer-events: none; font-size: 0.8rem; }

/* --- SEGMENTED CONTROL (APPLE STYLE) --- */
.segmented-control {
    display: flex; background: var(--input-bg);
    border-radius: 10px; padding: 4px; border: 1px solid var(--input-border);
    margin-bottom: 1.5rem; overflow-x: auto; white-space: nowrap;
    min-width: 0;
    max-width: 100%;
}
.segmented-control::-webkit-scrollbar { height: 0; width: 0; }
.segment-btn {
    flex: 1; background: transparent; border: none; padding: 0.6rem 1rem;
    font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    border-radius: 8px; cursor: pointer; transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-family: inherit; white-space: nowrap;
}
.segment-btn.active {
    background: var(--text-primary); color: var(--bg-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
[data-theme="light"] .segment-btn.active { background: #ffffff; color: var(--text-primary); border: 1px solid rgba(0,0,0,0.05); }

/* --- ACTIVITIES GRID CARDS --- */
.activities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.8rem; }
.activity-card {
    background: var(--card-bg); border: 1px solid var(--input-border); border-radius: 12px;
    padding: 1rem 1.25rem; cursor: pointer; position: relative;
    display: flex; flex-direction: column; gap: 0.2rem;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease, border-color 0.2s ease;
}
.activity-card:hover { background: var(--card-hover); }
.activity-card:active { transform: scale(0.98); } 
.activity-card.active { background: rgba(10, 132, 255, 0.1); border-color: var(--accent); }
.activity-card .act-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.activity-card .act-desc { font-size: 0.8rem; color: var(--text-secondary); font-weight: 400; }
[data-theme="light"] .activity-card.active { background: rgba(0, 122, 255, 0.08); }

.section-label { display: block; margin-bottom: 0.6rem; font-weight: 600; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.mb-1 { margin-bottom: 1rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 2.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 2rem !important; }
.mt-4 { margin-top: 2.5rem !important; }

/* INPUTS */
.token-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-prefix { position: absolute; left: 1rem; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
input[type="number"] {
    width: 100%; padding: 0.9rem 1rem 0.9rem 3rem; border-radius: 10px;
    background: var(--input-bg); border: 1px solid var(--input-border);
    color: var(--text-primary); font-family: inherit; font-size: 1rem; font-weight: 500;
    outline: none; transition: border-color 0.3s, box-shadow 0.3s;
}
input[type="number"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2); }

/* RADIO CARDS */
.radio-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.radio-card { cursor: pointer; position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.card-content {
    background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 10px;
    padding: 0.8rem 0.5rem; text-align: center; transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex; flex-direction: column; gap: 0.2rem;
}
.card-content strong { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.card-content span { font-size: 0.7rem; color: var(--text-secondary); font-weight: 500; }
.radio-card input:checked + .card-content { background: rgba(10, 132, 255, 0.1); border-color: var(--accent); }
.radio-card:active .card-content { transform: scale(0.96); }

/* TOGGLE SWITCH */
.toggle-group { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: var(--input-bg); border-radius: 10px; border: 1px solid var(--input-border); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--input-border); transition: .3s cubic-bezier(0.2, 0.8, 0.2, 1); border: 1px solid transparent; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 2px; bottom: 1px; background-color: #fff; transition: .3s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: #34C759; border-color: #34C759; }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.divider { border: 0; height: 1px; background: var(--divider); margin: 2rem 0; }

/* RESULT CARDS */
.result-cards { display: flex; flex-direction: column; gap: 1rem; }
.result-card { background: var(--card-bg); border: 1px solid var(--glass-border); border-radius: 14px; padding: 1.25rem; transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.result-card:hover { transform: translateY(-2px); }
.card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.card-header .icon { font-size: 1.1rem; }
.card-header h3 { font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin: 0; }

.res-value { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; color: var(--text-primary); letter-spacing: -0.02em; }
.res-sub { font-size: 0.85rem; color: var(--text-secondary); font-weight: 400; display: block; line-height: 1.4; }
.res-value.mono { font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace; color: var(--accent); background: var(--input-bg); padding: 0.2rem 0.5rem; border-radius: 6px; display: inline-block; font-size: 0.9rem; border: 1px solid var(--input-border); word-break: break-all; white-space: normal; }

/* COST DISPLAY */
.cost-card { background: rgba(52, 199, 89, 0.05); border-color: rgba(52, 199, 89, 0.2); }
[data-theme="light"] .cost-card { background: rgba(52, 199, 89, 0.1); }
.cost-display { display: flex; align-items: baseline; gap: 0.2rem; margin-bottom: 0.2rem; }
.cost-currency { font-size: 1.2rem; font-weight: 600; color: #34C759; }
.cost-amount { font-size: 2.2rem; font-weight: 700; color: #34C759; letter-spacing: -0.03em; }

/* NOTICE */
.notice-box { padding: 1rem; border-radius: 10px; background: rgba(255, 149, 0, 0.1); border: 1px solid rgba(255, 149, 0, 0.2); color: #FF9500; font-size: 0.85rem; font-weight: 500; line-height: 1.5; }
[data-theme="light"] .notice-box { color: #D07A00; }

/* --- MANIFESTO ACCORDION (V10) --- */
.manifesto-section { padding: 0; margin-bottom: 4rem; }
.accordion { overflow: hidden; padding: 0; }
.accordion-header {
    padding: 1.5rem 2rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    background: transparent; transition: background 0.3s ease;
}
.accordion-header:hover { background: var(--card-hover); }
.accordion-header .header-content { display: flex; align-items: center; gap: 0.8rem; }
.accordion-header .icon { font-size: 1.2rem; color: var(--accent); }
.accordion-header h3 { font-size: 1.1rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; color: var(--text-primary); }
.accordion-header .chevron { color: var(--text-secondary); transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }

.accordion.open .chevron { transform: rotate(180deg); }

.accordion-body {
    max-height: 0; opacity: 0; overflow: hidden;
    transition: max-height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
    border-top: 1px solid transparent;
}
.accordion.open .accordion-body {
    max-height: 1200px; opacity: 1; border-top-color: var(--glass-border);
}

/* WIKI TABS */
.wiki-tabs { display: flex; border-bottom: 1px solid var(--divider); padding: 0 1rem; margin-top: 0.5rem; overflow-x: auto; }
.wiki-tabs::-webkit-scrollbar { height: 0; width: 0; }
.wiki-tab-btn {
    background: none; border: none; padding: 1rem 1.5rem; color: var(--text-secondary);
    font-size: 0.9rem; font-weight: 600; cursor: pointer; position: relative;
    transition: color 0.3s ease; font-family: inherit; white-space: nowrap;
}
.wiki-tab-btn:hover { color: var(--text-primary); }
.wiki-tab-btn.active { color: var(--text-primary); }
.wiki-tab-btn::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
    background: var(--accent); transform: scaleX(0); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.wiki-tab-btn.active::after { transform: scaleX(1); }

/* WIKI CONTENT */
.wiki-content { padding: 2rem; }
.wiki-pane { display: none; animation: fadeInSlide 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.wiki-pane.active { display: block; }
.wiki-pane h4 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--text-primary); letter-spacing: -0.01em; }
.wiki-pane p { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1.2rem; }
.wiki-pane ul { margin-left: 1.2rem; margin-bottom: 1.5rem; color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }
.wiki-pane li { margin-bottom: 0.5rem; }
.clean-list-spaced li { margin-bottom: 0.8rem; }
.text-small { font-size: 0.8rem !important; }

/* CODE BLOCK */
.code-block {
    background: var(--input-bg); border: 1px solid var(--input-border);
    border-radius: 10px; padding: 1.5rem; font-family: "SF Mono", monospace;
    font-size: 0.85rem; color: var(--text-primary); overflow-x: auto;
    line-height: 1.5; tab-size: 4; margin: 1rem 0;
}

/* --- EXAMPLES CARD & LIST --- */
.examples-card {
    background: rgba(10, 132, 255, 0.02);
    border-color: rgba(10, 132, 255, 0.15);
}
[data-theme="light"] .examples-card {
    background: rgba(0, 122, 255, 0.04);
    border-color: rgba(0, 122, 255, 0.15);
}
.examples-list {
    margin-left: 1.25rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    list-style-type: disc;
}
.examples-list li {
    padding-left: 0.25rem;
}
.examples-list li strong {
    font-weight: 600;
}

@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInSlide { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- MEDIA QUERIES (MOBILE PERFECTION) --- */
@media (max-width: 992px) {
    .router-grid { grid-template-columns: 1fr; gap: 2rem; }
    .panel { padding: 2rem; }
}

@media (max-width: 768px) {
    .container { padding: 1.5rem 1rem; }
    
    .header-top { flex-direction: column; gap: 1rem; align-items: stretch; text-align: center; margin-bottom: 2rem; }
    .header-top .theme-switch-wrapper { justify-content: center; margin-top: 0.5rem; }
    
    .app-header { margin-bottom: 2rem; }
    .app-header h1 { font-size: 2.2rem; }
    .app-header p { font-size: 1rem; padding: 0 0.5rem; }
    
    .panel { padding: 1.25rem; border-radius: 16px; }
    
    .segmented-control { border-radius: 8px; padding: 4px; }
    .segment-btn { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
    
    .activities-grid { grid-template-columns: 1fr; }
    
    .radio-group { display: flex; flex-direction: column; gap: 0.8rem; }
    .radio-card { width: 100%; }
    
    .token-inputs { display: flex; flex-direction: column; gap: 1rem; }
    
    .result-cards { gap: 1rem; }
    .result-card { padding: 1.25rem; }
    
    /* Document/Manifesto Mobile */
    .wiki-tabs { 
        flex-direction: column; 
        padding: 0; 
        border: 1px solid var(--input-border); 
        border-radius: 12px; 
        margin: 1rem 0;
        background: var(--input-bg);
    }
    .wiki-tab-btn { 
        border-bottom: 1px solid var(--input-border); 
        border-radius: 0; 
        text-align: left; 
        padding: 1rem;
    }
    .wiki-tab-btn:last-child { border-bottom: none; }
    .wiki-tab-btn.active::after { display: none; }
    .wiki-tab-btn.active { background: var(--input-border); color: var(--text-primary); }
    .wiki-pane { padding: 1.5rem 1rem; }
    
    .code-block { font-size: 0.75rem; padding: 1rem; overflow-x: auto; max-width: 100%; }
}

/* --- FLOATING BUTTON (FAB) --- */
.prd-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 24px rgba(10, 132, 255, 0.4);
    cursor: pointer;
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s;
    outline: none;
}
.prd-fab:hover {
    transform: scale(1.08) translateY(-2px);
    background: #0070E5;
}
.prd-fab:active {
    transform: scale(0.96);
}
.prd-fab .icon {
    font-size: 1.6rem;
}
.prd-fab .badge-fab {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #34C759;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    border: 1px solid var(--bg-main);
}

/* --- BACKDROP & MODAL --- */
.prd-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.prd-backdrop.show {
    display: block;
    opacity: 1;
}

.prd-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.95);
    width: 90%;
    max-width: 600px;
    height: 70vh;
    max-height: 650px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    padding: 1.5rem !important;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important;
}
.prd-modal.show {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.prd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--divider);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}
.prd-modal-header .header-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.prd-modal-header .header-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.prd-modal-header .icon {
    font-size: 1.2rem;
    color: var(--accent);
}
.prd-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    outline: none;
}
.prd-close-btn:hover {
    color: var(--text-primary);
}

/* Chat Area */
.prd-chat-history {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}
.prd-chat-history::-webkit-scrollbar {
    width: 6px;
}
.prd-chat-history::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
.prd-chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Chat Bubbles */
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeInSlide 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.chat-msg.user {
    align-self: flex-end;
}
.chat-msg.assistant {
    align-self: flex-start;
}
.msg-bubble {
    padding: 0.8rem 1rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}
.chat-msg.user .msg-bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant .msg-bubble {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.msg-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}
.chat-msg.user .msg-time {
    align-self: flex-end;
}

/* Code block actions in assistant messages */
.chat-msg.assistant pre {
    margin-top: 0.8rem;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
}
.copy-md-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    outline: none;
}
.copy-md-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.copy-md-btn:active {
    transform: scale(0.96);
}

/* Input Area */
.prd-chat-input-area {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 10px 14px;
    border-radius: 14px;
}
.prd-chat-input-area textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    min-height: 70px;
    height: 70px;
    max-height: 180px;
    line-height: 1.45;
    padding: 4px 0;
    box-sizing: border-box;
}
.prd-send-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    flex-shrink: 0;
    margin-bottom: 2px;
    outline: none;
}
.prd-send-btn:hover {
    background: #0070E5;
    transform: scale(1.08);
}
.prd-send-btn:active {
    transform: scale(0.95);
}
.prd-send-btn .send-icon {
    font-size: 0.8rem;
    line-height: 1;
}

@media (max-width: 576px) {
    .prd-fab {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
    }
    .prd-fab .icon {
        font-size: 1.4rem;
    }
    .prd-modal {
        height: 85vh;
        max-height: 90%;
        bottom: 0;
        top: auto;
        transform: translate(-50%, 20px) scale(0.95);
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        width: 100%;
        max-width: 100%;
    }
    .prd-modal.show {
        transform: translate(-50%, 0) scale(1);
    }
}

/* --- LAST PRD BUTTON --- */
.last-prd-btn {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: none; /* Shown dynamically if cached PRD exists */
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}
.last-prd-btn:hover {
    background: var(--input-border);
    transform: translateY(-1px);
}
.last-prd-btn:active {
    transform: translateY(0);
}
