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

body {
    background-color: #f0f0f0;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.moments-container {
    max-width: 600px;
    min-height: calc(100vh - 80px);
    margin: 0 auto;
    padding-bottom: 120px;
    background: #fff;
}

.admin-topbar {
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 1100;
    display: flex;
    width: 600px;
    max-width: 100%;
    gap: 8px;
    justify-content: flex-end;
    padding: 10px 12px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid #ececec;
    backdrop-filter: blur(10px);
}

.admin-topbar + .moments-container {
    padding-top: 48px;
}

.top-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 6px;
    color: #fff;
    background: #576b95;
    cursor: pointer;
}

.top-btn.ghost {
    color: #576b95;
    background: #eef2f8;
}

.user-profile {
    position: relative;
    z-index: 10;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 0 0 15px 15px;
    background: transparent;
}

.profile-bg {
    position: relative;
    height: 350px;
    background: #f5f5f5;
}

.profile-bg img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.95);
}

.user-avatar-container {
    position: absolute;
    right: 20px;
    bottom: -25px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    justify-content: flex-end;
}

.avatar {
    display: block;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border: 3px solid #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.user-details {
    display: flex;
    align-items: center;
}

.user-details h2 {
    margin-top: -18px;
    color: #fff;
    font-size: 22px;
    font-weight: 600;
}

.profile-info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
    padding: 20px;
    background: #fff;
}

.profile-intro-below-avatar {
    position: relative;
    z-index: 101;
    align-self: flex-end;
    margin-top: 35px;
    color: #666;
    font-size: 14px;
}

.module-intro {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    margin: 12px 12px 2px;
    padding: 12px;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    color: #596579;
    background: #fbfcfe;
}

.module-intro-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 8px;
    color: #576b95;
    background: #eef2f8;
}

.module-intro p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.primary-btn,
.secondary-btn,
.danger-btn {
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.primary-btn {
    color: #fff;
    background: #576b95;
}

.login-corner-button {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 6px;
    color: #fff;
    background: rgba(0, 0, 0, 0.42);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.login-corner-button:hover {
    background: rgba(0, 0, 0, 0.58);
}

.login-lightbox-panel {
    width: min(380px, 100%);
}

.form-error {
    color: #d24545;
    font-size: 14px;
}

.secondary-btn {
    color: #576b95;
    background: #eef2f8;
}

.danger-btn {
    color: #fff;
    background: #d24545;
}

.moment-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    animation: fadeIn 0.3s ease-out;
    transition: background-color 0.2s;
}

.moment-item:hover {
    background-color: #fafafa;
}

.moment-avatar {
    flex-shrink: 0;
}

.moment-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.moment-content {
    flex: 1;
    min-width: 0;
}

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

.moment-header h3 {
    color: #4e5f85;
    font-size: 18px;
    font-weight: 600;
}

.moment-title-link {
    color: #4e5f85;
}

.moment-text {
    margin-bottom: 15px;
    color: #333;
    font-size: 15px;
    line-height: 1.75;
}

.moment-text p,
.moment-text ul,
.moment-text ol {
    margin-bottom: 14px;
}

.moment-text br,
.about-page br {
    display: block;
    margin-bottom: 5px;
    content: "";
}

.moment-text p:last-child,
.moment-text ul:last-child,
.moment-text ol:last-child {
    margin-bottom: 0;
}

.moment-text ul,
.moment-text ol {
    padding-left: 20px;
}

.moment-text a {
    color: #576b95;
}

.markdown-image {
    display: block;
    max-width: calc(100% - 60px);
    height: auto;
    margin: 10px 60px 12px 0;
    border-radius: 4px;
}

.moment-text code,
.about-page code {
    padding: 2px 5px;
    border-radius: 4px;
    color: #35445f;
    background: #eef2f8;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

.moment-text pre,
.about-page pre {
    overflow-x: auto;
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 6px;
    color: #2f3c54;
    background: #f5f7fb;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.55;
}

.moment-text pre code,
.about-page pre code {
    padding: 0;
    background: transparent;
}

.moment-text hr,
.about-page hr {
    height: 1px;
    margin: 14px 0;
    border: 0;
    background: #e6e9ef;
}

.moment-text h1,
.moment-text h2,
.moment-text h3 {
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
    line-height: 1.35;
}

.private-lock,
.private-admin-note,
.draft-admin-note {
    margin: 10px 0 12px;
    border-radius: 8px;
}

.private-lock {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px;
    color: #576b95;
    background: #f3f6fb;
}

.private-lock > i {
    margin-top: 2px;
    font-size: 18px;
}

.private-lock strong {
    display: block;
    color: #405275;
    font-size: 15px;
}

.private-lock p {
    color: #78849a;
    font-size: 13px;
}

.unlock-form {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
}

.unlock-form input {
    flex: 1;
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid #d8deea;
    border-radius: 6px;
}

.unlock-form button {
    padding: 8px 12px;
    border-radius: 6px;
    color: #fff;
    background: #576b95;
    cursor: pointer;
}

.unlock-error {
    grid-column: 1 / -1;
    color: #d24545 !important;
}

.private-admin-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    color: #6b4a19;
    background: #fff2d8;
    font-size: 13px;
}

.draft-admin-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    color: #405275;
    background: #edf3ff;
    font-size: 13px;
}

