* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --md-sys-color-primary: #0061a4;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d1e4ff;
    --md-sys-color-on-primary-container: #001d36;
    --md-sys-color-secondary: #535f70;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #d7e3f7;
    --md-sys-color-on-secondary-container: #101c2b;
    --md-sys-color-tertiary: #6b5778;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #f2daff;
    --md-sys-color-on-tertiary-container: #251431;
    --md-sys-color-background: #fdfcff;
    --md-sys-color-on-background: #1a1c1e;
    --md-sys-color-surface: #fdfcff;
    --md-sys-color-on-surface: #1a1c1e;
    --md-sys-color-surface-variant: #dfe2eb;
    --md-sys-color-on-surface-variant: #43474e;
    --md-sys-color-outline: #73777f;
    --md-sys-color-outline-variant: #c3c7cf;

    --md-sys-color-primary-rgb: 0, 97, 164;

    --mdc-linear-progress-active-indicator-color: var(--md-sys-color-primary);
    --mdc-linear-progress-track-color: var(--md-sys-color-surface-variant);
    --mdc-linear-progress-track-height: 4px;
    --mdc-linear-progress-border-radius: 40px;

    --mdc-linear-progress-primary-half: 83.67142%;
    --mdc-linear-progress-primary-full: 200.611057%;
    --mdc-linear-progress-secondary-quarter: 37.651913%;
    --mdc-linear-progress-secondary-half: 84.386165%;
    --mdc-linear-progress-secondary-full: 160.277782%;
}

body {
    background: var(--md-sys-color-background);
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--md-sys-color-on-surface);
}

#loading {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: var(--md-sys-color-background);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9999;
}
.loader-circle {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-outline-variant);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}
@keyframes rotate { to { transform: rotate(360deg); } }
#loading-text {
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.content {
    max-width: 460px;
    width: 100%;
    display: none;
}
@media (min-width: 768px) {
    .content { max-width: 700px; }
}

.inner-card {
    background: var(--md-sys-color-surface);
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 16px;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--md-sys-color-outline-variant);
}
.profile-info {
    text-align: center;
}
.profile-info h2 {
    font-weight: 500;
    font-size: 28px;
    margin-bottom: 4px;
    color: var(--md-sys-color-on-surface);
}
.profile-info p {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 16px;
}
@media (min-width: 768px) {
    .profile-header {
        flex-direction: row;
        align-items: center;
        text-align: left;
        margin-bottom: 32px;
    }
    .avatar { width: 140px; height: 140px; }
    .profile-info { text-align: left; flex: 1; }
}

.skill-grid {
    display: grid;
    gap: 12px;
    margin: 32px 0;
}
.skill-item {
    padding: 16px;
}
.skill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
}
.skill-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.skill-label i { font-size: 18px; color: var(--md-sys-color-primary); }

@media (min-width: 768px) {
    .skill-grid { grid-template-columns: 1fr 1fr; }
    .skill-more { grid-column: span 2; }
}

.mdc-linear-progress {
    position: relative;
    width: 100%;
    height: var(--mdc-linear-progress-track-height);
    transform: translateZ(0);
    outline: 1px solid transparent;
    overflow-x: hidden;
    transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--mdc-linear-progress-border-radius);
}

