body {
    font-family: Verdana, sans-serif;
    background-color: #000; 
    margin: 0;
    zoom: 0.9;
}

h1 {
    margin: 0;
}


.hidden {
    display: none !important;
}

.main-title {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    color: white;
    text-align: center;
    font-size: 3em;
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
    margin: 0;
    font-family: Arial, sans-serif;
    z-index: 10;
    pointer-events: none;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-top: 30px;
    margin-bottom: 170px;
}


.header-left-group, .header-right-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1; 
}

.header-right-group {
    justify-content: flex-end; 
}


.main-header h3 {
    color: white;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    flex-shrink: 0; 
    padding: 0 20px;
    font-size: 2em; 
    margin-top: 40px; 
    position: relative;
    transform: translateY(150px);
}



#new-character-btn {
	padding: 7px 14px;
	border-radius: 10px;
	background-color: #004da0; 
	color: white;
	cursor: pointer;
	font-size: 18px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

#new-character-btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

#new-character-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#new-character-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#manage-personas-btn {
	padding: 7px 14px;
	border-radius: 10px;
	background-color: #313275; 
	color: white;
	cursor: pointer;
	font-size: 18px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none;
}

#manage-personas-btn:hover {
	filter: brightness(1.25); 
	transform: translateY(-1px);
}

#manage-personas-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#manage-personas-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#create-new-persona-btn {
    background-color: #0065d1;
    color: white;
}

#create-new-persona-btn:hover {
    background-color: #2682e4; 
}



#app-settings-btn {
	background-color: #4d2d56;
	color: white;
	text-decoration: none;
	padding: 7px 14px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer; 
	font-size: 18px;
    font-family: Arial;
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
}

#app-settings-btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

#app-settings-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#app-settings-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#search-input, #tag-search-input {
    background-color: #52545a7a;
    color: #dfdfdf;
    border: 1px solid #48546b75;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 18px;
    width: 100%;
    max-width: 500px; 
    transition: all 0.2s;
    text-align: center;
}

#search-input:focus {
    outline: none;
    border-color: #007bff; 
    background-color: #4f545c;
}

#tag-search-input:focus {
    outline: none;
    border-color: #007bff; 
    background-color: #4f545c;
}

#search-input::placeholder {
    color: #aaaaaa;
}

#tag-search-input::placeholder {
    color: #aaaaaa;
}

.header-menu {
    display: flex;
    gap: 10px;
}



.header-menu button,
#privacy-btn,
#help-btn {
	background-color: #8d949b94; 
	color: white;
	padding: 7px 14px;
	border-radius: 10px;
	cursor: pointer;
	font-size: 18px;
    font-family: Arial;
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
	display: inline-flex; 
	align-items: center; 
	gap: 8px; 
}

.header-menu button:hover,
#privacy-btn:hover,
#help-btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.header-menu button:active,
#privacy-btn:active,
#help-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.header-menu button:focus-visible,
#privacy-btn:focus-visible,
#help-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}




#character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    gap: 20px;
    padding: 20px;
}

.character-card {
    display: flex;
    flex-direction: column;
    width: 180px; 
    height: 250px; 
    cursor: pointer;
    overflow: hidden; 
    position: relative;
    z-index: 1;
    transition: all 0.2s;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    will-change: transform; 
    backface-visibility: hidden;
}

.character-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(110, 110, 110, 0.603);
    filter: blur(20px); 
    z-index: -1;
    margin: -10px;
}

.character-card:hover {
    transform: translateY(-5px); 
}

.card-image-container, .card-name-container {
    position: relative;
    z-index: 1;
}

.card-image-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: rgba(0,0,0,0.5);
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.placeholder-icon {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 70px; 
    color: rgba(255, 255, 255, 0.2);
    user-select: none;
}

.card-name-container {
    color: white;
    font-size: 20px;
    font-family: Arial;
    text-align: center;
    text-shadow: 0 5px 5px rgba(0,0,0,0.6);
    letter-spacing: 2px;
    overflow-wrap: break-word;
    white-space: pre-line;
    hyphens: auto;
    height: 70px;
    padding: 4px 10px;
    box-sizing: border-box;
    display: grid;
    place-items: center;
}

#chat-list-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: transparent;
    padding: 20px;
    box-sizing: border-box;
    z-index: 1500;
}

.chat-list-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 2;
}

#back-to-main-btn, #delete-character-btn-dashboard {
	background: rgba(105, 105, 105, 0.397); 
	color: white;
	padding: 7px 14px; 
	border-radius: 10px;
	cursor: pointer;
	font-size: 14px;
    font-family: Arial;
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

#back-to-main-btn:hover {
	filter: brightness(1.3);
	transform: translateY(-1px);
}

#delete-character-btn-dashboard:hover {
	background-color: rgb(223, 23, 23);
	transform: translateY(-1px);
    transition: 0.2s;
}

#back-to-main-btn:active, 
#delete-character-btn-dashboard:active {
	filter: brightness(0.9);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#back-to-main-btn:focus-visible, 
#delete-character-btn-dashboard:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}

.chat-list-content-wrapper {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    background: rgba(100, 100, 100, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
    padding: 25px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    color: #f0f2f5;
}

.chat-list-character-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

#chat-list-avatar-container {
  width: 240px;
  height: 240px;
  border-radius: 15px;
  overflow: hidden; 
  border: none;      
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
  flex-shrink: 0; 
}

#chat-list-avatar {
  width: 100%;
  height: 100%;
  display: block;  
  object-fit: cover;
  border-radius: inherit;   
  border: none;           
  box-shadow: none;   
}

#chat-list-avatar-placeholder {
    width: 240px;
    height: 240px;
    border-radius: 15px;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 90px;
    color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 5px rgb(0, 0, 0, 0.5);
    user-select: none;
    flex-shrink: 0;
}

.chat-list-character-header h2 {
    margin: 0;
    font-size: 36px;
    flex-grow: 1;
    text-shadow: 0 2px 5px rgba(0,0,0, 0.5);
    min-width: 0; 
    overflow: hidden;
    overflow-wrap: break-word;
    hyphens: auto; 
}



