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

:root {
    --sidebar-width: 300px;
    --sidebar-min: 260px;
    --sidebar-max: 420px;
}

body {
    font-family: 'Arial', 'Hiragino Kaku Gothic ProN', sans-serif;
    background-color: #fef5f8;
    color: #4a4a4a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.time-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    margin-top: 4px;
    color: #fff;
    font-size: 0.95em;
}

.time-display i {
    color: #fff;
}

.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.license-note {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 10px 14px 0;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: min(520px, calc(100% - 24px));
    padding: 20px 20px 18px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
}

.modal-content h3 {
    margin-bottom: 10px;
    color: #6a5acd;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-content.background-modal {
    width: min(720px, calc(100% - 24px));
}

.background-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.background-option {
    position: relative;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    background: #f9f6ff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-align: left;
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
    width: 100%;
    appearance: none;
}

.background-option img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.background-option-label {
    padding: 8px 10px 10px;
    font-weight: bold;
    color: #4a4a4a;
}

.background-option-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ba55d3;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.background-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.12);
    border-color: #e0c5f3;
}

.background-option:focus-visible {
    outline: 3px solid rgba(90, 90, 180, 0.4);
    outline-offset: 2px;
}

.background-option.is-selected {
    border-color: #ba55d3;
    box-shadow: 0 10px 20px rgba(186,85,211,0.22);
}

.background-option.is-selected .background-option-badge {
    opacity: 1;
    transform: scale(1);
}

.modal-lead {
    font-weight: bold;
    margin-bottom: 6px;
    color: #4a4a4a;
}

.license-list {
    margin: 0 0 8px 18px;
    color: #4a4a4a;
    line-height: 1.6;
}

.modal-note {
    font-size: 0.9em;
    color: #555;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.1em;
}

.modal-close:hover {
    color: #ba55d3;
}

.master-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.master-card {
    background: #fff;
    border: 2px solid #e8d5f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 8px 20px rgba(186, 85, 211, 0.08);
}

.master-card .card-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #fefbff;
    border: 2px dashed #dda0dd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ba55d3;
    font-size: 1.5em;
    flex-shrink: 0;
}

.master-card .card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.master-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.master-card .card-title {
    font-weight: bold;
    color: #6a5acd;
    display: flex;
    align-items: center;
    gap: 8px;
}

.master-card .card-meta {
    font-size: 0.9em;
    color: #7a6c80;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.empty-state {
    margin-top: 16px;
    padding: 30px 16px;
    border: 2px dashed #e8d5f0;
    border-radius: 12px;
    text-align: center;
    color: #7a6c80;
    background: #fff;
}

.empty-state i {
    font-size: 2em;
    margin-bottom: 8px;
    color: #ba55d3;
}

.master-modal {
    width: min(640px, calc(100% - 24px));
}

.master-modal .form-group {
    margin-bottom: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.primary-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(135deg, #ba55d3 0%, #9370db 100%);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(186, 85, 211, 0.3);
    transition: all 0.3s;
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.primary-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(186, 85, 211, 0.4);
}

.ghost-btn {
    padding: 10px 16px;
    border-radius: 22px;
    border: 1px solid #d9c8e7;
    background: #fff;
    color: #6a5acd;
    cursor: pointer;
    transition: all 0.2s;
}

.ghost-btn:hover {
    background: #f8f0ff;
}

.master-icon-upload {
    flex-wrap: wrap;
    align-items: flex-start;
}

.master-icon-upload .icon-preview {
    width: 96px;
    height: 96px;
}

/* サイドメニュー */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-min);
    background: linear-gradient(180deg, #6a5acd 0%, #9370db 100%);
    height: 100vh;
    padding: 20px 0;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    box-shadow: 3px 0 15px rgba(106, 90, 205, 0.2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.sidebar-header h1 {
    color: #ffffff;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-spacer {
    flex: 1;
}

.user-menu {
    position: relative;
    margin-top: 12px;
    padding: 14px 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    overflow: visible;
}

.user-menu-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 10px 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger,
.user-menu-trigger.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    display: grid;
    place-items: center;
    color: #fff;
    flex-shrink: 0;
}

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

.user-name {
    flex: 1;
    font-weight: bold;
    color: #fff;
    text-align: left;
}

.user-dropdown {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    min-width: 200px;
    width: min(230px, calc(100% - 24px));
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 5;
}

.user-dropdown::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.user-menu.open .user-dropdown {
    display: block;
}

.user-dropdown button {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 14px;
    text-align: left;
    color: #4a4a4a;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-dropdown button + button {
    border-top: 1px solid #eee;
}

.user-dropdown button:hover {
    background: #f8f0ff;
    color: #6a5acd;
}

.time-item {
    padding: 0 12px 14px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item a:hover,
.nav-item a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-left: 4px solid #ff69b4;
}

.nav-item a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-resizer {
    width: 10px;
    cursor: col-resize;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    flex-shrink: 0;
    position: relative;
}

.sidebar-resizer::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 32px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

.sidebar-resizer:hover,
body.resizing .sidebar-resizer {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
}

body.resizing {
    user-select: none;
    cursor: col-resize;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
    height: 100vh;
    overflow-y: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(147, 112, 219, 0.15);
}

.setting-section {
    display: none;
}

.setting-section.active {
    display: block;
}

h2 {
    color: #6a5acd;
    border-bottom: 3px solid #dda0dd;
    padding-bottom: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-note {
    background: linear-gradient(135deg, #f8f0ff 0%, #fff0f8 100%);
    border-left: 4px solid #ba55d3;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 8px;
}

.setting-block {
    border: 2px solid #e8d5f0;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fefbff 0%, #ffffff 100%);
    box-shadow: 0 4px 15px rgba(147, 112, 219, 0.08);
}

.setting-block-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.block-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #6a5acd;
    font-size: 1.05em;
}

.block-description {
    color: #777;
    line-height: 1.5;
    font-size: 0.95em;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px 18px;
}

.field-grid.single-col {
    grid-template-columns: 1fr;
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: bold;
    color: #6a5acd;
    margin-bottom: 8px;
}

.note-small {
    font-size: 0.85em;
    color: #999;
    margin-top: 3px;
    display: block;
}
.note-small.inline {
    display: inline;
}

input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea,
input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e8d5f0;
    border-radius: 6px;
    background-color: #ffffff;
    color: #4a4a4a;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #ba55d3;
    outline: none;
}

.input-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}

