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

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;
    --border-color: #404040;
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --info: #60a5fa;
    --user-msg: #3b82f6;
    --assistant-msg: #e0e0e0;
}

body {
    font-family: 'Consolas', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
}

#chat-container::-webkit-scrollbar {
    width: 8px;
}

#chat-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

#chat-container::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

#chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

.chat-history {
    max-width: 1200px;
    margin: 0 auto;
}

.message {
    margin-bottom: 16px;
    animation: fadeIn 0.2s ease-in;
}

.tool-message {
    margin-bottom: 0;
}

.tool-result {
    margin-top: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    display: flex;
    gap: 0;
    color: var(--text-muted);
}

.user-message .message-prefix {
    width: 2ch;
    color: var(--text-muted);
    flex-shrink: 0;
}

.user-message .message-content {
    flex: 1;
    color: var(--text-muted);
    white-space: pre-wrap;
}

.assistant-message {
    color: #d4a017;
    padding-left: 2ch;
    position: relative;
    background-image: linear-gradient(to right, transparent 0px, transparent calc(1ch - 5px), #d4a017 calc(1ch - 5px), #d4a017 calc(1ch - 4px), transparent calc(1ch - 4px));
    background-repeat: repeat-y;
    background-position: left top;
}

.system-line {
    display: flex;
    gap: 8px;
    color: var(--text-secondary);
    margin: 4px 0;
}

.pipe-prefix {
    color: var(--text-muted);
}

.text-line {
    margin: 4px 0;
}

.tool-message {
    margin-top: 12px;
    display: flex;
    gap: 0;
}

.tool-message .message-prefix {
    width: 2ch;
    color: var(--text-muted);
    flex-shrink: 0;
    padding-bottom: 1px;
}

.tool-bullet-success {
    color: var(--success) !important;
}

.tool-bullet-error {
    color: var(--error) !important;
}

.tool-bullet-pending {
    color: #888 !important;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

.tool-content {
    flex: 1;
}

.tool-header {
    color: var(--text-muted);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    word-break: break-word;
}

.tool-result {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    margin-left: 2ch;
}

.result-line {
    color: var(--success);
    margin: 2px 0;
}

.file-content-result {
    margin-left: 2ch;
}

.file-content {
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    white-space: pre;
    overflow-x: auto;
    line-height: 1.4;
}

.diff-line {
    margin: 0;
    padding: 0;
    white-space: pre;
    font-family: 'Consolas', 'Courier New', monospace;
    display: flex;
    line-height: 1.4;
}

.diff-line-number {
    color: var(--text-muted);
    user-select: none;
    flex-shrink: 0;
    text-align: right;
    min-width: 3ch;
    padding-right: 1ch;
    border-right: 1px solid var(--border-color);
    margin-right: 1ch;
}

.diff-line-content {
    flex: 1;
    white-space: pre;
}

.diff-add {
    color: var(--success);
}

.diff-add .diff-line-content {
    color: var(--success);
}

.diff-remove {
    color: var(--error);
}

.diff-remove .diff-line-content {
    color: var(--error);
}

.batch-separator {
    height: 1.4em;
}

.show-more-link {
    color: var(--info);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.show-more-link:hover {
    color: var(--text-primary);
}

.file-chevron {
    cursor: pointer;
    user-select: none;
    font-size: 0.75em;
}

.clickable-header {
    cursor: pointer;
    user-select: none;
}

.clickable-header:hover {
    opacity: 0.8;
}

.success {
    color: var(--success);
}

.error {
    color: var(--error);
}

.error-message {
    margin-top: 12px;
}

.error-hint {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.checklist {
    margin: 12px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--info);
}

.checklist-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.checklist-item {
    margin: 6px 0;
    padding: 4px 0;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.checklist-item.completed .checkbox {
    color: var(--success);
}

.checklist-item.pending .checkbox {
    color: var(--text-muted);
}

.checklist-item.skipped .checkbox {
    color: var(--text-muted);
}

.checkbox {
    font-family: 'Courier New', monospace;
}

.progress-line {
    color: var(--info);
    font-weight: 500;
    margin: 8px 0;
}

.completion-line {
    color: var(--success);
    font-weight: 500;
    margin: 8px 0;
}

.loading-message {
    display: flex;
    align-items: center;
    min-height: 40px;
}

.loading-bubble {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 18px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.mode-transition {
    color: var(--text-muted);
    font-style: italic;
    margin: 12px 0;
}

.begin-execution-checklist {
    margin: 12px 0;
    padding-left: 0;
}

.execution-checklist-item {
    color: #60a5fa;
    margin: 4px 0;
    display: flex;
    gap: 8px;
}

.execution-checkbox {
    font-family: 'Courier New', monospace;
    color: #60a5fa;
}

.mark-complete-message {
    margin: 12px 0;
    padding-left: 0;
}

.mark-complete-message .completion-line,
.mark-complete-message .progress-line {
    color: #60a5fa;
    margin: 4px 0;
}

.plan-approval-message {
    margin: 20px 0;
}

/* Clean plan box design */
.plan-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--info);
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.plan-header {
    font-size: 1em;
    font-weight: 600;
    color: var(--info);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-description {
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.plan-checklist {
    margin: 0;
}

.plan-checklist-item {
    display: flex;
    gap: 10px;
    margin: 6px 0;
    line-height: 1.6;
    align-items: flex-start;
}

.plan-checkbox {
    color: var(--info);
    font-family: 'Courier New', monospace;
    font-size: 1em;
    flex-shrink: 0;
    opacity: 0.7;
}

.plan-item-content {
    color: var(--text-secondary);
    flex: 1;
}

/* Approval question - simple terminal style */
.approval-question {
    color: var(--info);
    font-weight: 500;
    margin-top: 12px;
    padding-left: 2ch;
}

/* Task start notification - subtle background highlight */
.task-start-notification {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(96, 165, 250, 0.15);
    border-left: 4px solid var(--info);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-start-icon {
    color: var(--info);
    font-size: 1.2em;
    font-weight: bold;
}

.task-start-content {
    color: var(--text-primary);
    flex: 1;
}

/* Task completion notification - checkmark and strikethrough */
.task-complete-notification {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(74, 222, 128, 0.1);
    border-left: 4px solid var(--success);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-complete-icon {
    color: var(--success);
    font-size: 1.2em;
    font-weight: bold;
}

.task-complete-content {
    color: var(--text-secondary);
    flex: 1;
    text-decoration: line-through;
}

/* Review start notification - gold/amber background */
.review-start-notification {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.15);
    border-left: 4px solid #d97706;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.review-start-icon {
    color: #d97706;
    font-size: 1.2em;
    font-weight: bold;
}

.review-start-content {
    color: var(--text-primary);
    flex: 1;
}

/* Review end notification - gold/amber styling with checkmark */
.review-end-notification {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.1);
    border-left: 4px solid #d97706;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.review-end-icon {
    color: #d97706;
    font-size: 1.2em;
    font-weight: bold;
}

.review-end-content {
    color: var(--text-secondary);
    flex: 1;
}

#input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 16px 16px 16px calc(12px + 2.5ch);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

#input-container::before {
    content: '> ';
    position: absolute;
    left: calc(12px + 0.5ch);
    top: 16px;
    color: white;
    pointer-events: none;
    z-index: 1;
}

#message-input {
    width: 100%;
    max-width: none;
    margin: 0;
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    resize: none;
    overflow-y: hidden;
    line-height: 1.6;
    max-height: calc(1.6em * 6);
}

#message-input:focus {
    outline: none;
}

#message-input::placeholder {
    color: var(--text-muted);
}

#message-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#scroll-to-bottom {
    position: fixed;
    bottom: calc(32px + 1.6em + 10px); /* input container padding (16px + 16px) + line height + 10px gap */
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#scroll-to-bottom:hover {
    background: var(--border-color);
    transform: translateX(-50%) scale(1.1);
}