#edit-character-btn {
	background-color: #0065d1; 
	color: white;
	padding: 7px 14px; 
	width: 100%;
	flex-shrink: 0;
	cursor: pointer;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

#edit-character-btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

#edit-character-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#edit-character-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#copy-character-btn {
	background-color: #6c757d; 
	color: white;
	padding: 7px 14px;
	width: 100%;
	flex-shrink: 0;
	cursor: pointer;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

#copy-character-btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

#copy-character-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#copy-character-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



/* Chatlist header */
.header-button-group {
    display: flex;
    flex-direction: column; 
    gap: 10px;  
    margin-left: auto; 
    flex-shrink: 0; 
}



.chat-list-separator {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 20px 0;
    flex-shrink: 0;
}

.chat-list-session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.chat-list-session-header h3 {
    margin: 0;
    font-size: 22px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}



#start-new-chat-btn {
	background-color: #24af45; 
	color: white;
	padding: 7px 14px; 
	width: 35%;
	cursor: pointer;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 18px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
    margin-bottom: 10px;
}

#start-new-chat-btn:hover {
	filter: brightness(1.15);
	transform: translateY(-1px);
}

#start-new-chat-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#start-new-chat-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#chat-session-list {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 10px;
    margin-right: -10px;
}

.chat-session-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.12));
  border: 1px solid rgba(255,255,255,.12);

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px -18 rgba(0,0,0,.45);

  transition:
    transform .06s ease,
    filter .2s ease,
    background-color .2s ease,
    border-color .2s ease;
}

.chat-session-entry:hover{
    background-color: #ffffff36;
  filter: brightness(1.12);
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.20);
}

.chat-session-entry:active{
  filter: brightness(.98);
  transform: translateY(0);
  box-shadow:
    inset 0 1px 0 rgba(0,0,0,.25),
    0 6px 18px -12 rgba(0,0,0,.35);
}


.chat-session-name{
  font-size: 19px;
  cursor: pointer;
  color: #e9e9e9;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  transition: color .18s ease, transform .06s ease, text-shadow .18s ease;
}

.chat-session-entry:hover .chat-session-name,
.chat-session-name:hover{
  color: #96c0ff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

.chat-session-name:focus-visible{
  outline: none;
  border-radius: 8px;
  box-shadow:
    0 0 0 2px rgba(0,0,0,.55),
    0 0 0 4px rgba(130,177,255,.35);
}




.rename-chat-btn { 
	background-color: #6c757d; 
}
.delete-chat-btn { 
	background-color: #dc3546bb;
}

.chat-session-entry button {
	margin-left: 5px;
	padding: 6px 12px; 
    padding-top: 8px;
	color: white;
	cursor: pointer;
    width: 80px;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 14px;
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35);
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

.chat-session-entry button:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.chat-session-entry button:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.chat-session-entry button:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#chat-session-list::-webkit-scrollbar {
    width: 8px;
}
#chat-session-list::-webkit-scrollbar-track {
    background: transparent; 
}
#chat-session-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
#chat-session-list::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}


#chat-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

#chat-header {
    display: flex;
    align-items: center;
    padding: 0px 15px;
    background: rgba(0, 0, 0, 0.25);
    color: white;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 20;
}

#back-to-selection-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    padding: 0 15px 0 10px;
    margin-left: 15px;
    cursor: pointer;
    line-height: 1;
}

#chat-avatar, #chat-avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0; 
}

#chat-avatar {
    object-fit: cover;
}

#chat-avatar-placeholder {
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
}

#chat-character-name {
    font-size: 1em;
    font-weight: normal;
}

#chat-window {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--message-spacing, 10px);
    background: transparent;
}

.message {
    padding: 8px 15px 10px;
    border-radius: 15px;
    max-width: 70%;
    line-height: 1.4;
    position: relative;
    min-width: 100px;
    font-size: var(--chat-font-size, 16px);
    color: var(--main-text-color, #FFFFFF);
    backdrop-filter: blur(var(--message-blur, 0px));
    -webkit-backdrop-filter: blur(var(--message-blur, 0px));
}


.user-message-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    justify-content: flex-end; 
}

.user-message {
    background-color: var(--user-bubble-color, rgba(0, 123, 255, 0.7));
    align-self: flex-end;
}
.ai-message-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    justify-content: flex-start;
}

.message-avatar {
    width: var(--ai-avatar-size, 200px);
    height: var(--ai-avatar-size, 200px);
    border-radius: 15px;
    box-shadow: 0 2px 5px rgb(0, 0, 0, 0.5);
    flex-shrink: 0;
    margin-bottom: 10px;
    border: none; 
    overflow: hidden; 
    background-color: rgba(255, 255, 255, 0.1); 
    position: relative; 
}

.message-avatar.placeholder-icon {
    font-size: var(--ai-placeholder-icon-size, 120px);
    line-height: var(--ai-avatar-size, 200px);
    color: rgba(255, 255, 255, 0.2);
}

.ai-message,
.user-message {
    background-color: var(--ai-bubble-color, rgba(50, 50, 50, 0.7));
    margin-right: auto;
}

.user-message {
    background-color: var(--user-bubble-color, rgba(0, 123, 255, 0.7));
    align-self: flex-end;
    margin-right: 0; 
    margin-left: auto;
}

#chat-form {
    display: flex;
    padding: 10px 15px;
    gap: 10px;
    background: transparent;
    flex-shrink: 0;
    align-items: flex-end;
}

#message-input {
    flex-grow: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px 15px;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: white;
    resize: none;
    overflow-y: hidden;
    max-height: 150px;
    line-height: 1.4;
    box-sizing: border-box; 
    font-family: inherit;
    padding-right: 45px;
    scrollbar-width: none;
}

#message-input::-webkit-scrollbar {
  display: none; 
  width: 0;
  height: 0;
}

#message-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
  opacity: 1; 
}

#chat-form #stop-stream-btn { 
    position: absolute;
    right: 12px;
    bottom: 6px; 
    width: 30px !important; 
    height: 30px !important; 
    padding: 0 !important;
    font-size: 12px;
    border-radius: 50%; 
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border: none; 
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
    flex-shrink: 0;
}

