/*
 * lolin 全站基础样式
 * 手绘纸面风格，前台与登录/安装页共用。
 *
 * 重要：SVG 尺寸规则放在文件最前面，并给 svg 一个明确的默认尺寸，
 * 避免任何情况下图标被撑满容器。
 */

@font-face {
    font-family: CustomFont;
    src: url('1.ttf') format('truetype');
    font-display: swap;
}

:root {
    --paper: #f4f4f4;
    --paper-line: #dddddd;
    --white: #ffffff;
    --black: #171717;
    --gray: #666666;
    --border: 2.5px solid #171717;
    --shadow: 4px 4px 0 rgba(0, 0, 0, .14);
    --radius-a: 255px 15px 225px 15px / 15px 225px 15px 255px;
    --radius-b: 2px 255px 3px 25px / 255px 5px 225px 5px;
}

/* =========================================================
 * SVG 基础尺寸：最先声明，给所有图标一个安全默认值
 * ========================================================= */

svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

svg.icon {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
}

.tabs svg.icon {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
}

svg.upload-icon {
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
}

.large-icon svg {
    width: 65px;
    height: 65px;
    max-width: 65px;
    max-height: 65px;
}

.success-icon svg {
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
}

/* =========================================================
 * 基础重置
 * ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: CustomFont, PingFang SC, Microsoft YaHei, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    color: var(--black);
    background-color: var(--paper);
    background-image:
        repeating-linear-gradient(0deg,
            transparent, transparent 31px,
            var(--paper-line) 31px, var(--paper-line) 32px),
        repeating-linear-gradient(90deg,
            transparent, transparent 31px,
            var(--paper-line) 31px, var(--paper-line) 32px);
    background-size: 32px 32px;
}

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

button,
a {
    -webkit-user-select: none;
    user-select: none;
}

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

img {
    max-width: 100%;
}

.hidden {
    display: none !important;
}

/* =========================================================
 * 页头
 * ========================================================= */

header {
    text-align: center;
    padding: 50px 20px 28px;
}

.logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: 8px;
    background: #fff;
}

header h1 {
    font-size: 50px;
    letter-spacing: 1px;
    transform: rotate(-1deg);
}

header p {
    max-width: 620px;
    margin: 14px auto 0;
    padding: 0 10px;
    color: var(--gray);
    font-size: 17px;
    line-height: 1.7;
}

.small-header {
    padding-bottom: 10px;
}

.small-header h1 {
    font-size: 38px;
}

/* =========================================================
 * 状态条
 * ========================================================= */

.status-bar {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 18px;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-item {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-a);
    padding: 9px 15px;
    box-shadow: var(--shadow);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border: 2px solid var(--black);
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--black);
}

/* =========================================================
 * 内容区
 * ========================================================= */

.content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-b);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 17px;
}

/* =========================================================
 * 标签页
 * ========================================================= */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 14px;
    border: var(--border);
    border-radius: var(--radius-a);
    background: #fff;
    color: var(--black);
    font-size: 15px;
    cursor: pointer;
    transition: .15s;
}

.tab:hover {
    transform: rotate(-.5deg);
}

.tab.active {
    background: var(--black);
    color: #fff;
}

.tab-panel {
    margin-bottom: 4px;
}

/* =========================================================
 * 表单
 * ========================================================= */

.text-input {
    width: 100%;
    min-height: 320px;
    resize: vertical;
    padding: 18px;
    border: var(--border);
    border-radius: 8px 20px 7px 15px;
    background: #fafafa;
    outline: none;
    font-size: 16px;
    line-height: 1.7;
    display: block;
    user-select: text;
    -webkit-user-select: text;
}

.text-input:focus {
    box-shadow: 3px 3px 0 rgba(0, 0, 0, .12);
    background: #fff;
}

.text-input::placeholder {
    color: #999;
}

