:root {
    --primary-color: #5a4a42;
    --secondary-color: #8e7b6d;
    --accent-color: #d7b99f;
    --light-accent: #f5e9dd;
    --text-color: #333333;
    --light-text: #f5f5f5;
    --background: #f8f4f1;
    --chat-bubble-user: #e9f3ff;
    --chat-bubble-ai: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --feedback-good: #4CAF50;
    --feedback-close: #ff9800;
    --feedback-bad: #f44336;
    --app-height: 100vh;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

@supports (height: 100dvh) {
    :root {
        --app-height: 100dvh;
    }
}

html {
    height: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-color);
    height: var(--app-height);
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px var(--shadow);
    flex-shrink: 0;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.cafe-icon {
    font-size: 1.5rem;
}

.container {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    min-height: 0;
}

.character-panel {
    width: 300px;
    background-color: var(--light-accent);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    position: relative;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* モデル選択スタイル */
.model-selection {
    width: 100%;
    background-color: white;
    padding: 0.75rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 0;
}

.model-selection h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    text-align: center;
}

.model-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.model-dropdown {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
    background-color: white;
    color: var(--text-color);
    cursor: pointer;
    flex: 1 1 120px;
}

.model-dropdown:focus {
    outline: none;
    border-color: var(--accent-color);
}

.model-dropdown:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.model-status .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning-color);
}

.model-status.ready .status-indicator {
    background-color: var(--success-color);
}

.model-status.error .status-indicator {
    background-color: var(--error-color);
}

.conversation-history {
    width: 100%;
    padding: 0.25rem 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.conversation-history h3 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--primary-color);
    text-align: left;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    flex: 1;
}

.conversation-list::-webkit-scrollbar {
    width: 6px;
}

.conversation-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 10px;
}

.conversation-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.conversation-item {
    width: auto;
    flex: 1;
    min-width: 0;
    border: none;
    border-radius: 0;
    padding: 0.35rem 0;
    background-color: transparent;
    text-align: left;
    font-size: 0.84rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
    appearance: none;
}

.conversation-item:hover {
    color: var(--secondary-color);
}

.conversation-item.active {
    font-weight: 600;
}

.conversation-actions {
    position: relative;
    flex-shrink: 0;
}

.conversation-menu-toggle {
    border: none;
    background-color: transparent;
    color: var(--secondary-color);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    letter-spacing: 1px;
    line-height: 1;
}

.conversation-menu-toggle:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--primary-color);
}

.conversation-item-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 90px;
    padding: 0.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 5;
}

.conversation-item-menu.open {
    display: block;
}

.conversation-menu-item {
    width: 100%;
    border: none;
    background-color: transparent;
    color: var(--text-color);
    text-align: left;
    font-size: 0.78rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.conversation-menu-item:hover {
    background-color: var(--light-accent);
}

.conversation-menu-item.danger {
    color: var(--error-color);
}

.conversation-empty {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-align: left;
    padding: 0.5rem 0;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4CAF50;
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + var(--safe-area-bottom));
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.chat-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
}

.scroll-to-latest-button {
    position: absolute;
    left: 50%;
    bottom: 7rem;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 999px;
    background: rgba(43, 28, 18, 0.88);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    z-index: 200;
}

.scroll-to-latest-button:hover {
    background: rgba(43, 28, 18, 0.96);
}

.scroll-to-latest-button.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 10px;
}

.chat-message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.message-row {
    display: flex;
    align-items: flex-start;
}