#chat-form #stop-stream-btn:hover {
    background-color: rgba(255, 255, 255, 0.2); 
    transform: scale(1.1);
    filter: none; 
    opacity: 1;
}

#chat-form #stop-stream-btn.hidden {
    display: none !important;
}

.textarea-wrapper {
    position: relative;
    flex-grow: 1; 
    display: flex;
}



#chat-form button {
	background-color: #9999997a; 
	color: white;
	padding: 10px 10px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-shrink: 0;
	cursor: pointer;
	border-radius: 15px;
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px); 
	-webkit-backdrop-filter: blur(8px); 
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

#chat-form button:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

#chat-form button:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

#chat-form button:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}

#tag-suggestion-box {
    display: flex;
    flex-wrap: wrap; 
    gap: 10px;
    padding: 0 15px 10px 15px; 
    flex-shrink: 0;
}

.tag-suggestion {
	background-color: #9999997a; 
	color: #ffffff;
	padding: 6px 12px; 
	cursor: pointer;
	border-radius: 13px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px); 
	-webkit-backdrop-filter: blur(8px); 
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

.tag-suggestion:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.tag-suggestion:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.tag-suggestion:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#character-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}


.modal-content {
    background-color: #2c2f33; 
    color: #dcddde; 
    padding: 50px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 900px; 
    max-height: 85vh;
    overflow-y: auto; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}


#persona-selection-modal .modal-content,
#persona-list-modal .modal-content {
    max-width: 550px; 
}

.modal-content::-webkit-scrollbar {
    width: 10px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #4f545c;
  backdrop-filter: blur(2px);
}


.editor-avatar-container {
    width: 240px;
    height: 240px;
    border-radius: 15px;
    border: none; 
    box-shadow: 0 2px 5px rgb(0, 0, 0, 0.5);
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1); 
}

#persona-editor-avatar-container {
    margin: 5px auto 25px auto;
}

#persona-editor-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;   
  object-position: center;
}

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


#editor-avatar-placeholder, #persona-editor-avatar-placeholder {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 90px;
    color: rgba(255, 255, 255, 0.25);
    user-select: none;
}

.modal-content h2 {
    margin: 0;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0, 0, 0);
}



#editor-token-counter {
    position: absolute;
    top: 15px;
    right: 30px;
    font-size: 14px;
    color: #999;
}

#persona-editor-token-counter {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 14px;
    color: #999;
}

#character-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#character-form label {
  font-weight: 600;
  margin-top: 22px;
  margin-bottom: 4px;
  color: #ffffff;
  letter-spacing: .2px;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}

#character-form input[type="text"],
#character-form input[type="url"],
#character-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 12px;
  background-color: transparent;
  background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.18);
  color: #e9e9e9;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px -18 rgba(0,0,0,.45);

  transition:
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease,
    transform .06s ease;
}

#character-form input[type="text"]:hover,
#character-form input[type="url"]:hover,
#character-form textarea:hover {
  background-color: rgba(255,255,255,.10);
}

#character-form input[type="text"]:focus,
#character-form input[type="url"]:focus,
#character-form textarea:focus {
  outline: none;
  background-color: rgba(255,255,255,.10);
  border-color: rgba(190,195,205,.65);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.55),
    0 0 0 4px rgba(160,165,175,.35),
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 26px -16 rgba(0,0,0,.5);
  transform: translateY(-1px);
}

#character-form ::placeholder {
  color: #9aa0a6;
}

#character-form textarea {
  resize: vertical;         
  overflow-y: auto;
  min-height: 42px;         
  box-sizing: border-box;
  scrollbar-width: thin; 
  scrollbar-color: rgba(255,255,255,.20) transparent; 
}

#character-form textarea::-webkit-scrollbar {
  width: 8px !important;
}

#character-form textarea::-webkit-scrollbar-track {
  background: transparent !important;
}

#character-form textarea::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,.20) !important;
  border-radius: 10px !important;
}

#character-form textarea::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,.35) !important;
}

#character-form #char-instructions,
#character-form #char-description,
#character-form #char-lore,
#character-form #char-reminder,
#character-form #char-narrator-reminder {
max-height: 27em;
}

.form-row {
  display: flex;
  gap: 16px;
  width: 100%;
  align-items: flex-start;
}

.form-group {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 12px;
}


.form-group label {
    margin-bottom: -5px;
}

.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.form-buttons button[type="submit"] {
	background-color: #2eb94e; 
	color: white;
	padding: 7px 14px;
	cursor: pointer;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

.form-buttons button[type="submit"]:hover {
	filter: brightness(1.15);
	transform: translateY(-1px);
}

.form-buttons button[type="submit"]:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.form-buttons button[type="submit"]:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



.form-buttons button[type="button"] {
	background-color: #6c757d; 
	color: white;
	padding: 7px 14px;
	cursor: pointer;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

.form-buttons button[type="button"]:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.form-buttons button[type="button"]:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.form-buttons button[type="button"]:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#chat-window::-webkit-scrollbar {
    width: 10px;
}

#chat-window::-webkit-scrollbar-track {
    background: transparent;
}

#chat-window::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

#chat-window::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

#chat-window {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}


#loading-indicator {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 50px;
    z-index: 3000;
}
#loading-indicator .dot {
  width: 12px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
  border: 1px solid rgba(0, 0, 0, 0.2); 
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); 
}
#loading-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
#loading-indicator .dot:nth-child(2) { animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0);
}
}

.message .think-block {
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    background-color: #00000070;
    margin: 0;
    margin-top: 5px;
}

.message .main-content {
    white-space: pre-wrap;
    margin: 0;
    min-height: 1.2em;
}

.message .think-block + .main-content {
    margin-top: 10px;
}

.message .think-block-summary {
    padding: 8px 12px;
    cursor: pointer;
    outline: none;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
    list-style: none;
}

.message .think-block-summary::-webkit-details-marker,
.message .think-block-summary::marker {
    display: none;
    content: "";
    font-size: 0;
}

.message .think-block-summary::before {
    content: '►';
    margin-right: 8px;
    font-size: 0.8em;
    display: inline-block;
    transition: transform 0.2s;
}

.message .think-block[open] > .think-block-summary::before {
    transform: rotate(90deg);
}

