:root {
    --primary-color: #FFB347;
    /* Pastel Orange */
    --secondary-color: #FFD1DC;
    /* Pastel Pink */
    --accent-color: #77DD77;
    /* Pastel Green */
    --text-color: #5D4037;
    /* Warm Brown */
    --bg-color: #FFF9E6;
    /* Creamy White */
    --card-bg: #FFFFFF;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: url('background.png');
    /* Will be generated */
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 249, 230, 0.85);
    /* Semi-transparent overlay to make text readable */
    z-index: -1;
}

header {
    margin-top: 40px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 1200px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

h1 {
    font-size: 3em;
    color: var(--text-color);
    text-shadow: 2px 2px 0px var(--primary-color);
    margin: 0;
}

/* Auth Container */
#auth-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Features Menu */
.features-menu {
    position: relative;
}

.features-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: white;
    color: #3c4043;
    border: 2px solid var(--accent-color);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    font-family: 'Noto Sans TC', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.features-btn:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.features-btn svg {
    flex-shrink: 0;
}

/* Login Button */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: white;
    color: #3c4043;
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    font-family: 'Noto Sans TC', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-btn svg {
    flex-shrink: 0;
}

/* User Profile */
.user-profile {
    position: relative;
}

.user-profile.hidden {
    display: none;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--primary-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.dropdown-menu.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.dropdown-header img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--secondary-color);
}

.dropdown-user-info {
    flex: 1;
    overflow: hidden;
}

.dropdown-name {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-email {
    color: #666;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--secondary-color);
    margin: 0 10px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1em;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background-color: rgba(255, 179, 71, 0.1);
}

.dropdown-item svg {
    flex-shrink: 0;
}

.hidden {
    display: none;
}


#story-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 20px;
    max-width: 1200px;
    width: 100%;
}

.story-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 25px;
    width: 300px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid var(--primary-color);
    display: flex;
    flex-direction: column;
}

.story-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.story-card h2 {
    margin-top: 0;
    color: var(--text-color);
    border-bottom: 2px dashed var(--secondary-color);
    padding-bottom: 10px;
}

.story-card p {
    line-height: 1.6;
    flex-grow: 1;
}

.read-more {
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: bold;
    text-align: right;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 40px;
    border: 3px solid var(--primary-color);
    border-radius: 25px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 25px;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
}

#modal-title {
    color: var(--text-color);
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 15px;
    margin-top: 0;
}

#modal-body {
    line-height: 1.6;
    /* white-space: pre-wrap; Removed because we are using Markdown now */
}

#modal-body p {
    margin-bottom: 1em;
    margin-top: 0;
}

#modal-body ul {
    margin-bottom: 1em;
    padding-left: 20px;
}

#modal-body li {
    margin-bottom: 0.5em;
}

#modal-body h1,
#modal-body h2,
#modal-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text-color);
}

#modal-body strong {
    color: var(--primary-color);
}