.user-message .message-row {
    justify-content: flex-end;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 0.75rem;
    background-color: white;
    box-shadow: 0 2px 5px var(--shadow);
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-message .avatar {
    order: 2;
    margin-right: 0;
    margin-left: 0.75rem;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 70%;
    box-shadow: 0 1px 4px var(--shadow);
    line-height: 1.5;
    font-size: 0.95rem;
    position: relative;
}

.ai-message .message-bubble {
    background-color: var(--chat-bubble-ai);
    border-top-left-radius: 4px;
}

.user-message .message-bubble {
    background-color: var(--chat-bubble-user);
    border-top-right-radius: 4px;
}

/* モデル情報バッジ */
.model-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.message-time {
    font-size: 0.75rem;
    margin-top: 0.3rem;
    color: var(--secondary-color);
    padding: 0 0.5rem;
}

.ai-message .message-time {
    margin-left: 48px;
}

.user-message .message-time {
    align-self: flex-end;
    margin-right: 48px;
}

/* フィードバックボタンのスタイル */
.feedback-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    margin-left: 48px;
    opacity: 1;
}

.answer-copy-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    background: none;
    color: var(--secondary-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: all 0.2s ease;
}

.answer-copy-btn:hover {
    border-color: var(--accent-color);
    background-color: var(--light-accent);
    color: var(--primary-color);
}

.answer-copy-btn.copied {
    border-color: var(--feedback-good);
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--feedback-good);
}

.answer-copy-btn.copy-failed {
    border-color: var(--feedback-bad);
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--feedback-bad);
}

.answer-copy-btn svg {
    width: 16px;
    height: 16px;
}

.feedback-btn {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s ease;
    color: var(--secondary-color);
    min-width: 50px;
    justify-content: center;
}

.feedback-btn:hover {
    border-color: var(--accent-color);
    background-color: var(--light-accent);
}

.feedback-btn.good {
    border-color: var(--feedback-good);
    color: var(--feedback-good);
}

.feedback-btn.good:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

.feedback-btn.close {
    border-color: var(--feedback-close);
    color: var(--feedback-close);
}

.feedback-btn.close:hover {
    background-color: rgba(255, 152, 0, 0.1);
}

.feedback-btn.bad {
    border-color: var(--feedback-bad);
    color: var(--feedback-bad);
}

.feedback-btn.bad:hover {
    background-color: rgba(244, 67, 54, 0.1);
}

.feedback-btn.active {
    background-color: currentColor;
    color: white;
}

.feedback-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* フィードバックモーダル */
.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.feedback-modal-content {
    background-color: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.feedback-modal h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-align: center;
}

.feedback-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.feedback-modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.feedback-modal-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-modal-btn.cancel {
    background-color: #f5f5f5;
    color: var(--text-color);
}

.feedback-modal-btn.cancel:hover {
    background-color: #e0e0e0;
}

.feedback-modal-btn.submit {
    background-color: var(--primary-color);
    color: white;
}

.feedback-modal-btn.submit:hover {
    background-color: var(--secondary-color);
}

.chat-input-container {
    display: flex;
    position: relative;
    align-items: flex-end;
    gap: 0.5rem;
    box-shadow: 0 -1px 5px var(--shadow);
    border-radius: 24px;
    background-color: white;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    min-width: 0;
}

.chat-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-color);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.model-picker {
    position: relative;
    flex-shrink: 0;
}

.model-picker-button {
    height: 38px;
    min-width: 116px;
    border: none;
    border-radius: 19px;
    padding: 0 0.7rem;
    background-color: var(--light-accent);
    color: var(--primary-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-family: inherit;
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.model-picker-button:hover,
.model-picker-button[aria-expanded="true"] {
    background-color: var(--accent-color);
}

.model-picker-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.model-picker-provider {
    font-weight: 600;
}

.model-picker-profile {
    color: var(--secondary-color);
}

.model-picker-chevron {
    color: var(--secondary-color);
    font-size: 0.7rem;
}

.model-picker-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.65rem);
    width: 220px;
    padding: 0.45rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    z-index: 300;
}