.message .think-block-content {
    padding: 0 12px 12px 12px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 5px;
    white-space: pre-wrap;
}

.message em {
    font-style: italic;
    font-weight: normal;
}
.message .dialogue {
    color: var(--dialogue-color, #CCEEFF);
    font-weight: 500;
}


.delete-message-btn {
    position: absolute;
    top: -8px;
    background-color: #6c757d;
    color: white;
    border: 1px solid #0000001a;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    text-align: center;
    padding: 0;
    z-index: 10;
    transition: background-color 0.2s, transform 0.2s;
}

.user-message .delete-message-btn {
    right: -8px;
}

.ai-message .delete-message-btn {
    left: -8px;
}

.message:hover .delete-message-btn {
    display: block;
}

.delete-message-btn:hover {
    background-color: #dc3545;
    transform: scale(1.1);
}

#message-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
}

.message-editor-content {
    background-color: #2c2f33;
    color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.message-editor-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #4f545c;
    padding-bottom: 10px;
}

#message-editor-textarea {
    width: 100%;
    background-color: #40444b;
    color: #dcddde;
    border: 1px solid #5c6067;
    border-radius: 5px;
    padding: 10px;
    font-size: var(--chat-font-size, 16px);
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
    min-height: 100px;
    max-height: 90vh;
}

.editor-info {
    margin-top: 15px;
    font-size: 0.8em;
    color: #999;
    text-align: center;
}


.message-controls {
    position: absolute;
    bottom: -15px;
    display: none;
    align-items: center;
    gap: 5px;
    background-color: rgba(40, 40, 40, 0.8);
    padding: 4px 8px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.ai-message:hover .message-controls {
    display: flex;
}

.user-message .message-controls {
    display: none !important;
}

.ai-message {
    position: relative;
    padding-bottom: 15px;
}

.ai-message .message-controls {
    left: 50%;
    transform: translateX(-50%);
}

.message-controls button {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    line-height: 1;
}

.message-controls button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.message-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.variant-counter {
    font-size: 18px;
    color: #ccc;
    padding: 0 5px;
    font-variant-numeric: tabular-nums;
}


.story-message {
    margin-left: calc(var(--ai-avatar-size, 200px) + 10px);
}


#settings-container {
    margin-left: auto; 
    position: relative;
    padding: 0 10px;
}

#settings-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 5px 10px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#settings-btn:hover {
    opacity: 1;
}

#settings-panel {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    width: 300px;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#settings-panel.hidden {
    display: none;
}

.setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.setting-grid .setting input[type="color"] {
    width: 100%;
    box-sizing: border-box;
}

.setting label {
    font-size: 0.9em;
    color: #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.setting input[type="range"] {
    width: 100%;
    cursor: pointer;
}


.setting select {
  width: 100%;
  padding: 8px;
  border: 1px solid #666;
  background-color: #444;
  color: #eee;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.setting input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: transparent;
    width: 120px;
    height: 25px;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
}
.setting input[type="color"]::-webkit-color-swatch {
    border-radius: 3px;
    border: none;
}
.setting input[type="color"]::-moz-color-swatch {
    border-radius: 3px;
    border: none;
}



.settings-action-btn {
	background-color: #6c757d; 
	color: white;
	padding: 8px; 
	margin-top: 10px;
	cursor: pointer;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 15px;
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25);
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
	width: 100%; 
	box-sizing: border-box; 
}

.settings-action-btn:hover {
	background-color: #e42626;
	transform: translateY(-1px);
}

.settings-action-btn:active {
	filter: brightness(0.95);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.settings-action-btn:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



.toggle-switch {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    width: 48px;
    height: 26px;
    background-color: #444;
    border: 1px solid #666;
    border-radius: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: #f0f2f5;
    border-radius: 50%;
    transition: left 0.2s;
}

.toggle-switch:checked {
    background-color: #007bff;
}

.toggle-switch:checked::after {
    left: 24px;
}
.settings-separator {
    border: none;
    border-top: 1px solid #555;
    margin: 5px 0;
}


#participant-icon-list {
    display: flex;
    align-items: center;
    margin-left: -5px; 
    margin-right: 10px;
}

#participant-icon-list img,
#participant-icon-list .placeholder-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-left: -8px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}



#token-info-container {
    position: relative;
}

#token-info-icon {
    font-size: 15px;
    color: white;
    cursor: help;
    padding: 5px 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#token-info-icon:hover {
    opacity: 1;
}

#token-tooltip {
    position: absolute;
    top: 100%;
    margin-top: 8px; 
    right: 0;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 30; 
}

#token-info-container:hover #token-tooltip {
    opacity: 1;
}



#settings-btn,
#add-participant-btn,
#select-persona-btn {
    background: none;
    border: none;
    color: white;
    font-size: 21px;
    cursor: pointer;
    padding: 5px 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}


#settings-btn:hover,
#add-participant-btn:hover,
#select-persona-btn:hover {
    opacity: 1;
}


#participant-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2100;
}

#participant-modal-content {
    max-width: 550px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#participant-selection-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
}

.participant-option-btn {
	display: flex;
	align-items: center;
	gap: 15px;
	width: 100%;
	padding: 10px;
	background-color: #5865f24d; 
	border: 1px solid rgba(255, 255, 255, 0.1); 
	color: #dcddde;
	cursor: pointer;
	text-align: left;
	font-weight: bold; 
	border-radius: 10px;
	font-family: Arial; 
	font-size: 18px; 
	transition: transform .06s ease, filter .2s ease;
}

.participant-option-btn:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.participant-option-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
}

.participant-option-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgba(0,0,0,.5), 0 0 0 4px rgba(255,255,255,.35);
}

.participant-option-btn:hover {
    background-color: #5865f280;
}

.participant-option-btn img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}


.participant-option-btn .placeholder-icon {
    width: 40px;  
    height: 40px; 
    border-radius: 50%;
    font-size: 22px;  
    flex-shrink: 0; 
    background-color: rgba(0,0,0,0.2); 
}


.participant-option-btn .edit-persona-btn,
.participant-option-btn .delete-persona-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 5px;
    flex-shrink: 0;
    font-size: 16px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; 
}

