* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #202124;
    line-height: 1.6;
}

a {
    color: #4285f4;
    text-decoration: underline;
}

a:hover {
    color: #1a73e8;
    text-decoration: underline;
}

a:visited {
    color: #4285f4;
}

.container {
    max-width: 768px;
    margin: 0 auto;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.container.conversation-mode {
    flex-direction: column;
}

.container.conversation-mode .input-container {
    order: 3;
    border-top: 1px solid #f1f3f4;
    border-bottom: none;
}

.container.conversation-mode .chat-container {
    order: 2;
    flex: 1;
}

.header {
    background: #ffffff;
    padding: 32px 24px 16px;
    text-align: center;
    position: relative;
}

.top-controls {
    position: absolute;
    top: 16px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.language-selector {
    position: relative;
}

.language-dropdown {
    position: relative;
    display: inline-block;
}

.language-current {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #5f6368;
    min-width: 70px;
    user-select: none;
}

.language-current:hover {
    background: #f8f9fa;
    border-color: #c4c7c5;
}

.language-dropdown.open .language-current {
    border-color: #4285f4;
    background: #f8f9fa;
}

.language-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 10px;
}

.language-dropdown.open .language-arrow {
    transform: rotate(180deg);
}

.language-options {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
}

.language-dropdown.open .language-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #5f6368;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: #f8f9fa;
}

.language-option.active {
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 500;
}

.language-flag {
    font-size: 16px;
}

.daruma-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    display: block;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.daruma-logo:hover {
    transform: scale(1.05);
}

