:root {
    --bg-color: #131314;
    --surface-color: #1e1f20;
    --text-primary: #e3e3e3;
    --text-secondary: #c4c7c5;
    --accent-blue: #a8c7fa;
    --user-bubble: #282a2c; /* Slightly lighter than bg */
    --gemini-bubble-bg: #000000;
    --gemini-bubble-text: #ffffff;
    --input-bg: #1e1f20;
    --gemini-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body.light-mode {
    --bg-color: #ffffff;
    --surface-color: #f0f4f9;
    --text-primary: #1f1f1f;
    --text-secondary: #444746;
    --accent-blue: #0b57d0;
    --user-bubble: #e3e3e3;
    --gemini-bubble-bg: #ffffff;
    --gemini-bubble-text: #000000;
    --input-bg: #f0f4f9;
}

/* Ensure SVGs inherit the correct color */
svg {
    fill: var(--text-primary);
}

/* Special case for the send button arrow which should be dark on the light blue button in dark mode, but maybe different in light mode? */
.send-button svg {
    fill: #000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* Header Section */
.header-section {
    background-color: var(--bg-color);
    z-index: 10;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    min-height: 56px;
}

.action-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 16px 12px 16px;
}

.menu-icon, .profile-icon {
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
}

.menu-icon:hover {
    background-color: rgba(255,255,255,0.1);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    margin-left: 12px;
}

.gemini-text {
    font-size: 20px;
    font-weight: 500;
}

.version-badge {
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid #444746;
    padding: 2px 8px;
    border-radius: 4px;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    background-color: #7cacf8;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
}

/* Chat Area */
.chat-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
    padding-bottom: 100px; /* Space for input */
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centered initial state */
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 16px;
    color: var(--text-secondary);
}

.welcome-message h1 {
    font-family: 'Google Sans', sans-serif;
    background: var(--gemini-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 32px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.chip {
    background-color: var(--surface-color);
    border: 1px solid #444746;
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px; /* App style chips */
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chip:hover {
    background-color: #303335;
}

/* Messages */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.message.user {
    flex-direction: row; /* User on Left */
}

.message.gemini {
    flex-direction: row-reverse; /* Gemini on Right */
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gemini-avatar img, .gemini-avatar svg {
    width: 24px;
    height: 24px;
}

.user-avatar {
    background-color: transparent;
    font-size: 20px;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 85%;
}

.user .message-content {
    align-items: flex-start; /* User Aligned Left */
}

.gemini .message-content {
    align-items: flex-end; /* Gemini Aligned Right */
}

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* User (Left) Bubble */
.user .bubble {
    background-color: var(--user-bubble);
    border-bottom-left-radius: 4px; /* Corner on left */
    border-bottom-right-radius: 18px;
    color: var(--text-primary);
}

/* Gemini (Right) Bubble */
.gemini .bubble {
    background-color: var(--gemini-bubble-bg);
    border-bottom-right-radius: 4px; /* Corner on right */
    color: var(--gemini-bubble-text);
}

/* Herny-specific style: force black bubble and white text for his messages across themes */
.message.herny .bubble {
    background-color: #000 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    box-shadow: none !important;
}

/* Ensure Herny bubble remains readable in light-mode as well */
body.light-mode .message.herny .bubble {
    background-color: #000 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
}

.gemini .bubble img {
    /* allow bubble image corner styling to inherit from the bubble so images appear rounded */
    border-radius: 12px;
    max-width: 100%;
    margin-top: 8px;
    border: 1px solid #444746;
}

.action-text {
    font-weight: 700;
    color: #ffffff;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 12px;
    margin-top: 8px;
    border: 1px solid #444746;
    max-width: 100%;
}

.file-icon {
    width: 24px;
    height: 24px;
    fill: #a8c7fa;
    flex-shrink: 0;
}

.file-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e3e3e3;
}

.file-type {
    font-size: 12px;
    color: #c4c7c5;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 6px 2px;
    align-items: center;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-primary);
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input Area */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    padding: 16px;
    z-index: 20;
    display: flex;
    justify-content: center;
}

.input-container {
    background-color: var(--input-bg);
    border-radius: 32px;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    width: 100%;
    max-width: 600px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.input-container:focus-within {
    border-color: rgba(255,255,255,0.2);
}

#user-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    padding: 12px;
    outline: none;
}

.action-button {
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.action-button:hover {
    background-color: rgba(255,255,255,0.1);
}

.send-button {
    background-color: #a8c7fa;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
    transition: transform 0.2s;
}

.send-button:active {
    transform: scale(0.9);
}

.hidden {
    display: none !important;
}

.image-preview {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: #333;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Intro Overlay */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease-out;
}

.intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    text-align: center;
}

#intro-text-1 {
    font-size: 4rem;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s, transform 0.8s;
    margin-bottom: 10px;
    position: relative;
    z-index: 30;
}

#intro-text-2 {
    font-size: 1.5rem;
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s, transform 0.8s;
    position: relative;
    z-index: 30;
}