.participant-option-btn .edit-persona-btn:hover {
    background-color: #5865f2;
}

.participant-option-btn .delete-persona-btn:hover {
    background-color: #dc3545;
}

#scroll-top-fab {
    position: fixed;
    bottom: 75px;
    right: 15px;
    width: 36px;
    height: 36px;
    background-color: rgba(0, 0, 0, 0.164);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 16px;
    text-align: center;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    z-index: 0;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

#scroll-top-fab.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#scroll-top-fab:hover {
    background-color: #c5c5c596;
}


#character-selection-screen {
    position: relative;
    background-color: transparent;
    overflow-y: auto; 
    min-height: 100vh;
}


#character-selection-screen.is-inactive {
    overflow: hidden;
}

.main-header, #character-list {
    position: relative;
    z-index: 1;
}
#stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

#stars-container.visible {
  opacity: 1;
}

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

@keyframes rotate-counter-clockwise {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

#stars, #stars2, #stars3 {
    position: absolute;
    width: 150vmax; 
    height: 150vmax;
    top: 50%;
    left: 50%;
    margin-top: -75vmax;
    margin-left: -75vmax;
    background: transparent;
    background-repeat: repeat;
    transform-origin: center center;
    will-change: transform; 
    backface-visibility: hidden;
}

#stars {
    background-image:
        radial-gradient(1px 1px at 20px 30px, #eee, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 50px 160px, #ddd, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 90px 40px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));
    background-size: 200px 200px;
    animation: rotate-clockwise 500s linear infinite;
}

#stars2 {
    background-image:
        radial-gradient(1px 1px at 10px 90px, #eee, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 40px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 100px, #ddd, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 20px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 110px 80px, #fff, rgba(0,0,0,0));
    background-size: 250px 250px;
    animation: rotate-counter-clockwise 400s linear infinite;
}

#stars3 {
    background-image:
        radial-gradient(2px 2px at 30px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 80px 120px, #ddd, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 120px 40px, #fff, rgba(0,0,0,0));
    background-size: 300px 300px;
    animation: rotate-clockwise 300s linear infinite;
}

.scenario-list-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    border: 1px solid #40444b;
    border-radius: 5px;
    padding: 20px;
    background-color: rgba(0,0,0,0.2);
    margin-top: 10px;
}

.scenario-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.scenario-entry textarea {
    flex-grow: 1; 
    min-height: 6em;
    max-height: 30em;
}

.delete-scenario-btn {
    flex-shrink: 0;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-scenario-btn:hover {
    background-color: #dc3545;
}



.add-scenario-button {
	background-color: #0065d1; 
	color: white;
	padding: 7px 14px;
	cursor: pointer;
	display: block; 
	width: 40%;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: 10px;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
	box-sizing: border-box; 
}

.add-scenario-button:hover {
	filter: brightness(1.25);
	transform: translateY(-1px);
}

.add-scenario-button:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.add-scenario-button:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#scenario-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2100; 
}

#scenario-modal-content {
    max-width: 550px; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#scenario-selection-list,
#persona-selection-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
}

#scenario-selection-list::-webkit-scrollbar,
#participant-selection-list::-webkit-scrollbar,
#persona-selection-list::-webkit-scrollbar {
    width: 8px;
}
#scenario-selection-list::-webkit-scrollbar-track,
#participant-selection-list::-webkit-scrollbar-track,
#persona-selection-list::-webkit-scrollbar-track {
    background: #40444b;
}
#scenario-selection-list::-webkit-scrollbar-thumb,
#participant-selection-list::-webkit-scrollbar-thumb,
#persona-selection-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}



.scenario-option-btn {
	width: 100%;
	padding: 15px;
	background-color: #798492; 
	border: 1px solid #00000075; 
	color: #dcddde;
	text-shadow: 0 1px 2px rgba(0,0,0,0.5); 
	box-shadow: 0 2px 10px rgba(0,0,0,0.4); 
	cursor: pointer;
	text-align: left;
	font-weight: bold; 
	white-space: pre-wrap;
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	transition: transform .06s ease, filter .2s ease;
}

.scenario-option-btn:hover {
    background-color: #869dbb;
	transform: translateY(-1px);
}

.scenario-option-btn:active {
	filter: brightness(0.98);
	transform: translateY(0);
}

.scenario-option-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgba(0,0,0,.5), 0 0 0 4px rgba(255,255,255,.35);
}



.scenario-name-input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 5px; 
    font-weight: bold;
    border: 1px solid #222428;
    background-color: #4f545c; 
    color: #FFFFFF;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    font-family: inherit;
}

.editor-header-buttons {
    margin-left: auto; 
    display: flex;
    gap: 10px;
}

.editor-header-buttons button {
	padding: 7px 14px;
	cursor: pointer;
	color: white; 
	border-radius: 10px; 
	font-family: Arial; 
	font-size: 17px; 
	border: 1px solid rgba(255,255,255,.18);
	background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	box-shadow:
		inset 0 1px 0 rgba(255,255,255,.08),
		0 10px 24px -12 rgba(0,0,0,.35); 
	text-shadow: 0 1px 0 rgba(0,0,0,.25); 
	transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
	-webkit-tap-highlight-color: transparent;
	text-decoration: none; 
}

#save-edit-btn-top {
	background-color: #29ac47; 
}
#cancel-edit-btn-top {
	background-color: #6c757d; 
}

.editor-header-buttons button:hover {
	filter: brightness(1.2);
	transform: translateY(-1px);
}

.editor-header-buttons button:active {
	filter: brightness(0.98);
	transform: translateY(0);
	box-shadow:
		inset 0 1px 0 rgba(0,0,0,.25),
		0 6px 18px -12 rgba(0,0,0,.35);
}

.editor-header-buttons button:focus-visible {
	outline: none;
	box-shadow:
		0 0 0 2px rgba(0,0,0,.55),
		0 0 0 4px rgba(255,255,255,.35),
		inset 0 1px 0 rgba(255,255,255,.08);
}



#persona-list-modal,
#persona-editor-modal,
#persona-selection-modal { 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2200; 
}

#persona-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px; 
}