.input-info {
    text-align: right;
    color: var(--gray);
    font-size: 13px;
    margin-top: 6px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.form-label {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.select-input {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    background: #fff;
    border: var(--border);
    border-radius: var(--radius-a);
    outline: none;
}

/* =========================================================
 * 文件上传区
 * ========================================================= */

.upload-area {
    padding: 30px 20px;
    border: 2px dashed #171717;
    border-radius: 8px 20px 7px 15px;
    background: #fafafa;
    text-align: center;
    cursor: pointer;
    transition: background .15s, transform .15s;
}

.upload-area:hover,
.upload-area.dragging {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.upload-area .upload-icon {
    display: block;
    margin: 0 auto 12px;
}

.upload-title {
    font-size: 15px;
    font-weight: 700;
}

.upload-hint {
    margin-top: 5px;
    font-size: 13px;
    color: #888;
}

.file-info {
    margin-top: 12px;
    padding: 10px 14px;
    border: 1.5px solid #171717;
    border-radius: 7px;
    background: #fff;
    font-size: 14px;
    display: none;
}

.file-info.show {
    display: block;
}

/* =========================================================
 * 按钮
 * ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 45px;
    padding: 9px 20px;
    border: var(--border);
    border-radius: var(--radius-a);
    background: #fff;
    color: var(--black);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}

.btn:hover {
    transform: rotate(-1deg) translateY(-1px);
}

.btn:active {
    transform: rotate(1deg) scale(.98);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, .12);
}

.btn.primary {
    background: var(--black);
    color: #fff;
}

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

.btn:disabled {
    opacity: .55;
    cursor: wait;
    transform: none;
}

.upload-btn {
    width: 100%;
    min-height: 54px;
    font-size: 17px;
}

/* =========================================================
 * 结果卡片
 * ========================================================= */

.result-card {
    display: none;
}

.result-card.show {
    display: block;
    animation: sketchIn .35s ease;
}

.share-link-box {
    display: flex;
    width: 100%;
}

.share-link {
    width: 100%;
    min-height: 50px;
    border: var(--border);
    border-radius: 8px 18px 6px 15px;
    padding: 10px 15px;
    outline: none;
    background: #f7f7f7;
    font-size: 15px;
    user-select: text;
    -webkit-user-select: text;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* =========================================================
 * 元信息
 * ========================================================= */

.meta-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--gray);
    font-size: 13px;
    margin-top: 10px;
}

.meta-info span {
    padding: 5px 10px;
    border: 1px solid #aaa;
    border-radius: 30px;
    background: #fff;
}

/* =========================================================
 * 查看页
 * ========================================================= */

.share-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.text-display {
    margin-top: 20px;
    padding: 20px;
    min-height: 180px;
    border: var(--border);
    border-radius: 8px 18px 6px 15px;
    background: #fafafa;
    font-size: 16px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: auto;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.viewer-footer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

/* =========================================================
 * 错误页
 * ========================================================= */

.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-page h2 {
    font-size: 25px;
    margin: 18px 0 8px;
}

.error-page p {
    color: var(--gray);
    margin-bottom: 25px;
}

.large-icon {
    width: 65px;
    height: 65px;
    margin: 0 auto;
}

/* =========================================================
 * 页脚
 * ========================================================= */

footer {
    text-align: center;
    padding: 30px 20px 45px;
    color: var(--gray);
    font-size: 14px;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--black);
    text-decoration: underline;
}

/* =========================================================
 * 提示条
 * ========================================================= */

#toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 120px);
    max-width: calc(100% - 40px);
    padding: 12px 24px;
    background: #fff;
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius-a);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .3s;
    z-index: 9999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* =========================================================
 * 安装 / 登录
 * ========================================================= */

.install-page,
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.install-card,
.login-card {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border: var(--border);
    box-shadow: 5px 5px 0 rgba(0, 0, 0, .15);
    border-radius: var(--radius-b);
    padding: 35px;
}

.login-card {
    max-width: 420px;
    padding: 32px;
}

.install-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 13px;
    margin-bottom: 28px;
}

.install-brand img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border: var(--border);
    border-radius: 8px;
    background: #fff;
}

.install-brand h1 {
    font-size: 40px;
}

.install-card h2,
.login-card h2 {
    font-size: 25px;
    margin-bottom: 20px;
    text-align: center;
}

.install-card label,
.login-card label {
    display: block;
    font-weight: 700;
    margin: 15px 0 8px;
}

.input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: var(--border);
    border-radius: 7px 18px 6px 15px;
    outline: none;
    background: #fafafa;
}

.input:focus {
    background: #fff;
}

.full {
    width: 100%;
    margin-top: 22px;
}

.error-box,
.success-box {
    padding: 12px 15px;
    border: 2px solid var(--black);
    background: #f2f2f2;
    margin-bottom: 15px;
    border-radius: 6px;
}

.success-box {
    background: #eef7ee;
}

.install-success {
    text-align: center;
}

.success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
}

.install-success h2 {
    margin-bottom: 8px;
}

.install-success p {
    color: var(--gray);
    margin-bottom: 20px;
}

.install-success .btn {
    margin: 5px;
}

.login-back {
    margin-top: 20px;
    text-align: center;
}

.login-back a {
    color: var(--black);
    text-decoration: underline;
}

/* =========================================================
 * 动画
 * ========================================================= */

@keyframes sketchIn {
    from {
        opacity: 0;
        transform: translateY(10px) rotate(-1deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

/* =========================================================
 * 响应式
 * ========================================================= */

@media (max-width: 600px) {

    header {
        padding-top: 35px;
    }

    header h1 {
        font-size: 42px;
    }

    header p {
        font-size: 15px;
    }

    .content {
        padding: 12px;
    }

    .card {
        padding: 18px;
    }

    .text-input {
        min-height: 240px;
    }

    .form-row {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .select-input {
        width: 100%;
    }

    .share-header {
        flex-direction: column;
    }

    .result-actions .btn,
    .viewer-footer .btn {
        flex: 1;
    }

    .install-card,
    .login-card {
        padding: 25px 20px;
    }

    .tabs {
        gap: 8px;
    }

    .tab {
        font-size: 14px;
        padding: 8px 10px;
    }
}