.model-picker-section + .model-picker-section {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.model-picker-label {
    padding: 0.25rem 0.45rem;
    color: var(--secondary-color);
    font-size: 0.68rem;
    font-weight: 600;
}

.model-picker-option {
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 0.6rem;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-family: inherit;
    font-size: 0.86rem;
    text-align: left;
}

.model-picker-option:hover {
    background-color: var(--light-accent);
}

.model-picker-option.active {
    color: var(--primary-color);
    font-weight: 600;
}

.model-picker-option:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.model-picker-check {
    visibility: hidden;
    color: var(--primary-color);
}

.model-picker-option.active .model-picker-check {
    visibility: visible;
}

.action-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-button:hover {
    background-color: var(--light-accent);
    color: var(--primary-color);
}

.action-button.send {
    background-color: var(--primary-color);
    color: white;
}

.action-button.send:hover {
    background-color: var(--secondary-color);
}

.action-button.send.stop {
    background-color: #c94f4f;
}

.action-button.send.stop:hover {
    background-color: #a63d3d;
}

.typing-indicator {
    display: flex;
    padding: 0 1.25rem;
    margin-bottom: 1rem;
    align-items: center;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.typing-animation {
    display: flex;
    margin-left: 0.5rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    margin: 0 2px;
    animation: typingAnimation 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.support-notice {
    margin: 0.55rem 0 0;
    color: var(--secondary-color);
    font-size: 0.7rem;
    line-height: 1.45;
    text-align: center;
    flex-shrink: 0;
}

.support-notice a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.support-notice a:hover {
    color: var(--secondary-color);
}

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

@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        overflow: hidden;
    }

    .character-panel {
        width: 100%;
        height: auto;
        flex: 0 0 auto;
        max-height: min(32vh, 260px);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
        overflow-y: auto;
    }

    .chat-panel {
        flex: 1 1 auto;
        min-height: 0;
        padding: 1rem;
        padding-bottom: calc(1rem + var(--safe-area-bottom));
    }

    .model-selection {
        width: 100%;
    }

    .conversation-history {
        max-height: 260px;
    }

    .feedback-buttons {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem;
    }

    .logo {
        min-width: 0;
    }

    .logo h1 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .character-panel {
        flex-direction: column;
        align-items: stretch;
        max-height: min(30vh, 220px);
    }

    .model-selection,
    .conversation-history {
        width: 100%;
    }

    .chat-input-container {
        border-radius: 18px;
        padding: 0.55rem 0.65rem;
    }

    .chat-input {
        padding: 0.45rem 0.35rem;
    }

    .model-picker-button {
        min-width: 104px;
        padding: 0 0.55rem;
        font-size: 0.74rem;
    }

    .model-picker-menu {
        width: min(220px, calc(100vw - 2rem));
    }

    .support-notice {
        font-size: 0.66rem;
        line-height: 1.4;
        text-align: left;
    }

    .feedback-modal-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    #username-display {
        display: none;
    }

    .header .action-button {
        width: 34px;
        height: 34px;
    }

    .chat-input-container .action-button:disabled {
        display: none;
    }

    .model-picker-button {
        min-width: 82px;
    }

    .model-picker-provider {
        display: none;
    }
}

/* メッセージバブル内のマークダウン要素 */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 0.5rem 0;
    font-weight: 600;
    line-height: 1.2;
}

.message-bubble h1 {
    font-size: 1.3rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.2rem;
}

.message-bubble h2 {
    font-size: 1.2rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 0.1rem;
}

.message-bubble h3 {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.message-bubble strong {
    font-weight: 700;
    color: var(--primary-color);
}

.message-bubble em {
    font-style: italic;
    color: var(--secondary-color);
}

.message-bubble code {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 0.1rem 0.3rem;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.85em;
    color: var(--primary-color);
}

.message-bubble pre {
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.85em;
    line-height: 1.4;
}

.message-bubble pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-color);
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-bubble li {
    margin: 0.2rem 0;
    line-height: 1.4;
}

.message-bubble ul li {
    list-style-type: disc;
}

.message-bubble ol li {
    list-style-type: decimal;
}