#persona-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#persona-form label {
  font-weight: 600;
  margin-top: 22px;
  margin-bottom: 4px;
  color: #ffffff;
  letter-spacing: .2px;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}

#persona-form input,
#persona-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 12px;
  background-color: transparent;
  background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.18);
  color: #e9e9e9;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px -18 rgba(0,0,0,.45);
  transition:
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease,
    transform .06s ease;
}

#persona-form textarea {
  resize: vertical;
  overflow-y: auto;
  min-height: 42px;
  box-sizing: border-box;
  scrollbar-width: thin;       
  scrollbar-color: rgba(255,255,255,.20) transparent;
}

#persona-form input:hover,
#persona-form textarea:hover {
  background-color: rgba(255,255,255,.10);
}

#persona-form input:focus,
#persona-form textarea:focus {
  outline: none;
  background-color: rgba(255,255,255,.10);
  border-color: rgba(190,195,205,.65);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.55),
    0 0 0 4px rgba(160,165,175,.35),
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 26px -16 rgba(0,0,0,.5);
  transform: translateY(-1px);
}

#persona-form ::placeholder {
  color: #9aa0a6;
}

#persona-form textarea::-webkit-scrollbar { width: 8px; } 
#persona-form textarea::-webkit-scrollbar-track { background: transparent; }
#persona-form textarea::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,.20);
  border-radius: 10px;
}
#persona-form textarea::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,.35);
}


.persona-list-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background-color: #5865f24d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #dcddde;
    border-radius: 10px; 
    text-align: left;
    font-size: 18px; 
    font-weight: bold;
    font-family: Arial; 
    transition: transform .06s ease, filter .2s ease, background-color 0.2s; 
}

.persona-list-entry:hover {
    background-color: #5865f280;
    filter: brightness(1.25); 
    transform: translateY(-1px); 
}

.persona-list-entry img,
.persona-list-entry .placeholder-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.persona-list-entry .placeholder-icon {
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.2);
}

.persona-list-entry .edit-persona-btn,
.persona-list-entry .delete-persona-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 5px;
    flex-shrink: 0;
    font-size: 14px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.persona-list-entry .edit-persona-btn:hover {
    background-color: #5865f2;
}

.persona-list-entry .delete-persona-btn:hover {
    background-color: #dc3545;
}


#favorites-bar-container {
    padding: 0 20px; 
    margin-bottom: 40px; 
    min-height: 85px; 
}

#favorites-bar-container h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 1.1em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

#favorites-bar {
    display: flex;
    justify-content: center; 
    gap: 15px;
    flex-wrap: wrap;
    padding-top: 5px; 
    padding-bottom: 20px;
}



.favorite-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0; 
    width: 80px;
}

.avatar-container {
  position: relative; 
  width: 100px;
  height: 100px;
  border-radius: 50%; 
  overflow: hidden; 
  border: 1px solid rgba(125, 125, 125, 0.5);
  transition: transform 0.2s;
  background-color: rgba(0, 0, 0, 0.5); 
}

.favorite-item:hover .avatar-container {
  transform: scale(1.1); 
  z-index: 100;
}


.avatar-container img {
  width: 100%;
  height: 100%;
  object-fit: cover !important; 
  position: relative; 
  z-index: 2; 
}



.effect-container {
  position: relative;
  overflow: hidden;
  display: block; 
  background-size: cover;
  background-position: center;
}

.effect-container::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  
  background-image: inherit; 
  background-size: cover;
  background-position: center;

  filter: blur(10px) saturate(1.2) brightness(0.9);
  transform: scale(1.2); 
  z-index: 1;
}

.effect-container img {
  width: 100%;
  height: 100%;
  object-fit: contain; 
  position: relative;
  z-index: 2;
}



.favorite-item .placeholder-icon {
    width: 100px; 
    height: 100px; 
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    font-size: 50px; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    background-color: rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.favorite-item:hover img,
.favorite-item:hover .placeholder-icon {
    transform: scale(1.1);
}

.favorite-item span {
    color: #ffffffc5;
    font-size: 17px; 
    font-family: Arial;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0; 
    padding: 0; 
    line-height: 1; 
}

.character-card:hover .favorite-btn {
    opacity: 1;
}


.favorite-btn.is-favorite {
    opacity: 1; 
    color: #FFD700;
}


.favorite-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}


html::-webkit-scrollbar {
    width: 10px; 
}

html::-webkit-scrollbar-track {
    background: transparent; 
}

html::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3); 
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

html::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5); 
}


html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}



#character-selection-screen,
#chat-list-screen,
#chat-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.2s ease-in-out;
}


.is-inactive {
    opacity: 0;
    pointer-events: none; 
}



#bulk-actions-bar{
  display:flex;
  justify-content:center;
  margin: 8px 0 0 0;
}

#bulk-delete-btn {
    background-color: #8d949b3a; 
    color: white;
    padding: 4px 10px; 
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px; 
    font-family: Arial; 
    border: 1px solid rgba(255,255,255,.18); 
    background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
    backdrop-filter: blur(8px); 
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,.08),
        0 10px 24px -12 rgba(0,0,0,.35);
    text-shadow: 0 1px 0 rgba(0,0,0,.25); 
    transition: transform .06s ease, box-shadow .2s ease, filter .2s ease; 
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    margin-top: 50px;
    margin-bottom: 20px;
}

#bulk-delete-btn:hover { 
    background-color: rgb(214, 47, 64); 
    filter: brightness(1.25); 
    transform: translateY(-1px), .06s ease, box-shadow .2s ease, filter .2s ease, background-color 0.15s ease;
}

#bulk-delete-btn:active {
    filter: brightness(0.98);
    transform: translateY(0);
    box-shadow:
        inset 0 1px 0 rgba(0,0,0,.25),
        0 6px 18px -12 rgba(0,0,0,.35);
}

#bulk-delete-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(0,0,0,.55),
        0 0 0 4px rgba(255,255,255,.35),
        inset 0 1px 0 rgba(255,255,255,.08);
}

#bulkCharSelectAll {
  transform: scale(1);
  min-width: 22px;
  height: 22px;
  cursor: pointer;
}

