:root {
    --bg-color: #f5f5f5;
    --text-color: #1a1a1a;
    --panel-bg: #ffffff;
    --panel-border: #e0e0e0;
    --input-bg: #ebebeb;
    --accent-color: #4CAF50; /* Primary Green */
    --accent-hover: #5cb85c;
    --secondary-accent-text: #2E8B57; /* Darker Green for text */
    --text-muted: #666666;
    --text-inverted: #ffffff;
    --text-shadow-color: rgba(255, 255, 255, 0.5);
    --bubble-text-shadow-color: #ffffff;
    --switch-bg: #ccc;
    --switch-checked-unhinged: #ff6b6b;
    --switch-checked-twist: #B22222; /* Dark Red */
    --switch-checked-roleplay: #4C8BF5;
    --body-bg-image: linear-gradient(to bottom, #f5f5f5, #e9e9e9);
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #ffffff;
    --panel-bg: #1e1e1e;
    --panel-border: #333;
    --input-bg: #2d2d2d;
    --accent-color: #4CAF50;
    --accent-hover: #66bb6a;
    --secondary-accent-text: #66bb6a; /* Lighter Green for dark mode text */
    --text-muted: #aaa;
    --text-inverted: #1a1a1a;
    --text-shadow-color: rgba(0, 0, 0, 0.5);
    --bubble-text-shadow-color: #000;
    --switch-bg: #333;
    --body-bg-image: linear-gradient(to bottom, #121212, #0d0d0d);
}

body {
    background-color: var(--bg-color);
    background-image: var(--body-bg-image);
    color: var(--text-color);
    font-family: 'Fredoka', sans-serif;
    padding: 20px;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

body.modal-open {
    overflow: hidden;
}

#app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    width: 100%;
    border-bottom: 1px solid var(--panel-border);
}

#app-logo {
    height: 50px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(-1deg); }
    50% { transform: translateY(-5px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(-1deg); }
}

#user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#tabs {
    display: flex;
    gap: 10px;
    padding-bottom: 5px;
}

.tab-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 18px;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid transparent;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
    top: 0;
}

.tab-btn:hover:not(.active) {
    background-color: var(--panel-bg);
    color: var(--text-color);
    top: -2px;
}

.tab-btn.active {
    color: var(--text-color);
    border-bottom-color: var(--accent-color);
    background-color: var(--panel-bg);
}

#generator-view {
    display: flex; /* Changed from grid to flex */
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

@media (min-width: 992px) {
    #generator-view {
        flex-wrap: nowrap; /* Prevent wrapping on large screens */
    }
}

#generator-controls-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 400px; /* Flex properties for responsive controls column */
    min-width: 350px;
}

#generator-output-column {
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative; /* Default position */
    flex: 2 1 500px; /* Flex properties for responsive output column */
}

/* Add styles for floating window behavior */
#generator-output-column.floating-window {
    position: absolute; /* Take out of flow to be draggable */
    right: 20px;
    top: 150px;
    width: 45%;
    min-width: 350px;
    height: 70vh;
    min-height: 300px;
    resize: both; /* Make it resizable */
    overflow: hidden; /* Hide the browser's resize handle overflow */
    z-index: 1000;
}

#output-window-header {
    padding: 10px 15px;
    background-color: var(--input-bg);
    cursor: move; /* Indicate it's draggable */
    border-bottom: 1px solid var(--panel-border);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    font-weight: bold;
    color: var(--text-color);
}

#settings-panel {
    background-color: var(--panel-bg);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-section {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--panel-border);
}

.settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section h2 {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--secondary-accent-text);
    font-weight: 700;
}

#character-selector-wrapper {
    display: flex;
    justify-content: center;
}

#official-characters {
    width: 100%;
}

#official-characters h3 {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

#custom-characters-selection h3 {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

#custom-character-selector p {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

#character-selector-container {
    background-color: var(--panel-bg);
    padding: 20px;
    border-radius: 20px;
}

#character-selector, #community-char-sub-selector {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 15px;
}

