/* chat1 page styles extracted from index.php test test*/

/* 動的にセットされる変数を使用（値はJSで上書きされる可能性あり、宣言は静的） */

/* 
:root {
    --vh: 1vh;
    --vw: 1vw;
}
*/

/* 
body {
    margin: 0;
    padding: 0;
    background-image: url('/images/transparent.png');
    background-size: cover;
    background-position: center;
    background-attachment: scroll; 
    overflow-x: hidden;
}


.main-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    touch-action: none;
    box-sizing: border-box;
    transform: translateZ(0);
}
*/

/*
.canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    border: 1px solid #C0C0C0; 
}


#canvas {
    background: transparent;
    z-index: 1;
}

/* 画像表示エリア */

.image-display {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	/* canvasより後ろ */
	pointer-events: none;
	/* クリックを透過 */
}
.image-display img {
	position: absolute;
	top: 33%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 540px;
	width: calc(100% - 32px);
	max-height: 100%;
	height: auto;
	object-fit: contain;
	opacity: 0;
	transition: opacity 0.5s ease-in-out;
}
.image-display img.visible {
	opacity: 1;
}
/* 吹き出し表示 */

.speech-bubble {
	position: absolute;
	background: rgba(255, 255, 255, 0.95);
	border: 4px #4CFF50;
	border-radius: 20px;
	padding: 15px 20px;
	max-width: 350px;
	min-width: 200px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 998;
	font-family: 'Hiragino Sans', 'ヒラギノ角ゴ Pro W3', 'Meiryo', 'メイリオ', sans-serif;
	font-size: 14px;
	line-height: 1.6;
	color: #333;
	word-wrap: break-word;
	animation: bubbleAppear 0.3s ease-out;
	display: none;
	--tail-x: 50px;
	--tail-x-inner: 52px;
}
.speech-bubble::after {
	content: '';
	position: absolute;
	bottom: -10px;
	left: var(--tail-x);
	width: 0;
	height: 0;
	border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-top: 10px solid #FFFFFF;
}
.speech-bubble::before {
	content: '';
	position: absolute;
	bottom: -8px;
	left: var(--tail-x-inner);
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-top: 8px solid rgba(255, 255, 255, 0.95);
}
/* 画像あり時の下部配置用：三角を上側に切り替える */

.speech-bubble.bottom::after {
	top: -10px;
	bottom: auto;
	border-top: none;
	border-bottom: 10px solid #FFFFFF;
}
.speech-bubble.bottom::before {
	top: -8px;
	bottom: auto;
	border-top: none;
	border-bottom: 8px solid rgba(255, 255, 255, 0.95);
}
@keyframes bubbleAppear {
	0% {
		opacity: 0;
		transform: translateY(10px) scale(0.9);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}
@keyframes bubbleDisappear {
	0% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
	100% {
		opacity: 0;
		transform: translateY(-10px) scale(0.9);
	}
}
.speech-bubble.disappearing {
	animation: bubbleDisappear 0.3s ease-in forwards;
}
.input-overlay {
	position: absolute;
	bottom: 50px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 15px;
	width: 90%;
	max-width: 90%;
	box-sizing: border-box;
}
.input-top-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin-bottom: 10px;
}
/* リンク表示エリア */

.link-display {
	position: absolute;
	bottom: 155px;
	left: 50%;
	right: auto !important;
	transform: translateX(-50%);
	z-index: 3;
	display: none;
}
.link-display a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 240px;
	background: rgba(255, 255, 255, 0.8);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 18px;
	padding: 4px 16px;
	text-decoration: none;
	color: #333;
	font-size: 14px;
	font-weight: 400;
	text-align: center;
	white-space: nowrap;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	transition: all 0.2s ease;
}
.link-display a:hover {
	background: rgba(255, 255, 255, 0.9);
	transform: translateY(-1px);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}
.link-display img {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
}
/* Composer fixed */

.composer {
	display: none;
}
.composer-fixed {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 20px;
	display: flex;
	justify-content: center;
	pointer-events: none;
	z-index: 900;
}
/* Ensure composer container sits above the mask */

.composer-fixed #textInputContainer {
	position: relative;
	z-index: 4;
}
html {
	scroll-padding-top: var(--topbar-height);
}
.composer-fixed #textInputContainer {
	width: 85%;
	max-width: 85%;
	position: relative;
}
.composer-fixed #textInput {
	width: 100%;
	background: var(--pill);
    border: 2px solid var(--pill);
	border-radius: 999px;
	padding: 14px 54px 14px 18px;
	color: var(--text);
	font-size: 16px;
	pointer-events: auto;
    outline: none;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