.intro-visuals {
    position: relative;
    width: 100%;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 60px;
}

#intro-explosion {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    height: auto;
    object-fit: contain;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

#intro-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    opacity: 0;
    transition: opacity 1s;
    z-index: 10;
}

.visible-intro {
    opacity: 1 !important;
}

#intro-text-1.visible-intro,
#intro-text-2.visible-intro {
    transform: translateY(0) !important;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--surface-color);
    width: 90%;
    max-width: 400px;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 20px;
    color: var(--text-primary);
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-item:hover {
    background-color: #303335;
}

.user-emoji {
    font-size: 24px;
    width: 40px;
    height: 40px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Support & Follow Buttons removed */

.community-btn {
    background: linear-gradient(135deg, #a4f6a5 0%, #4caf50 100%);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.create-user-header-btn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.community-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.create-user-header-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(254, 207, 239, 0.3);
}

.community-btn:active, .create-user-header-btn:active {
    transform: scale(0.95);
}

.action-btn-primary {
    background-color: var(--accent-blue);
    color: #fff; /* Usually white text on blue looks best, or dark if blue is light */
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.light-mode .action-btn-primary {
    color: #fff;
}

.action-btn-primary:hover {
    opacity: 0.9;
}

.action-btn-secondary {
    background-color: var(--surface-color);
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn-secondary:hover {
    background-color: rgba(255,255,255,0.05);
}

.light-mode .action-btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
}

.divider {
    height: 1px;
    background-color: rgba(255,255,255,0.1);
    width: 100%;
}

.light-mode .divider {
    background-color: rgba(0,0,0,0.1);
}

/* Create User Modal Specifics */
.create-user-container {
    max-width: 400px;
}

.create-user-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.input-group label {
    font-size: 14px;
    color: var(--text-secondary);
}

.input-group input, .input-group textarea {
    background: var(--input-bg);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    outline: none;
}

.light-mode .input-group input, .light-mode .input-group textarea {
    border: 1px solid rgba(0,0,0,0.1);
}

.avatar-selection {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#custom-emoji-input {
    width: 60px;
    text-align: center;
    font-size: 20px;
}

#custom-avatar-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

#custom-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.icon-btn-small {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-user-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.user-action-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}

.user-action-btn:hover {
    background: rgba(255,255,255,0.2);
    color: var(--text-primary);
}

.section-header {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 12px 0 8px 0;
    padding-left: 8px;
}

.shared-user-card {
    background: rgba(255,255,255,0.05);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    border: 1px dashed rgba(255,255,255,0.2);
}

.shared-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    font-size: 24px;
    object-fit: cover;
}

.shared-user-info {
    flex-grow: 1;
}

.shared-user-name {
    font-weight: 600;
    font-size: 15px;
    display: block;
}

.shared-user-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.add-custom-user-btn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
}

/* Settings Modal Specifics */
.settings-container {
    max-width: 300px;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.light-mode .setting-item {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.light-mode #save-chat-title {
    border: 1px solid rgba(0,0,0,0.1);
}

.saved-chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

.light-mode .saved-chat-item {
    background: rgba(0,0,0,0.05);
}

.saved-chat-info {
    display: flex;
    flex-direction: column;
}

.saved-chat-title {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-primary);
}

.saved-chat-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.saved-chat-actions {
    display: flex;
    gap: 8px;
}

.theme-toggle-btn {
    background: var(--surface-color);
    border: 1px solid var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.theme-toggle-btn:hover {
    background: rgba(128,128,128,0.1);
}

/* Community Page */
.community-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.community-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.light-mode .community-header {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.community-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.search-bar-container input {
    width: 100%;
    background: var(--surface-color);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
}

.light-mode .search-bar-container input {
    border: 1px solid rgba(0,0,0,0.1);
}

.upload-section-container {
    background: var(--surface-color);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.upload-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.upload-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.upload-type-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    flex: 1;
    justify-content: center;
}

.light-mode .upload-type-btn {
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
}

.upload-type-btn:hover {
    background: rgba(255,255,255,0.1);
}

.upload-preview-area img, .upload-preview-area video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.comm-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    outline: none;
}

.light-mode .comm-input {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(0,0,0,0.1);
}

.comm-textarea {
    resize: vertical;
    min-height: 80px;
}

.submit-post-btn {
    width: 100%;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.submit-post-btn:hover {
    opacity: 0.9;
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.post-card {
    background: var(--surface-color);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 12px;
    cursor: pointer;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-info {
    display: flex;
    flex-direction: column;
}

.post-username {
    font-weight: 600;
    color: var(--text-primary);
}

.post-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.post-media {
    width: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.post-media img, .post-media video {
    max-width: 100%;
    max-height: 500px;
}



.post-content {
    padding: 12px;
}

.post-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.post-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.post-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    background: none;
    border: none;
}

.action-item:hover {
    color: var(--text-primary);
}

.action-item.active {
    color: var(--accent-blue);
}

.action-item.active svg {
    fill: var(--accent-blue);
}

.comments-section {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 12px;
}

.light-mode .comments-section {
    border-top: 1px solid rgba(0,0,0,0.1);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.comment-item {
    display: flex;
    gap: 8px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-body {
    flex-grow: 1;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 12px;
}

.light-mode .comment-body {
    background: rgba(0,0,0,0.05);
}

.comment-user {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.comment-text {
    font-size: 14px;
    color: var(--text-primary);
}

.comment-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.comment-action {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-item.pinned {
    background: rgba(168, 199, 250, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(168, 199, 250, 0.3);
}

.pinned-badge {
    background-color: var(--accent-blue);
    color: #000;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-bottom: 4px;
    display: inline-block;
}

.comment-action:hover {
    text-decoration: underline;
}

.reply-input-container {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.reply-input {
    flex-grow: 1;
    background: var(--input-bg);
    border: none;
    padding: 8px;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.comment-input-area {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.comment-input {
    flex-grow: 1;
    background: var(--input-bg);
    border: none;
    padding: 10px;
    border-radius: 20px;
    color: var(--text-primary);
    outline: none;
}

.replies-list {
    margin-left: 40px;
    margin-top: 8px;
    border-left: 2px solid rgba(255,255,255,0.1);
    padding-left: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.light-mode .replies-list {
    border-left: 2px solid rgba(0,0,0,0.1);
}

.community-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: var(--text-secondary);
}

.profile-header-card {
    text-align: center;
    margin-bottom: 20px;
    background: var(--surface-color);
    padding: 20px;
    border-radius: 16px;
    position: relative;
}

#profile-view-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 8px;
}

.delete-btn {
    color: #ff6b6b;
    font-size: 12px;
    cursor: pointer;
    background: none;
    border: none;
    margin-left: auto;
}

.delete-btn:hover {
    text-decoration: underline;
}

/* iPad / mobile improvements */
.chat-area, .community-content, .user-list, .modal-container, .upload-preview-area {
    -webkit-overflow-scrolling: touch; /* smoother momentum scroll on iOS */
}

/* Respect safe area inset at the bottom for iPad with home indicator / keyboard */
.input-area {
    padding: calc(16px + env(safe-area-inset-bottom));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Increase touch target size for iPad */
.action-button, .icon-btn, .send-button, .community-btn, .action-btn-primary, .action-btn-secondary {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    touch-action: manipulation;
}

/* Make modal container a bit wider on large tablets */
@media (min-width: 768px) {
    .modal-container {
        max-width: 560px;
    }

    .app-container {
        max-width: 720px;
    }
}

/* Ensure videos/audios inline playback on iOS by hinting via CSS fallback (attribute must be set in DOM too) */
video[playsinline], video[webkit-playsinline] {
    outline: none;
}