#character-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
}

.character-label {
    width: 100%;
    box-sizing: border-box;
    height: auto;
    min-height: 45px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 18px;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.character-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--bg-color), var(--panel-bg), var(--bg-color));
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.character-label:hover::before {
    opacity: 1;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.character-label img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--bg-color);
}

.character-label input {
    display: none;
}

.character-label input:checked + img + span {
    font-weight: bold;
}

#conversation-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background-color: var(--panel-bg);
    border-radius: 20px;
    height: 100%;
    overflow-y: auto;
    border: none; /* Border is now on the parent */
    flex-grow: 1; /* Make it fill the draggable window */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--panel-bg);
}

#conversation-container::-webkit-scrollbar {
    width: 8px;
}

#conversation-container::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

#conversation-container::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

.message-row {
    display: flex;
    opacity: 0;
    animation: fadeIn 0.8s forwards;
    gap: 10px;
    align-items: flex-end;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.message-row.align-left {
    justify-content: flex-start;
    flex-direction: row;
}

.message-row.align-right {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.character-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: contain;
    background-color: var(--bg-color);
    padding: 5px;
    border: 2px solid;
    flex-shrink: 0;
    margin-bottom: 5px;
    transition: box-shadow 0.5s ease-out;
}

.character-icon.speaking {
    animation: speakPulse 2s ease-in-out;
}

@keyframes speakPulse {
    0% { transform: scale(1); box-shadow: 0 0 15px 5px var(--glow-color, #fff); }
    50% { transform: scale(1.1); box-shadow: 0 0 25px 10px var(--glow-color, #fff); }
    100% { transform: scale(1); box-shadow: 0 0 15px 5px var(--glow-color, #fff); }
}

.message-bubble {
    background-color: #000000;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 22px;
    max-width: 75%;
    display: inline-block;
    line-height: 1.4;
    border: 3px solid;
    text-align: left;
    text-shadow: -1px -1px 0 var(--bubble-text-shadow-color), 1px -1px 0 var(--bubble-text-shadow-color), -1px 1px 0 var(--bubble-text-shadow-color), 1px 1px 0 var(--bubble-text-shadow-color);
    font-weight: 700;
    color: #ffffff;
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255,255,255,0.1),
        rgba(255,255,255,0.1) 10px,
        transparent 10px,
        transparent 20px
    );
    animation: bubblePattern 30s linear infinite;
}

@keyframes bubblePattern {
    from { background-position: 0 0; }
    to { background-position: 100% 100%; }
}

/* Update FF7 message style */
.message-bubble.ff7-style {
    border: solid 1px #424542;
    box-shadow: 1px 1px #e7dfe7,
                -1px -1px #e7dfe7,
                1px -1px #e7dfe7,
                -1px 1px #e7dfe7,
                0 -2px #9c9a9c,
                -2px 0 #7b757b,
                0 2px #424542;
    padding: 15px 20px;
    margin: 5px 0;
    background: #04009d;
    background: -moz-linear-gradient(top, #04009d 0%, #06004d 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#04009d), color-stop(100%,#06004d));
    background: -webkit-linear-gradient(top, #04009d 0%,#06004d 100%);
    background: -o-linear-gradient(top, #04009d 0%,#06004d 100%);
    background: -ms-linear-gradient(top, #04009d 0%,#06004d 100%);
    background: linear-gradient(to bottom, #04009d 0%,#06004d 100%);
    border-radius: 7px;
    position: relative;
    text-shadow: none;
    max-width: 75%;
}

.message-bubble.ff7-style .dialogue-text {
    color: #eff1ff;
    text-shadow: 2px 2px #212421,
                 1px 1px #212021;
    font-family: Verdana, sans-serif;
    font-size: 20px;
    font-weight: normal;
    margin: 5px 0;
    line-height: 1.4;
}

.message-bubble.ff7-style:after {
    content: '▼';
    position: absolute;
    bottom: -20px;
    right: 20px;
    color: #eff1ff;
    text-shadow: 2px 2px #212421,
                 1px 1px #212021;
    animation: ff7Arrow 1s infinite;
}

/* Preview specific adjustments */
#edit-message-preview .message-bubble.ff7-style {
    margin: 10px 0;
    min-width: 200px;
}

#edit-message-preview .message-bubble.ff7-style .dialogue-text {
    font-size: 16px; /* Slightly smaller in preview */
}

/* Maintain the same arrow animation */
@keyframes ff7Arrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.message-bubble.twisted {
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 5px #ff4d4d;
}

.dialogue-text {
    display: block;
    padding: 5px 10px;
    font-weight: 700;
    color: #ffffff;
}

.message-bubble strong {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    opacity: 0.8;
}

.Dandy .message-bubble {
    background-color: #4CAF50; /* Bright Green */
    color: #ffffff;
}

.Astro .message-bubble {
    background-color: #6495ED; /* Light Blue */
    color: #ffffff;
}

.Pebble .message-bubble {
     background-color: #808080; /* Grey */
     color: #ffffff;
}

#loading-message, #error-message {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-muted);
    margin: auto;
}

#error-message {
    color: #ff6b6b;
}

#action-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

#generate-button {
    font-family: 'Fredoka', sans-serif;
    font-size: 20px;
    font-weight: bold;
    padding: 12px 25px;
    border-radius: 30px;
    border: none;
    background: linear-gradient(to bottom, var(--accent-color), var(--accent-hover));
    color: var(--text-inverted);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

#generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

#generate-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);
}

#generate-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.search-container {
    padding: 10px 20px;
    background-color: var(--panel-bg);
    border-radius: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#community-search-input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
    font-family: 'Fredoka', sans-serif;
}

#community-character-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-character-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    border: 2px solid transparent;
    background-color: var(--input-bg);
}

.filter-character-label input {
    display: none;
}

.filter-character-label img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--input-bg);
    object-fit: contain;
}

.filter-character-label:hover {
    border-color: var(--accent-color);
}

.filter-character-label input:checked + span {
    font-weight: bold;
}

#save-button {
    font-family: 'Fredoka', sans-serif;
    font-size: 20px;
    font-weight: bold;
    padding: 12px 25px;
    border-radius: 30px;
    border: none;
    background-color: #555;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#save-button:hover {
    background-color: var(--accent-hover);
}