.moment-images {
    margin-bottom: 15px;
}

.image-grid {
    display: grid;
    gap: 3px;
    overflow: hidden;
    border-radius: 0;
}

.image-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto !important;
    border-radius: 3px;
    object-fit: cover;
    transition: transform 0.2s;
}

.image-grid img:hover {
    cursor: zoom-in;
}

.image-grid.images-1 {
    grid-template-columns: 1fr !important;
    width: 50% !important;
}

.image-grid.images-2 {
    grid-template-columns: repeat(2, 1fr) !important;
    width: 50% !important;
}

.image-grid.images-3,
.image-grid.images-5,
.image-grid.images-6,
.image-grid.images-7,
.image-grid.images-8,
.image-grid.images-9 {
    grid-template-columns: repeat(3, 1fr) !important;
    width: calc(100% - 60px) !important;
    margin-right: 60px !important;
}

.image-grid.images-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    width: 50% !important;
}

.moment-media {
    width: calc(100% - 60px) !important;
    margin-top: 12px;
    margin-right: 60px !important;
    margin-bottom: 12px;
}

.audio-player {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    background-color: #f5f5f5;
}

.audio-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.audio-title {
    color: #333;
    font-size: 15px;
    font-weight: 500;
}

.audio-element {
    width: 100%;
    margin-top: 4px;
}

.video-player {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background-color: #000;
}

.video-element {
    display: block;
    width: 100%;
    height: auto;
}

.moment-location {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #576b95;
    font-size: 13px;
}

.moment-time-below {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    color: #999;
    font-size: 12px;
}

.moment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 0;
    border-radius: 5px;
    background-color: #f7f7f7;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 20px;
    color: #666;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.action-item:hover {
    color: #667eea;
    background-color: #f5f5f5;
}

.action-item.is-selected {
    color: #576b95;
    background-color: #e9edf5;
}

.action-item:disabled {
    cursor: wait;
    opacity: 0.72;
}

.action-item i {
    font-size: 16px;
}

.action-item span,
.action-item b {
    font-size: 13px;
    font-weight: 400;
}