.mdc-linear-progress__bar {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto 0;
    width: 100%;
    animation: none;
    transform-origin: top left;
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-linear-progress__bar-inner {
    display: inline-block;
    position: absolute;
    width: 100%;
    height: 100%;
    animation: none;
    background-color: var(--mdc-linear-progress-active-indicator-color);
    border-radius: var(--mdc-linear-progress-border-radius);
}

.mdc-linear-progress__buffer {
    display: flex;
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto 0;
    width: 100%;
    overflow: hidden;
    background-color: var(--mdc-linear-progress-track-color);
    border-radius: var(--mdc-linear-progress-border-radius);
}

.mdc-linear-progress__buffer-bar {
    flex: 0 1 100%;
    background-color: var(--mdc-linear-progress-track-color);
    transition: flex-basis 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-linear-progress__primary-bar {
    transform: scaleX(0);
}

.mdc-linear-progress__secondary-bar {
    display: none;
}

.mdc-linear-progress--determinate .mdc-linear-progress__primary-bar {
    transform: scaleX(var(--mdc-linear-progress-value, 0));
}

.mdc-linear-progress--indeterminate .mdc-linear-progress__bar {
    will-change: transform;
}

.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar {
    left: -145.166611%;
    will-change: transform;
}

.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar {
    left: -54.888891%;
    display: block;
    will-change: transform;
}

.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar {
    animation: mdc-linear-progress-primary-indeterminate-translate 2s infinite linear;
}

.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar > .mdc-linear-progress__bar-inner {
    animation: mdc-linear-progress-primary-indeterminate-scale 2s infinite linear;
}

.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar {
    animation: mdc-linear-progress-secondary-indeterminate-translate 2s infinite linear;
}

.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar > .mdc-linear-progress__bar-inner {
    animation: mdc-linear-progress-secondary-indeterminate-scale 2s infinite linear;
}

@keyframes mdc-linear-progress-primary-indeterminate-translate {
    0% { transform: translateX(0); }
    20% { animation-timing-function: cubic-bezier(0.5, 0, 0.701732, 0.495819); transform: translateX(0); }
    59.15% { animation-timing-function: cubic-bezier(0.302435, 0.381352, 0.55, 0.956352); transform: translateX(var(--mdc-linear-progress-primary-half)); }
    100% { transform: translateX(var(--mdc-linear-progress-primary-full)); }
}
@keyframes mdc-linear-progress-primary-indeterminate-scale {
    0% { transform: scaleX(0.08); }
    36.65% { animation-timing-function: cubic-bezier(0.334731, 0.12482, 0.785844, 1); transform: scaleX(0.08); }
    69.15% { animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1); transform: scaleX(0.661479); }
    100% { transform: scaleX(0.08); }
}
@keyframes mdc-linear-progress-secondary-indeterminate-translate {
    0% { animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685); transform: translateX(0); }
    25% { animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712); transform: translateX(var(--mdc-linear-progress-secondary-quarter)); }
    48.35% { animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026); transform: translateX(var(--mdc-linear-progress-secondary-half)); }
    100% { transform: translateX(var(--mdc-linear-progress-secondary-full)); }
}
@keyframes mdc-linear-progress-secondary-indeterminate-scale {
    0% { animation-timing-function: cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971); transform: scaleX(0.08); }
    19.15% { animation-timing-function: cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315); transform: scaleX(0.457104); }
    44.15% { animation-timing-function: cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179); transform: scaleX(0.72796); }
    100% { transform: scaleX(0.08); }
}

.skill-detail-card {
    padding: 16px;
    margin-bottom: 12px;
}
.skill-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--md-sys-color-on-surface);
}
.skill-title i { font-size: 20px; color: var(--md-sys-color-primary); }
.skill-desc {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0 24px;
    height: 40px;
    border: none;
    border-radius: 20px;
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    background: transparent;
    color: var(--md-sys-color-primary);
}
.button i, .button .material-icons { font-size: 18px; }

.button.filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}
.button.filled:hover { background: #004d87; }

.button.tonal {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}
.button.tonal:hover { background: #c2d1e8; }

.button.outlined {
    border: 1px solid var(--md-sys-color-outline);
    background: transparent;
    color: var(--md-sys-color-primary);
}
.button.outlined:hover { background: rgba(var(--md-sys-color-primary-rgb), 0.05); }

.button.text {
    background: transparent;
    color: var(--md-sys-color-primary);
    width: auto;
    padding: 0 16px;
}
.button.text:hover { background: rgba(var(--md-sys-color-primary-rgb), 0.08); }

.button + .button { margin-top: 8px; }

.button:disabled,
.button.disabled {
    cursor: not-allowed;
    pointer-events: none;
    background: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border: none;
    opacity: 1;
}

.divider {
    border: none;
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 24px 0;
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 12px;
}
.friend-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.friend-info {
    flex: 1;
    min-width: 0;
}
.friend-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--md-sys-color-on-surface);
}
.friend-desc {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}
.friend-info .button.text {
    width: auto;
    padding: 0 8px;
    height: 32px;
}

.dialog {
    display: flex;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dialog.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.dialog-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.3);
}

.dialog-panel {
    background: var(--md-sys-color-surface);
    border-radius: 28px;
    border: 1px solid var(--md-sys-color-outline-variant);
    width: calc(100% - 48px);
    max-width: 500px;
    padding: 24px;
    position: relative;
    z-index: 10001;
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
}

.dialog.open .dialog-panel {
    transform: scale(1);
}

.dialog-panel.large { max-width: 600px; }
.dialog-panel h2 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--md-sys-color-on-surface);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.visit-count {
    text-align: center;
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

.announcement-item {
    margin-bottom: 16px;
}
.announcement-item:last-child {
    margin-bottom: 0;
}
.announcement-title {
    font-weight: 500;
    font-size: 18px;
    margin-bottom: 4px;
    color: var(--md-sys-color-on-surface);
}
.announcement-meta {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}
.announcement-content {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 12px;
    white-space: pre-wrap;
}
.announcement-button {
    display: inline-flex;
    width: auto;
    margin-top: 4px;
}

.novel-item {
    margin-bottom: 16px;
}
.novel-title {
    font-weight: 500;
    font-size: 18px;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}
.novel-title i {
    transition: transform 0.2s;
}

.novel-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}
.novel-children.expanded {
    max-height: 600px;
    margin-top: 12px;
}

.chapter-card {
    background: var(--md-sys-color-surface-variant);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.chapter-card .chapter-title {
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chapter-card .chapter-link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}
.chapter-card .chapter-link:hover {
    text-decoration: underline;
}

* {
    -webkit-tap-highlight-color: transparent;
}