.error-text {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 6px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.password-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.password-row .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #ba55d3;
}

.password-row .note-small {
    display: block;
    line-height: 1.45;
    min-height: 3.2em;
}

.icon-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-preview {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 2px dashed #dda0dd;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fefbff;
    overflow: hidden;
    color: #ba55d3;
    font-size: 1.4em;
}

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

.icon-upload-actions {
    display: flex;
    gap: 10px;
}

.icon-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: linear-gradient(135deg, #ba55d3 0%, #9370db 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(186, 85, 211, 0.3);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95em;
    text-align: center;
    line-height: 1.2;
    gap: 8px;
    transition: all 0.3s;
}

.form-group .icon-upload-btn {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.icon-upload-btn input[type="file"] {
    display: none;
}

.icon-upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(186, 85, 211, 0.4);
}

.icon-remove-btn {
    padding: 8px 12px;
    border: 2px solid #e8d5f0;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    color: #6a5acd;
    font-weight: bold;
}

.icon-remove-btn:hover {
    background: #f8f0ff;
}

/* ボタン */
.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #ba55d3 0%, #9370db 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(186, 85, 211, 0.3);
    min-height: 46px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(186, 85, 211, 0.4);
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid #e8d5f0;
    border-radius: 25px;
    background: #fff;
    color: #6a5acd;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 46px;
}

.secondary-btn:hover {
    background: #f8f0ff;
    box-shadow: 0 4px 12px rgba(147, 112, 219, 0.15);
}

.ghost-btn {
    padding: 10px 16px;
    border: 2px dashed #dda0dd;
    border-radius: 12px;
    background: #fff;
    color: #6a5acd;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.ghost-btn.small {
    padding: 8px 12px;
    font-size: 0.9em;
    border-style: solid;
}

.ghost-btn:hover {
    background: #f8f0ff;
    box-shadow: 0 4px 12px rgba(186, 85, 211, 0.18);
}

.knowledge-list {
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
}

.knowledge-card {
    border: 2px solid #e8d5f0;
    border-radius: 10px;
    padding: 14px;
    background: #fefbff;
    box-shadow: 0 6px 16px rgba(147, 112, 219, 0.08);
}

.knowledge-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.knowledge-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #6a5acd;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f8f0ff;
    border: 1px solid #dda0dd;
    border-radius: 999px;
    font-size: 0.85em;
    color: #6a5acd;
}

.knowledge-index {
    color: #9370db;
    font-size: 0.95em;
}

.file-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

#knowledge-files-input {
    display: none;
}

#qna-files-input {
    display: none;
}

.knowledge-file-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.knowledge-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid #e8d5f0;
    border-radius: 10px;
    background: #fefbff;
}

.knowledge-file-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6a5acd;
    font-weight: bold;
}

.knowledge-file-meta .note-small {
    margin-top: 0;
}

.remove-knowledge-file {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-weight: bold;
}