#textInput {

	border: none;
	border-radius: 20px;
	padding: 12px 20px;
	padding-right: 64px;
	font-size: 16px;
	color: #333;
	
}

.composer-fixed #textInput:focus {
	border-color: var(--accent-light);
}

/* Input top controls (status + skip button) */

.composer-fixed .input-top-controls {
	position: absolute;
	top: -45px;
	right: 7.5%;
	display: flex;
	align-items: center;
	gap: 8px;
	pointer-events: auto;
	z-index: 901;
}
/* mock-ui.cssのright: 7.5%に合わせて幅を調整 */

.composer-fixed .input-top-controls {
	width: 85% !important;
}
/* link-display を composer に相対配置し、input-top-controls の直上に固定 */

.composer-fixed .link-display {
	position: absolute;
	top: -90px;
	right: 7.5%;
	left: auto;
	bottom: auto;
	transform: none;
	z-index: 902;
	pointer-events: auto;
}
/* Desktop: keep composer within main (not over sidebar) */

@media (min-width: 769px) {
	.composer-fixed {
		left: var(--sidebar-width);
		right: 0;
	}
	.composer-fixed #textInputContainer {
		width: 85%;
		max-width: 85%;
	}
	.composer-fixed #textInput {
		width: 100%;
	}
}
/* ヘッダー上でのスクロール抑止 */

/*  
.topbar {
    overscroll-behavior: contain;
    touch-action: none;
}
*/

.controls-left {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}
.text-input-container {
	display: flex;
	align-items: center;
	gap: 10px;
	backdrop-filter: blur(15px);
	border-radius: 25px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	position: relative;
}
#textInputContainer {
	position: relative;
}

/* テキストボックス内右端に重ねる送信ボタン */

/*
#sendBtn {
	position: absolute;
	left: auto;
	right: 28px;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: linear-gradient(45deg, #4CAF50, #45a049);

	display: flex;
	align-items: center;

	float: none;
	margin: 0;
}
*/
/* 外部スタイルの .send-pill の左寄せを打ち消し（安全策） */

.composer-fixed .send-pill {
	position: absolute !important;
	left: auto !important;
	right: 28px !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	margin: 0 !important;
	float: none !important;
}
.composer-fixed #sendBtn.send-pill, .composer-fixed .send-pill {
	left: -48px;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	border: 2px solid var(--accent-light);
	background: var(--accent-light);
	display: grid;
	place-items: center;
	pointer-events: auto;
	color: var(--black);
	justify-content: center;
	font-size: 16px;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
	z-index: 3;
}
/* ID指定の強いセレクタも明示的に上書き */

.composer-fixed #sendBtn.send-pill {
	position: absolute !important;
	left: auto !important;
	right: 28px !important;
	top: 49% !important;
	transform: translateY(-50%) !important;
	margin: 0 !important;
	float: none !important;
}
#sendBtn:hover {
	transform: translateY(-50%) scale(1.05);
	background: var(--accent-soft) !important;
	border: 2px solid var(--accent-soft) !important;
	color: var(--gray-500) !important;
}
#sendBtn:active {
	transform: translateY(-50%) scale(0.95);
	background: var(--accent) !important;
	border: 2px solid var(--accenr) !important;
	color: var(--black) !important;
	box-shadow: 0 2px 8px rgba(47, 138, 56, 0.45);
}
/* キーボード操作/フォーカス時の視認性向上 */

#sendBtn:focus-visible {
	outline: 3px solid rgba(76, 175, 80, 0.55);
	outline-offset: 2px;
}
/* 無効時 */

#sendBtn:disabled {
	background: #9ecfa7 !important;
	box-shadow: none !important;
	cursor: not-allowed;
}
#textInput::placeholder {
	color: #666;
}
.send-btn {
	background: linear-gradient(45deg, #4CAF50, #45a049);
	color: white;
	border: none;
	border-radius: 50%;
	width: 45px;
	height: 45px;
	cursor: pointer;
	font-size: 18px;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}
.send-btn:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}
.send-btn:active {
	transform: scale(0.95);
}
.send-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
	transform: none;
}
.ready-badge {
	margin-top: 8px;
	background: #d5f5d5;
	color: #2a6b2a;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 14px;
	border: 1px solid #bfe7a6;
}
/* ローディング状態のスタイル */

