/* 自定义CSS样式 - 晨曦世界MC服务器主页 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
/* 自定义字体类 */
.font-inter {
    font-family: 'Inter', sans-serif;
}

.font-poppins {
    font-family: 'Poppins', sans-serif;
}

/* QQ品牌颜色 */
.from-qq-blue {
    --tw-gradient-from: var(--color-brand-qq-blue);
    --tw-gradient-to: rgba(var(--color-brand-qq-blue-rgb), 0);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.to-qq-green {
    --tw-gradient-to: var(--color-brand-qq-green);
}

/* 加载动画 */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

.loading-pulse {
    position: relative;
    min-height: 1em;
}
.loading-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse-dot 1.5s infinite;
}

/* 隐藏滚动条但保留滚动功能 */
.scrollbar-hide {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 自定义滚动条样式 */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    display: block !important;
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 自定义动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(var(--color-primary-rgb), 0);
    }
}

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

/* 自定义类 */
.float-animation {
    animation: float 3s ease-in-out infinite;
}

.slide-in {
    animation: slideIn 0.6s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.pulse-glow {
    animation: pulse-glow 2s infinite;
}

.rotate-slow {
    animation: rotate 20s linear infinite;
}

/* 渐变背景效果 */
.gradient-shimmer {
    background: linear-gradient(
        90deg,
        rgba(var(--color-neutral-white-rgb), 0) 0%,
        rgba(var(--color-neutral-white-rgb), 0.8) 50%,
        rgba(var(--color-neutral-white-rgb), 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* 玻璃拟态效果 */
.glass-effect {
    background: rgba(var(--color-neutral-white-rgb), 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--color-neutral-white-rgb), 0.2);
}

.dark-glass-effect {
    background: rgba(var(--color-neutral-black-rgb), 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--color-neutral-white-rgb), 0.1);
}

/* 自定义按钮样式 */
.btn-hover-effect {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-hover-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.6s;
}

.btn-hover-effect:hover::after {
    left: 100%;
}

/* 卡片悬停效果 */
.card-hover-effect {
    transition: all 0.3s ease;
}

.card-hover-effect:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(var(--color-neutral-black-rgb), 0.1);
}

/* Minecraft风格边框 */
.minecraft-border {
    position: relative;
}

.minecraft-border::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px dashed var(--color-minecraft-border);
    pointer-events: none;
}

/* Minecraft Crafting Table UI */
.mc-crafting-table {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
}

.mc-slot {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top-color: rgba(255, 255, 255, 0.1);
    border-left-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.5);
}

.mc-slot.result {
    width: 64px;
    height: 64px;
}

.mc-item-icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    object-fit: contain;
}

.mc-slot.result .mc-item-icon {
    width: 42px;
    height: 42px;
}

.mc-item-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.02);
}

.mc-arrow {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-crafting-table.cooking {
    gap: 15px;
}

.mc-crafting-table.cooking .mc-arrow {
    font-size: 1.5rem;
}

@media (max-width: 640px) {
    .mc-crafting-table {
        padding: 15px;
        gap: 10px;
    }
    .mc-slot {
        width: 36px;
        height: 36px;
    }
    .mc-slot.result {
        width: 48px;
        height: 48px;
    }
    .mc-item-icon {
        width: 24px;
        height: 24px;
    }
}
/* 响应式调整 */
@media (max-width: 768px) {
    body {
        background: linear-gradient(135deg, var(--color-bg-from) 0%, var(--color-bg-to) 100%);
    }
    
    #app {
        max-width: 100%;
        padding: 0;
    }
    
    header {
        padding: 0.5rem 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    nav {
        padding: 0.5rem;
    }
}

@media (max-width: 640px) {
    .community-modal {
        width: 100%;
        max-height: 100vh;
    }
    
    /* 修复移动端弹窗显示 */
    #upload-modal:not(.hidden) {
        padding: 0;
        display: block; /* 移动端取消 flex 居中，直接铺满 */
        overflow-y: auto;
        overflow-x: hidden;
    }

    #upload-modal .relative.max-w-6xl {
        width: 100%;
        min-height: 100vh;
        height: auto;
        max-height: none;
        border-radius: 0;
        border: none;
    }
    
    #upload-modal .flex-1.overflow-hidden {
        overflow-y: auto !important;
    }

    #upload-modal #upload-form {
        height: auto !important;
    }

    #upload-modal #upload-form > div {
        height: auto !important;
        overflow: visible !important;
    }

    #upload-modal .lg\:flex-row {
        gap: 2rem;
    }

    #upload-modal h3 {
        font-size: 1.125rem;
    }
}