/* メディアアップロード */
.media-upload-area {
    border: 2px dashed #dda0dd;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    background-color: #fefbff;
}

.media-upload-area:hover {
    background-color: #f8f0ff;
    border-color: #ba55d3;
}

.media-upload-area input[type="file"] {
    display: none;
}

.media-upload-area p {
    margin: 5px 0 0;
    font-size: 0.9em;
    color: #999;
}

.media-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.media-item {
    position: relative;
    border: 2px solid #e8d5f0;
    border-radius: 8px;
    overflow: hidden;
    padding: 5px;
}

.media-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

.media-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    font-size: 0.75em;
    color: #4a4a4a;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e8d5f0;
    border-radius: 6px;
}

.delete-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff69b4;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-item-container {
    position: relative;
    border: 2px solid #e8d5f0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    background-color: #fefbff;
}

.saved-transcript {
    margin-top: 10px;
    padding: 10px;
    background: #f7f2ff;
    border: 1px solid #e8d5f0;
    border-radius: 6px;
}

.saved-transcript-label {
    font-weight: bold;
    color: #6a5acd;
    margin-bottom: 4px;
}

.saved-transcript-body {
    white-space: pre-wrap;
    line-height: 1.5;
}

.audio-item-container audio {
    width: 100%;
    margin-bottom: 10px;
}