#save-button:active {
    transform: scale(0.95);
}

#save-button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

#topic-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#topic-section label {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-muted);
    text-align: left;
}

#options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 25px 20px;
    align-items: start;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.control-group label {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

#length-select,
#content-rating-select {
    font-family: 'Fredoka', sans-serif;
    padding: 8px 12px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    cursor: pointer;
    transition: border-color 0.3s ease;
    width: 100%;
}

#length-select:focus,
#content-rating-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

#character-limit-message {
    display: none; 
}

#topic-input {
    font-family: 'Fredoka', sans-serif;
    width: 100%;
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

#topic-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Range slider styles */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--panel-border);
    border-radius: 5px;
    cursor: pointer;
    outline: none;
    transition: background 0.3s;
    margin-top: 4px; /* Align better with selects */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
}

#max-line-length-value {
    font-weight: normal;
    color: var(--text-color);
}

/* Custom Toggle Switch for Unhinged Mode */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin-top: 2px; /* Align with other controls */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--switch-checked-unhinged);
}

input#twist-toggle:checked + .slider {
    background-color: var(--switch-checked-twist);
}

input#roleplay-toggle:checked + .slider {
    background-color: var(--switch-checked-roleplay);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 28px;
}

.slider.round:before {
    border-radius: 50%;
}

#audio-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(30, 30, 30, 0.8);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 1000;
}

#audio-controls button {
    font-family: 'Fredoka', sans-serif;
    padding: 8px 15px;
    border-radius: 20px;
    border: none;
    background: var(--accent-color);
    color: var(--text-inverted);
    cursor: pointer;
    transition: background 0.3s;
    font-size: 15px;
    font-weight: bold;
    width: 100%;
    max-width: 800px;      /* cap width to match main container */
}

