/* =========================
   NyaCraft - Night Cat Theme
========================= */

:root {

    --bg-main:
        #11131a;

    --bg-sub:
        #1a1d29;

    --card:
        rgba(25, 27, 40, 0.72);

    --card-hover:
        rgba(35, 38, 56, 0.88);

    --border:
        rgba(255,255,255,0.06);

    --text:
        #e8e8ee;

    --text-sub:
        #9ea4b5;

    --pink:
        #d89ac7;

    --purple:
        #8b7fd1;

    --blue:
        #7aa2d6;
}

/* =========================
   全局
========================= */

* {

    box-sizing: border-box;
}

html,
body {

    margin: 0;

    min-height: 100vh;

    overflow-x: hidden;

    font-family:
        "MiSans",
        "Microsoft YaHei",
        sans-serif;

    color: var(--text);

    background:
        linear-gradient(
            135deg,
            #11131a 0%,
            #1a1d29 50%,
            #161922 100%
        );
}

/* 背景噪点 */

body::before {

    content: "";

    position: fixed;

    inset: 0;

    pointer-events: none;

    opacity: 0.035;

    background-image:
        radial-gradient(
            rgba(255,255,255,0.08) 1px,
            transparent 1px
        );

    background-size:
        4px 4px;

    z-index: 0;
}

/* =========================
   欢迎页
========================= */

#welcome {

    position: fixed;

    top: 50%;

    left: 50%;

    transform:
        translate(-50%, -50%);

    width: 420px;

    max-width: 90%;

    padding: 50px 40px;

    border-radius: 28px;

    background:
        rgba(25,27,40,0.78);

    backdrop-filter:
        blur(18px);

    border:
        1px solid rgba(255,255,255,0.06);

    box-shadow:
        0 0 40px rgba(139,127,209,0.12);

    text-align: center;

    cursor: pointer;

    transition: 0.45s;

    z-index: 10;
}

#welcome:hover {

    transform:
        translate(-50%, -50%)
        scale(1.02);

    box-shadow:
        0 0 60px rgba(216,154,199,0.16);
}

#welcome h1 {

    margin: 0;

    font-size: 54px;

    font-weight: 700;

    letter-spacing: 2px;
}

#welcome p {

    margin-top: 18px;

    color: var(--text-sub);

    font-size: 15px;
}

.enter {

    margin-top: 30px;

    padding: 12px 20px;

    border-radius: 14px;

    background:
        rgba(255,255,255,0.04);

    border:
        1px solid rgba(255,255,255,0.05);

    font-size: 13px;

    letter-spacing: 3px;

    color: var(--pink);

    animation:
        glow 2s infinite;
}

@keyframes glow {

    0% {

        opacity: 0.5;
    }

    50% {

        opacity: 1;
    }

    100% {

        opacity: 0.5;
    }
}

/* 消失动画 */

.hide {

    opacity: 0;

    transform:
        translate(-50%, -50%)
        scale(1.08);

    filter:
        blur(12px);

    pointer-events: none;

    visibility: hidden;

}

/* =========================
   主页面
========================= */

#main {

    display: none;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.8s ease;

    position: relative;

    z-index: 1;

    padding:
        90px 20px;
}

#main.show {

    display: block;

    opacity: 1;

    pointer-events: auto;
}

#motd {

    margin-top: 8px;

    color:
        #8d93a6;

    font-size: 13px;

    letter-spacing: 1px;

    opacity: 0.82;

    font-style: italic;
}

/* =========================
   按钮
========================= */

button {

    margin-top: 20px;

    width: 100%;

    padding: 14px;

    border: none;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            rgba(139,127,209,0.24),
            rgba(216,154,199,0.18)
        );

    color: white;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;

    transition:
        0.25s ease;

    border:
        1px solid rgba(255,255,255,0.06);
}

button:hover {

    opacity: 0.92;

    transform:
        translateY(-2px);

    background:
        linear-gradient(
            135deg,
            rgba(139,127,209,0.38),
            rgba(216,154,199,0.28)
        );

    box-shadow:
        0 0 18px rgba(216,154,199,0.14);
}
/*oc页面转跳按钮*/
.hidden-archive{

    display:inline-block;

    color:#bcaeff;

    text-decoration:none;

    opacity:.42;

    letter-spacing:1px;

    transition:.35s;
}

.hidden-archive:hover{

    opacity:1;

    transform:translateX(4px);

    text-shadow:
        0 0 18px rgba(188,174,255,.55);
}
/* =========================
   Token 阅读入口
========================= */

.reader-entry {

    width: min(920px, calc(100% - 36px));

    margin:
        0 auto 44px;

    padding:
        30px;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr) minmax(280px, 380px);

    gap:
        28px;

    align-items: center;

    border-radius:
        24px;

    background:
        var(--card);

    border:
        1px solid var(--border);

    backdrop-filter:
        blur(16px);

    box-shadow:
        0 0 24px rgba(0,0,0,0.18);
}