#bulkCharDeleteBtn {
    background-color: #dc3545; 
    color: #fff;
    padding: 7px 14px; 
    border-radius: 10px; 
    cursor: pointer;
    font-family: Arial; 
    font-size: 17px; 
    border: 1px solid rgba(255,255,255,.18); 
    background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12)); 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,.08),
        0 10px 24px -12 rgba(0,0,0,.35);
    text-shadow: 0 1px 0 rgba(0,0,0,.25); 
    transition: transform .06s ease, box-shadow .2s ease, filter .2s ease; 
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

#bulkCharDeleteBtn:hover {
    filter: brightness(1.25); 
    transform: translateY(-1px); 
}

#bulkCharDeleteBtn:active {
    filter: brightness(0.98);
    transform: translateY(0);
    box-shadow:
        inset 0 1px 0 rgba(0,0,0,.25),
        0 6px 18px -12 rgba(0,0,0,.35);
}

#bulkCharDeleteBtn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(0,0,0,.55),
        0 0 0 4px rgba(255,255,255,.35),
        inset 0 1px 0 rgba(255,255,255,.08);
}



.archive-btn {
    position: absolute;
    bottom: 5px; 
    left: 5px;   
    width: 28px;
    height: 28px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0; 
    line-height: 1;
}


.character-card:hover .archive-btn {
    opacity: 1;
}


.archive-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}



#archive-section {
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 30px;
}

#archive-header h3 {
    color: white;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}



#archive-toggle-btn {
    background-color: #0080ff5b; 
    color: white;
    padding: 8px 14px; 
    border-radius: 10px; 
    cursor: pointer;
    font-size: 16px; 
    font-family: Arial; 
    border: 1px solid rgba(255,255,255,.18);
    background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
    backdrop-filter: blur(8px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.08),
        0 10px 24px -12 rgba(0,0,0,.35);
    text-shadow: 0 1px 0 rgba(0,0,0,.25);
    transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

#archive-toggle-btn:hover {
    filter: brightness(1.25);
    transform: translateY(-1px);
}

#archive-toggle-btn:active {
    filter: brightness(0.98);
    transform: translateY(0);
    box-shadow:
        inset 0 1px 0 rgba(0,0,0,.25),
        0 6px 18px -12 rgba(0,0,0,.35);
}

#archive-toggle-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(0,0,0,.55),
        0 0 0 4px rgba(255,255,255,.35),
        inset 0 1px 0 rgba(255,255,255,.08);
}



#archived-character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}


#archive-content.collapsed {
    display: none;
}


.chat-session-name {
  flex-grow: 1;
  min-width: 0; 
}


.chat-session-actions {
  flex-shrink: 0; 
  margin-left: 15px; 
}


.modal-search-container {
  margin-bottom: 15px; 
}


.modal-search-input {
  width: 50%;
  box-sizing: border-box; 
  background-color: #52545a7a;
  color: #dcddde;
  border: 1px solid #48546b75;
  border-radius: 5px;
  padding: 10px 15px;
  font-size: 16px;
  transition: all 0.2s;
}

.modal-search-input:focus {
  outline: none;
  border-color: #007bff;
  background-color: #4f545c;
}

.modal-search-input::placeholder {
  color: #999;
}



#search-bar-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    margin-bottom: 20px;
    gap: 15px;
}


#copyright-notice {
    color: #8e9297;
    font-size: 14px;
    text-align: center;
    padding: 10px 0 30px 0;
    width: 100%;
    position: relative;
    z-index: 10;
    margin-top: 40px;
}


.favorites-placeholder {
    color: #8e9297;
    font-size: 18px;
}



#app-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2300;
}

.modal-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.modal-content > p {
    margin-top: 10px;
    margin-bottom: 40px;
    color: #b9bbbe; 
}



.settings-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-input {
    width: 70%;
    box-sizing: border-box;
    padding: 11px 14px;
    border-radius: 12px;
    background-color: transparent;
    background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.06));
    border: 1px solid rgba(255,255,255,.18);
    color: #e9e9e9;
    font-family: inherit;
    font-size: 16px;
}
.settings-input:focus {
    outline: none;
    border-color: rgba(190,195,205,.65);
}



#app-settings-form label {
  font-weight: 600;
  color: #ffffff;
  display: block;
  margin-top: 22px;
  margin-bottom: 4px;
  letter-spacing: .2px;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}

hr.settings-separator {
    border: none;
    border-top: 1px solid #4f545c;
    margin: 25px 0;
}

.model-entry-inputs {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-entry input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 12px;

  background-color: transparent;
  background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.18);
  color: #e9e9e9;

  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px -18 rgba(0,0,0,.45);

  transition:
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease,
    transform .06s ease;
}
.model-entry input:hover  { background-color: rgba(255,255,255,.10); }
.model-entry input:focus  {
  outline: none;
  background-color: rgba(255,255,255,.10);
  border-color: rgba(190,195,205,.65);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.55),
    0 0 0 4px rgba(160,165,175,.35),
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 26px -16 rgba(0,0,0,.5);
  transform: translateY(-1px);
}
.model-entry input::placeholder { color: #9aa0a6; }


#add-model-btn {
    display: block;
    margin: 30px auto 0 auto;
    margin-bottom: 50px;
    width: 50%;
}

.delete-model-btn {
    flex-shrink: 0;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-model-btn:hover {
    background-color: #dc3545;
}

#reset-app-settings-btn {
    background-color: #6c757d; 
    color: white;
    border: 1px solid rgba(255,255,255,.18); 
    font-size: 14px; 
    font-family: Arial; 
    padding: 6px 14px; 
    border-radius: 10px; 
    text-shadow: 0 1px 0 rgba(0,0,0,.25); 
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,.08),
        0 10px 24px -12 rgba(0,0,0,.35);
    cursor: pointer;
    background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.12));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .06s ease, box-shadow .2s ease, filter .2s ease, background-color 0.15s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

#reset-app-settings-btn:hover {
    background-color: #dc3545; 
    filter: brightness(1.25); 
    transform: translateY(-1px); 
}

#reset-app-settings-btn:active {
    filter: brightness(0.98);
    transform: translateY(0);
    box-shadow:
        inset 0 1px 0 rgba(0,0,0,.25),
        0 6px 18px -12 rgba(0,0,0,.35);
}

