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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.4;
    color: #333;
    background-color: #f8f9fa;
}

h2 {
    font-size: 1.1rem;
    margin: 0.1rem 0;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 0.5rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

nav h1 {
    font-size: 1.4rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    font-size: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0rem 0.7rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1001;
    border-radius: 5px;
    top: 100%;
    right: 0;
    margin-top: 0px;
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.dropdown-link {
    color: #333 !important;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
}

.dropdown-link:hover {
    background-color: #f1f1f1;
    border-radius: 5px;
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

main {
    margin-top: 40px;
    padding: 1rem;
}

section {
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 10px;
    padding: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

section:not(.upload-section):not(.public-sessions-section):not(.chat-open) {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.version-section {
    padding: 0.0rem;
}

.session-section {
    padding: 0.0rem;
}

.upload-section {
    text-align: center;
    padding-top: 0.2rem;
    border: 2px solid #3498db;
}

.upload-area {
    padding-top: 0.4rem;
}

.drop-zone {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.drop-zone.dragover {
    border-color: #3498db;
    background: #e6f3ff;
    border-style: solid;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.upload-icon {
    color: #666;
    margin-bottom: 0.25rem;
    font-size: 1.2rem;
}

.drop-text {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    margin: 0;
}

.drop-text-small {
    font-size: 0.8rem;
    font-weight: 500;
    color: #999;
    margin: 0;
}

.drop-subtext {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
}

.upload-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.or-text {
    color: #666;
    font-size: 0.8rem;
    margin: 0.3rem 0;
    font-style: italic;
    text-align: center;
}

.new-file-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.new-file-input {
    padding: 0.2rem 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    width: 150px;
}

.new-file-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.upload-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-button:hover {
    background: #2980b9;
}

.upload-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.button-text-main {
    font-size: 1rem;
    font-weight: 500;
}

.button-text-sub {
    font-size: 0.6rem;
    font-weight: 400;
    margin-top: 0.2rem;
}

#upload-status {
    margin-top: 1rem;
    font-style: italic;
    color: #666;
}

.upload-area .public-sessions-section {
    margin-top: 0rem;
    text-align: center;
    display: flex;
    justify-content: center;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 0.25rem;
    background: #f8f9fa;
}

.file-name {
    font-weight: bold;
    flex-grow: 1;
}

.clickable-filename {
    color: #3498db;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.clickable-filename:hover {
    color: #2980b9;
    text-decoration: underline;
}

.file-size {
    color: #666;
    font-size: 0.8rem;
    margin-right: 1rem;
}

.no-files-message {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 2rem 1rem;
    margin: 0;
    background: #f9f9f9;
    border-radius: 5px;
    border: 2px dashed #ddd;
}

.action-button {
    background: #27ae60;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    font-size: 0.8rem;
}

.action-button:hover {
    background: #219a52;
}

.action-button.secondary {
    background: #95a5a6;
}

.action-button.secondary:hover {
    background: #7f8c8d;
}

.run-button {
    background: #e74c3c;
}

.run-button:hover {
    background: #c0392b;
}

.delete-button {
    background: #dc3545;
}

.delete-button:hover {
    background: #c82333;
}

.button-group {
    display: flex;
    gap: 0.05rem;
    flex-wrap: wrap;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.version-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.version-selector label {
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.version-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    font-size: 12px;
    min-width: 150px;
}

.version-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.version-selector-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.version-selector-main label {
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

/* セッション機能のCSS */
.session-controls {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f0f8ff;
    border-radius: 5px;
    border: 1px solid #e0e8f0;
}

.session-save {
    margin-bottom: 0.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    color: #333;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 0.5rem;
}

.session-share {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.copy-feedback {
    font-size: 11px;
    color: #27ae60;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.copy-feedback.show {
    opacity: 1;
}

.session-restore {
    background: #fff9e6;
    border: 1px solid #f0e68c;
    border-radius: 5px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.session-restore h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 0.95rem;
}

.restore-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.session-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
}

.session-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.session-options {
    margin-top: 0.5rem;
}

.session-description {
    margin-bottom: 0.5rem;
}

.session-description label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: bold;
    color: #333;
}

.description-input {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 12px;
    resize: vertical;
}

.description-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.session-public {
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

.public-sessions-section {
    max-width: 1800px;
    margin: 0 auto;
    text-align: center;
}

.section-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}

.loading-indicator {
    text-align: center;
    padding: 1rem;
    color: #666;
}

.sessions-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.session-card {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.session-header {
    flex: 1;
    margin-right: 1rem;
}

.session-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.session-date {
    font-size: 0.7rem;
    color: #7f8c8d;
    font-weight: normal;
    text-align: left;
}

.session-meta {
    margin-bottom: 0.5rem;
}

.session-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: #666;
}

.session-id {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.session-updated {
    color: #95a5a6;
}

.session-stats {
    font-size: 0.8rem;
    color: #34495e;
}

.file-count {
    background: #e8f4f8;
    color: #2980b9;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.session-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-shrink: 0;
}

.session-actions .action-button {
    text-align: center;
    text-decoration: none;
    display: inline-block;
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
    min-width: auto;
    white-space: nowrap;
}

.session-actions .delete-button {
    background: #dc3545;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.session-actions .delete-button:hover {
    background: #c82333;
}

.no-sessions {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #666;
}

.no-sessions p {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.error-message {
    color: #e74c3c;
    font-weight: bold;
    padding: 1rem;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    text-align: center;
}

@media (max-width: 768px) {
    .sessions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .session-card {
        padding: 1rem;
        flex-direction: column;
    }
    
    .session-header {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .session-actions {
        flex-direction: row;
        gap: 0.25rem;
        justify-content: flex-end;
    }
    
    .session-actions .action-button {
        min-width: auto;
        padding: 0.3rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .session-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

.editor-section {
    background: #e8f4f8;
    border: 2px solid #3498db;
    border-radius: 10px;
}

#code-editor {
    width: 100%;
    height: 70vh;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 0.75rem;
    resize: vertical;
    background: #fafafa;
    white-space: pre;
    overflow-x: auto;
    overflow-wrap: normal;
    word-break: normal;
    -webkit-text-size-adjust: none;
    -webkit-hyphens: none;
    hyphens: none;
    text-wrap: nowrap;
    wrap: off;
}

.execution-section {
    background: #f8f9fa;
}

#execution-status {
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.status-running {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.status-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.output-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    background: white;
}

.output-file .file-name {
    font-weight: bold;
    color: #2c3e50;
}

.output-file .file-size {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.output-summary {
    padding: 0.75rem;
    background: #e8f4f8;
    border: 1px solid #b8dce8;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.output-summary p {
    margin: 0;
    color: #2c3e50;
    font-size: 0.9rem;
    line-height: 1.5;
}

.file-link {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
}

.file-link:hover {
    text-decoration: underline;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.viewer-buttons {
    display: flex;
    gap: 0.5rem;
}

#file-content {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    
    section {
        padding: 1rem;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .editor-controls {
        justify-content: center;
    }
    
    .file-item {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .viewer-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
}

/* AI Chat Panel */
.editor-section.chat-open {
    max-width: none;
}

.editor-chat-container {
    display: flex;
    gap: 0;
}

.editor-pane {
    flex: 1;
    min-width: 200px;
}

.ai-chat-btn {
    background: #8e44ad;
}

.ai-chat-btn:hover {
    background: #7d3c98;
}

.chat-divider {
    width: 6px;
    cursor: col-resize;
    background: #e0e0e0;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chat-divider:hover,
.chat-divider.dragging {
    background: #8e44ad;
}

.ai-chat-panel {
    flex: 1;
    min-width: 200px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 5px 5px 0;
    background: #fff;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #8e44ad;
    color: white;
    border-radius: 0 4px 0 0;
}

.ai-chat-title {
    font-weight: bold;
    font-size: 0.9rem;
}

.ai-chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.ai-chat-close-btn:hover {
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-welcome {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    padding: 1rem 0.5rem;
}

.chat-welcome p {
    margin-bottom: 0.75rem;
}

.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chat-suggestion-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.chat-suggestion-btn:hover {
    background: #e0e0e0;
}

.chat-message {
    max-width: 90%;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: #3498db;
    color: white;
    border-bottom-right-radius: 3px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: #f1f3f5;
    color: #333;
    border-bottom-left-radius: 3px;
}

.chat-thinking-phi {
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-phi-img {
    width: 28px;
    height: auto;
    animation: chat-phi-sway 2s ease-in-out infinite;
}
@keyframes chat-phi-sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}
.chat-thinking-dots span {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: bold;
    color: #4ab0d9;
    animation: chat-thinking-bounce 1.2s ease-in-out infinite;
}
.chat-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-thinking-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.chat-message.assistant h2,
.chat-message.assistant h3,
.chat-message.assistant h4 {
    font-size: 0.9rem;
    margin: 0.5rem 0 0.25rem;
}

.chat-message.assistant h2 {
    font-size: 0.95rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.2rem;
}

.chat-message.assistant p {
    margin: 0.3rem 0;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
    margin: 0.3rem 0;
    padding-left: 1.2rem;
}

.chat-message.assistant li {
    margin: 0.15rem 0;
}

.chat-message.assistant code {
    background: #e8e8e8;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

.chat-message.assistant pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.75rem;
    margin: 0.4rem 0;
}

.chat-message.assistant pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.chat-message.assistant strong {
    font-weight: 600;
}

.chat-message.assistant .chat-phits-code {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre;
    margin: 0.5rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.chat-diff-view {
    background: #1e1e1e;
    border-radius: 4px;
    padding: 0.5rem;
    margin-top: 0.4rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    max-height: 300px;
    overflow: auto;
    line-height: 1.4;
}

.diff-added {
    background: #1e3a1e;
    color: #4ec94e;
    white-space: pre;
}

.diff-removed {
    background: #3a1e1e;
    color: #e74c3c;
    white-space: pre;
}

.diff-unchanged {
    color: #888;
    white-space: pre;
}

.chat-apply-btn {
    display: inline-block;
    background: #27ae60;
    color: white;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    transition: background 0.2s;
}

.chat-apply-btn:hover {
    background: #219a52;
}

.chat-apply-btn.applied {
    background: #95a5a6;
    cursor: default;
}

.chat-references {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e0e0e0;
}

.chat-ref-link {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    line-height: 1.3;
}

.chat-ref-link.sample {
    background: #e8f5e9;
    color: #2e7d32;
    text-decoration: none;
    cursor: pointer;
}

.chat-ref-link.sample:hover {
    text-decoration: underline;
    background: #c8e6c9;
}

.chat-ref-link.manual {
    background: #f0f0f0;
    color: #666;
    cursor: default;
}

.chat-input-area {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem;
    border-top: 1px solid #ddd;
    background: #fafafa;
    border-radius: 0 0 4px 0;
}

.chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.chat-input:focus {
    border-color: #8e44ad;
    box-shadow: 0 0 3px rgba(142, 68, 173, 0.3);
}

.chat-send-btn {
    background: #8e44ad;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #7d3c98;
}

.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-send-btn.cancel-mode {
    background: #e74c3c;
}

.chat-send-btn.cancel-mode:hover {
    background: #c0392b;
}

.chat-voice-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    border-radius: 5px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-voice-btn:hover {
    background: #e0e0e0;
}

.chat-voice-btn.recording {
    background: #fde8e8;
    animation: voice-pulse 1s infinite;
}

@keyframes voice-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@media (max-width: 768px) {
    .editor-chat-container {
        flex-direction: column;
    }

    .chat-divider {
        display: none;
    }

    .editor-pane {
        flex: none;
    }

    .chat-open #code-editor {
        height: 40vh;
    }

    .ai-chat-panel {
        flex: none;
        width: 100%;
        height: 70vh;
        border-left: 1px solid #ddd;
        border-top: none;
        border-radius: 0 0 5px 5px;
    }

    .ai-chat-header {
        border-radius: 0;
    }

    .chat-input-area {
        border-radius: 0 0 5px 5px;
    }
}