.reader-entry small,
.reader-panel small {

    color:
        rgba(255,255,255,0.36);

    letter-spacing:
        4px;

    font-size:
        12px;
}

.reader-entry h2,
.reader-panel h1 {

    margin:
        12px 0 0;

    font-size:
        32px;
}

.reader-entry p,
.reader-panel p,
.reader-empty p {

    color:
        var(--text-sub);

    line-height:
        1.8;
}

.reader-form {

    display:
        grid;

    gap:
        14px;
}

.reader-form input {

    width:
        100%;

    padding:
        14px 16px;

    border-radius:
        16px;

    border:
        1px solid rgba(255,255,255,0.08);

    outline:
        none;

    background:
        rgba(8,10,18,0.52);

    color:
        var(--text);

    font-size:
        15px;
}

.reader-form button {

    margin-top:
        0;
}

/* =========================
   Token 阅读页
========================= */

.reader-page {

    width:
        min(960px, calc(100% - 32px));

    margin:
        0 auto;

    padding:
        36px 0 96px;

    position:
        relative;

    z-index:
        1;
}

.reader-back {

    display:
        inline-flex;

    margin-bottom:
        24px;

    padding:
        10px 14px;

    border-radius:
        12px;

    color:
        #d7dbea;

    text-decoration:
        none;

    background:
        rgba(25,27,40,0.78);

    border:
        1px solid rgba(255,255,255,0.05);

    backdrop-filter:
        blur(10px);
}

.reader-panel,
.reader-empty,
.reader-toolbar,
.reader-gate {

    padding:
        28px;

    border-radius:
        24px;

    background:
        var(--card);

    border:
        1px solid var(--border);

    backdrop-filter:
        blur(16px);
}

.reader-panel {

    display:
        grid;

    gap:
        16px;
}

.reader-empty,
.reader-toolbar,
.reader-gate {

    margin-top:
        24px;
}

.reader-toolbar {

    display:
        flex;

    justify-content:
        space-between;

    gap:
        18px;

    color:
        var(--text-sub);
}

.reader-gate {

    display:
        flex;

    align-items:
        center;

    justify-content:
        space-between;

    gap:
        18px;
}

.reader-gate-copy {

    min-width:
        0;

    display:
        grid;

    gap:
        10px;
}

.reader-gate h2 {

    margin:
        0;

    font-size:
        24px;

    line-height:
        1.35;

    overflow-wrap:
        anywhere;
}

.reader-gate-meta {

    display:
        flex;

    flex-wrap:
        wrap;

    gap:
        10px;
}

.reader-gate-meta span {

    padding:
        8px 10px;

    border-radius:
        12px;

    background:
        rgba(8,10,18,0.52);

    border:
        1px solid rgba(255,255,255,0.08);

    color:
        var(--text-sub);

    font-size:
        12px;
}

.reader-confirm {

    width:
        min(168px, 100%);

    margin-top:
        0;

    flex:
        0 0 auto;
}

.reader-confirm:disabled {

    opacity:
        0.58;

    cursor:
        progress;
}

.reader-gate.is-error {

    border-color:
        rgba(216,154,199,0.36);
}

.reader-viewer {

    margin-top:
        24px;

    display:
        grid;

    grid-template-columns:
        64px minmax(0, 1fr) 64px;

    gap:
        16px;

    align-items:
        start;
}

.reader-page-figure {

    margin:
        0;

    padding:
        14px;

    border-radius:
        20px;

    background:
        rgba(10,13,24,0.72);

    border:
        1px solid rgba(255,255,255,0.05);

    cursor:
        pointer;
}

.reader-page-figure img {

    width:
        auto;

    max-width:
        min(100%, 820px);

    height:
        auto;

    display:
        block;

    margin:
        0 auto;

    border-radius:
        12px;
}

.reader-page-figure figcaption {

    padding:
        12px 4px 0;

    color:
        var(--text-sub);

    text-align:
        center;

    font-size:
        13px;
}

.reader-nav {

    width:
        64px;

    height:
        96px;

    margin-top:
        min(36vh, 260px);

    border-radius:
        18px;

    font-size:
        46px;

    line-height:
        1;

    position:
        sticky;

    top:
        44vh;
}

.reader-pager {

    width:
        min(420px, 100%);

    margin:
        22px auto 0;

    display:
        grid;

    grid-template-columns:
        52px 52px minmax(76px, 1fr) 52px 52px;

    gap:
        10px;

    align-items:
        center;
}