#audio-controls button:hover {
    background: var(--accent-hover);
}

#audio-controls button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Community View Styles */
#community-view {
    background-color: var(--panel-bg);
    padding: 20px;
    border-radius: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

#community-view-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    width: 100%;
    max-width: 1200px; /* Use app-container width for consistency */
}

#community-view-wrapper .search-container {
    flex-shrink: 0; /* Prevent the search container from shrinking */
}

#community-view {
    flex-grow: 1; /* Allow the prompt grid to grow and fill available space */
}

.prompt-card {
    background-color: var(--bg-color);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.prompt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-color: var(--accent-color);
}

.prompt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--input-bg);
}

.prompt-card-icons {
    display: flex;
    align-items: center;
}

.prompt-card-char-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--panel-bg);
    margin-left: -10px;
    background-color: var(--bg-color);
    object-fit: contain;
}

.prompt-card-char-icon:first-child {
    margin-left: 0;
}

.prompt-card-body {
    padding: 15px;
    flex-grow: 1;
}

.prompt-stats {
    display: flex;
    gap: 12px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: bold;
    align-items: center;
}

.prompt-title {
    font-weight: bold;
    font-size: 18px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    max-height: 4.2em; /* Fallback for browsers that don't support line-clamp */
    line-height: 1.4em;
    color: var(--text-color);
}

.prompt-creator {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.prompt-creator img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.prompt-creator-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.prompt-creator-username {
    font-weight: bold;
    color: var(--text-color);
}

.delete-prompt-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.delete-prompt-btn:hover {
    background-color: rgba(255, 0, 0, 0.1);
}

.prompt-card:hover .delete-prompt-btn {
    opacity: 1;
}

/* Custom Character View Styles */
#custom-character-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    background-color: var(--panel-bg);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
}

@media (min-width: 768px) {
    #custom-character-view {
        grid-template-columns: 350px 1fr;
    }
}

#custom-char-creator h3, #custom-char-gallery h3 {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--secondary-accent-text);
    font-weight: 700;
}

#custom-char-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

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

.form-group.span-2 {
    grid-column: span 2;
}

#custom-char-form label,
#edit-char-form label {
    font-weight: bold;
    color: var(--text-muted);
    font-size: 14px;
}

#custom-char-form input[type="text"],
#custom-char-form textarea,
#custom-char-form input[type="file"],
#custom-char-form select {
    font-family: 'Fredoka', sans-serif;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    box-sizing: border-box;
}

#custom-char-form textarea {
    resize: vertical;
    min-height: 80px;
}

#custom-char-form input[type="color"] {
    width: 100%;
    height: 44px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    cursor: pointer;
    padding: 2px;
    border-radius: 10px;
}

#custom-char-form button {
    font-family: 'Fredoka', sans-serif;
    font-size: 18px;
    font-weight: bold;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background-color: var(--accent-color);
    color: var(--text-inverted);
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
}

#custom-char-form button:hover {
    background-color: var(--accent-hover);
}

#custom-char-form button:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

#custom-char-gallery {
    /* This now contains the selector */
}

#custom-char-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.custom-char-card {
    background-color: var(--bg-color);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    border: 2px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.custom-char-card img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: contain;
    background-color: var(--input-bg);
    margin: 0 auto 10px auto; /* Center image */
}

.custom-char-info h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: bold;
    word-break: break-word;
}

.custom-char-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.custom-char-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-around;
    gap: 5px;
}

.custom-char-actions button {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-grow: 1;
}

.custom-char-actions .edit-btn {
    background-color: #007bff; /* Blue */
    color: white;
}

.custom-char-actions .edit-btn:hover {
    background-color: #0056b3;
}

.custom-char-actions .delete-btn {
    background-color: #dc3545; /* Red */
    color: white;
}

.custom-char-actions .delete-btn:hover {
    background-color: #c82333;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto; /* Allow scrolling of the overlay itself */
}

