/* --- レイアウト・画面構造 --- */
.hidden {
    display: none !important;
}

.layout-hidden {
    display: none !important;
}

.app-container {
    display: flex;
    position: relative;
    height: 100%;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-primary);
    box-shadow: 0 0 10px var(--shadow-secondary);
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.app-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(var(--bg-header-rgb, 74, 144, 226), var(--header-footer-opacity, 1));
    color: var(--text-light);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    transition:
        background-color 0.3s ease,
        padding 0.2s ease,
        gap 0.2s ease,
        min-height 0.2s ease;
    gap: 8px;
}

body.pastel-rainbow-mode .app-header {
    background: var(--bg-header);
}

.app-header h1 {
    font-size: 18px;
    font-weight: bold;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
    margin: 0;
    margin-right: auto;
    flex-shrink: 1;
    min-width: 60px;
    transition: font-size 0.2s ease;
}

.header-button {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 20px;
    padding: 5px;
    line-height: 1;
    min-width: 30px;
    flex-shrink: 0;
    transition:
        padding 0.2s ease,
        font-size 0.2s ease,
        min-width 0.2s ease,
        height 0.2s ease;
}

#goto-settings-btn {
    order: 99;
    margin-left: 5px;
}

.app-header #toggle-clipboard-stack-btn,
.app-header #toggle-memo-btn,
.app-header #twin-engine-summary-btn,
.app-header .scroll-jump-button,
.app-header #toggle-all-content-btn,
.app-header .api-provider-toggle-btn {
    background-color: transparent !important;
    color: var(--text-light);
    box-shadow: none !important;
    border: 1px solid transparent;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

@media (hover: hover) {
    .app-header #toggle-clipboard-stack-btn:hover,
    .app-header #toggle-memo-btn:hover,
    .app-header #twin-engine-summary-btn:hover,
    .app-header .scroll-jump-button:hover,
    .app-header #toggle-all-content-btn:hover,
    .app-header .api-provider-toggle-btn:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
    }
}

body.pastel-yellow-mode .app-header #toggle-clipboard-stack-btn,
body.pastel-yellow-mode .app-header #toggle-memo-btn,
body.pastel-yellow-mode .app-header #twin-engine-summary-btn,
body.pastel-yellow-mode .app-header .scroll-jump-button,
body.pastel-yellow-mode .app-header #toggle-all-content-btn,
body.pastel-yellow-mode .app-header .api-provider-toggle-btn {
    color: #424242;
}

@media (hover: hover) {
    body.pastel-yellow-mode .app-header #toggle-clipboard-stack-btn:hover,
    body.pastel-yellow-mode .app-header #toggle-memo-btn:hover,
    body.pastel-yellow-mode .app-header #twin-engine-summary-btn:hover,
    body.pastel-yellow-mode .app-header .scroll-jump-button:hover,
    body.pastel-yellow-mode .app-header #toggle-all-content-btn:hover,
    body.pastel-yellow-mode .app-header .api-provider-toggle-btn:hover {
        background-color: rgba(0, 0, 0, 0.05) !important;
        border-color: rgba(0, 0, 0, 0.1) !important;
    }
}

@media (hover: hover) {
    body.dark-mode .app-header #toggle-clipboard-stack-btn:hover,
    body.dark-mode .app-header #toggle-memo-btn:hover,
    body.dark-mode .app-header #twin-engine-summary-btn:hover,
    body.dark-mode .app-header .scroll-jump-button:hover,
    body.dark-mode .app-header #toggle-all-content-btn:hover,
    body.dark-mode .app-header .api-provider-toggle-btn:hover {
        background-color: rgba(255, 255, 255, 0.08) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
    }
}

#history-screen .app-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(var(--bg-header-rgb, 74, 144, 226), var(--header-footer-opacity, 1));
    color: var(--text-light);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    transition:
        background-color 0.3s ease,
        padding 0.2s ease,
        gap 0.2s ease,
        min-height 0.2s ease;
    gap: 10px;
    flex-direction: row;
    justify-content: space-between;
}