.reader-pager button {

    width:
        52px;

    height:
        44px;

    margin-top:
        0;

    padding:
        0;

    border-radius:
        14px;

    font-size:
        22px;
}

.reader-pager input {

    width:
        100%;

    height:
        44px;

    border-radius:
        14px;

    border:
        1px solid rgba(255,255,255,0.08);

    outline:
        none;

    background:
        rgba(8,10,18,0.52);

    color:
        var(--text);

    text-align:
        center;

    font-size:
        15px;
}

/* =========================
   手机适配
========================= */

@media (max-width: 768px) {

    #welcome h1 {

        font-size: 42px;
    }

    .reader-entry {

        grid-template-columns:
            1fr;
    }

    .reader-viewer {

        grid-template-columns:
            1fr;
    }

    .reader-nav {

        display:
            none;
    }

    .reader-page-figure {

        padding:
            10px;
    }

    .reader-page-figure img {

        max-width:
            100%;
    }

    #music-card {

        right:
            12px;

        bottom:
            12px;

        width:
            min(240px, calc(100vw - 24px));
    }

}

/* =========================
   手机点击优化
========================= */

html,
body {

    touch-action:
        manipulation;
}
/* =========================
   音乐
========================= */
#music-card {

    position: fixed;

    right: 20px;

    bottom: 20px;

    width:
        min(260px, calc(100vw - 40px));

    padding:
        14px;

    border-radius:
        18px;

    background:
        rgba(18,21,32,0.78);

    border:
        1px solid rgba(255,255,255,0.07);

    backdrop-filter:
        blur(16px);

    box-shadow:
        0 14px 36px rgba(0,0,0,0.28);

    z-index: 99;
}

#music-controls {

    display:
        flex;

    gap:
        8px;
}

#music-controls button {

    flex:
        1;

    width: auto;

    min-width:
        0;

    height:
        42px;

    margin-top: 0;

    padding:
        0 10px;

    border-radius:
        12px;

    background:
        rgba(255,255,255,0.05);

    border:
        1px solid rgba(255,255,255,0.06);

    color:
        #d7dbea;

    transition:
        0.2s ease;

    font-size:
        14px;
}

#music-controls button:hover {

    transform:
        translateY(-2px);

    background:
        rgba(216,154,199,0.16);
}

#music-name {

    margin-bottom:
        10px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    color:
        #d7dbea;

    font-size: 13px;

    line-height:
        1.4;
}
/*页脚信息*/
.site-footer {
    width: fit-content;

    margin: 80px auto 40px auto;

    padding: 10px 22px;

    border-radius: 16px;

    background: rgba(20,20,35,0.45);

    backdrop-filter: blur(12px);

    border: 1px solid rgba(255,255,255,0.08);

    color: rgba(255,255,255,0.75);

    font-size: 13px;

    text-align: center;

    box-shadow:
        0 0 20px rgba(120,100,255,0.15);
}

/* =========================
   Reader polish
========================= */

.reader-entry-text {
    display: grid;
    gap: 10px;
}

.reader-recent {
    display: grid;
    gap: 12px;
}

.reader-recent-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.reader-recent-title,
.reader-recent-note,
.reader-label,
.reader-percent,
.reader-page-name {
    color: var(--text-sub);
    font-size: 12px;
    letter-spacing: 1px;
}

.reader-recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.reader-recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    background: rgba(8,10,18,0.52);
    border: 1px solid rgba(255,255,255,0.08);
}

.reader-recent-token {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-recent-meta,
.reader-recent-progress {
    color: var(--text-sub);
    font-size: 12px;
    white-space: nowrap;
}

.reader-toolbar {
    flex-wrap: wrap;
    align-items: center;
}

.reader-toolbar-block {
    display: grid;
    gap: 4px;
}

.reader-toolbar-progress {
    margin-left: auto;
    text-align: right;
}

.reader-page-figure {
    position: relative;
    overflow: hidden;
    min-height: clamp(420px, 70vh, 980px);
}

.reader-page-figure img {
    max-height: min(78vh, 980px);
    object-fit: contain;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.reader-page-figure.is-loading img {
    opacity: 0.28;
    transform: scale(0.995);
}

.reader-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 1;
    color: var(--text-sub);
    letter-spacing: 2px;
    background: linear-gradient(180deg, rgba(10,13,24,0.48), rgba(10,13,24,0.12));
}

.reader-page-figure figcaption {
    display: grid;
    gap: 6px;
}

.reader-page-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-form input:focus,
.reader-pager input:focus {
    border-color: rgba(216,154,199,0.55);
    box-shadow: 0 0 0 4px rgba(139,127,209,0.12);
}

.reader-back:hover,
.reader-recent-chip:hover {
    transform: translateY(-2px);
    border-color: rgba(216,154,199,0.28);
    background: rgba(35,38,56,0.9);
}

@media (max-width: 768px) {
    .reader-page {
        width: min(100%, calc(100% - 16px));
    }

    .reader-toolbar-progress {
        margin-left: 0;
        text-align: left;
    }

    .reader-gate {
        display: grid;
    }

    .reader-confirm {
        width: 100%;
    }

    .reader-page-figure {
        min-height: calc(100svh - 280px);
    }

    .reader-page-figure img {
        max-height: calc(100svh - 340px);
    }

    .reader-pager {
        position: sticky;
        bottom: 10px;
        z-index: 4;
        width: 100%;
        padding: 10px;
        border-radius: 18px;
        background: rgba(18,21,32,0.82);
        backdrop-filter: blur(16px);
        border: 1px solid rgba(255,255,255,0.08);
    }
}

/* =========================
   Home polish
========================= */

.topbar,
.home-status,
#message-section {
    width: min(960px, calc(100% - 36px));
    margin-left: auto;
    margin-right: auto;
}