/* Make the conversation player modal draggable */
.draggable-modal {
    display: none; /* Hidden by default */
    background: transparent; /* No dark overlay for the draggable window */
    pointer-events: none; /* Allow clicks to pass through the overlay */
    padding: 0; /* Remove padding */
    overflow: hidden; /* Prevent overlay scroll */
}

.draggable-modal > #modal-content {
    pointer-events: auto; /* Re-enable pointer events for the modal itself */
    position: absolute; /* Allow positioning within the overlay */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Start centered */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); /* Add shadow for floating effect */
    max-height: 90vh; /* Cap the height to 90% of viewport height */
    display: flex;
    flex-direction: column;
    background-color: var(--panel-bg);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
}

#modal-conversation-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background-color: var(--panel-bg);
    border-radius: 20px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--panel-bg);
    max-height: calc(90vh - 200px); /* Subtract space for header and interaction section */
}

#modal-conversation-container::-webkit-scrollbar {
    width: 8px;
}

#modal-conversation-container::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

#modal-conversation-container::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

#modal-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 90vh;
    width: 90%;
    max-width: 800px;
    background-color: var(--panel-bg);
    border-radius: 20px;
    padding: 20px;
}

#modal-header {
    flex-shrink: 0; /* Prevent header from shrinking */
}

#modal-interaction-section {
    flex-shrink: 0; /* Prevent interaction section from shrinking */
}

#modal-interaction-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: var(--panel-bg);
    padding: 15px;
    border-radius: 20px;
}

#modal-like-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#modal-like-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#modal-like-button.liked {
    filter: drop-shadow(0 0 5px #ff6b6b);
}

#modal-like-button:hover {
    transform: scale(1.1);
}

#modal-like-count {
    font-size: 18px;
    font-weight: bold;
}

#comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 5px;
}

.subtle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 14px;
    padding: 5px;
}

.subtle-btn:hover {
    color: var(--text-color);
}

#comments-collapsible-area {
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--panel-bg);
}

#comments-collapsible-area::-webkit-scrollbar {
    width: 8px;
}

#comments-collapsible-area::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

#comments-collapsible-area::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

#modal-comments-section h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-muted);
    border-bottom: none;
    padding-bottom: 0;
}

#modal-comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
    align-items: flex-start;
}

.comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-item img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-content {
    background: var(--bg-color);
    padding: 8px 12px;
    border-radius: 10px;
    flex-grow: 1;
}

.comment-author {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--secondary-accent-text);
}

.comment-text {
    font-size: 15px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

#modal-comment-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

#modal-comment-input {
    flex-grow: 1;
    font-family: 'Fredoka', sans-serif;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    resize: vertical;
    min-height: 40px;
    box-sizing: border-box;
}

#modal-comment-form button {
     font-family: 'Fredoka', sans-serif;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: var(--text-inverted);
    cursor: pointer;
    transition: background 0.3s;
    font-size: 15px;
    font-weight: bold;
}

#modal-comment-form button:hover {
    background: var(--accent-hover);
}

/* Edit Character Modal Specific Styles */
#edit-character-modal #edit-char-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#edit-character-modal label {
    font-weight: bold;
    color: var(--text-muted);
}

#edit-character-modal input[type="text"],
#edit-character-modal textarea,
#edit-character-modal input[type="file"],
#edit-character-modal select {
    font-family: 'Fredoka', sans-serif;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    box-sizing: border-box;
}

#edit-character-modal textarea {
    resize: vertical;
    min-height: 80px;
}

#edit-character-modal input[type="color"] {
    width: 100%;
    height: 44px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    cursor: pointer;
    padding: 2px;
    border-radius: 10px;
}

/* Add styles for the private toggle in edit modal */
#edit-character-modal .switch {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

#edit-character-modal .switch .slider {
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

#edit-character-modal .switch input:checked + .slider {
    background-color: var(--accent-color);
}

#edit-character-modal .switch input:checked + .slider:before {
    transform: translateX(22px);
}

