/**
 * shared/profile_styles.css
 * 统一个人主页 + 登录弹窗共享样式
 */

/* 这里曾 @import 一个 jsdelivr 上的霞鹜文楷（只给徽章弹层那几行字用）。已删除：
   jsdelivr 在国内不可靠，而 CSS 的 @import 阻塞渲染，本文件又被全部学生端页面引用 ——
   等于为一个二级弹层的装饰字体，赌上全站首屏。徽章弹层改走系统楷体栈（见 profile_panel.js），
   有系统楷体的设备照样是楷体，没有的回退 Noto Serif SC。 */

/* 右侧滑入动画 */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out both;
}

/* 淡入动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fade-in {
    animation: fadeIn 0.3s ease-out both;
}

/* 上浮淡入动画 */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up {
    animation: fadeInUp 0.35s ease-out both;
}

/* 书卷纸纹背景 */
.shared-paper-bg {
    background-color: #faf8f3;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d6d3c9' fill-opacity='0.15' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* 隐藏滚动条 */
.shared-no-scrollbar::-webkit-scrollbar {
    display: none;
}
.shared-no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 高级图鉴卡片 UI (Premium Atlas UI) */
.atlas-category-header {
    background: linear-gradient(90deg, #f0ede6 0%, transparent 100%);
    border-left: 4px solid #b4a078;
    color: #5c4f41;
}

.atlas-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: #8b7355;
    margin-bottom: 0.75rem;
}

.atlas-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #e7dfd0 0%, transparent 100%);
    margin-left: 1rem;
}

.atlas-item-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(249,246,240,0.6));
    border: 1px solid #e7dfd0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(139,115,85,0.05);
}

.atlas-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(139,115,85,0.1);
    border-color: #d4c5a9;
    background: #fff;
}

.atlas-empty-star {
    color: #e5e0d8;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.atlas-filled-star {
    color: #fbbf24;
    filter: drop-shadow(0 0 2px rgba(251,191,36,0.4));
}