body.pastel-rainbow-mode #history-screen .app-header {
    background: var(--bg-header);
}

#history-screen .app-header h1#history-title {
    font-size: 18px;
    font-weight: bold;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
    margin: 0;
    margin-right: auto;
    order: 1;
    transition: font-size 0.2s ease;
    flex-grow: 1;
}

#history-screen .app-header #back-to-chat-from-history {
    order: 100;
}

#history-screen .app-header #export-all-sessions-btn {
    order: 2;
    padding: 4px 8px;
}

#history-screen .app-header #import-all-sessions-btn {
    order: 3;
    padding: 4px 8px;
}

#history-screen .app-header #import-history-btn {
    order: 4;
    margin-right: 0;
    padding: 4px 8px;
}

.header-save-button {
    padding: 4px 12px;
    font-size: 13px;
    background-color: var(--bg-button-save);
    color: var(--text-light);
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        padding 0.2s ease,
        font-size 0.2s ease,
        height 0.2s ease;
    flex-shrink: 0;
}

.header-save-button:hover:not(:disabled) {
    background-color: var(--bg-button-save-hover);
}

body.dark-mode .header-save-button {
    background-color: var(--bg-button-save);
}

body.dark-mode .header-save-button:hover:not(:disabled) {
    background-color: var(--bg-button-save-hover);
}

.header-notice {
    font-size: 11px;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

body.dark-mode .header-notice {
    color: rgba(255, 255, 255, 0.7);
}

body.pastel-pink-mode .header-notice,
body.pastel-blue-mode .header-notice,
body.pastel-yellow-mode .header-notice,
body.pastel-purple-mode .header-notice,
body.pastel-rainbow-mode .header-notice {
    color: var(--text-light);
    opacity: 0.9;
}

body.pastel-yellow-mode .header-button,
body.pastel-yellow-mode .header-notice {
    color: #424242;
}

body.pastel-yellow-mode .new-chat-button,
body.pastel-yellow-mode .app-header .action-button-in-header,
body.pastel-yellow-mode .header-save-button {
    color: #424242;
}

body.pastel-rainbow-mode .header-button,
body.pastel-rainbow-mode .header-notice,
body.pastel-rainbow-mode .new-chat-button,
body.pastel-rainbow-mode .app-header .action-button-in-header,
body.pastel-rainbow-mode .header-save-button {
    color: var(--text-light);
}

.new-chat-button {
    font-size: 14px;
    padding: 5px 10px;
    background-color: var(--bg-button-save);
    color: var(--text-light);
    flex-shrink: 0;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        padding 0.2s ease,
        font-size 0.2s ease,
        height 0.2s ease;
}

.new-chat-button:hover {
    background-color: var(--bg-button-save-hover);
}

body.dark-mode .new-chat-button {
    background-color: var(--bg-button-save);
}

body.dark-mode .new-chat-button:hover {
    background-color: var(--bg-button-save-hover);
}

.app-header .action-button-in-header {
    padding: 5px 10px;
    font-size: 14px;
    color: var(--text-light);
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        padding 0.2s ease,
        font-size 0.2s ease,
        height 0.2s ease;
    flex-shrink: 0;
}

.app-header #delete-session-btn {
    background-color: var(--bg-button-header-delete);
}

.app-header #delete-session-btn:hover:not(:disabled) {
    background-color: var(--bg-button-header-delete-hover);
}

.app-header #copy-session-btn {
    background-color: var(--bg-button-header-copy);
}

.app-header #copy-session-btn:hover:not(:disabled) {
    background-color: var(--bg-button-header-copy-hover);
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    position: relative;
    z-index: 1;
    touch-action: pan-y;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    background-color: var(--bg-primary);
    z-index: 0;
}