#edit-character-modal .switch .switch-label {
    position: relative;
    color: var(--text-color);
    font-size: 14px;
}

#edit-character-modal .switch input:not(:checked) + .slider + .switch-label {
    color: var(--text-muted); /* Muted text when off */
}

#edit-character-modal #save-edit-character-button {
    font-family: 'Fredoka', sans-serif;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background-color: var(--accent-color);
    color: var(--text-inverted);
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 16px;
    font-weight: bold;
}

#edit-character-modal #save-edit-character-button:hover {
    background-color: var(--accent-hover);
}

#edit-character-modal #save-edit-character-button:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

/* Add some spacing before the actions section */
#edit-char-form {
    padding-bottom: 20px;
}

#edit-character-modal .edit-char-actions {
    display: flex;
    justify-content: space-between; /* Changed from flex-end to space-between */
    gap: 10px;
    margin-top: 20px;
    position: sticky; /* Make buttons stick to bottom */
    bottom: 0;
    background: var(--panel-bg);
    padding: 15px 0;
    border-top: 1px solid var(--panel-border);
    z-index: 10;
}

#edit-character-modal #delete-edit-character-button {
    background-color: #dc3545; /* Red */
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 15px;
    font-weight: bold;
}

#edit-character-modal #delete-edit-character-button:hover {
    background-color: #c82333;
}

#edit-character-modal #delete-edit-character-button:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

/* Live Conversation Display: updated to match other containers and improve placeholder visibility */
#live-conversation-display {
    flex-grow: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--panel-bg);
}

#live-conversation-display::-webkit-scrollbar {
    width: 8px;
}

#live-conversation-display::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

#live-conversation-display::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 4px;
}

/* Center the "waiting" placeholder when no content is playing */
#live-conversation-display #live-player-placeholder {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 20px;
    text-align: center;
}

/* Adjust live view to contain dialogue in a window */
#live-view {
    display: grid;
    grid-template-columns: minmax(300px, 800px) 1fr;
    gap: 20px;
    margin-bottom: 20px;
    height: calc(100vh - 220px);
    min-height: 500px;
}

#live-player-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--panel-bg);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid var(--panel-border);
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

#live-prompt-info {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 15px;
}

#live-prompt-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: var(--text-color);
    min-height: 24px;
}

#live-prompt-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#live-prompt-creator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    min-height: 32px;
}

#live-prompt-creator-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

#live-prompt-stats {
    font-size: 16px;
    font-weight: bold;
}

#live-up-next {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 15px;
}

#live-up-next h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: var(--text-muted);
}

#up-next-prompt-card {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--input-bg);
    padding: 10px;
    border-radius: 10px;
    min-height: 70px;
}

#up-next-thumbnail {
    width: 100px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    background-color: #000;
}

#up-next-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#up-next-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

#live-chat {
    background: var(--panel-bg);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--panel-border);
}

#live-chat-header {
    padding: 15px 20px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--panel-border);
}

#live-chat-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--secondary-accent-text);
}

#live-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.chat-message {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 15px;
    word-break: break-word;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.chat-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-message .username {
    color: var(--secondary-accent-text);
    font-weight: bold;
}

.chat-message .timestamp {
    color: #777;
    font-size: 12px;
    margin-left: auto;
    flex-shrink: 0;
    align-self: center;
}

.chat-text {
    flex-grow: 1;
}

#live-chat-form {
    padding: 15px;
    display: flex;
    gap: 10px;
    background: var(--bg-color);
    border-top: 1px solid var(--panel-border);
}

#live-chat-input {
    flex-grow: 1;
    font-family: 'Fredoka', sans-serif;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    min-height: 20px; /* Base height for one line */
    box-sizing: border-box;
}

#live-chat-input:disabled {
    background-color: var(--text-muted);
}

#live-chat-form button {
    font-family: 'Fredoka', sans-serif;
    padding: 10px 15px;
    border-radius: 10px;
    border: none;
    background: var(--accent-color);
    color: var(--text-inverted);
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