.admin-action {
    color: #576b95;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    z-index: 1000;
    display: flex;
    width: 600px;
    max-width: 100%;
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    border-top: 1px solid #f0f0f0;
    border-radius: 15px 15px 0 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item.active {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
}

.nav-item:hover {
    color: #667eea;
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 20px;
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

.feed-state {
    padding: 16px;
    color: #888;
    text-align: center;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 18px 12px 10px;
}

.pager.is-hidden {
    display: none;
}

.pager a {
    min-width: 34px;
    padding: 6px 10px;
    border: 1px solid #e4e7ee;
    border-radius: 6px;
    color: #576b95;
    text-align: center;
}

.pager a.active {
    color: #fff;
    background: #576b95;
}

.pager a.disabled {
    pointer-events: none;
    color: #bbb;
    background: #f7f7f7;
}

.about-page {
    padding: 22px 18px 36px;
    line-height: 1.75;
}

.about-page h1,
.about-page h2,
.about-page h3 {
    margin: 0 0 12px;
    color: #4e5f85;
    line-height: 1.3;
}

.about-page p,
.about-page ul {
    margin-bottom: 16px;
}

.about-page ul {
    padding-left: 22px;
}

.about-page a {
    color: #576b95;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.55);
}

.lightbox.is-open {
    display: flex;
}

.lightbox-panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(86vh, 780px);
    overflow: auto;
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.lightbox-panel h2 {
    margin-bottom: 16px;
    color: #4e5f85;
    font-size: 20px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    color: #888;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.admin-form {
    display: grid;
    gap: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.admin-form .check-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 39px;
    white-space: nowrap;
}

.admin-form .check-label input {
    width: auto;
}

.input-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.compact-btn {
    white-space: nowrap;
}

.attachment-results {
    display: grid;
    gap: 9px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #edf0f5;
}

.attachment-results h3 {
    color: #4e5f85;
    font-size: 16px;
}

.attachment-results p {
    color: #778196;
    font-size: 13px;
}

.attachment-result-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.admin-form label {
    display: grid;
    gap: 5px;
    color: #555;
    font-size: 14px;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #dfe3ea;
    border-radius: 6px;
    outline: none;
}

.admin-form textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-panel p {
    margin-bottom: 14px;
    color: #666;
}

.confirm-panel form {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.share-panel {
    width: min(380px, 100%);
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

.share-card {
    display: grid;
    gap: 16px;
    justify-items: center;
}

.share-card-header {
    display: flex;
    width: 100%;
    gap: 12px;
    align-items: center;
}

.share-card-header i {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: #576b95;
    font-size: 20px;
}

.share-card-header h2 {
    margin-bottom: 2px;
}

.share-card-header p {
    color: #778196;
    font-size: 13px;
}

.qr-frame {
    padding: 14px;
    border: 1px solid #e3e8f2;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(87, 107, 149, 0.16);
}

.qr-frame img {
    display: block;
    width: 240px;
    height: 240px;
}

#shareUrlLink {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #576b95;
    font-size: 12px;
    text-align: center;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 2300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
}

.image-modal-content {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.image-modal img {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 90px);
    border-radius: 10px;
}

.image-modal-close,
.image-modal-nav {
    position: absolute;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.image-modal-close {
    top: -42px;
    right: 0;
    font-size: 30px;
}

.image-modal-nav {
    top: 50%;
    padding: 15px 10px;
    transform: translateY(-50%);
    font-size: 24px;
}

.image-modal-nav.prev {
    left: 0;
}

.image-modal-nav.next {
    right: 0;
}

.image-modal-caption {
    position: absolute;
    bottom: -30px;
    width: 100%;
    color: #fff;
    text-align: center;
}

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

@media (hover: none) and (pointer: coarse) {
    .action-item:active,
    .nav-item:active {
        transform: scale(0.95);
    }
}

@media (max-width: 768px) {
    .moments-container,
    .bottom-nav,
    .admin-topbar {
        max-width: 100%;
        width: 100%;
    }

    .bottom-nav {
        border-radius: 0;
    }

    .profile-bg {
        height: 300px;
    }

    .user-avatar-container {
        bottom: -20px;
    }

    .avatar {
        width: 60px;
        height: 60px;
        border: 2px solid #fff;
    }

    .user-details h2 {
        font-size: 18px;
    }

    .profile-intro-below-avatar {
        font-size: 16px;
    }

    .moment-item {
        padding: 10px 12px;
    }

    .moment-avatar img {
        width: 45px;
        height: 45px;
    }

    .moment-header h3 {
        font-size: 18px;
    }

    .moment-text {
        font-size: 16px;
    }

    .moment-media {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .markdown-image {
        max-width: 100%;
        margin-right: 0;
    }

    .audio-player {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .admin-topbar {
        justify-content: space-between;
    }

    .top-btn span {
        font-size: 13px;
    }

    .profile-bg {
        height: 300px;
    }

    .moment-actions {
        gap: 4px;
    }

    .action-item {
        padding: 6px 8px;
    }

    .action-item span,
    .action-item b {
        font-size: 12px;
    }

    .nav-item {
        padding: 6px 16px;
    }
}

@media (max-width: 360px) {
    .profile-bg {
        height: 260px;
    }

    .avatar {
        width: 50px;
        height: 50px;
    }

    .moment-avatar img {
        width: 40px;
        height: 40px;
    }
}