/* 模态框全屏与响应式优化 */
#upload-modal .relative.max-w-6xl {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    #upload-modal .max-w-6xl {
        width: 95vw;
        height: 90vh;
        max-height: 90vh;
    }

    /* 电脑端左右对等布局优化 */
    #upload-modal #upload-form {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        height: 100%;
    }

    #upload-modal #upload-form > div {
        height: 100%;
        overflow-y: auto;
        padding-right: 0.5rem;
    }
    
    /* 自定义左右分栏的滚动条 */
    #upload-modal #upload-form > div::-webkit-scrollbar {
        width: 4px;
    }
    
    #upload-modal #upload-form > div::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
    }
    
    #upload-modal #upload-form > div::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* 隐藏预览区域在移动端的默认边距，如果需要的话 */
@media (max-width: 1023px) {
    #upload-modal .lg\:border-l {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-left: 0;
        padding-top: 1.5rem;
    }
}

/* 桌面端文字与排版系统 */
@media (min-width: 1024px) {
    body {
        font-size: 1rem;
    }

    h1 {
        font-size: 2rem;
        line-height: 2.5rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    h2 {
        font-size: 1.5rem;
        line-height: 2rem;
        font-weight: 600;
    }

    h3 {
        font-size: 1.125rem;
        line-height: 1.75rem;
        font-weight: 600;
    }

    p,
    .text-sm {
        font-size: 0.9375rem;
        line-height: 1.6;
    }

    .text-xs {
        font-size: 0.8125rem;
        line-height: 1.4;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    #app {
        max-width: 500px;
        margin: 0 auto;
    }
}

/* 桌面适配 */
@media (min-width: 1025px) {
    body {
        background: linear-gradient(135deg, var(--color-bg-from) 0%, var(--color-bg-via) 50%, var(--color-bg-to) 100%);
    }
    
    #app {
        max-width: 420px;
        margin: 0 auto;
        box-shadow: 0 20px 60px rgba(var(--color-neutral-black-rgb), 0.3);
        min-height: 100vh;
        overflow: hidden;
    }
}

/* 大屏幕适配 */
@media (min-width: 1440px) {
    #app {
        max-width: 380px;
    }
}

/* 加载动画 */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-primary);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

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

.image-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1.5rem;
}

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

.image-lightbox-inner {
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

.image-lightbox-inner img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.image-lightbox-close {
    position: absolute;
    top: -1.5rem;
    right: -1.5rem;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
}

/* 玩家头像样式 */
.player-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-avatar-from) 0%, var(--color-avatar-to) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(var(--color-neutral-black-rgb), 0.1);
}

.player-avatar.online::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: var(--color-primary);
    border-radius: 50%;
    border: 2px solid var(--color-neutral-white);
}

/* 分隔线样式 */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-neutral-e5), transparent);
    margin: 1rem 0;
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background-color: var(--color-neutral-1f);
    color: var(--color-neutral-white);
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 100;
}

.tooltip:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--color-neutral-1f);
}

/* 输入框焦点效果 */
.focus-ring {
    transition: box-shadow 0.2s ease-in-out;
}

.focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
    outline: none;
}

/* 统计数字动画 */
.counter {
    font-variant-numeric: tabular-nums;
}

/* 响应式文本大小 */
.text-responsive {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

/* 图片懒加载样式 */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* 骨架屏加载 */
.skeleton {
    background: linear-gradient(90deg, var(--color-neutral-f0) 25%, var(--color-neutral-e0) 50%, var(--color-neutral-f0) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* 移动端触摸反馈 */
.touch-feedback {
    transition: transform 0.1s ease;
}

.touch-feedback:active {
    transform: scale(0.95);
}

/* 打印样式 */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    #phone-simulator {
        border: none !important;
        box-shadow: none !important;
    }
}

.markdown-body {
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.7;
    word-wrap: break-word;
}

.markdown-body h1 {
    font-size: 1.75rem;
    line-height: 2.25rem;
    font-weight: 700;
    margin: 1rem 0 0.75rem;
}

.markdown-body h2 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    margin: 1rem 0 0.6rem;
}

.markdown-body h3 {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    margin: 0.9rem 0 0.5rem;
}

.markdown-body h4 {
    font-size: 1.125rem;
    line-height: 1.6rem;
    font-weight: 600;
    margin: 0.85rem 0 0.45rem;
}

.markdown-body h5,
.markdown-body h6 {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    margin: 0.8rem 0 0.4rem;
}

.markdown-body p {
    margin: 0.75rem 0;
}

.markdown-body ul,
.markdown-body ol {
    margin: 0.75rem 0 0.75rem 1.5rem;
}

.markdown-body ul {
    list-style: disc;
}

.markdown-body ol {
    list-style: decimal;
}

.markdown-body li {
    margin: 0.25rem 0;
}

.markdown-body blockquote {
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.5rem;
}

.markdown-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 0.35rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.75rem;
    border-radius: 0.75rem;
    overflow: auto;
    margin: 0.8rem 0;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    font-size: 0.9em;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.9rem 0;
    font-size: 0.95em;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 0.45rem 0.6rem;
    text-align: left;
}

.markdown-body thead th {
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 1rem 0;
}

.markdown-body a {
    color: #7dd3fc;
    text-decoration: underline;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 0.75rem;
}

.markdown-body .katex {
    color: inherit;
}