.text-input-container.loading {
	position: relative;
	pointer-events: none;
	opacity: 0.6;
}
.text-input-container.loading::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.8);
	border-radius: 25px;
	z-index: 1;
}
.loading-overlay {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2;
	display: none;
}
.text-input-container.loading .loading-overlay {
	display: block;
}
.loading-spinner {
	width: 30px;
	height: 30px;
	animation: spin 1s linear infinite;
}
@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}
.text-input-container.loading #textInput, .text-input-container.loading #sendBtn {
	pointer-events: none;
	opacity: 0.5;
}
.status-area {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	margin-bottom: 10px;
	width: 100%;
}
.status {
	color: var(--gray-700);
	font-size: 12px;
	text-align: right;
	min-height: 16px;
	background: var(--accent-soft);
	backdrop-filter: blur(15px);
	padding: 8px 16px;
	border-radius: 15px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	width: fit-content;
	max-width: 200px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.skip-btn {
	background: rgba(255, 100, 100, 0.9);
	color: white;
	padding: 8px 12px;
	border-radius: 15px;
	font-size: 11px;
	font-weight: bold;
	cursor: pointer;
	backdrop-filter: blur(15px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	box-shadow: 0 4px 16px rgba(255, 0, 0, 0.2);
	transition: all 0.2s ease;
	white-space: nowrap;
}
.skip-btn:hover {
	background: rgba(255, 80, 80, 1);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(255, 0, 0, 0.3);
}
.skip-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
}
.history-btn, .voice-btn {
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	padding: 6px;
	border-radius: 16px;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	backdrop-filter: blur(15px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.history-btn:hover, .voice-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.history-btn:active, .voice-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.history-btn:disabled, .voice-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}
.history-btn .icon, .voice-btn .icon {
	font-size: 16px;
	line-height: 1;
}
/* 音声推奨ツールチップ */

.voice-tooltip {
	position: absolute;
	z-index: 3000;
	max-width: min(350px, calc(100% - 24px));
	background: rgba(255, 255, 255, 0.95);
	border-radius: 20px;
	padding: 15px 20px;
	font-size: 14px;
	line-height: 1.6;
	color: #333;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	pointer-events: none;
	transform: translateX(-50%);
	opacity: 0;
	transition: opacity 0.15s ease;
	text-align: left;
	white-space: normal;
	overflow-wrap: anywhere;
	--tail-x: 50%;
	--tail-x-inner: calc(50% + 2px);
}
.voice-tooltip.visible {
	opacity: 1;
}
.voice-tooltip::after {
	content: '';
	position: absolute;
	bottom: -8px;
	left: calc(50% + var(--tail-offset, 0) - 13px);
	width: 0;
	height: 0;
	border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-top: 10px solid #FFFFFF;
}
/* スタートモーダル */



.start-modal {
	display: flex;
	position: fixed;
	z-index: 2000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background: var(--accent);
	justify-content: center;
	align-items: center;
	cursor: pointer;
	transition: opacity 0.3s ease-out;
}
.start-modal.hidden {
	opacity: 0;
	pointer-events: none;
}
.start-content {
	text-align: center;
	color: white;
	max-width: 400px;
	padding: 20px;
}
.start-image {
	max-width: 40vw;
	max-height: 40vh;
	width: auto;
	height: auto;
	border-radius: 20px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	margin-bottom: 20px;
	transition: transform 0.3s ease;
}
/* iOS対応：画像サイズもCSS変数を使用 */

body.ios-viewport-fix .start-image {
	max-width: calc(var(--vw, 1vw) * 40);
	max-height: calc(var(--vh, 1vh) * 40);
}
.start-image:hover {
	transform: scale(1.05);
}
.start-text {
	font-size: 18px;
	font-weight: bold;
	margin-bottom: 10px;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.start-subtext {
	font-size: 14px;
	opacity: 0.9;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
/* プロファイルエラーモーダル */

.modal {
	display: none;
	position: fixed;
	z-index: 1000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(10px);
}
/*
.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 15% auto;
    padding: 30px;
    border-radius: 20px;
    width: 400px;
    max-width: 90%;
    text-align: center;
    color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
*/

.modal-content h2 {
	margin-top: 0;
	font-size: 24px;
	margin-bottom: 20px;
}
.modal-content p {
	font-size: 16px;
	line-height: 1.6;
	margin-bottom: 0;
}
.disabled {
	opacity: 0.3;
	pointer-events: none;
}
/* 履歴モーダル */
/* 左メニューのトグルボタンより上にだすので、z-indexは一番上。*/
.history-modal-overlay {
	display: none;
	position: absolute;
	z-index: 1110;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.9);
	justify-content: center;
	align-items: center;
}
/*
 * History Modal policy:
 * - 外側コンテナ（.history-modal-content）はスクロールさせない（スクロールバーを出さない）
 * - スクロールは内側の .history-body のみで行う
 * - body 側のグローバルな overflow 制御は行わない
 */

.history-modal-content {
	background: transparent;
	color: #fff;
	padding: 0;
	border-radius: 0;
	width: 90%;
	max-width: 768px;
	height: calc(100% - calc(var(--topbar-height) * 2));
	margin: var(--topbar-height) auto;
	position: relative;
	/*overflow-y: auto;*/
}
.history-header {
	display: none;
}
.history-title {
	display: none;
}
.history-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: transparent;
	border: none;
	font-size: 48px;
	cursor: pointer;
	color: #fff;
	width: 60px;
	height: 60px;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1111;
	font-weight: 300;
	line-height: 1;
}
.history-close.show {
	display: flex;
}
.history-close:hover {
	color: rgba(255, 255, 255, 0.7);
}
.history-image {
	width: 320px;
	margin: auto;
}

/* 共通メニューボタン */

/*  
.common-menu-toggle {
    position: fixed;
    top: 5px;
    left: 5px;
    background: rgba(23, 122, 6, 0.9);
    color: #fff;
    border: none;
    font-size: 22px;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.common-menu-toggle:hover { background: rgba(23, 122, 6, 1); }
*/

/* Show common menu toggle only on mobile */

/* 
@media (max-width: 768px) {
    .common-menu-toggle { display: flex; }
    body.sidebar-open .common-menu-toggle { display: none; }
}
*/

/* Pricingモーダル */

/* 
.pricing-modal-overlay {
    display: none;
    position: absolute;
    z-index: 1001;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
}

.pricing-modal-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.pricing-content-inner { min-height: 100%; }
*/

/* Contactモーダル */

/*
.contact-modal-overlay {
    display: none;
    position: absolute;
    z-index: 1001;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    overflow-y: auto;
}

.contact-modal-content {
    width: 100%;
    height: 100%;
    color: #333;
    overflow-y: auto;
}

.contact-content-inner { min-height: 100%; }
*/

/* Mobile sidebar functionality */

/* 
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1010;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1010;
    }
    body.sidebar-open #sidebar {
        transform: translateX(0); 
    }
    
    .backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.25);
        z-index: 1000;
        touch-action: none;
        overscroll-behavior: contain;
    }
    body.sidebar-open .backdrop {
        display: block; 
    }
    body.sidebar-open .main { 
        overflow: hidden; 
    }
}
*/

/*
 * 履歴一覧のスクロール領域。
 * 外側はスクロールしない方針のため、ここにのみ overflow を付与する。
 */

.history-body {
	background: transparent;
	border: none;
	border-radius: 0;
	max-height: 100%;
	overflow: auto;
	padding: 20px;
	text-align: left;
	font-size: var(--body);
	line-height: 1.5;
	color: #fff;
}
.history-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.history-item {
	display: block;
	margin-bottom: 0;
	padding: 8px 12px;
	border-radius: 10px;
	max-width: fit-content;
	word-wrap: break-word;
}

.history-item-devide {
    border-bottom: 1px solid #ffffff;
    margin-bottom: 16px;
}

.history-item.user {
	background: rgba(100, 100, 100, 0.8);
	margin-left: auto;
	margin-right: 0;
	text-align: right;
	margin-bottom: 64px;
}
.history-item.ai {
	background: transparent;
	margin-left: 0;
	margin-right: auto;
	text-align: left;
	margin-bottom: 32px;
}
.history-item .content {
	width: 100%;
}
.history-item .role-label {
	font-weight: 700;
	font-size: 12px;
	color: #ccc;
	margin-bottom: 4px;
}
.history-item .message-text {
	white-space: pre-wrap;
	word-wrap: break-word;
	display: flex;
	gap: 16px;
	flex-direction: column;
}