#live-chat-form button:hover {
    background: var(--accent-hover);
}

/* New styles for character sub-tabs */
#character-sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center; /* Center the sub-tabs */
}

.sub-tab-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 16px;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background-color: var(--bg-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sub-tab-btn.active {
    background-color: var(--accent-color);
    color: var(--text-inverted);
    border-color: var(--accent-color);
}

.sub-tab-btn:hover:not(.active) {
    background-color: var(--input-bg);
}

.community-sub-selector-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

#community-char-search-input {
    flex-grow: 1;
    max-width: 250px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 2px solid var(--panel-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    box-sizing: border-box;
    font-family: 'Fredoka', sans-serif;
}

/* Small switch for "My Characters" */
.small-switch {
    width: 100px; /* Adjust width to fit text */
    height: 28px;
    position: relative;
    display: flex; /* Use flex to align label */
    align-items: center;
    justify-content: center;
    padding: 0 5px; /* Add some padding for the label */
}

.small-switch .slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg);
    transition: .4s;
    border-radius: 50%;
}

.small-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.small-switch input:checked + .slider {
    background-color: var(--accent-color); /* Green for "on" */
}

.small-switch input:checked + .slider:before {
    transform: translateX(70px); /* Move further for wider switch */
}

.small-switch .switch-label {
    position: absolute;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-inverted); /* White text on active switch */
    text-align: center;
    pointer-events: none; /* Make sure label doesn't interfere with click */
    z-index: 1;
    transition: color 0.4s;
}

.small-switch input:not(:checked) + .slider + .switch-label {
    color: var(--text-muted); /* Muted text when off */
}

/* Responsiveness */
@media (max-width: 991px) {
    #generator-output-column.floating-window {
        position: relative; /* Put it back in the document flow */
        right: auto;
        top: auto;
        width: 100%; /* Take full width */
        height: 60vh;
        min-height: 400px;
        resize: vertical; /* Only allow vertical resize on smaller screens */
    }
}

@media (max-width: 768px) {
    #custom-character-view {
        grid-template-columns: 1fr;
    }
    
    #live-view {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    #live-player-container, #live-chat {
        height: 60vh; /* Give them a defined height on mobile */
    }

    #options-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .filter-character-label {
        font-size: 14px;
        padding: 5px 12px;
        gap: 6px;
        background-color: var(--input-bg);
    }
    
    .filter-character-label img {
        background-color: var(--input-bg);
    }

    #tabs {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .tab-btn {
        font-size: 15px;
        padding: 8px 12px;
    }
    
    #generator-view {
        grid-template-columns: 1fr;
    }

    #generator-output-column {
        position: relative;
        top: 0;
        height: 60vh;
    }

    #settings-panel {
        padding: 15px;
        gap: 20px;
    }
    
    .settings-section h2 {
        font-size: 18px;
    }

    .character-label {
        font-size: 16px;
        padding: 8px 12px;
        gap: 6px;
    }
    
    #character-selector, #community-char-sub-selector {
        gap: 10px;
    }
    
    #community-view {
        padding: 15px;
    }

    .message-bubble {
        font-size: 18px;
        max-width: 85%;
    }

    .character-icon {
        width: 40px;
        height: 40px;
    }

    #modal-content {
        padding: 15px;
        width: 95%;
        max-height: 95vh;
    }

    #modal-title {
        font-size: 20px;
    }

    #modal-conversation-container {
        padding: 10px;
        min-height: 250px;
    }
    
    #modal-comment-form {
        flex-direction: column;
        align-items: flex-end;
    }

    #modal-comment-input {
        width: 100%;
        box-sizing: border-box;
    }

    #audio-controls {
        bottom: 10px;
        right: 10px;
        padding: 5px;
    }

    #live-chat-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    #live-chat-form button {
        width: 100%;
    }
    .small-switch {
        width: 90px;
    }
    .small-switch input:checked + .slider:before {
        transform: translateX(60px);
    }
}