#main {
    padding: 48px 20px 96px;
}

#welcome {
    border-radius: 20px;
}

#welcome h1 {
    font-size: clamp(40px, 9vw, 54px);
    letter-spacing: 0;
}

.enter {
    border-radius: 12px;
    letter-spacing: 1px;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(34px, 7vw, 76px);
    line-height: 0.95;
    letter-spacing: 0;
}

.topbar p {
    margin: 12px 0 0;
    color: var(--text-sub);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.site-nav a,
.home-status span {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    color: #d7dbea;
    text-decoration: none;
    background: rgba(8,10,18,0.42);
    border: 1px solid rgba(255,255,255,0.07);
}

.site-nav a:hover {
    border-color: rgba(216,154,199,0.28);
    background: rgba(35,38,56,0.9);
}

.home-status {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.home-status span {
    min-height: 32px;
    color: var(--text-sub);
    font-size: 12px;
    letter-spacing: 1px;
}

.reader-entry {
    width: min(360px, calc(100% - 36px));
    margin: 16px calc((100% - min(960px, calc(100% - 36px))) / 2) 56px auto;
    padding: 16px;
    grid-template-columns: 1fr;
    gap: 12px;
    border-radius: 14px;
    background: rgba(18,21,32,0.54);
    box-shadow: 0 12px 28px rgba(0,0,0,0.16);
}

.reader-form input,
.reader-form button,
button {
    border-radius: 12px;
}

.reader-entry small {
    letter-spacing: 2px;
    font-size: 11px;
}

.reader-entry h2 {
    margin-top: 6px;
    font-size: 20px;
}

.reader-entry .reader-recent {
    margin-top: 4px;
}

.reader-entry .reader-recent-head {
    display: none;
}

.reader-entry .reader-recent-list {
    gap: 8px;
}

.reader-entry .reader-recent-chip {
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 11px;
    font-size: 12px;
}

.reader-entry .reader-recent-chip:nth-child(n + 4) {
    display: none;
}

.reader-entry .reader-recent-meta,
.reader-entry .reader-recent-progress {
    display: none;
}

.reader-entry .reader-form {
    gap: 10px;
}

.reader-entry .reader-form input,
.reader-entry .reader-form button {
    min-height: 40px;
}

.reader-entry .reader-form input {
    padding: 10px 12px;
    font-size: 13px;
}

.reader-entry .reader-form button {
    padding: 10px 12px;
    font-size: 13px;
}

.site-footer {
    width: fit-content;
    max-width: calc(100% - 36px);
    margin: 80px auto 40px auto;
    padding: 10px 22px;
    border-radius: 16px;
    background: rgba(20,20,35,0.45);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    text-align: center;
    box-shadow: 0 0 20px rgba(120,100,255,0.15);
}

input,
textarea,
button,
a {
    -webkit-tap-highlight-color: transparent;
}

input::placeholder,
textarea::placeholder {
    color: rgba(215,219,234,0.42);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(216,154,199,0.62);
    outline-offset: 3px;
}

#message-section,
.site-footer,
.reader-panel,
.reader-empty,
.reader-toolbar,
.reader-gate,
.reader-page-figure,
.reader-pager {
    box-shadow: 0 18px 44px rgba(0,0,0,0.2);
}

.reader-form button,
.message-form button {
    min-height: 46px;
}

.reader-form input {
    min-height: 46px;
}

@media (max-width: 768px) {
    #main {
        padding: 32px 12px 110px;
    }

    .topbar {
        display: grid;
        gap: 18px;
    }

    .site-nav {
        justify-content: flex-start;
    }

    .reader-entry,
    #message-section,
    .site-footer,
    .home-status,
    .topbar {
        width: min(100%, calc(100% - 12px));
    }

    .reader-entry {
        margin: 16px auto 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
