* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #0f1012;
    --surface: rgba(24, 26, 29, 0.88);
    --surface-2: #22252a;
    --surface-3: #2d3138;
    --text: #f1f3f5;
    --muted: #b7bdc5;
    --quiet: #828a94;
    --border: rgba(232, 236, 242, 0.12);
    --border-strong: rgba(232, 236, 242, 0.24);
    --button: #262a30;
    --button-hover: #303640;
    --danger: #ff7a59;
    --danger-hover: #ff5c35;
    --accent: #7dd3fc;
    --accent-2: #f472b6;
    --accent-3: #facc15;
    --accent-soft: rgba(125, 211, 252, 0.12);
    --danger-soft: rgba(255, 122, 89, 0.14);
    --success-soft: rgba(134, 239, 172, 0.12);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
    --radius: 8px;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    position: relative;
    overflow-x: hidden;
    isolation: isolate;
    background: linear-gradient(180deg, #15171b 0%, var(--bg) 44%, #0a0b0d 100%);
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    line-height: 1.6;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: -10vh -8vw;
    z-index: 0;
    pointer-events: none;
}

body::before {
    opacity: 0.68;
    background-image: url("data:image/svg+xml,%3Csvg width='1440' height='680' viewBox='0 0 1440 680' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M-90 156 C160 22 270 272 498 142 C730 10 870 32 1054 174 C1218 300 1370 236 1532 92' stroke='%237dd3fc' stroke-opacity='.22' stroke-width='2.4'/%3E%3Cpath d='M-120 384 C108 240 282 514 514 356 C734 206 922 294 1084 420 C1232 534 1394 486 1534 342' stroke='%23f472b6' stroke-opacity='.18' stroke-width='2'/%3E%3Cpath d='M-80 548 C132 408 302 658 536 514 C774 368 966 438 1130 552 C1274 652 1426 616 1540 490' stroke='%23facc15' stroke-opacity='.13' stroke-width='1.7'/%3E%3C/g%3E%3C/svg%3E");
    background-position: top center;
    background-repeat: repeat-y;
    background-size: min(1440px, 128vw) auto;
}

body::after {
    opacity: 0.36;
    background:
        linear-gradient(120deg, transparent 0 18%, rgba(125, 211, 252, 0.06) 18.2%, transparent 30%),
        linear-gradient(245deg, transparent 0 56%, rgba(244, 114, 182, 0.05) 56.2%, transparent 70%);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-2);
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
textarea {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 16, 18, 0.86);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-inner {
    width: min(1100px, 92vw);
    margin: 0 auto;
    padding: 14px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-nav a {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--muted);
}

.site-nav a:hover {
    background: rgba(125, 211, 252, 0.1);
    border-color: rgba(125, 211, 252, 0.28);
    color: var(--text);
}

.site-footer {
    position: relative;
    z-index: 1;
    width: min(1100px, 92vw);
    margin: 48px auto 0;
    padding: 24px 0 32px;
    border-top: 1px solid var(--border);
    color: var(--quiet);
    text-align: center;
}

.site-footer p {
    margin: 6px 0;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1100px, 92vw);
    margin: 32px auto 56px;
}

.page-shell.narrow {
    max-width: 760px;
}

.page-shell.compact {
    max-width: 440px;
}

.panel,
.project-card,
.detail-card,
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.panel,
.detail-card,
.login-box {
    padding: 28px;
}

.section-title,
h1,
h2,
h3 {
    color: var(--text);
    line-height: 1.25;
    letter-spacing: 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.section-title {
    position: relative;
    margin-bottom: 18px;
    font-size: 28px;
}

.section-title::after {
    content: "";
    display: block;
    width: 54px;
    height: 2px;
    margin-top: 10px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
}

.muted,
.tip,
.chat-subtitle,
.chat-tips,
.meta,
.empty-box,
.placeholder,
.project-placeholder,
.avatar-placeholder,
.empty-image {
    color: var(--muted);
}

.btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--button);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #2b3037 0%, var(--button) 100%);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
    white-space: nowrap;
}

.btn:hover {
    background: var(--button-hover);
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.btn-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #17191d;
}

.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
    color: #fff7f3;
}