/* 徽章饼状解锁：底层灰度，上层彩色按 --pct 顺时针揭示（与名著书架 mingzhu/shelf.html 一致） */
.badge-pie {
    position: relative;
    flex-shrink: 0;
}
.badge-pie .layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.badge-pie .base {
    filter: grayscale(1) contrast(0.9);
    opacity: 0.35;
}
.badge-pie .fill {
    -webkit-mask-image: conic-gradient(#000 var(--pct, 0%), transparent 0);
            mask-image: conic-gradient(#000 var(--pct, 0%), transparent 0);
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
}
.badge-pie.full .fill {
    -webkit-mask-image: none;
            mask-image: none;
}
/* 老旧内核（部分微信 WebView）不支持 conic-gradient 遮罩：退化为自下而上的线性揭示 */
@supports not (mask-image: conic-gradient(#000 50%, transparent 0)) {
    .badge-pie .fill {
        -webkit-mask-image: linear-gradient(to top, #000 var(--pct, 0%), transparent 0);
                mask-image: linear-gradient(to top, #000 var(--pct, 0%), transparent 0);
    }
}

/* 至尊金框：全书满三星时叠在徽章外圈的金环（透明底图），不参与饼状遮罩/灰度 */
.badge-pie .layer.frame {
    /* img 为替换元素：绝对定位下 width:auto 取图片固有尺寸，必须显式给百分比 */
    inset: -18%;
    width: 136%;
    height: 136%;
    max-width: none;
    z-index: 2;
    pointer-events: none;
    -webkit-mask-image: none;
            mask-image: none;
    filter: drop-shadow(0 0 3px rgba(250, 204, 21, 0.45));
}
/* 非饼状场景（勋章墙格子/放大层）的金框：配合徽章图 scale(0.82) 缩身，金环压在徽章边缘 */
.badge-frame {
    position: absolute;
    inset: -2%;
    width: 104%;
    height: 104%;
    max-width: none;
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
    filter: drop-shadow(0 0 3px rgba(250, 204, 21, 0.45));
}

/* ============================================================
   板块导航（shared/module_nav.js）
   顶栏左侧的品牌下拉：一个按钮同时承载「回门户」与「切板块」。
   刻意不用 Tailwind —— portal/mingzhu/wenyan 的 CSS 是构建期扫描产物，
   扫不到的类会静默丢失；纯手写就不必跟着重跑 build_tailwind.sh。
   ============================================================ */

.sy-modnav {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

/* heading 模式外层是 h1，得抹掉默认 margin 和字号继承 */
.sy-modnav__hd {
    margin: 0;
    display: flex;
    align-items: center;
    font: inherit;
}

.sy-modnav__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    /* 未读红点 .sy-nav-dot 以此为定位基准，缺了会飘到页面左上角 */
    position: relative;
    /* 负 margin 让按钮的视觉左缘与原标题文字左缘对齐，不因内边距整体右移 */
    margin-left: -0.5rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sy-modnav__btn:hover,
.sy-modnav__btn.is-open {
    background: rgba(0, 0, 0, 0.045);
    border-color: rgba(0, 0, 0, 0.06);
}

/* <img> 是替换元素，宽高都得显式写死，否则在 flex 顶栏里会被拉扁/撑变形。
   源图 183×119，比例 1.538 → 24px 高对应 37px 宽。 */
.sy-modnav__logo {
    display: block;
    flex: none;
    height: 1.5rem;
    width: 2.31rem;
    object-fit: contain;
}

.sy-modnav__label {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.2;
    color: #1c1917;
    white-space: nowrap;
}

.sy-modnav__caret {
    font-size: 0.7rem;
    color: #a8a29e;
    transition: transform 0.2s ease;
    flex: none;
}

.sy-modnav__btn.is-open .sy-modnav__caret {
    transform: rotate(180deg);
}

/* sm：文言那条顶栏功能键密集，标题得收窄 */
.sy-modnav--sm .sy-modnav__logo {
    height: 1.25rem;
    width: 1.92rem;
}

.sy-modnav--sm .sy-modnav__label {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    color: #44403c;
}

/* 窄屏：大标题（名著/作文的页面主标题）缩字号保留，不能直接藏——藏了顶栏就没标题了；
   sm（文言）本就只是功能栏里的一个入口，窄屏藏掉文字只留 logo + ▾，给其余控件让位 */
@media (max-width: 640px) {
    .sy-modnav__logo {
        height: 1.3rem;
        width: 2rem;
    }

    .sy-modnav__label {
        font-size: 1.15rem;
        letter-spacing: 0.06em;
    }

    .sy-modnav__btn {
        gap: 0.4rem;
        padding: 0.25rem 0.45rem;
    }

    .sy-modnav--sm .sy-modnav__label {
        display: none;
    }
}

/* ---------- 下拉面板 ---------- */

.sy-modnav__mask {
    position: fixed;
    inset: 0;
    z-index: 79;
    cursor: default;
}

/* fixed 定位（坐标由 JS 按按钮 rect 算）：宿主容器可能有 overflow:hidden
   （文言 header 左侧那个 flex 容器就是），absolute 菜单会被裁掉半截。 */
.sy-modnav__menu {
    position: fixed;
    z-index: 80;
    width: 14rem;
    padding: 0.5rem;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(28, 25, 23, 0.14);
    animation: fadeInUp 0.18s ease-out both;
}

.sy-modnav__brand {
    padding: 0.25rem 0.6rem 0.5rem;
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: #a8a29e;
    white-space: nowrap;
}

.sy-modnav__sep {
    height: 1px;
    margin: 0.4rem 0.3rem;
    background: #f5f5f4;
}

.sy-modnav__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: #44403c;
    transition: background-color 0.15s ease;
}

a.sy-modnav__item:hover {
    background: #faf8f3;
    color: #1c1917;
}

.sy-modnav__emoji {
    font-size: 1.05rem;
    line-height: 1;
    flex: none;
}

.sy-modnav__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.sy-modnav__name {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.sy-modnav__desc {
    margin-top: 0.1rem;
    font-size: 0.65rem;
    color: #a8a29e;
    white-space: nowrap;
}

.sy-modnav__tag {
    flex: none;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    background: #f5f5f4;
    color: #a8a29e;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sy-modnav__tag--current {
    background: #fef3c7;
    color: #b45309;
}

.sy-modnav__item--current {
    background: #faf8f3;
    color: #1c1917;
}

.sy-modnav__item--soon {
    opacity: 0.45;
    cursor: default;
}

/* ============================================================
   反馈弹窗 (shared/feedback_widget.js) —— .sy-fb-*
   与 module_nav 同样刻意不用 Tailwind：各板块的 Tailwind 是构建期扫描产物，
   共享组件里写的类扫不到，会静默丢样式。
   ============================================================ */

.sy-fb-mask {
    position: fixed;
    inset: 0;
    z-index: 95;               /* 高于个人面板遮罩(90)，低于徽章放大层(100) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(28, 25, 23, 0.55);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out both;
}

.sy-fb-panel {
    position: relative;
    width: 100%;
    max-width: 26rem;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1rem;
    background: #fffdf9;
    border: 1px solid #e7e5e4;
    box-shadow: 0 20px 45px rgba(28, 25, 23, 0.25);
    animation: fadeInUp 0.25s ease-out both;
}

.sy-fb-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0ede6;
    background: #f9f6f0;
}

.sy-fb-title {
    font-size: 1rem;
    font-weight: 700;
    color: #292524;
    letter-spacing: 0.02em;
}

.sy-fb-close {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: #a8a29e;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.sy-fb-close:hover { background: rgba(0, 0, 0, 0.05); color: #57534e; }

.sy-fb-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.sy-fb-hint {
    margin: 0 0 0.875rem;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #a8a29e;
}

.sy-fb-target {
    margin-bottom: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: #f5f5f4;
    font-size: 0.75rem;
    color: #57534e;
    word-break: break-all;
}

.sy-fb-target-label {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    background: #e7e5e4;
    color: #78716c;
    font-size: 0.625rem;
    font-weight: 700;
}

.sy-fb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.sy-fb-chip {
    padding: 0.35rem 0.75rem;
    border: 1px solid #e7e5e4;
    border-radius: 9999px;
    background: #fff;
    color: #78716c;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sy-fb-chip:hover { border-color: #d6d3d1; color: #44403c; }
.sy-fb-chip--on {
    background: #292524;
    border-color: #292524;
    color: #fff;
}

.sy-fb-textarea,
.sy-fb-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    border: 1px solid #e7e5e4;
    border-radius: 0.625rem;
    background: #fff;
    color: #44403c;
    font-size: 0.9375rem;   /* ≥16px 的一半以上，配合下方 iOS 规则防聚焦缩放 */
    font-family: inherit;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sy-fb-textarea:focus,
.sy-fb-input:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.sy-fb-count {
    margin: 0.35rem 0 0.75rem;
    text-align: right;
    font-size: 0.6875rem;
    color: #d6d3d1;
}

.sy-fb-input { margin-bottom: 0.875rem; }

.sy-fb-error {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    color: #dc2626;
}

.sy-fb-submit {
    width: 100%;
    padding: 0.75rem;
    border: 0;
    border-radius: 0.625rem;
    background: #292524;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}
.sy-fb-submit:hover:not(:disabled) { background: #44403c; }
.sy-fb-submit:disabled { opacity: 0.45; cursor: not-allowed; }

.sy-fb-toast {
    position: fixed;
    left: 50%;
    bottom: 4.5rem;
    z-index: 120;
    transform: translateX(-50%);
    max-width: 85vw;
    padding: 0.625rem 1.125rem;
    border-radius: 9999px;
    background: rgba(28, 25, 23, 0.9);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.25s ease-out both;
}

/* iOS Safari 在字号 <16px 的输入框聚焦时会自动放大整页，且不会缩回来。
   桌面端保持 15px 观感，触屏设备统一提到 16px 换取不缩放。 */
@media (hover: none) and (pointer: coarse) {
    .sy-fb-textarea,
    .sy-fb-input { font-size: 16px; }
}

/* 顶栏未读红点（module_nav 的品牌按钮上） */
.sy-nav-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #dc2626;
    box-shadow: 0 0 0 2px #fffdf9;
}