.header p {
    font-size: 1rem;
    font-weight: 300;
    color: #5f6368;
    margin: 0;
    letter-spacing: 0.005em;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages {
    flex: 1;
    padding: 32px 24px;
    overflow-y: auto;
    background: #ffffff;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.message {
    margin-bottom: 32px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.875rem;
    border: 2px solid #f1f3f4;
    background: #ffffff;
    color: #5f6368;
    flex-shrink: 0;
    overflow: hidden;
}

.message.user .message-avatar {
    background: #ffffff;
    color: #202124;
    border-color: #202124;
}

.person-kanji {
    width: 32px;
    height: 32px;
    border: 2px solid #202124;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #202124;
}

.message.ai .message-avatar,
.message.assistant .message-avatar {
    background: transparent;
    border: none;
    color: #202124;
    font-weight: 600;
}

.message.ai .message-avatar img,
.message.assistant .message-avatar img {
    width: 40px;
    height: 40px;
    display: inline-block;
    object-fit: contain;
    border-radius: 50%;
}

.message-content {
    max-width: 80%;
    padding: 0;
    line-height: 1.6;
    font-weight: 400;
    font-size: 1rem;
}

.message.user .message-content {
    color: #202124;
}

.message.ai .message-content {
    color: #202124;
}

/* ── Rendered Markdown inside assistant messages ─────────────────────────── */
.message-content p { margin: 0 0 0.75em; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong,
.message-content b { font-weight: 700; }
.message-content em { font-style: italic; }
.message-content ul,
.message-content ol { margin: 0.5em 0 0.75em; padding-left: 1.5em; }
.message-content li { margin: 0.2em 0; }
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 { font-weight: 600; line-height: 1.3; margin: 1em 0 0.4em; }
.message-content h1 { font-size: 1.3rem; }
.message-content h2 { font-size: 1.18rem; }
.message-content h3 { font-size: 1.07rem; }
.message-content h4 { font-size: 1rem; }
.message-content blockquote {
    margin: 0.75em 0;
    padding: 0.4em 1em;
    border-left: 3px solid #c9a227;          /* netsuke gold accent */
    background: #faf7ee;
    color: #3c4043;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}
.message-content blockquote p { margin: 0; }
.message-content hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1em 0;
}
.message-content a { color: #1558d6; text-decoration: underline; }
.message-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: #f1f3f4;
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.message-content pre {
    background: #f6f8fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.75em 1em;
    overflow-x: auto;
    margin: 0.75em 0;
}
.message-content pre code { background: none; padding: 0; font-size: 0.88em; }
.message-content table {
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 0.93rem;
    display: block;
    overflow-x: auto;
    max-width: 100%;
}
.message-content th,
.message-content td {
    border: 1px solid #e0e0e0;
    padding: 0.4em 0.7em;
    text-align: left;
    vertical-align: top;
}
.message-content thead th { background: #f6f7f9; font-weight: 600; }
.message-content tbody tr:nth-child(even) { background: #fafbfc; }

.sources {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f1f3f4;
}

.sources-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #5f6368;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.source-pill {
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 240px;
    color: #202124;
}

.source-pill:hover {
    background: #e8f0fe;
    border-color: #4285f4;
}

.source-pill.expanded {
    background: #e8f0fe;
    border-color: #4285f4;
}

.source-pill .pill-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

.source-pill .pill-page {
    color: #5f6368;
    font-size: 0.75rem;
    font-weight: 400;
    flex-shrink: 0;
}

.source-excerpt {
    display: none;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #202124;
}

.source-excerpt.show {
    display: block;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from { 
        opacity: 0; 
        transform: translateY(-4px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

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

.message.assistant.fade-in {
    animation: fadeInUp 0.4s ease-out;
}

.streaming-text-chunk {
    opacity: 0;
    animation: fadeInText 0.3s ease-out forwards;
}

@keyframes fadeInText {
    from { 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

.source-excerpt-header {
    font-weight: 500;
    color: #202124;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.source-excerpt-content {
    color: #5f6368;
    font-style: italic;
}

/* Forum-specific styles */
.forum-pill {
    background: #fef7e0 !important;
    border-color: #fbbc04 !important;
    color: #b8860b !important;
}

.forum-pill:hover {
    background: #fde68a !important;
    border-color: #f9ab00 !important;
}

.forum-pill.expanded {
    background: #fde68a !important;
    border-color: #f9ab00 !important;
}

.journal-pill {
    background: #e8f0fe;
    border-color: #4285f4;
    color: #1a73e8;
}

.journal-pill:hover {
    background: #d2e3fc;
    border-color: #1a73e8;
}

.journal-pill.expanded {
    background: #d2e3fc;
    border-color: #1a73e8;
}

.wikipedia-pill {
    background: #f3e8ff;
    border-color: #9333ea;
    color: #7c3aed;
}

.wikipedia-pill:hover {
    background: #e9d5ff;
    border-color: #7c3aed;
}

.wikipedia-pill.expanded {
    background: #e9d5ff;
    border-color: #7c3aed;
}

.fuld-pill {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.fuld-pill:hover {
    background: #bbdefb;
    border-color: #1976d2;
}

.fuld-pill.expanded {
    background: #90caf9;
    border-color: #1565c0;
}

.pill-icon {
    font-size: 0.7rem;
    flex-shrink: 0;
}

.forum-excerpt {
    background: #fef7e0 !important;
    border-color: #fbbc04 !important;
}

.journal-excerpt {
    background: #e8f0fe;
    border-color: #4285f4;
}

.wikipedia-excerpt {
    background: #f3e8ff;
    border-color: #9333ea;
}

.fuld-excerpt {
    background: #e3f2fd;
    border-color: #2196f3;
}

.forum-header {
    color: #b8860b;
    font-weight: 500;
    font-size: 0.8125rem;
}

.forum-details {
    color: #b8860b;
    font-size: 0.75rem;
    display: block;
    margin-top: 2px;
}

.input-container {
    padding: 24px;
    background: #ffffff;
    border-bottom: 1px solid #f1f3f4;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.new-chat-container {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f3f4;
}

.new-chat-container.hidden {
    display: none;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#messageInput {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 400;
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: #ffffff;
    outline: none;
    caret-color: #4285f4;
    caret-shape: block;
    overflow-y: hidden;
    overflow-x: hidden;
}
#messageInput::placeholder {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#messageInput:focus {
    border-color: #4285f4;
    animation: cursorPulse 2s infinite;
}

@keyframes cursorPulse {
    0%, 100% { border-color: #4285f4; }
    50% { border-color: #1a73e8; }
}

#sendButton {
    background: #4285f4;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 80px;
}

#sendButton:hover:not(:disabled) {
    background: #1a73e8;
}

#sendButton:disabled {
    background: #dadce0;
    cursor: not-allowed;
    color: #9aa0a6;
}

.photo-tip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    margin-bottom: 15px;
    background: linear-gradient(135deg, #4285f4 0%, #2b7de9 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    text-align: center;
    white-space: nowrap;
}

.photo-tip.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8eaed;
    border-top: 3px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px auto;
}

.loading-text {
    color: #5f6368;
    font-size: 16px;
    font-weight: 500;
}

.loading-content {
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.photo-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #2b7de9;
}


.attach-button {
    background: #f8f9fa;
    color: #5f6368;
    position: relative;
    border: 1px solid #dadce0;
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.attach-button:hover {
    background: #e8eaed;
    border-color: #5f6368;
}

.attach-button.has-file {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #1a73e8;
}

.image-preview-container {
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e8eaed;
    display: none;
    align-items: center;
    gap: 12px;
}

.image-preview-container.visible {
    display: flex;
}

.image-preview-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dadce0;
}

.image-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.image-preview-size {
    font-size: 12px;
    color: #5f6368;
}

.image-remove-button {
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.image-remove-button:hover {
    background: #e8eaed;
}

.new-chat-button {
    background: transparent;
    color: #5f6368;
    border: 1px solid #dadce0;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-button:hover {
    background: #f8f9fa;
    color: #202124;
    border-color: #c4c7c5;
}

.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    color: #6b7280;
    font-style: italic;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #6b7280;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes jiggle {
    0% { 
        transform: rotate(0deg) scale(1) translateY(0px);
    }
    10% { 
        transform: rotate(-12deg) scale(1.1) translateY(-2px);
    }
    20% { 
        transform: rotate(12deg) scale(1.1) translateY(-2px);
    }
    30% { 
        transform: rotate(-10deg) scale(1.08) translateY(-1px);
    }
    40% { 
        transform: rotate(10deg) scale(1.08) translateY(-1px);
    }
    50% { 
        transform: rotate(-8deg) scale(1.05) translateY(0px);
    }
    60% { 
        transform: rotate(8deg) scale(1.05) translateY(0px);
    }
    70% { 
        transform: rotate(-5deg) scale(1.02) translateY(0px);
    }
    80% { 
        transform: rotate(5deg) scale(1.02) translateY(0px);
    }
    90% { 
        transform: rotate(-2deg) scale(1.01) translateY(0px);
    }
    100% { 
        transform: rotate(0deg) scale(1) translateY(0px);
    }
}

@keyframes bounce-in {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    70% {
        transform: scale(0.9) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.message-avatar img.avatar-jiggle {
    animation: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
               jiggle 0.8s ease-in-out 0.5s !important;
    transform-origin: center center !important;
    display: inline-block !important;
}

.typing-cursor {
    color: #4285f4;
    font-weight: normal;
}

.welcome-message {
    text-align: center;
    color: #5f6368;
    padding: 20px;
    transition: all 0.3s ease;
}

.welcome-message.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.example-questions {
    margin-top: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.example-question {
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 24px;
    padding: 16px 20px;
    margin: 12px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #202124;
}

.example-question:hover {
    background: #e8f0fe;
    border-color: #4285f4;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .container {
        height: 95vh;
        margin: 0;
        border-radius: 16px;
        max-width: 100%;
    }
    
    .top-controls {
        top: 12px;
        right: 16px;
        gap: 8px;
    }
    
    .user-info {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .register-btn {
        font-size: 13px;
    }

    .message-content {
        max-width: 88%;
    }

    .header {
        padding: 24px 20px;
    }

    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .messages {
        padding: 20px 16px;
    }
    
    .input-container {
        padding: 20px 16px;
    }
    
    .input-group {
        gap: 12px;
        align-items: center;
    }
    
    #messageInput {
        font-size: 16px;
        padding: 14px 16px;
    }
    
    #sendButton {
        padding: 14px 20px;
        min-width: 80px;
    }
    
    .source-pill {
        max-width: 200px;
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        border-radius: 12px;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .message-content {
        max-width: 92%;
        padding: 14px 16px;
    }
    
    .source-pills {
        gap: 6px;
    }
    
    .source-pill {
        max-width: 160px;
    }
    
    .scroll-to-top {
        bottom: 160px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
    }
}

.scroll-to-top {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(66, 133, 244, 0.9);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    z-index: 1000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: rgba(26, 115, 232, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.scroll-to-top:active {
    transform: translateY(0);
}

/* Registration Modal Styles */
.registration-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
}

.auth-form {
    margin: 24px 0;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.auth-button {
    width: 100%;
    padding: 14px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.auth-button:hover:not(:disabled) {
    background: #1a73e8;
}

.auth-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.auth-message {
    margin-top: 16px;
}

.auth-message .error {
    color: #e53e3e;
    background: #fed7d7;
    padding: 12px;
    border-radius: 8px;
}

.auth-message .success {
    color: #2f855a;
    background: #c6f6d5;
    padding: 12px;
    border-radius: 8px;
}

.auth-message .info {
    color: #1a73e8;
    background: #e8f0fe;
    padding: 12px;
    border-radius: 8px;
}

.modal-footer {
    margin-top: 24px;
    text-align: center;
}

.close-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
}

/* User Status Indicator */
.user-status {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
    border-radius: 4px;
}

.user-menu-trigger:hover {
    background: #f5f5f5;
}

.user-email {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hamburger icon styles moved to shared CSS */

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
    min-width: 160px;
    z-index: 1000;
}

.user-dropdown.open {
    display: block;
}

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.user-dropdown-item:hover {
    background: #f8f9fa;
}

.user-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.user-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.language-menu-item {
    cursor: pointer;
    position: relative;
}

.language-menu-item .current-language {
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
}

.language-menu-item .chevron {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
    display: inline-block;
    color: #5f6368;
}

.language-menu-item.expanded .chevron {
    transform: rotate(90deg);
}

.user-language-options {
    display: none;
    padding: 0;
    margin: 0;
    list-style: none;
}

.language-menu-item.expanded .user-language-options {
    display: block !important;
}

.language-option-item {
    display: block;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    text-align: left;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    margin: 0;
    white-space: nowrap;
}

.language-option-item:hover {
    background: #f8f9fa;
}

.language-option-item.active {
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 500;
}

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

.register-btn {
    background: none;
    color: #4285f4;
    border: none;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.register-btn:hover {
    color: #1a73e8;
    text-decoration: underline;
}

/* Usage Warning Styles */
.usage-warning {
    background: #fef5e7;
    border-left: 4px solid #f39c12;
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

.warning-content {
    color: #7d6608;
    font-size: 14px;
}

.warning-content a {
    color: #f39c12;
    font-weight: 600;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Journal thumbnail styles */
.journal-excerpt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.journal-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: #1f2937;
}

.journal-subscribe-link {
    font-size: 0.75rem;
    color: #667eea;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.journal-subscribe-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.journal-excerpt-with-thumbnail {
    display: flex;
    gap: 16px;
}

.journal-thumbnail {
    width: 120px;
    height: auto;
    max-height: 170px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.journal-text-content,
.journal-excerpt-text {
    flex: 1;
    min-width: 0;
}

/* Hide thumbnails on mobile for better readability */
@media (max-width: 640px) {
    .journal-thumbnail {
        display: none;
    }
    
    .journal-excerpt-with-thumbnail {
        display: block;
    }
    
    .journal-excerpt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .journal-subscribe-link {
        font-size: 0.7rem;
    }
}

/* Fallback when thumbnail fails to load */
.journal-excerpt-with-thumbnail.no-thumbnail {
    display: block;
}