mari-chat-3 / streamlit_styles.css
sirochild's picture
Upload 2 files
9a1a95e verified
/* 麻理チャット用カスタムCSS - 新デザインシステム */
/* Google Fonts読み込み */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;500;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');
/* === CSS カスタムプロパティ(テーマ変数) === */
:root {
/* 新しいカラーパレット - コントラスト改善版 */
--base-color: #FAF3E0; /* クリーム色(背景) */
--text-color: #333333; /* 濃い灰色(テキスト) - 視認性向上 */
--mari-bubble-bg: #F5F5F5; /* オフホワイト(麻理の吹き出し) */
--user-bubble-bg: #A8D0B0; /* より濃い緑(ユーザーの吹き出し) - コントラスト比改善 */
--hidden-bubble-bg: #FFF8E1; /* 暖かいクリーム(本音の吹き出し) */
--icon-color: #3D2F24; /* ダークセピア(アイコン・ボタン) */
/* フォントファミリー */
--mari-font: "しっぽり明朝", "Noto Serif JP", "Yu Mincho", "YuMincho", "Hiragino Mincho Pro", "Times New Roman", serif;
--ui-font: "Noto Sans JP", "M PLUS 1p", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
/* アニメーション設定 */
--transition-smooth: all 0.3s ease;
--transition-slow: all 0.5s ease;
}
/* === グローバルスタイル === */
* {
font-family: var(--ui-font) !important;
}
/* === メインアプリケーション === */
.stApp {
/* 背景は動的に設定されるため、ここでは基本設定のみ */
color: var(--text-color);
min-height: auto !important;
}
/* アプリケーションコンテナ - 動的背景を優先 */
/* ベースのbody背景は透過にしておく */
body {
background: none !important;
}
/* 背景画像は動的にJavaScriptで設定されるため、静的な設定は削除 */
/* Streamlit内部背景透過で下の背景を見せる */
/* .stAppは動的に背景が設定されるため、透過設定を削除 */
[data-testid="stAppViewContainer"] > section,
[data-testid="stAppViewContainer"] > section > div.block-container,
.main .block-container {
background: transparent !important;
}
/* 操作可能な要素のz-indexを確実に上げる */
.stApp [data-testid="stChatInput"],
.stApp [data-testid="stSidebar"],
.stApp .stButton,
.stApp .stTextInput,
.stApp .stSelectbox,
.stApp .stCheckbox,
.stApp .stRadio,
.stApp .stSlider,
.stApp .stProgress,
.stApp .stMetric,
.stApp .stExpander,
.stApp .stTabs {
position: relative !important;
z-index: 1000 !important;
}
/* チャットメッセージのz-indexも上げる */
.stApp .stChatMessage {
position: relative !important;
z-index: 1000 !important;
}
/* メインコンテンツエリアの背景を調整 - 縦長対応 */
.main .block-container {
background: transparent !important;
border-radius: 15px !important;
padding: 20px !important;
margin: 10px !important;
backdrop-filter: none !important;
min-height: auto !important;
padding-bottom: 150px !important;
}
/* タブエリアの背景を明示的に設定 */
.stTabs {
background: rgba(255, 255, 255, 0.95) !important;
backdrop-filter: blur(10px) !important;
border-radius: 10px !important;
padding: 10px !important;
margin: 10px 0 !important;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}
/* タブコンテンツの背景 - 縦長対応 */
.stTabs [data-baseweb="tab-panel"] {
background: rgba(255, 255, 255, 0.98) !important;
backdrop-filter: blur(15px) !important;
border-radius: 8px !important;
padding: 20px !important;
margin-top: 10px !important;
min-height: auto !important;
max-height: none !important;
}
/* タブヘッダーの背景 */
.stTabs [data-baseweb="tab-list"] {
background: rgba(255, 255, 255, 0.9) !important;
backdrop-filter: blur(10px) !important;
border-radius: 8px 8px 0 0 !important;
padding: 5px !important;
}
/* === チャットメッセージ === */
.stChatMessage {
background: rgba(255, 255, 255, 0.98) !important;
backdrop-filter: blur(15px) !important;
border-radius: 12px !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
margin: 8px 0 !important;
margin-bottom: 12px !important;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
transition: all 0.3s ease;
color: #333333 !important;
font-family: var(--ui-font) !important;
font-size: 18px !important;
position: relative !important;
z-index: 1000 !important;
}
/* チャットメッセージ内のすべてのテキスト要素を確実に黒文字に */
.stChatMessage * {
color: #333333 !important;
}
/* チャットメッセージ内のマークダウン要素 */
.stChatMessage p,
.stChatMessage div,
.stChatMessage span {
color: #333333 !important;
}
/* 最後のチャットメッセージに追加の下部マージンを設定 */
.stChatMessage:last-of-type {
margin-bottom: 120px !important;
}
.stChatMessage:hover {
background: rgba(255, 255, 255, 1) !important;
border: 1px solid rgba(0, 0, 0, 0.2) !important;
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}
/* ユーザーメッセージ */
.stChatMessage[data-testid="user-message"] {
background: var(--user-bubble-bg) !important;
border: 1px solid rgba(168, 208, 176, 0.6) !important;
color: #333333 !important;
font-family: var(--ui-font) !important;
font-size: 18px !important;
}
/* ユーザーメッセージ内のすべてのテキスト要素 */
.stChatMessage[data-testid="user-message"] * {
color: #333333 !important;
}
/* アシスタントメッセージ(麻理の対話) */
.stChatMessage[data-testid="assistant-message"] {
background: var(--mari-bubble-bg) !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
color: #333333 !important;
font-family: var(--mari-font) !important;
line-height: 1.7 !important;
font-size: 18px !important;
}
/* アシスタントメッセージ内のすべてのテキスト要素 */
.stChatMessage[data-testid="assistant-message"] * {
color: #333333 !important;
}
/* アシスタントメッセージ内のマークダウン要素 */
.stChatMessage[data-testid="assistant-message"] p,
.stChatMessage[data-testid="assistant-message"] div,
.stChatMessage[data-testid="assistant-message"] span {
color: #333333 !important;
}
/* 隠された真実の吹き出し */
.stChatMessage[data-testid="assistant-message"].hidden-truth {
background: var(--hidden-bubble-bg) !important;
border: 1px solid rgba(255, 248, 225, 0.7) !important;
box-shadow: 0 2px 8px rgba(255, 248, 225, 0.3) !important;
}
/* 麻理の初期メッセージアニメーション */
.mari-initial-message {
color: #333333 !important; /* 黒文字で表示 */
font-weight: 500;
background-color: transparent !important;
animation: popIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
/* Streamlitのチャットメッセージ内での初期メッセージ */
.stChatMessage .mari-initial-message {
color: #333333 !important; /* 黒文字で表示 */
font-weight: 500;
}
/* より具体的なセレクタでStreamlitのデフォルトスタイルを上書き */
div[data-testid="stChatMessage"] .mari-initial-message {
color: #333333 !important; /* 黒文字で表示 */
font-weight: 500;
}
/* Streamlitのチャットメッセージ要素全体に対する強制的な文字色設定 */
div[data-testid="stChatMessage"],
div[data-testid="stChatMessage"] *,
div[data-testid="assistant-message"],
div[data-testid="assistant-message"] *,
div[data-testid="user-message"],
div[data-testid="user-message"] * {
color: #333333 !important;
}
/* Streamlitのマークダウン要素 */
div[data-testid="stChatMessage"] .stMarkdown,
div[data-testid="stChatMessage"] .stMarkdown *,
div[data-testid="stChatMessage"] .element-container,
div[data-testid="stChatMessage"] .element-container * {
color: #333333 !important;
}
@keyframes popIn {
0% {
opacity: 0;
transform: scale(0.3) translateY(20px);
}
50% {
opacity: 0.8;
transform: scale(1.05) translateY(-5px);
}
100% {
opacity: 1;
transform: scale(1) translateY(0);
}
}
/* 自動スクロール用のスムーズスクロール */
.chat-container {
scroll-behavior: smooth;
}
/* === サイドバー === */
[data-testid="stSidebar"],
[data-testid="stSidebar"] > div,
[data-testid="stSidebar"] > div > div,
.stSidebar,
.stSidebar > div {
background: #FAF3E0 !important; /* クリーム色の不透明背景 */
border-right: 1px solid rgba(61, 47, 36, 0.3) !important;
/* backdrop-filterを削除して透過効果をなくす */
backdrop-filter: none !important;
/* 透過を完全に無効化 */
opacity: 1 !important;
}
/* サイドバーの最上位コンテナも確実に設定 */
section[data-testid="stSidebar"] {
background: #FAF3E0 !important;
backdrop-filter: none !important;
}
/* サイドバー内のテキスト */
[data-testid="stSidebar"] .stMarkdown,
[data-testid="stSidebar"] label {
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
text-shadow: none;
background: transparent !important; /* テキスト要素は透過 */
}
/* サイドバー内のすべての要素の背景を制御 */
[data-testid="stSidebar"] * {
backdrop-filter: none !important;
}
/* サイドバー内のメトリクス(好感度表示)*/
[data-testid="stSidebar"] .stMetric {
background: rgba(255, 255, 255, 1.0) !important; /* 完全不透明の白背景 */
padding: 10px !important;
border-radius: 8px !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
margin: 5px 0 !important;
}
[data-testid="stSidebar"] .stMetric [data-testid="metric-container"] {
background: transparent !important;
}
[data-testid="stSidebar"] .stMetric [data-testid="metric-container"]>div {
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
}
[data-testid="stSidebar"] .stMetric [data-testid="metric-container"]>div:first-child {
color: var(--text-color) !important;
font-size: 0.9em !important;
font-weight: 500 !important;
font-family: var(--ui-font) !important;
}
[data-testid="stSidebar"] .stMetric [data-testid="metric-container"]>div:last-child {
color: var(--text-color) !important;
font-weight: bold !important;
font-size: 1.4em !important;
font-family: var(--ui-font) !important;
}
/* サイドバー内のすべてのメトリクステキストを統一カラーにする */
[data-testid="stSidebar"] .stMetric * {
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
}
/* === 入力フィールド === */
.stTextInput>div>div>input {
background: rgba(255, 255, 255, 0.95) !important;
color: var(--text-color) !important;
border: 1px solid rgba(61, 47, 36, 0.4) !important;
border-radius: 8px !important;
backdrop-filter: blur(5px);
transition: all 0.3s ease;
font-family: var(--ui-font) !important;
}
.stTextInput>div>div>input:focus {
background: rgba(255, 255, 255, 1) !important;
border: 1px solid rgba(61, 47, 36, 0.7) !important;
box-shadow: 0 0 10px rgba(61, 47, 36, 0.3) !important;
}
.stTextInput>div>div>input::placeholder {
color: rgba(61, 47, 36, 0.7) !important;
}
/* === チャット入力フォーム固定スタイル === */
/* フォーム全体を画面下部に固定 */
[data-testid="stForm"] {
position: fixed !important;
bottom: 20px !important;
left: 50% !important;
transform: translateX(-50%) !important;
width: calc(100% - 40px) !important;
max-width: 800px !important;
z-index: 999 !important;
background: rgba(255, 255, 255, 0.95) !important;
backdrop-filter: blur(15px) !important;
border-radius: 25px !important;
border: 2px solid rgba(61, 47, 36, 0.2) !important;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
padding: 15px 20px !important;
transition: all 0.3s ease !important;
}
[data-testid="stForm"]:hover {
background: rgba(255, 255, 255, 1) !important;
border: 2px solid rgba(61, 47, 36, 0.4) !important;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2) !important;
transform: translateX(-50%) translateY(-2px) !important;
}
/* チャット履歴エリアに下部マージンを追加 - 縦長対応 */
.stChatMessage:last-of-type {
margin-bottom: 200px !important;
}
/* チャット履歴コンテナの高さ調整 */
.chat-history-container {
min-height: auto !important;
max-height: none !important;
}
/* === 浮遊カードスタイル入力エリア(旧stChatInput用) === */
.stChatInput {
position: sticky !important;
bottom: 30px !important;
z-index: 100 !important;
padding: 0 20px !important;
margin-top: 40px !important;
}
.stChatInput > div {
background: rgba(255, 255, 255, 0.95) !important;
backdrop-filter: blur(15px) !important;
border-radius: 25px !important;
border: 2px solid rgba(61, 47, 36, 0.2) !important;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
padding: 15px 20px !important;
transition: all 0.3s ease !important;
position: relative !important;
}
.stChatInput > div:hover {
background: rgba(255, 255, 255, 1) !important;
border: 2px solid rgba(61, 47, 36, 0.4) !important;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2) !important;
transform: translateY(-2px) !important;
}
/* チャット入力フィールドのスタイル */
.stChatInput>div>div>input {
background: transparent !important;
color: var(--text-color) !important;
border: none !important;
border-radius: 0 !important;
font-family: var(--ui-font) !important;
font-size: 16px !important;
padding: 8px 50px 8px 15px !important;
outline: none !important;
box-shadow: none !important;
}
.stChatInput>div>div>input:focus {
background: transparent !important;
border: none !important;
box-shadow: none !important;
outline: none !important;
}
.stChatInput>div>div>input::placeholder {
color: rgba(61, 47, 36, 0.6) !important;
font-style: italic !important;
}
/* 送信ボタンのスタイル(紙飛行機アイコン) */
.stChatInput button {
position: absolute !important;
right: 15px !important;
top: 50% !important;
transform: translateY(-50%) !important;
background: linear-gradient(45deg, var(--text-color), #5B4636) !important;
color: white !important;
border: none !important;
border-radius: 50% !important;
width: 40px !important;
height: 40px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
font-size: 16px !important;
cursor: pointer !important;
transition: all 0.3s ease !important;
box-shadow: 0 4px 12px rgba(61, 47, 36, 0.3) !important;
}
.stChatInput button:hover {
background: linear-gradient(45deg, #5B4636, var(--text-color)) !important;
transform: translateY(-50%) scale(1.1) !important;
box-shadow: 0 6px 16px rgba(61, 47, 36, 0.4) !important;
}
.stChatInput button:active {
transform: translateY(-50%) scale(0.95) !important;
}
/* 送信ボタンのアイコンを紙飛行機に変更 */
.stChatInput button::before {
content: "➢" !important;
font-size: 18px !important;
line-height: 1 !important;
}
/* 元のボタンテキストを非表示 */
.stChatInput button span {
display: none !important;
}
/* 無効化状態のスタイル */
.stChatInput[data-disabled="true"] > div,
.stChatInput:has(input:disabled) > div {
background: rgba(200, 200, 200, 0.7) !important;
border: 2px solid rgba(150, 150, 150, 0.3) !important;
cursor: not-allowed !important;
}
.stChatInput[data-disabled="true"] input,
.stChatInput input:disabled {
color: rgba(100, 100, 100, 0.7) !important;
cursor: not-allowed !important;
}
.stChatInput[data-disabled="true"] button,
.stChatInput:has(input:disabled) button {
background: rgba(150, 150, 150, 0.5) !important;
cursor: not-allowed !important;
transform: translateY(-50%) !important;
}
.stChatInput[data-disabled="true"] button:hover,
.stChatInput:has(input:disabled) button:hover {
background: rgba(150, 150, 150, 0.5) !important;
transform: translateY(-50%) !important;
box-shadow: 0 4px 12px rgba(150, 150, 150, 0.3) !important;
}
/* 入力エリア全体のアニメーション効果 */
.stChatInput > div::before {
content: '' !important;
position: absolute !important;
top: -2px !important;
left: -2px !important;
right: -2px !important;
bottom: -2px !important;
background: linear-gradient(45deg,
rgba(61, 47, 36, 0.1),
rgba(245, 245, 245, 0.1),
rgba(61, 47, 36, 0.1)) !important;
border-radius: 27px !important;
z-index: -1 !important;
opacity: 0 !important;
transition: opacity 0.3s ease !important;
}
.stChatInput > div:focus-within::before {
opacity: 1 !important;
animation: borderGlow 2s ease-in-out infinite !important;
}
@keyframes borderGlow {
0%, 100% {
background: linear-gradient(45deg,
rgba(61, 47, 36, 0.2),
rgba(245, 245, 245, 0.2),
rgba(61, 47, 36, 0.2));
}
50% {
background: linear-gradient(45deg,
rgba(61, 47, 36, 0.4),
rgba(245, 245, 245, 0.4),
rgba(61, 47, 36, 0.4));
}
}
/* === フォーム内の入力フィールドスタイル === */
[data-testid="stForm"] .stTextInput > div > div > input {
background: transparent !important;
color: var(--text-color) !important;
border: none !important;
border-radius: 0 !important;
font-family: var(--ui-font) !important;
font-size: 16px !important;
padding: 8px 15px !important;
outline: none !important;
box-shadow: none !important;
}
[data-testid="stForm"] .stTextInput > div > div > input:focus {
background: transparent !important;
border: none !important;
box-shadow: none !important;
outline: none !important;
}
[data-testid="stForm"] .stTextInput > div > div > input::placeholder {
color: rgba(61, 47, 36, 0.6) !important;
font-style: italic !important;
}
/* === フォーム内の送信ボタンスタイル === */
[data-testid="stForm"] .stButton > button {
background: linear-gradient(45deg, var(--text-color), #5B4636) !important;
color: white !important;
border: none !important;
border-radius: 20px !important;
font-weight: 500 !important;
font-family: var(--ui-font) !important;
transition: all 0.3s ease !important;
box-shadow: 0 4px 12px rgba(61, 47, 36, 0.3) !important;
}
[data-testid="stForm"] .stButton > button:hover {
background: linear-gradient(45deg, #5B4636, var(--text-color)) !important;
transform: scale(1.05) !important;
box-shadow: 0 6px 16px rgba(61, 47, 36, 0.4) !important;
}
[data-testid="stForm"] .stButton > button:active {
transform: scale(0.95) !important;
}
/* === ボタン === */
.stButton>button {
background: rgba(255, 255, 255, 0.95) !important;
color: var(--text-color) !important;
border: 1px solid rgba(61, 47, 36, 0.4) !important;
border-radius: 8px !important;
backdrop-filter: blur(5px);
transition: all 0.3s ease;
font-weight: 500;
font-family: var(--ui-font) !important;
}
.stButton>button:hover {
background: rgba(255, 255, 255, 1) !important;
border: 1px solid rgba(61, 47, 36, 0.6) !important;
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(61, 47, 36, 0.3) !important;
}
.stButton>button:active {
transform: translateY(0);
}
/* プライマリボタン */
.stButton>button[kind="primary"] {
background: linear-gradient(45deg, #667eea, #764ba2) !important;
border: 1px solid rgba(255, 255, 255, 0.4) !important;
color: white !important;
}
.stButton>button[kind="primary"]:hover {
background: linear-gradient(45deg, #5a6fd8, #6a4190) !important;
}
/* セカンダリボタン */
.stButton>button[kind="secondary"] {
background: rgba(255, 255, 255, 0.8) !important;
border: 1px solid rgba(61, 47, 36, 0.4) !important;
color: var(--text-color) !important;
}
/* === プログレスバー(好感度ゲージ用) === */
/* チュートリアル進行バーのみを非表示にする(クラス名で区別) */
.tutorial-progress {
display: none !important;
}
/* 好感度プログレスバーのスタイル */
.stProgress {
background: rgba(255, 255, 255, 0.95) !important;
border-radius: 10px !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
padding: 5px !important;
margin: 10px 0 !important;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}
.stProgress > div > div {
background: linear-gradient(90deg, #ff69b4, #ff1493) !important;
border-radius: 8px !important;
transition: all 0.3s ease !important;
}
/* サイドバー内の好感度プログレスバー */
[data-testid="stSidebar"] .stProgress {
background: rgba(255, 255, 255, 1.0) !important;
border-radius: 8px !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
padding: 8px !important;
margin: 8px 0 !important;
}
[data-testid="stSidebar"] .stProgress > div > div {
background: linear-gradient(90deg, #ff69b4, #ff1493) !important;
border-radius: 6px !important;
height: 12px !important;
}
/* === Expander(折りたたみ要素)のスタイル === */
[data-testid="stExpander"] {
background: rgba(255, 255, 255, 0.95) !important;
border: 2px solid rgba(100, 149, 237, 0.3) !important;
border-radius: 15px !important;
backdrop-filter: blur(10px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
margin: 15px 0 !important;
transition: all 0.3s ease;
}
[data-testid="stExpander"]:hover {
border: 2px solid rgba(100, 149, 237, 0.5) !important;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
transform: translateY(-2px);
}
[data-testid="stExpander"] summary {
/* Expanderのヘッダー部分 */
font-size: 1.2em !important;
font-weight: 600 !important;
color: #2c3e50 !important;
padding: 15px 20px !important;
background: rgba(100, 149, 237, 0.1) !important;
border-radius: 12px !important;
margin: -1px !important;
transition: all 0.3s ease;
}
[data-testid="stExpander"] summary:hover {
background: rgba(100, 149, 237, 0.2) !important;
color: #1a252f !important;
}
/* Expanderの中身のスタイル */
[data-testid="stExpander"] .streamlit-expanderContent {
padding: 20px !important;
background: rgba(255, 255, 255, 0.98) !important;
border-radius: 0 0 12px 12px !important;
}
/* チュートリアル用の特別なスタイル */
[data-testid="stExpander"] .streamlit-expanderContent h3 {
color: #2c3e50 !important;
font-size: 1.1em !important;
margin: 15px 0 8px 0 !important;
padding-bottom: 5px !important;
border-bottom: 2px solid rgba(100, 149, 237, 0.3) !important;
}
[data-testid="stExpander"] .streamlit-expanderContent ul {
margin: 10px 0 !important;
padding-left: 20px !important;
}
[data-testid="stExpander"] .streamlit-expanderContent li {
margin: 5px 0 !important;
color: #34495e !important;
line-height: 1.6 !important;
}
[data-testid="stExpander"] .streamlit-expanderContent strong {
color: #2980b9 !important;
font-weight: 600 !important;
}
/* チュートリアルの最終メッセージを強調 */
[data-testid="stExpander"] .streamlit-expanderContent p:last-child {
background: linear-gradient(45deg, rgba(100, 149, 237, 0.1), rgba(155, 89, 182, 0.1)) !important;
padding: 12px 15px !important;
border-radius: 8px !important;
border-left: 4px solid #3498db !important;
font-weight: 500 !important;
color: #2c3e50 !important;
margin-top: 15px !important;
}
/* Expanderの開閉アニメーション */
[data-testid="stExpander"] .streamlit-expanderContent {
animation: expanderFadeIn 0.3s ease-out;
}
@keyframes expanderFadeIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 中央寄せのためのコラムスタイル調整 */
.stColumns>div:first-child,
.stColumns>div:last-child {
padding: 0 !important;
}
.stColumns>div:nth-child(2) {
padding: 0 10px !important;
}
/* === カスタムチャット履歴エリア === */
.chat-history-container {
max-height: 500px !important;
overflow-y: auto !important;
padding: 15px !important;
background: rgba(255, 255, 255, 0.1) !important;
border-radius: 15px !important;
border: 2px solid rgba(255, 255, 255, 0.2) !important;
backdrop-filter: blur(10px) !important;
margin: 20px 0 !important;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
transition: all 0.3s ease !important;
}
.chat-history-container:hover {
border: 2px solid rgba(255, 255, 255, 0.4) !important;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
}
.chat-message {
margin: 12px 0 !important;
padding: 12px 16px !important;
border-radius: 12px !important;
max-width: 80% !important;
word-wrap: break-word !important;
animation: messageSlideIn 0.3s ease-out !important;
transition: all 0.3s ease !important;
}
.chat-message:hover {
transform: translateY(-2px) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}
.chat-message.user {
background: var(--user-bubble-bg) !important;
border: 1px solid rgba(168, 208, 176, 0.6) !important;
margin-left: auto !important;
text-align: right !important;
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
text-shadow: none !important;
}
.chat-message.assistant {
background: var(--mari-bubble-bg) !important;
border: 1px solid rgba(245, 245, 245, 0.5) !important;
margin-right: auto !important;
color: var(--text-color) !important;
font-family: var(--mari-font) !important;
line-height: 1.7 !important;
text-shadow: none !important;
}
.chat-message.initial {
background: rgba(255, 20, 147, 0.2) !important;
border: 1px solid rgba(255, 20, 147, 0.4) !important;
animation: initialMessagePulse 2s ease-in-out !important;
}
.message-role {
font-size: 0.8em !important;
font-weight: bold !important;
margin-bottom: 5px !important;
opacity: 0.8 !important;
}
.message-content {
line-height: 1.5 !important;
font-size: 18px !important;
}
@keyframes messageSlideIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes initialMessagePulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
/* チャット履歴コンテナのスクロールバー */
.chat-history-container::-webkit-scrollbar {
width: 8px !important;
}
.chat-history-container::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1) !important;
border-radius: 4px !important;
}
.chat-history-container::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3) !important;
border-radius: 4px !important;
transition: background 0.3s ease !important;
}
.chat-history-container::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5) !important;
}
/* UI分裂防止のためのスタイル */
.stApp>div:first-child {
position: relative !important;
z-index: 1 !important;
}
/* チャット入力エリアの安定化 - 新しい浮遊カードスタイルに統合済み */
/* スピナー(考え中...)のスタイル改善 */
.stSpinner {
position: fixed !important;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
z-index: 1000 !important;
background: rgba(0, 0, 0, 0.8) !important;
padding: 20px !important;
border-radius: 10px !important;
color: white !important;
}
/* 重複要素の防止 */
.stApp [data-testid="stAppViewContainer"] {
overflow-x: hidden !important;
}
/* タブコンテンツの安定化 - 縦長に拡張 */
.stTabs [data-baseweb="tab-panel"] {
padding-top: 20px !important;
min-height: auto !important;
padding-bottom: 150px !important;
}
/* === スクロールバー === */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.1);
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.3);
border-radius: 4px;
transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(0, 0, 0, 0.5);
}
::-webkit-scrollbar-corner {
background: transparent;
}
/* === テキストの可読性向上 === */
.stMarkdown,
.stText {
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
text-shadow: none;
}
.stMarkdown h1,
.stMarkdown h2,
.stMarkdown h3 {
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
text-shadow: none;
}
/* フォームラベルのスタイル統一 */
.stTextInput label,
.stSelectbox label,
.stTextArea label {
color: white !important;
font-family: var(--ui-font) !important;
font-weight: 500 !important;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7) !important;
background: rgba(0, 0, 0, 0.3) !important;
padding: 4px 8px !important;
border-radius: 4px !important;
margin-bottom: 5px !important;
display: inline-block !important;
}
/* === アクセシビリティ改善 === */
/* フォーカス状態の視認性向上 */
.stButton>button:focus,
.stTextInput>div>div>input:focus,
.stChatInput>div>div>input:focus {
outline: 2px solid var(--text-color) !important;
outline-offset: 2px !important;
}
/* === マスクアイコンとフリップアニメーション === */
.message-container {
position: relative;
perspective: 1000px;
margin: 10px 0;
}
.message-flip {
position: relative;
width: 100%;
height: auto;
min-height: 60px;
transform-style: preserve-3d;
transition: transform 0.4s ease-in-out;
}
.message-flip.flipped {
transform: rotateY(180deg);
}
.message-side {
position: absolute;
width: 100%;
backface-visibility: hidden;
padding: 15px 45px 15px 15px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
font-family: var(--mari-font);
line-height: 1.7;
min-height: 50px;
}
.message-front {
background: var(--mari-bubble-bg);
border: 1px solid rgba(0, 0, 0, 0.1);
color: var(--text-color);
transform: rotateY(0deg);
}
.message-back {
background: var(--hidden-bubble-bg);
border: 1px solid rgba(255, 248, 225, 0.7);
color: var(--text-color);
transform: rotateY(180deg);
box-shadow: 0 2px 8px rgba(255, 248, 225, 0.3);
}
.mask-icon {
position: absolute;
bottom: 12px;
right: 12px;
font-size: 20px;
cursor: pointer;
padding: 6px;
border-radius: 50%;
background: rgba(192, 65, 65, 0.9);
transition: all 0.3s ease;
z-index: 10;
user-select: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.mask-icon:hover {
background: rgb(197, 89, 89);
transform: scale(1.1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.mask-icon:active {
transform: scale(0.95);
}
.mask-icon.tutorial-pulse {
animation: tutorialPulse 2s ease-in-out infinite;
}
@keyframes tutorialPulse {
0%, 100% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(255, 105, 180, 0.7);
}
50% {
transform: scale(1.1);
box-shadow: 0 0 0 10px rgba(255, 105, 180, 0);
}
}
/* === アニメーション === */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.scene-transition {
animation: fadeIn 2s ease-in-out;
}
/* === レスポンシブ対応 === */
@media (max-width: 768px) {
.stApp {
background-attachment: scroll;
}
.stChatMessage {
margin: 4px 0 !important;
border-radius: 8px !important;
font-size: 16px !important;
}
/* モバイル向けチャット履歴調整 */
.chat-history-container {
max-height: 400px !important;
padding: 10px !important;
margin: 15px 0 !important;
}
.chat-message {
max-width: 90% !important;
padding: 10px 12px !important;
margin: 8px 0 !important;
}
.message-content {
font-size: 16px !important;
}
/* モバイル向け浮遊入力エリア調整 */
.stChatInput {
bottom: 15px !important;
padding: 0 10px !important;
}
/* モバイル版でも最後のメッセージに十分なマージンを確保 */
.stChatMessage:last-of-type {
margin-bottom: 100px !important;
}
.stChatInput > div {
padding: 12px 15px !important;
border-radius: 20px !important;
}
.stChatInput>div>div>input {
font-size: 14px !important;
padding: 6px 45px 6px 12px !important;
}
.stChatInput button {
width: 35px !important;
height: 35px !important;
right: 12px !important;
}
.stChatInput button::before {
font-size: 16px !important;
}
}
/* --- ▼▼▼ 【UIクリーンアップのための追加ルール】 ▼▼▼ --- */
/* 1. Python側で生成される不要な要素を非表示 */
/* 謎のタブ、2本目のゲージ、カスタムステータス表示などをまとめて非表示 */
.status-display,
.metric-container,
.affection-gauge,
[data-testid="stSidebar"] [data-testid="stHeading"] {
display: none !important;
}
/* 2. メトリクスの表示を改善(サイドバー以外) */
[data-testid="stMetric"] {
background: rgba(223, 77, 77, 0.9) !important;
padding: 8px !important;
border-radius: 6px !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
}
[data-testid="stMetric"] [data-testid="metric-container"]>div {
color: #2c3e50 !important;
}
[data-testid="stMetric"] [data-testid="metric-container"]>div:first-child {
color: #555 !important;
font-size: 0.9em !important;
}
[data-testid="stMetric"] [data-testid="metric-container"]>div:last-child {
color: #2c3e50 !important;
font-weight: bold !important;
font-size: 1.4em !important;
}
/* サイドバー内のメトリクスを統一カラーにする */
[data-testid="stSidebar"] [data-testid="stMetric"] [data-testid="metric-container"]>div,
[data-testid="stSidebar"] [data-testid="stMetric"] [data-testid="metric-container"]>div>div,
[data-testid="stSidebar"] [data-testid="stMetric"] span,
[data-testid="stSidebar"] [data-testid="stMetric"] p {
color: var(--text-color) !important;
font-family: var(--ui-font) !important;
}
/* 3. サイドバーのデバッグ用チェックボックスなどを非表示 */
[data-testid="stSidebar"] .stCheckbox,
[data-testid="stSidebar"] .stSelectbox {
display: none !important;
}