/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    min-height: 100vh;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #409eff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}
.btn:hover {
    background: #337ecc;
}
.btn-secondary {
    background: #6c757d;
}
.btn-secondary:hover {
    background: #5a6268;
}

/* 导航栏样式（核心：PC/手机端统一双行布局） */
.navbar {
    background: #409eff;
    color: #fff;
    padding: 8px 15px;
    position: sticky;
    top: 0;
    z-index: 999;
}
.nav-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 1200px;
    margin: 0 auto;
}
/* 第一行：功能按钮（靠右）- 统一布局 */
.nav-top {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
/* 第二行：导航链接（靠左）+ 标题 - 统一布局 */
.nav-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-title {
    font-size: 18px;
    font-weight: 600;
}
.nav-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
}
.nav-menu a.active {
    background: rgba(255,255,255,0.2);
}

/* 专属链接/分享按钮样式 */
.link-group {
    display: flex;
    gap: 8px;
    align-items: center;
}
.link-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.link-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* 登录按钮样式 */
.login-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* 提示弹窗样式 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 9999;
    display: none;
}
.toast.active {
    display: block;
    animation: fadeInOut 2s ease;
}
@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* 4:3画布容器样式（绘画页面专属） */
.canvas-wrapper {
    flex: 1;
    background: #f5f5f5; /* 画布容器背景（区分透明区域） */
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    width: 100%;
    /* 强制4:3比例：高度 = 宽度 * 3/4 = 75% */
    aspect-ratio: 4 / 3;
    /* 兼容旧浏览器降级方案 */
    height: 0;
    padding-bottom: 75%;
}
#paintingCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none; /* 禁止触屏默认行为 */
    cursor: crosshair;
}

/* 标签切换样式 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.tab {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.tab.active {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}
.tab-content {
    display: none;
}

/* 鱼塘列表样式 */
.fish-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.fish-item {
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}
.fish-item:hover {
    transform: translateY(-2px);
}
.fish-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}
.fish-info {
    padding: 10px;
}
.fish-name {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 16px;
}
.fish-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
.fish-actions {
    display: flex;
    gap: 10px;
}
.action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.like-btn {
    color: #666;
    border: 1px solid #ddd;
}
.like-btn.liked {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}
.dislike-btn {
    color: #666;
    border: 1px solid #ddd;
}
.dislike-btn.disliked {
    background: #f56c6c;
    color: #fff;
    border-color: #f56c6c;
}

/* 排行榜样式 */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
.rank-number {
    font-size: 20px;
    font-weight: 600;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eee;
}
.rank-number.first {
    background: #ffd700;
    color: #fff;
}
.rank-number.second {
    background: #c0c0c0;
    color: #fff;
}
.rank-number.third {
    background: #cd7f32;
    color: #fff;
}
.rank-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}
.rank-info {
    flex: 1;
}
.rank-name {
    font-weight: 600;
    margin-bottom: 5px;
}
.rank-author {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}
.rank-score {
    font-size: 13px;
    color: #409eff;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}
.page-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.page-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}
.page-num.active {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title {
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录弹窗样式 */
.login-modal {
    max-width: 400px;
}
.login-form {
    padding: 15px;
}
.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
.login-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* 详情页样式 */
.detail-img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    margin: 10px 0;
    border-radius: 8px;
}
.detail-meta {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    font-size: 13px;
    color: #666;
}
.detail-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}
.detail-comments {
    margin-top: 20px;
}
.comment-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    min-height: 80px;
    resize: vertical;
}
.comment-list {
    margin-top: 15px;
}
.comment-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
}
.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
}
.comment-author {
    font-weight: 600;
}
.comment-time {
    color: #666;
}
.comment-content {
    font-size: 14px;
    line-height: 1.5;
}

/* 空状态样式 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    text-align: center;
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

/* 加载中样式 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}
.loading i {
    font-size: 24px;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 绘画页面样式 */
.painting-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: calc(100vh - 120px); /* 适配双行导航栏高度 */
    overflow: hidden;
    padding-bottom: 20px;
}
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    align-items: center;
}
.tool-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 120px;
}
.tool-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tool-btn.active {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}
.color-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 150px;
}
.color-picker {
    width: 36px;
    height: 36px;
    border: none;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

/* 响应式样式（仅调整尺寸，不改变布局结构） */
@media (max-width: 767px) {
    /* 手机端隐藏RGB数字输入框 */
    .rgb-input {
        display: none;
    }
    /* 手机端导航栏微调 */
    .nav-menu {
        gap: 10px;
    }
    .nav-menu a {
        font-size: 13px;
        padding: 2px 6px;
    }
    .link-btn, .login-btn {
        font-size: 11px;
        padding: 3px 6px;
    }
    /* 绘画工具栏适配 */
    .toolbar {
        gap: 5px;
        padding: 8px;
    }
    .tool-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    /* 鱼塘列表手机端单列 */
    .fish-list {
        grid-template-columns: 1fr;
    }
}

/* PC端样式（仅调整尺寸，保持双行布局） */
@media (min-width: 768px) {
    /* PC端导航栏仅调整间距，保持双行布局 */
    .nav-inner {
        gap: 10px;
        padding: 0 10px;
    }
    .nav-top {
        gap: 15px;
    }
    .nav-bottom {
        gap: 20px;
    }
    .nav-title {
        font-size: 20px;
    }
    .nav-menu {
        gap: 20px;
    }
    .nav-menu a {
        font-size: 15px;
        padding: 6px 10px;
    }
    /* PC端显示RGB数字输入框 */
    .rgb-input {
        width: 50px;
        padding: 4px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 12px;
    }
    /* PC端绘画工具栏调整 */
    .toolbar {
        gap: 15px;
    }
    .tool-btn {
        font-size: 14px;
        padding: 8px 12px;
    }
}