.message-bubble a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.message-bubble a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

/* 段落間の余白調整 */
.message-bubble p {
    margin: 0.5rem 0;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

/* ブロッククォート（オプション）*/
.message-bubble blockquote {
    border-left: 4px solid var(--accent-color);
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.02);
    font-style: italic;
    color: var(--secondary-color);
}

/* テーブル（オプション）*/
.message-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.message-bubble th,
.message-bubble td {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    text-align: left;
}

.message-bubble th {
    background-color: var(--light-accent);
    font-weight: 600;
    color: var(--primary-color);
}

.message-bubble tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.chat-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-color);
    resize: none; /* サイズ変更ハンドルを非表示 */
    overflow-y: auto; /* 縦スクロール */
    min-height: 1.5rem; /* 最小高さ */
    max-height: 120px; /* 最大高さ（5行程度） */
    line-height: 1.5;
    font-family: inherit; /* 親要素のフォントを継承 */
}

/* スクロールバーのスタイリング（webkit系ブラウザ） */
.chat-input::-webkit-scrollbar {
    width: 4px;
}

.chat-input::-webkit-scrollbar-track {
    background: transparent;
}

.chat-input::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.chat-input::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* ストリーミング関連のスタイル */

/* ストリーミング中のメッセージ */
.streaming-message .message-bubble {
    transition: all 0.2s ease-in-out;
}

.streaming-content {
    display: inline;
    color: inherit;
    opacity: 1;
    transform: none;
    transition: none;
}

.streaming-message .streaming-content *,
.streaming-message .streaming-content *::before,
.streaming-message .streaming-content *::after {
    color: inherit;
}

.agenda-progress-panel {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(91, 155, 213, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-color);
}

.agenda-progress-panel[hidden] {
    display: none;
}

.agenda-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.agenda-progress-label {
    font-weight: 700;
    font-size: 0.9rem;
}

.agenda-progress-count {
    font-size: 0.78rem;
    color: var(--secondary-color);
    white-space: nowrap;
}

.agenda-progress-message {
    font-size: 0.82rem;
    color: var(--secondary-color);
    margin-bottom: 0.55rem;
}

.agenda-progress-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.agenda-progress-steps li {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr);
    gap: 0.45rem;
    align-items: start;
    padding: 0.4rem 0.45rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.58);
}

.agenda-progress-steps li.active {
    background: var(--light-accent);
}

.agenda-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.agenda-step-main {
    min-width: 0;
}

.agenda-step-title {
    display: block;
    font-size: 0.84rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.agenda-step-meta {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: var(--secondary-color);
}

.agenda-progress-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.agenda-progress-actions button {
    border: 1px solid rgba(91, 155, 213, 0.28);
    background: white;
    color: var(--primary-color);
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    font-size: 0.76rem;
    cursor: pointer;
}

.agenda-progress-actions button:hover:not(:disabled) {
    background: var(--light-accent);
}

.agenda-progress-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ストリーミング中のメッセージバブル */
.streaming-bubble {
    position: relative;
}

.streaming-bubble::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    animation: progressLine 3s infinite ease-in-out;
}

@keyframes progressLine {
    0% { width: 0; opacity: 0; }
    20% { width: 30%; opacity: 1; }
    80% { width: 80%; opacity: 1; }
    100% { width: 0; opacity: 0; }
}

.user-message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.4rem;
}

.retry-edit-button {
    border: 1px solid rgba(91, 155, 213, 0.28);
    background: rgba(255, 255, 255, 0.96);
    color: var(--primary-color);
    border-radius: 999px;
    width: 2rem;
    height: 2rem;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.retry-edit-button:hover {
    background: var(--light-accent);
    transform: translateY(-1px);
}

.retry-edit-button svg {
    display: block;
}

.stream-status-note {
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

@media (max-width: 768px) {
    .scroll-to-latest-button {
        bottom: 8rem;
    }
}