.screen.dormant {
    visibility: hidden !important;
}

.screen.active {
    transform: translateX(0);
    z-index: 1;
}

#chat-screen {
    transform: translateX(0);
    position: relative;
    z-index: 0;
    background-image: var(--chat-background-image);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transition:
        background-image 0.3s ease,
        transform 0.3s ease-in-out;
}

#chat-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(var(--overlay-base-rgb), var(--chat-overlay-alpha));
    z-index: 0;
    transition: background-color 0.3s ease;
    pointer-events: none;
}

#chat-screen .main-content {
    z-index: 1;
    background-color: transparent;
    overflow-y: scroll;
    overflow-x: auto;
    touch-action: pan-x pan-y pinch-zoom;
    flex-grow: 1;
}

#chat-screen .app-header {
    z-index: 2;
}

#history-screen {
    transform: translateX(-100%);
    background-color: var(--bg-primary);
    transition: transform 0.3s ease-in-out;
    background-image: var(--history-background-image);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

#history-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(var(--overlay-base-rgb), var(--chat-overlay-alpha));
    z-index: 1;
    pointer-events: none;
}

#history-screen .app-header {
    position: relative;
    z-index: 2;
}

#history-screen .main-content {
    position: relative;
    z-index: 2;
    background-color: transparent;
    touch-action: pan-y;
}

#settings-screen {
    transform: translateX(100%);
    background-color: var(--bg-primary);
    transition: transform 0.3s ease-in-out;
    -webkit-user-select: none;
    user-select: none;
    background-image: var(--settings-background-image);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

#settings-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(var(--overlay-base-rgb), var(--chat-overlay-alpha));
    z-index: 1;
    pointer-events: none;
}

#settings-screen .app-header,
#settings-screen .main-content {
    position: relative;
    z-index: 2;
}

#settings-screen input,
#settings-screen textarea,
#settings-screen select {
    -webkit-user-select: text;
    user-select: text;
}

#settings-screen .main-content {
    background-color: transparent;
    touch-action: pan-y;
}

/* --- メモ・クリップボードスタック ・ツインエンジンエリア --- */
#memo-area {
    position: relative;
    width: 100%;
    min-height: 80px;
    max-height: var(--memo-height);
    background-color: var(--bg-memo);
    border-bottom: 1px solid var(--border-secondary);
    padding: 10px 15px;
    z-index: 4;
    box-shadow: 0 1px 3px var(--shadow-primary);
    overflow: auto;
    display: flex;
    flex-direction: column;
    transition:
        max-height 0.3s ease-out,
        padding-top 0.3s ease-out,
        padding-bottom 0.3s ease-out,
        opacity 0.3s ease-out,
        border-width 0.3s ease-out;
    resize: vertical;
    margin-bottom: 0;
}

#memo-area.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: 0 !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    overflow: hidden;
}

.memo-actions-container {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.memo-actions-container button {
    padding: 4px 10px;
    font-size: 12px;
}

.memo-actions-container .delete-memo-btn {
    background-color: var(--bg-button-delete);
}

.memo-actions-container .delete-memo-btn:hover {
    background-color: var(--bg-button-delete-hover);
}

.memo-actions-container .copy-memo-btn {
    background-color: var(--bg-button-copy);
}

.memo-actions-container .copy-memo-btn:hover {
    background-color: var(--bg-button-copy-hover);
}

.memo-actions-container .paste-memo-btn {
    background-color: var(--bg-button-paste);
}

.memo-actions-container .paste-memo-btn:hover {
    background-color: var(--bg-button-paste-hover);
}

#memo-editor {
    flex-grow: 1;
    width: 100%;
    border: none;
    resize: none;
    background-color: transparent;
    color: var(--text-memo);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    padding: 0;
    margin: 0;
    min-height: 50px;
    display: block;
}