.back-link,
.link-text,
.project-title-link,
.text-link {
    color: var(--accent);
}

.back-link:hover,
.link-text:hover,
.project-title-link:hover,
.text-link:hover {
    color: var(--accent-2);
    text-decoration: underline;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.action-group,
.btn-group,
.operation-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 700;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: #121417;
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: var(--quiet);
}

input[type="file"] {
    color: var(--muted);
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.16);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.required {
    color: var(--accent);
}

.error-box,
.success-box,
.error-message {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--danger-soft);
    border: 1px solid rgba(255, 122, 89, 0.42);
    color: var(--text);
}

.success-box {
    background: var(--success-soft);
    border-color: rgba(134, 239, 172, 0.36);
    color: var(--text);
}

.profile-section {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-start;
    margin-bottom: 28px;
}

.avatar-box {
    width: 220px;
    height: 220px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.avatar-box img,
.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.profile-info {
    flex: 1;
    min-width: 280px;
}

.profile-info h1 {
    margin-bottom: 12px;
    font-size: 32px;
}

.profile-info p {
    color: var(--muted);
    white-space: pre-wrap;
}

.chat-section {
    margin-bottom: 34px;
}

.split-section {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
    gap: 24px;
}

.chat-title {
    margin-bottom: 8px;
    font-size: 28px;
}

.chat-subtitle {
    margin-bottom: 16px;
}

.chat-box {
    height: 170px;
    overflow-y: auto;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #121417;
}

.chat-message {
    display: flex;
    margin-bottom: 12px;
}

.chat-message.user {
    justify-content: flex-start;
}

.chat-message.bot {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 78%;
    padding: 11px 13px;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    line-height: 1.7;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-message.bot .chat-bubble {
    background: var(--accent-soft);
    border: 1px solid rgba(125, 211, 252, 0.22);
}

.chat-form {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.chat-form textarea {
    min-height: 90px;
}

.chat-form button {
    width: 112px;
}

.chat-right {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border);
    padding-left: 22px;
    text-align: center;
}

.motivation-title {
    margin-bottom: 12px;
    font-size: 22px;
}

.motivation-box p {
    margin-bottom: 12px;
    color: var(--muted);
}

.motivation-gif {
    width: 190px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.08), 0 12px 26px rgba(0, 0, 0, 0.28);
    transition: transform 0.16s ease, filter 0.16s ease;
}

.motivation-gif:hover {
    filter: brightness(1.08);
    transform: scale(1.04);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.project-card {
    overflow: hidden;
}

.project-card:hover {
    border-color: rgba(244, 114, 182, 0.28);
}

.project-image {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #20242a, #16191d);
    border-bottom: 1px solid var(--border);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-content {
    padding: 18px;
}

.project-content h3 {
    margin-bottom: 10px;
    font-size: 20px;
}

.project-content p,
.project-desc {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.project-content p {
    display: -webkit-box;
    margin-bottom: 14px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.empty-box {
    padding: 26px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
}

.detail-card {
    max-width: 900px;
    margin: 0 auto;
}

.detail-card h1 {
    margin-bottom: 20px;
    font-size: 32px;
}

.detail-image {
    width: 100%;
    max-height: 430px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 18px 0 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.description {
    color: var(--muted);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
}

td {
    color: var(--muted);
    font-size: 14px;
}

.thumb,
.empty-image {
    width: 80px;
    height: 60px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.thumb {
    object-fit: cover;
}

.empty-image {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.project-title {
    margin-bottom: 5px;
    color: var(--text);
    font-weight: 700;
}

.project-desc {
    max-width: 280px;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.login-page .page-shell {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
}

.login-box h1,
.login-box .desc {
    text-align: center;
}

.login-box .desc {
    color: var(--muted);
}

@media (max-width: 760px) {
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-shell {
        margin-top: 22px;
    }

    .panel,
    .detail-card,
    .login-box {
        padding: 20px;
    }

    .split-section {
        grid-template-columns: 1fr;
    }

    .chat-right {
        border-left: 0;
        border-top: 1px solid var(--border);
        padding: 20px 0 0;
    }

    .chat-form {
        flex-direction: column;
    }

    .chat-form button {
        width: 100%;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .avatar-box {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
}