@media (max-width: 420px) {
    .prompt-card {
        text-align: center;
    }

    .prompt-creator {
        justify-content: center;
    }

    .prompt-stats {
        justify-content: center;
    }

    #generate-button, #save-button {
        font-size: 18px;
        padding: 10px 20px;
        width: 100%;
        box-sizing: border-box;
    }
    
    #action-bar {
        flex-direction: column;
        width: 100%;
    }

    .tab-btn {
        font-size: 14px;
        padding: 8px 10px;
    }
    
    #live-chat-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    #live-chat-form button {
        width: 100%;
    }
    .small-switch {
        width: 90px;
    }
    .small-switch input:checked + .slider:before {
        transform: translateX(60px);
    }
}

.achievement-popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    animation: achievementSlide 0.5s ease-out forwards;
}

.achievement-popup img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.achievement-popup .achievement-text {
    display: flex;
    flex-direction: column;
}

.achievement-popup .achievement-title {
    font-weight: bold;
    color: var(--accent-color);
}

.achievement-popup .achievement-description {
    font-size: 14px;
    color: var(--text-color);
}

@keyframes achievementSlide {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.character-tooltip {
    position: fixed; /* Changed from absolute to fixed for viewport positioning */
    background: var(--panel-bg);
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border: 1px solid var(--panel-border); /* Added border for Windows-like appearance */
    font-size: 14px;
    max-width: 250px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: scale(0.95); /* Slight scale effect */
}

.character-label:hover .character-tooltip {
    opacity: 1;
    transform: scale(1);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    font-family: 'Fredoka', sans-serif;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--panel-border);
}

.pagination-controls button {
    padding: 8px 15px;
    border: none;
    background: var(--panel-bg);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid var(--panel-border);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls button:not(:disabled):hover {
    background: var(--accent-color);
    color: var(--text-inverted);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-muted);
}

.pagination-page-select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    color: var(--text-color);
    font-family: inherit;
    cursor: pointer;
}

/* Add ichor-related styles */
.ichor-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
    background: var(--panel-bg);
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    position: relative;
}

#ichor-tank {
    width: 140px;  /* Even thinner */
    height: 300px;
    background-color: var(--input-bg);
    border: 3px solid var(--panel-border);
    border-radius: 70px; /* Make it more capsule shaped */
    position: relative;
    overflow: hidden;
}

#ichor-tank .tank-cap {
    position: absolute;
    width: 100%;
    height: 20px;
    background: #aaa;
    border-radius: 35px;
    z-index: 2;
}

#ichor-tank .tank-cap.bottom {
    bottom: 0;
    height: 15px; /* Make bottom cap smaller */
}

.ichor-bubble {
    position: absolute;
    bottom: 15px; /* Start above bottom cap */
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

@keyframes bubbleRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translateY(-250px) scale(0.5);
        opacity: 0;
    }
}

#ichor-level {
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0.9) 100%
    );
    position: absolute;
    bottom: 15px; /* Align with bottom cap */
    left: 0;
    width: 100%;
    height: 0%;
    transition: height 0.3s ease;
    z-index: 1;
}

/* Update skill check positioning */
.skill-check {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 30px;
    background: var(--panel-bg);
    border-radius: 15px;
    display: none;
    z-index: 3;
}

.skill-check-target {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 100%;
    background: #FFD700;
    opacity: 0.5;
    z-index: 1;
}

.skill-check-bar {
    position: absolute;
    width: 10px;
    height: 100%;
    background: #fff;
    z-index: 2;
}

.skill-check-result {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    text-align: center;
}

.skill-check-result.show {
    opacity: 1;
}

@keyframes slideBar {
    from { left: 0; }
    to { left: calc(100% - 10px); }
}

#valve-wheel {
    width: 120px;
    height: 120px;
    position: absolute;
    top: -140px;
    left: 50%;
    transform: translateX(-50%);
    transition: transform 0.1s linear;
}

.extracting #valve-wheel {
    animation: spin 2s linear infinite;
}

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