#clipboard-stack-area {
    position: relative;
    width: 100%;
    min-height: 80px;
    max-height: var(--clipboard-stack-height);
    background-color: var(--bg-memo);
    border-bottom: 1px solid var(--border-secondary);
    padding: 10px 15px;
    z-index: 5;
    box-shadow: 0 1px 3px var(--shadow-primary);
    overflow: auto;
    display: flex;
    flex-direction: column;
    transition:
        max-height 0.3s ease-out,
        padding-top 0.3s ease-out,
        padding-bottom 0.3s ease-out,
        opacity 0.3s ease-out,
        border-width 0.3s ease-out;
    resize: vertical;
    margin-bottom: 0;
}

#clipboard-stack-area.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: 0 !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    overflow: hidden;
}

.clipboard-stack-actions-container {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.clipboard-stack-actions-container button {
    padding: 4px 10px;
    font-size: 12px;
}

.clipboard-stack-actions-container .delete-clipboard-stack-btn {
    background-color: var(--bg-button-delete);
}

.clipboard-stack-actions-container .delete-clipboard-stack-btn:hover {
    background-color: var(--bg-button-delete-hover);
}

.clipboard-stack-actions-container .copy-clipboard-stack-btn {
    background-color: var(--bg-button-copy);
}

.clipboard-stack-actions-container .copy-clipboard-stack-btn:hover {
    background-color: var(--bg-button-copy-hover);
}

.clipboard-stack-actions-container .paste-clipboard-stack-btn {
    background-color: var(--bg-button-paste);
}

.clipboard-stack-actions-container .paste-clipboard-stack-btn:hover {
    background-color: var(--bg-button-paste-hover);
}

#clipboard-stack-editor {
    flex-grow: 1;
    width: 100%;
    border: none;
    resize: none;
    background-color: transparent;
    color: var(--text-memo);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    padding: 0;
    margin: 0;
    min-height: 50px;
    display: block;
}

#twin-engine-summary-area {
    position: relative;
    width: 100%;
    min-height: 80px;
    max-height: var(--memo-height);
    background-color: var(--bg-memo);
    border-bottom: 1px solid var(--border-secondary);
    padding: 10px 15px;
    z-index: 4;
    box-shadow: 0 1px 3px var(--shadow-primary);
    overflow: auto;
    display: flex;
    flex-direction: column;
    transition:
        max-height 0.3s ease-out,
        padding-top 0.3s ease-out,
        padding-bottom 0.3s ease-out,
        opacity 0.3s ease-out,
        border-width 0.3s ease-out;
    resize: vertical;
    margin-bottom: 0;
}

#twin-engine-summary-area.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: 0 !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    overflow: hidden;
}

.twin-engine-summary-actions-container {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.twin-engine-summary-actions-container button {
    padding: 4px 10px;
    font-size: 12px;
}

.twin-engine-summary-actions-container .resummarize-btn {
    margin-left: auto;
    background-color: var(--bg-button-update);
}

.twin-engine-summary-actions-container #twin-engine-mode-toggle-btn {
    background-color: var(--bg-button-action);
    min-width: 110px;
    text-align: center;
}

.twin-engine-summary-actions-container #twin-engine-api-key-cycle-btn {
    background-color: var(--bg-button-action);
    min-width: 60px;
}

.twin-engine-summary-actions-container #twin-engine-api-key-cycle-btn:hover:not(:disabled) {
    background-color: var(--bg-button-action-hover);
}

.twin-engine-summary-actions-container #twin-engine-mode-toggle-btn:hover:not(:disabled) {
    background-color: var(--bg-button-action-hover);
}

.twin-engine-summary-actions-container .resummarize-btn:hover:not(:disabled) {
    background-color: var(--bg-button-update-hover);
}

.twin-engine-summary-actions-container .clear-twin-engine-summary-btn {
    background-color: var(--bg-button-delete);
}

.twin-engine-summary-actions-container .clear-twin-engine-summary-btn:hover {
    background-color: var(--bg-button-delete-hover);
}