#reset-app-settings-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(0,0,0,.55),
        0 0 0 4px rgba(255,255,255,.35),
        inset 0 1px 0 rgba(255,255,255,.08);
}


.notification-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #ff4d4d;
  border-radius: 50%;
  border: 1px solid #fff;
  position: absolute;
  top: 5px;
  right: 5px;
  box-shadow: 0 0 8px #ff4d4d;
  animation: pulse 1.5s infinite;
}

#privacy-btn {
  position: relative;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(255, 77, 77, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
  }
}



.card-image-container img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  image-rendering: auto !important;  
  -webkit-font-smoothing: antialiased; 
  backface-visibility: hidden; 
}



.model-entry-header .model-entry-inputs {
    flex-grow: 1;
}

.global-prompts-container {
    margin-top: 10px;
    border: 1px solid #40444b;
    border-radius: 5px;
    background-color: rgba(0,0,0,0.1);
}

.global-prompts-summary {
    padding: 8px 12px;
    font-weight: bold;
    color: #b9bbbe;
    background-color: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    list-style: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.global-prompts-summary::-webkit-details-marker {
    display: none;
}

.global-prompts-summary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.global-prompts-summary::before {
    content: '►';
    margin-right: 8px;
    font-size: 0.8em;
    display: inline-block;
    transition: transform 0.2s;
}

.global-prompts-container[open] > .global-prompts-summary::before {
    transform: rotate(90deg);
}

.global-prompts-content {
    padding: 15px;
    border-top: 1px solid #40444b;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.global-prompts-content label {
    font-weight: bold;
    margin-bottom: -5px;
    font-size: 16px;
    color: #ffffff;
}

.global-prompts-content textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 12px;

  background-color: transparent;
  background-image: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.18);
  color: #e9e9e9;

  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;
  resize: vertical;
  min-height: 4em;
  max-height: 30em;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px -18 rgba(0,0,0,.45);

  transition:
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease,
    transform .06s ease;
}
.global-prompts-content textarea:hover {
  background-color: rgba(255,255,255,.10);
}
.global-prompts-content textarea:focus {
  outline: none;
  background-color: rgba(255,255,255,.10);
  border-color: rgba(190,195,205,.65);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.55),
    0 0 0 4px rgba(160,165,175,.35),
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 26px -16 rgba(0,0,0,.5);
  transform: translateY(-1px);
}
.global-prompts-content textarea::placeholder { color: #9aa0a6; }

.global-prompts-content textarea { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.20) transparent; }
.global-prompts-content textarea::-webkit-scrollbar { width: 8px; }
.global-prompts-content textarea::-webkit-scrollbar-track { background: transparent; }
.global-prompts-content textarea::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.20); border-radius: 10px; }
.global-prompts-content textarea::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.35); }



.model-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.model-content-wrapper {
    flex-grow: 1; 
    border-bottom: 1px solid #4f545c; 
    padding-bottom: 20px;
    margin-bottom: 20px;
}

#model-list-container .model-entry:last-child .model-content-wrapper {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}



#persona-description {
    max-height: 30em;
}



.input-with-button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-button input {
  flex-grow: 1;
}

.upload-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
}

.upload-btn:hover {
  background-color: #838e97;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}



html.freeze-layout { overflow-y: hidden; }
body.freeze-body   { position: fixed; width: 100%; overflow: hidden; }

#character-selection-screen,
#chat-list-screen,
#chat-screen {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  transition: opacity 0.2s ease-in-out; 
}

#character-selection-screen { overflow-y: auto !important; }
#chat-list-screen, 
#chat-screen { overflow: hidden !important; }



#character-selection-screen:not(.is-inactive) ~ #loading-indicator,
#chat-list-screen:not(.is-inactive) ~ #loading-indicator {
  display: none !important;
}



.message-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: 10px; 
}

.message-image-container img {
  max-width: 100%; 
  max-height: 1100px; 
  border-radius: 10px;
  object-fit: contain; 
}



#chat-avatar,
#participant-icon-list img,
.participant-option-btn img,
.persona-list-entry img{
  object-fit: cover !important;
}

#participant-icon-list .placeholder-icon {
    font-size: 14px; 
    line-height: 24px; 
    text-align: center;
}


#chat-list-character-name,
#chat-character-name {
  white-space: pre-line; 
}



.custom-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; 
}

.custom-alert-modal {
    background-color: #2c2f33; 
    color: #dcddde;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 400px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-alert-modal p {
    margin: 0 0 20px 0;
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.custom-alert-modal .action-btn,
.custom-alert-modal .secondary-btn {
    color: white;
    padding: 7px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 17px;
    border: 1px solid rgba(255, 255, 255, .18);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(0, 0, 0, .12));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .08),
        0 10px 24px -12px rgba(0, 0, 0, .35);
    text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
    transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}
.custom-alert-modal button {
    background-color: #0065d1; 
}
.custom-alert-modal .secondary-btn {
    background-color: #6c757d; 
}

.custom-alert-modal button:hover {
    filter: brightness(1.25);
    transform: translateY(-1px);
}

.custom-alert-modal button:active {
    filter: brightness(0.98);
    transform: translateY(0);
    box-shadow:
        inset 0 1px 0 rgba(0, 0, 0, .25),
        0 6px 18px -12px rgba(0, 0, 0, .35);
}

.custom-alert-modal button:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, .55),
        0 0 0 4px rgba(255, 255, 255, .35),
        inset 0 1px 0 rgba(255, 255, 255, .08);
}

.custom-dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px; 
    margin-top: 25px;
}



.card-image-container img.is-broken,
.avatar-container img.is-broken {
    display: none;
}

.card-image-container:has(img.is-broken) .placeholder-icon,
.avatar-container:has(img.is-broken) .placeholder-icon {
    display: flex !important;
}



#help-btn {
    position: relative;
}

.help-tooltip {
    position: absolute;
    bottom: 125%; 
    left: 50%;
    transform: translateX(-50%);
    background-color: #569cd6; 
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap; 
    z-index: 100;
    transition: opacity 0.2s;
}

.help-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; 
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #569cd6 transparent transparent transparent; 
}