/* アカウント設定 */
.display-id {
    padding: 10px;
    background: linear-gradient(135deg, #f8f0ff 0%, #fff0f8 100%);
    border: 2px solid #e8d5f0;
    border-radius: 6px;
    font-weight: bold;
    font-family: monospace;
    color: #6a5acd;
}

.success-message {
    background: linear-gradient(135deg, #d4f4dd 0%, #c8f7dc 100%);
    border: 2px solid #7bed9f;
    color: #2d6a4f;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    text-align: center;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.form-actions.end {
    justify-content: flex-end;
}

.form-actions .success-message {
    margin-bottom: 0;
    padding: 10px 12px;
    white-space: nowrap;
}

/* カラー設定 */
.color-themes {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.theme-option {
    flex: 1;
    min-width: 150px;
    padding: 15px;
    border: 3px solid #e8d5f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.theme-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(186, 85, 211, 0.2);
}

.theme-option.selected {
    border-color: #ba55d3;
    background: linear-gradient(135deg, #f8f0ff 0%, #fff0f8 100%);
}

.theme-preview {
    display: flex;
    gap: 5px;
    margin: 10px 0;
    justify-content: center;
}

.theme-preview-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.theme-name {
    font-weight: bold;
    color: #6a5acd;
    margin-top: 8px;
}

/* 会話テスト画面 */
.chat-container {
    display: flex;
    gap: 20px;
    height: 600px;
}

.clone-display {
    flex: 0 0 60%;
    border: 2px solid #e8d5f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8f0ff 0%, #fff0f8 100%);
}

.clone-image {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 300px;
    max-height: 420px;
    border-radius: 12px;
    margin-bottom: 20px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ba55d3;
    border: 2px dashed #dda0dd;
    font-size: 1.1em;
    position: relative;
    overflow: hidden;
}

.clone-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}
.clone-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.clone-display-item {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.clone-display-item.is-active {
    opacity: 1;
}

.clone-media {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 12px;
}

.clone-media.clone-video {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    background-color: #000;
}

.clone-media.clone-image-media {
    object-fit: cover;
    aspect-ratio: 16 / 9;
}

.clone-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    color: #ba55d3;
    border-radius: 12px;
    text-align: center;
    padding: 20px;
}

.clone-placeholder i {
    font-size: 3em;
}

.clone-image.has-media .clone-placeholder {
    opacity: 0;
    pointer-events: none;
}

.clone-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clone-btn {
    padding: 12px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.background-btn {
    background: linear-gradient(135deg, #6bcf9c 0%, #55b883 100%);
    color: #fff;
}

.background-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(107, 207, 156, 0.3);
}

.generate-btn {
    background: linear-gradient(135deg, #ba55d3 0%, #9370db 100%);
    color: white;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(186, 85, 211, 0.3);
}

.lora-btn {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
}

.lora-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 105, 180, 0.3);
}

.chat-area {
    flex: 0 0 calc(40% - 20px);
    display: flex;
    flex-direction: column;
    border: 2px solid #e8d5f0;
    border-radius: 12px;
    overflow: hidden;
    background-color: #fff;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fefbff;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

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

.message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message.user .message-content {
    background: linear-gradient(135deg, #ba55d3 0%, #9370db 100%);
    color: white;
}

.message.assistant .message-content {
    background-color: #f8f0ff;
    color: #4a4a4a;
}

.loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-style: italic;
    color: #666;
}

.loading-indicator .spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: #6a5acd;
    animation: rotate360 0.9s linear infinite;
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.message-text {
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-time {
    font-size: 0.8em;
    text-align: right;
    opacity: 0.8;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.85);
}

.message.assistant .message-time {
    color: #7a6c80;
}

.chat-input-area {
    padding: 15px;
    background-color: #fff;
    border-top: 2px solid #e8d5f0;
}

.input-controls {
    gap: 10px;
    align-items: flex-end;
}

.input-controls textarea {
    flex: 1;
    min-height: 60px;
    max-height: 150px;
}

.input-buttons {       
    gap: 8px;                  
}


.icon-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background: linear-gradient(135deg, #ba55d3 0%, #9370db 100%);
    color: white;
    transition: all 0.3s;
}

.icon-btn:hover {
    transform: scale(1.05);
}

.voice-btn {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
}

.voice-btn.recording {
    background: linear-gradient(135deg, #ff4757 0%, #ff6348 100%);
    animation: pulse 1s infinite;
}

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

/* スマホ対応 */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        min-height: 70px;
        padding: 0;
        background: linear-gradient(180deg, #6a5acd 0%, #9370db 100%);
        box-shadow: 0 -3px 15px rgba(106, 90, 205, 0.3);
        z-index: 1000;
    }

    .sidebar-header {
        display: none;
    }

    .nav-list {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 100%;
        padding: 0 5px;
        margin: 0;
    }

    .nav-item {
        margin: 0;
        flex: 1;
        display: flex;
        justify-content: center;
    }

    .nav-item a {
        padding: 8px 2px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 0.65em;
        gap: 2px;
        text-align: center;
        width: 100%;
    }

    .nav-item a i {
        margin: 0;
        font-size: 1.8em;
        width: auto;
    }

    .nav-item a:hover,
    .nav-item a.active {
        border-left: none;
        border-top: 3px solid #ff69b4;
        background-color: rgba(255, 255, 255, 0.15);
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 70px;
        width: 100%;
        padding: 15px;
        padding-top: 15px;
    }

    .container {
        padding: 15px;
        margin-top: 0;
    }

    h2 {
        font-size: 1.2em;
        gap: 5px;
    }

    h2 i {
        font-size: 0.9em;
    }

    .section-note {
        padding: 12px;
        font-size: 0.9em;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 0.95em;
    }

    input[type="text"],
    input[type="email"],
    input[type="date"],
    select,
    textarea,
    input[type="password"] {
        font-size: 16px;
    }

    .password-row {
        flex-direction: column;
        gap: 0;
    }

    .submit-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .color-themes {
        flex-direction: row;
        gap: 8px;
        justify-content: space-between;
    }

    .theme-option {
        min-width: auto;
        flex: 1;
        padding: 10px 5px;
    }

    .theme-preview {
        flex-direction: column;
        gap: 3px;
        margin: 5px 0;
    }

    .theme-preview-color {
        width: 100%;
        height: 20px;
        border-radius: 4px;
    }

    .theme-name {
        font-size: 0.75em;
        margin-top: 5px;
    }

    /* 会話テスト画面のスマホ対応 */
    .chat-container {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }

    .clone-display {
        flex: 1 1 auto;
    }

    .clone-image {
        height: 200px;
        margin-bottom: 15px;
    }

    .clone-buttons {
        flex-direction: row;
        gap: 10px;
    }

    .clone-btn {
        flex: 1;
    }

    .chat-area {
        flex: 1 1 auto;
        min-height: 350px;
        max-height: 400px;
    }

    .chat-messages {
        padding: 15px;
    }

    .message-content {
        max-width: 85%;
        font-size: 0.9em;
    }

    .input-controls {
        flex-direction: row;
        align-items: flex-end;
    }

    .input-controls textarea {
        flex: 1;
        font-size: 16px;
        min-height: 50px;
    }

    .input-buttons {
        flex-direction: column;
        gap: 5px;
    }

    .icon-btn {
        padding: 8px 12px;
    }

    .media-preview-list {
        gap: 8px;
    }

    .media-item img {
        width: 70px;
        height: 70px;
    }
}

/* 極小画面対応 */
@media (max-width: 480px) {
    .nav-item a {
        font-size: 0.6em;
        padding: 6px 1px;
    }

    .nav-item a i {
        font-size: 1.6em;
    }

    .main-content {
        padding: 10px;
    }

    .container {
        padding: 12px;
    }

    h2 {
        font-size: 1.1em;
    }

    .clone-image {
        height: 180px;
    }

    .chat-area {
        min-height: 300px;
        max-height: 350px;
    }
}