.twin-engine-summary-actions-container .copy-twin-engine-summary-btn {
    background-color: var(--bg-button-copy);
}

.twin-engine-summary-actions-container .copy-twin-engine-summary-btn:hover {
    background-color: var(--bg-button-copy-hover);
}

#twin-engine-summary-editor {
    flex-grow: 1;
    width: 100%;
    border: none;
    resize: none;
    background-color: transparent;
    color: var(--text-memo);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    padding: 0;
    margin: 0;
    min-height: 50px;
    display: block;
}

/* --- 履歴一覧 --- */
.history-list {
    list-style: none;
    padding: 0;
}

.history-item {
    padding: 12px;
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: var(--bg-primary);
    transition:
        background-color 0.2s ease,
        border-color 0.3s ease;
    cursor: pointer;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.history-item:hover {
    background-color: var(--bg-tertiary);
}

.history-list.striped .history-item:nth-child(even) {
    background-color: var(--bg-secondary);
}

body.turf-mode .history-list.striped .history-item:nth-child(even) {
    background-color: rgba(76, 175, 80, 0.08);
}

.history-list.striped .history-item:hover {
    background-color: var(--bg-tertiary) !important;
    filter: brightness(0.95);
}

body.dark-mode .history-list.striped .history-item:hover {
    filter: brightness(1.2);
}

.history-item-details {
    overflow: hidden;
    min-width: 0;
    width: 100%;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
    text-shadow:
        0 1px 3px var(--bg-primary),
        0 0 5px var(--bg-primary),
        0 0 10px var(--bg-primary);
}

.history-item-title {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 0px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
    color: var(--text-primary);
}

.history-item-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
    text-shadow:
        0 1px 3px var(--bg-primary),
        0 0 5px var(--bg-primary),
        0 0 10px var(--bg-primary);
}

.history-item-dates {
    font-size: 9px;
    color: var(--text-secondary);
    flex-shrink: 0;
    line-height: 1.3;
    text-align: left;
}

.history-item-dates span {
    display: block;
    white-space: nowrap;
}

.history-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: nowrap;
    cursor: default;
}

.history-item-actions button {
    cursor: pointer;
}

.history-item-actions .js-edit-title-btn {
    background-color: var(--bg-button-edit);
    font-size: 16px;
    padding: 6px 8px;
}

.history-item-actions .js-edit-title-btn:hover {
    background-color: var(--bg-button-edit-hover);
}

.history-item-actions .js-delete-btn {
    background-color: var(--bg-button-delete);
}

.history-item-actions .js-delete-btn:hover {
    background-color: var(--bg-button-delete-hover);
}

.history-item-actions .js-duplicate-btn {
    background-color: var(--bg-button-duplicate);
}

.history-item-actions .js-duplicate-btn:hover {
    background-color: var(--bg-button-duplicate-hover);
}

.history-item-actions .js-export-btn {
    background-color: var(--bg-button-export);
}

.history-item-actions .js-export-btn:hover {
    background-color: var(--bg-button-export-hover);
}

.history-item-actions .js-link-session-btn,
.history-item-actions .js-export-btn,
.history-item-actions .js-duplicate-btn,
.history-item-actions .js-delete-btn {
    padding: 6px 8px;
    font-size: 16px;
}

.js-history-item-template {
    display: none !important;
}

#no-history-message {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 20px;
}

.history-item-preview-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    padding: 0;
}

.history-preview-bubble {
    width: 100%;
    height: 100%;
    padding: 0px 10px 0px 10px;
    font-size: 13.5px;
    line-height: 1.2;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: hidden;
    opacity: 0.2;
    color: var(--text-primary);
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    -webkit-mask-image: linear-gradient(
        195deg,
        transparent 0%,
        black 25%,
        black 90%,
        transparent 100%
    );
    mask-image: linear-gradient(195deg, transparent 0%, black 25%, black 90%, transparent 100%);
}

.history-item-preview-layer.align-right .history-preview-bubble {
    justify-content: flex-end;
    text-align: right;
    background: linear-gradient(to left, var(--bg-user-message), transparent 90%);
}

.history-item-preview-layer.align-left .history-preview-bubble {
    justify-content: flex-start;
    text-align: left;
    background: linear-gradient(to right, var(--bg-model-message), transparent 90%);
}

body.dark-mode .history-preview-bubble {
    opacity: 0.25;
}

/* --- 画面スタイル調整 --- */
.app-container.minimized-ui .app-header,
.app-container.minimized-ui #history-screen .app-header {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 8px;
    padding-right: 8px;
    gap: 4px;
    min-height: 32px;
}

.app-container.minimized-ui .app-header h1 {
    font-size: 15px;
}

.app-container.minimized-ui .header-button,
.app-container.minimized-ui .new-chat-button,
.app-container.minimized-ui .app-header .action-button-in-header,
.app-container.minimized-ui .header-save-button {
    padding: 2px 6px;
    font-size: 13px;
    min-width: 28px;
    height: 28px;
}

.app-container.minimized-ui .header-button {
    font-size: 16px;
    padding: 2px;
}

.app-container.minimized-ui .api-provider-toggle-btn {
    font-size: 14px;
    min-width: 28px;
    height: 28px;
}

.app-container.minimized-ui .chat-input-area {
    padding: 2px 8px;
    gap: 6px;
}

.app-container.minimized-ui .chat-input-area textarea {
    min-height: 32px;
    height: 32px;
    padding: 6px 8px;
    font-size: 13px;
}

.app-container.minimized-ui .chat-input-area .footer-action-button,
.app-container.minimized-ui .chat-input-area button#send-button {
    height: 32px;
    width: 32px;
}

.app-container.minimized-ui .chat-input-area .footer-action-button {
    font-size: 16px;
}

.app-container.minimized-ui .chat-input-area button#paste-to-input-btn {
    font-size: 14px;
}

.app-container.minimized-ui .chat-input-area button#send-button {
    font-size: 16px;
}

/* --- Elevation UI レアウト --- */
body.elevation-enabled .app-container {
    box-shadow: var(--elevation-shadow-3);
}

body.elevation-enabled .app-header,
body.elevation-enabled .chat-input-area {
    box-shadow: var(--elevation-shadow-2);
}

body.elevation-enabled .settings-group,
body.elevation-enabled .history-item {
    border: 1px solid transparent;
    box-shadow: var(--elevation-shadow-1);
}

/* --- 履歴パネル文字サイズ調整用CSS --- */
#history-screen .main-content {
    font-size: calc(14px * var(--history-ui-scale));
}
#history-screen .history-item-title {
    font-size: 1.072em !important;
}
#history-screen .history-item-dates {
    font-size: 0.643em !important;
}
#history-screen .history-item-actions button {
    font-size: 1.143em !important;
    padding: 0.375em 0.5em !important;
}
#history-screen #no-history-message {
    font-size: 1em !important;
}

/* --- イマーシブモード --- */
body.immersive-mode .app-container {
    display: block;
    position: relative;
}

body.immersive-mode .app-header,
body.immersive-mode #history-screen .app-header,
body.immersive-mode #settings-screen .app-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    border-bottom: none;
}
body.immersive-mode .chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    border-top: none;
}
body.immersive-mode #chat-screen .main-content {
    height: 100%;
    padding-top: calc(var(--header-height, 50px) + 15px);
    padding-bottom: calc(var(--footer-height, 60px) + 16px);
    box-sizing: border-box;
}
body.immersive-mode #history-screen .main-content,
body.immersive-mode #settings-screen .main-content {
    height: 100%;
    padding-top: calc(var(--header-height, 50px) + 15px);
    padding-bottom: 20px;
    box-sizing: border-box;
}
