/*
Theme Name: Comic
Author: kenny
Version: 1.0.0
*/

/* ===== Color Tokens ===== */
:root {
    --color-primary: #6C9BD2;
    --color-on-primary: #ffffff;
    --color-primary-container: #D4E8F8;
    --color-on-primary-container: #003065;
    --color-surface: #faf9f7;
    --color-surface-dim: #d9dad8;
    --color-surface-container-lowest: #ffffff;
    --color-surface-container-low: #f4f4f1;
    --color-surface-container: #edeeec;
    --color-surface-container-high: #e7e8e6;
    --color-surface-container-highest: #e1e3e0;
    --color-on-surface: #303331;
    --color-on-surface-variant: #5d605e;
    --color-outline: #797b79;
    --color-outline-variant: #b0b2b0;
    --color-tertiary-container: #cde1fc;
    --color-on-tertiary-container: #3e5268;
    --topbar-height: 64px;
    --bottomnav-height: 72px;
}

/* ===== Base ===== */
body {
    background-color: var(--color-surface) !important;
    color: var(--color-on-surface) !important;
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100dvh;
}

/* ===== Top App Bar ===== */
.app-topbar {
    background: rgba(250, 249, 247, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: var(--topbar-height);
    border-bottom: 1px solid var(--color-surface-container-high);
    z-index: 999;
}

.app-topbar .app-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a3a5c;
    letter-spacing: -0.02em;
    margin: 0;
}

.app-topbar .topbar-icon-btn {
    color: #1a3a5c;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-topbar .topbar-icon-btn:hover {
    background: rgba(108, 155, 210, 0.12);
}

.user-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary-container);
}

/* ===== Main Content ===== */
.main-content {
    padding-top: calc(var(--topbar-height) + 1.25rem);
    padding-bottom: calc(var(--bottomnav-height) + 1.25rem);
    padding-left: 15px;
    padding-right: 15px;
    max-width: 640px;
    margin: 0 auto;
}

/* ===== Bottom Navigation ===== */
.app-bottomnav {
    background: rgba(250, 249, 247, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 2rem 2rem 0 0;
    box-shadow: 0 -4px 40px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 1rem;
    height: var(--bottomnav-height);
}

.bottomnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #9ca3af;
    padding: 0.375rem 1.25rem;
    border-radius: 9999px;
    transition: color 0.2s, background 0.2s;
    gap: 2px;
    line-height: 1;
}

.bottomnav-item .nav-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.bottomnav-item:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.bottomnav-item.active {
    background-color: var(--color-primary-container);
    color: #003065;
}

/* ===== Material Symbols ===== */
.material-symbols-outlined {
    font-size: 24px;
    line-height: 1;
    display: block;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ===== Hero Section ===== */
.anime-cover-wrap {
    border-radius: 1.5rem;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--color-surface-container-low);
}

.anime-cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.season-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    background-color: var(--color-tertiary-container);
    color: var(--color-on-tertiary-container);
    font-size: 0.875rem;
    font-weight: 500;
}

.anime-main-title {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-on-surface);
    line-height: 1.2;
    margin: 0;
}

.anime-episode-subtitle {
    color: var(--color-on-surface-variant);
    font-size: 1.125rem;
    opacity: 0.85;
    margin: 0;
}

/* ===== Episode Navigation ===== */
.episodes-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    scrollbar-width: none;
}

.episodes-scroll::-webkit-scrollbar {
    display: none;
}

.ep-btn {
    flex-shrink: 0;
    width: 4rem;
    height: 4rem;
    border-radius: 0.75rem;
    background: var(--color-surface-container-high);
    border: none;
    color: var(--color-on-surface-variant);
    font-weight: 700;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ep-btn:hover {
    background: var(--color-primary-container);
    color: var(--color-on-primary-container);
}

.ep-btn.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
    box-shadow: 0 0 0 4px var(--color-primary-container);
}

/* ===== Tabs Navigation ===== */
.anime-tabs-nav {
    position: sticky;
    top: var(--topbar-height);
    z-index: 10;
    background: rgba(250, 249, 247, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin: 0 -1.5rem;
    padding: 1rem 1.5rem;
}

.tabs-pill-wrap {
    background: var(--color-surface-container-high);
    border-radius: 9999px;
    padding: 0.375rem;
    display: flex;
    gap: 0.25rem;
}

.tabs-pill-wrap.nav {
    margin: 0;
    list-style: none;
}

.tabs-pill-wrap .nav-item {
    flex: 1;
}

.tab-pill-btn {
    flex: 1;
    padding: 0.625rem;
    border-radius: 9999px;
    border: none;
    font-weight: 700;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    color: var(--color-on-surface-variant);
    background: transparent;
    cursor: pointer;
}

.tabs-pill-wrap .nav-link {
    width: 100%;
    padding: 0.625rem;
    border-radius: 9999px;
    border: none;
    font-weight: 700;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    color: var(--color-on-surface-variant);
    background: transparent;
    text-align: center;
}

.tab-pill-btn.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
    box-shadow: 0 2px 8px rgba(108, 155, 210, 0.3);
}

.tabs-pill-wrap .nav-link.active,
.tabs-pill-wrap .show>.nav-link {
    background: var(--color-primary);
    color: var(--color-on-primary);
    box-shadow: 0 2px 8px rgba(108, 155, 210, 0.3);
}

.tab-pill-btn:hover:not(.active) {
    background: var(--color-surface-dim);
}

.tabs-pill-wrap .nav-link:hover:not(.active) {
    background: var(--color-surface-dim);
    color: var(--color-on-surface-variant);
}

/* ===== Tab Content Panes ===== */
.tab-pane-content {
    display: none;
}

.tab-pane-content.active {
    display: block;
}

/* ===== Intro Tab ===== */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

.synopsis-text {
    color: var(--color-on-surface-variant);
    font-size: 1.125rem;
    line-height: 1.75;
}

.meta-card {
    background: var(--color-surface-container-low);
    padding: 1rem;
    border-radius: 0.75rem;
}

.meta-card .meta-label {
    font-size: 0.75rem;
    color: rgba(93, 96, 94, 0.6);
    display: block;
    margin-bottom: 0.25rem;
}

.meta-card .meta-value {
    font-weight: 700;
    font-size: 0.875rem;
    margin: 0;
}

/* ===== Cast Tab ===== */
.cast-card {
    background: var(--color-surface-container-low);
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cast-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-surface-container-high);
    flex-shrink: 0;
}

.cast-name {
    font-weight: 700;
    font-size: 0.9375rem;
    margin: 0;
}

.cast-cv {
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
    margin: 0;
}

/* ===== Section Divider ===== */
.section-divider {
    border-color: var(--color-surface-container-high) !important;
    margin: 0;
}

/* ===== Comments Section ===== */
.comments-input-box {
    background: var(--color-surface-container-lowest);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 40px 0 rgba(0, 0, 0, 0.04);
}

.comment-textarea {
    width: 100%;
    background: var(--color-surface-container-high);
    border: none;
    border-radius: 0.75rem;
    padding: 1rem;
    min-height: 200px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-on-surface);
    resize: none;
    transition: background 0.2s, box-shadow 0.2s;
}

.comment-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(108, 155, 210, 0.25);
    background: var(--color-surface-container-lowest);
}

.btn-post-comment {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border: none;
    padding: 0.625rem 2rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(108, 155, 210, 0.2);
}

.btn-post-comment:active {
    transform: scale(0.95);
}

.btn-post-comment:hover {
    background: var(--color-on-primary-container, #003065);
    color: var(--color-on-primary);
}

.comment-card {
    background: var(--color-surface-container-low);
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    gap: 1rem;
    transition: background 0.2s;
}

.comment-card:hover {
    background: var(--color-surface-container-high);
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--color-surface-container-high);
}

.comment-username {
    font-weight: 700;
    font-size: 0.875rem;
}

.comment-time {
    font-size: 0.75rem;
    color: rgba(93, 96, 94, 0.6);
}

.comment-text {
    color: var(--color-on-surface-variant);
    font-size: 1.0625rem;
    line-height: 1.65;
    margin: 0;
}

.comment-reply-wrap {
    padding-left: 3rem;
}

.comment-reply-card {
    background: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    gap: 0.75rem;
    transition: background 0.2s;
}

.comment-reply-card:hover {
    background: var(--color-surface-container-low);
}

.comment-reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--color-surface-container-high);
}

.btn-like,
.btn-comment-reply {
    background: none;
    border: none;
    color: var(--color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-like:hover,
.btn-comment-reply:hover,
.btn-like.liked {
    color: var(--color-primary);
}

.btn-load-more {
    width: 100%;
    padding: 1rem;
    border-radius: 0.75rem;
    background: var(--color-surface-container-high);
    color: var(--color-on-surface-variant);
    border: none;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-load-more:hover {
    background: var(--color-surface-dim);
}

/* ===== Section spacing ===== */
.page-section {
    margin-bottom: 2.5rem;
}

/* ===== Search Input ===== */
.at-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.at-search-icon {
    position: absolute;
    left: 1rem;
    color: var(--color-on-surface-variant);
    font-size: 1.25rem;
    pointer-events: none;
}

.at-search-input {
    width: 100%;
    background: var(--color-surface-container-high);
    border: none;
    border-radius: 9999px;
    padding: 0.75rem 3rem 0.75rem 3rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-on-surface);
    transition: background 0.2s, box-shadow 0.2s;
}

.at-search-input:focus {
    outline: none;
    background: var(--color-surface-container-lowest);
    box-shadow: 0 0 0 2px rgba(108, 155, 210, 0.25);
}

.at-search-input::placeholder {
    color: var(--color-on-surface-variant);
    opacity: 0.7;
}

.at-search-spinner {
    position: absolute;
    right: 1rem;
}

/* ===== First Comment CTA ===== */
.at-first-comment-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    background: var(--color-surface-container-low);
    border-radius: 1.25rem;
}

.at-cta-icon {
    font-size: 3rem !important;
    color: var(--color-primary);
    opacity: 0.7;
}

.at-cta-label {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0;
}

.at-cta-sub {
    font-size: 0.875rem;
    color: var(--color-on-surface-variant);
    margin: 0 0 0.75rem;
}

.btn-first-comment {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--color-primary);
    color: var(--color-on-primary);
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 4px 16px rgba(108, 155, 210, 0.25);
}

.btn-first-comment:hover {
    opacity: 0.9;
}

.btn-first-comment:active {
    transform: scale(0.97);
}

.btn-first-comment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Search Result Cards ===== */
.at-search-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.at-search-card__link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    border-radius: 1rem;
    background: var(--color-surface-container-low);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.at-search-card__link:hover {
    background: var(--color-surface-container-high);
    text-decoration: none;
    color: inherit;
}

.at-search-card__thumb {
    width: 72px;
    height: 72px;
    border-radius: 0.625rem;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-surface-container-high);
}

.at-search-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.at-search-card__no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-outline);
}

.at-search-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.at-search-card__title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.at-search-card__comments {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--color-on-surface-variant);
    opacity: 0.7;
}

.at-search-card__comments .material-symbols-outlined {
    font-size: 15px;
}

.at-search-card__comments.has-comments {
    color: var(--color-primary);
    opacity: 1;
    font-weight: 600;
}

.at-search-empty {
    color: var(--color-on-surface-variant);
    text-align: center;
    padding: 2rem 0;
    font-size: 0.9375rem;
}

/* ===== Side Drawer ===== */
.app-drawer {
    width: 280px;
    border-right: none;
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.08);
}

.app-drawer .offcanvas-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--color-surface-container-high);
}

.app-drawer .offcanvas-body {
    padding: 1rem 0.75rem;
}

.drawer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary-container);
}

.drawer-username {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--color-on-surface);
}

.drawer-site {
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--color-on-surface-variant);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background 0.15s, color 0.15s;
}

.drawer-nav-item:hover {
    background: var(--color-surface-container-low);
    color: var(--color-on-surface);
    text-decoration: none;
}

.drawer-nav-item.active {
    background: var(--color-primary-container);
    color: var(--color-on-primary-container);
    font-weight: 700;
}

.drawer-divider {
    border-color: var(--color-surface-container-high);
    margin: 0.5rem 0.25rem;
}

/* ===== Login Page ===== */
.at-login-wrap {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.at-login-card {
    width: 100%;
    max-width: 360px;
    background: var(--color-surface-container-lowest);
    border-radius: 1.5rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.at-login-logo .material-symbols-outlined {
    font-size: 3rem !important;
    color: var(--color-primary);
}

.at-login-title {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--color-on-surface);
    margin: 0;
}

.at-login-subtitle {
    font-size: 0.9375rem;
    color: var(--color-on-surface-variant);
    margin: 0 0 1rem;
}

.at-login-error {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: #fef2f2;
    color: #b91c1c;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    width: 100%;
}

.at-social-btns {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.at-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.8125rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    border: 1.5px solid transparent;
}

.at-social-btn:hover {
    opacity: 0.88;
    text-decoration: none;
    transform: translateY(-1px);
}

.at-social-btn:active {
    transform: scale(0.97);
}

.at-social-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.at-social-btn--google {
    background: #fff;
    color: #3c4043;
    border-color: #dadce0;
}

.at-social-btn--line {
    background: #00B900;
    color: #fff;
}

.at-social-btn--x {
    background: #000;
    color: #fff;
}

.at-login-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    padding: 1.5rem;
    background: var(--color-surface-container-low);
    border-radius: 1rem;
    color: var(--color-on-surface-variant);
    font-size: 0.875rem;
}

.at-login-notice .material-symbols-outlined {
    font-size: 2rem !important;
    opacity: 0.5;
}

/* ===== Comments Login CTA ===== */
.at-login-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    background: var(--color-surface-container-low);
    border-radius: 1.25rem;
}

.at-login-cta-icon {
    font-size: 2.5rem !important;
    color: var(--color-on-surface-variant);
    opacity: 0.5;
}

.at-login-cta-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-on-surface-variant);
    margin: 0 0 0.5rem;
}

/* ===== Latest Discussions (index.php) ===== */
.at-disc-card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem;
    background: var(--color-surface-container);
    border-radius: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.at-disc-card:hover {
    background: var(--color-surface-container-high);
    color: inherit;
}

.at-disc-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--color-surface-container-high);
}

.at-disc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.at-disc-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-outline);
}

.at-disc-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.at-disc-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.at-disc-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.at-disc-author {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-primary);
}

.at-disc-dot,
.at-disc-time {
    font-size: 0.7rem;
    color: var(--color-on-surface-variant);
}

.at-disc-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.at-disc-excerpt {
    font-size: 0.8125rem;
    color: var(--color-on-surface-variant);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Search Infinite Scroll Sentinel ===== */
.at-search-sentinel {
    padding: 1.5rem 0;
    display: flex;
    justify-content: center;
}

.at-search-loading {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-on-surface-variant);
}


/* ── HTMX SPA 換頁 transition ─────────────────────────────────────── */
#at-main {
    transition: opacity 0.15s ease;
}

#at-main.htmx-swapping {
    opacity: 0;
}


/* ===== Profile Page ===== */

.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.profile-avatar-ring {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-container));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.profile-avatar-img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover;
    border: 3px solid var(--color-surface) !important;
    display: block;
}

.profile-username {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-on-surface);
    margin: 0;
}

.profile-bio {
    font-size: 0.9375rem;
    color: var(--color-on-surface-variant);
    font-style: italic;
    margin: 0;
    opacity: 0.85;
}

/* Stats */
.profile-stats {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.stat-pill {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 0.5rem;
    background: var(--color-surface-container-low);
    border-radius: 1rem;
}

.stat-pill--active {
    background: var(--color-primary-container);
}

.stat-number {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-on-surface);
    line-height: 1;
}

.stat-label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
}

/* Profile tabs */
.profile-tabs-nav {
    margin-bottom: 1.25rem;
}

/* Profile comment list */
.profile-comment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-view-all {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.profile-view-all:hover {
    text-decoration: underline;
}

.profile-comment-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    background: var(--color-surface-container-low);
    border-radius: 1rem;
    transition: background 0.15s;
}

.profile-comment-card:hover {
    background: var(--color-surface-container);
}

.profile-comment-thumb {
    width: 64px;
    height: 64px;
    border-radius: 0.625rem;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-surface-container-high);
}

.profile-comment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-comment-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-outline);
}

.profile-comment-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.profile-comment-post {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-comment-text {
    font-size: 0.8125rem;
    color: var(--color-on-surface-variant);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-comment-time {
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
    opacity: 0.6;
}

.profile-comment-card {
    text-decoration: none;
    color: inherit;
    display: flex;
}

.profile-comment-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.1rem;
}

.profile-comment-likes {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
}

/* ── Profile Anime Grid (看完了 / 正在看) ─────────────────────── */
.profile-anime-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-anime-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--color-surface-container-low);
    border-radius: 1rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.profile-anime-card:hover {
    background: var(--color-surface-container);
}

.profile-anime-thumb {
    width: 52px;
    height: 72px;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    background: var(--color-surface-container-high);
}

.profile-anime-thumb--placeholder {
    width: 52px;
    height: 72px;
    border-radius: 0.5rem;
    background: var(--color-surface-container-high);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-outline);
}

.profile-anime-info {
    flex: 1;
    min-width: 0;
}

.profile-anime-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-on-surface);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-anime-status {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
}

/* ── Profile Infinite Scroll ─────────────────────────────────── */
.profile-batch {
    display: contents;
    /* 不佔位，子元素直接進入父容器排版 */
}

.profile-load-sentinel {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.profile-load-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-outline);
}

.profile-load-spinner .material-symbols-outlined {
    font-size: 2rem;
    animation: profile-spin 1s linear infinite;
}

@keyframes profile-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── 首頁討論 sentinel ─────────────────────────────────────────── */

/* display:contents 讓 batch div 在 flex 佈局中透明，子卡片直接繼承 gap-3 */
.at-disc-batch {
    display: contents;
}

.at-disc-sentinel {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.at-disc-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-outline);
}

.at-disc-spinner .material-symbols-outlined {
    font-size: 2rem;
    animation: profile-spin 1s linear infinite;
}

/* Settings */
.profile-settings .section-title {
    font-size: 1.125rem;
}

.settings-list {
    display: flex;
    flex-direction: column;
    background: var(--color-surface-container-lowest);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--color-on-surface);
    border-bottom: 1px solid var(--color-surface-container-high);
    transition: background 0.15s;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row:hover {
    background: var(--color-surface-container-low);
    text-decoration: none;
    color: var(--color-on-surface);
}

.settings-row__icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 0.625rem;
    background: var(--color-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-on-primary-container);
}

.settings-row__icon-wrap .material-symbols-outlined {
    font-size: 20px;
}

.settings-row__label {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
}

.settings-row__arrow {
    color: var(--color-on-surface-variant);
    opacity: 0.4;
    font-size: 20px !important;
}

/* Logout */
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    border-radius: 1rem;
    border: 1.5px solid var(--color-outline-variant);
    background: transparent;
    color: var(--color-on-surface);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.btn-logout:hover {
    background: var(--color-surface-container-low);
    text-decoration: none;
    color: var(--color-on-surface);
    border-color: var(--color-outline);
}

.profile-version {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
    opacity: 0.5;
    margin-top: 1.25rem;
    margin-bottom: 0;
}


/* ===== Notifications Page ===== */

.notif-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.notif-filter-wrap {
    display: flex;
    gap: 0.5rem;
}

.notif-filter-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    border: 1.5px solid var(--color-outline-variant);
    background: transparent;
    color: var(--color-on-surface-variant);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.notif-filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-on-primary);
}

.notif-filter-btn:hover:not(.active) {
    background: var(--color-surface-container);
    border-color: var(--color-outline);
    color: var(--color-on-surface);
}

.notif-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.notif-card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem;
    background: var(--color-surface-container-lowest);
    border-radius: 1rem;
    border: 1px solid var(--color-surface-container-high);
    position: relative;
    transition: background 0.15s;
}

.notif-card:hover {
    background: var(--color-surface-container-low);
}

.notif-card--unread {
    background: var(--color-surface-container-low);
    border-color: var(--color-primary-container);
}

.notif-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon-wrap .material-symbols-outlined {
    font-size: 20px;
}

.notif-icon--reply {
    background: var(--color-primary-container);
    color: var(--color-on-primary-container);
}

.notif-icon--episode {
    background: #dbeafe;
    color: #1e40af;
}

.notif-icon--like {
    background: #fce7f3;
    color: #be185d;
}

.notif-icon--system {
    background: var(--color-surface-container-high);
    color: var(--color-on-surface-variant);
}

.notif-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.notif-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-on-surface);
    line-height: 1.35;
}

.notif-desc {
    font-size: 0.8125rem;
    color: var(--color-on-surface-variant);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
    opacity: 0.55;
    margin-top: 0.125rem;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 0.3rem;
}

/* ── Notification Bell Badge (footer) ────────────────────────── */
.notif-bell-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.at-notif-badge {
    position: absolute;
    top: -5px;
    right: -7px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--color-error, #e53935);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.at-notif-badge:empty {
    display: none;
}

/* ── Anime Status Buttons ─────────────────────────────────────── */
.at-anime-status-wrap {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.at-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1.5px solid var(--color-outline-variant);
    background: transparent;
    color: var(--color-on-surface-variant);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.at-status-btn:hover {
    background: var(--color-surface-container-high);
    border-color: var(--color-outline);
    color: var(--color-on-surface);
}

.at-status-btn.active {
    background: var(--color-primary-container);
    border-color: var(--color-primary);
    color: var(--color-on-primary-container);
}

.at-status-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ── @mention highlight ─────────────────────────────────────── */
.at-mention {
    color: var(--color-primary);
    font-weight: 600;
}

/* ── Profile Avatar Edit ─────────────────────────────────────── */
.profile-avatar-ring {
    position: relative;
    display: inline-block;
}

.profile-avatar-edit-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.42);
    color: #fff;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s;
}

.profile-avatar-ring:hover .profile-avatar-edit-btn,
.profile-avatar-edit-btn:focus {
    opacity: 1;
}

.profile-avatar-edit-btn .material-symbols-outlined {
    font-size: 28px;
}

/* ── Avatar Crop Modal ───────────────────────────────────────── */
.at-avatar-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.at-avatar-modal {
    background: var(--color-surface-container-lowest);
    border-radius: 20px;
    padding: 1.25rem;
    width: min(420px, 94vw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.at-avatar-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0;
}

.at-cropper-wrap {
    width: 100%;
    height: 280px;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
}

.at-cropper-wrap img {
    display: block;
    max-width: 100%;
}

/* 圓形裁切框 */
.at-cropper-wrap .cropper-view-box,
.at-cropper-wrap .cropper-face {
    border-radius: 50%;
}

.at-cropper-wrap .cropper-view-box {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 0;
}

.at-cropper-wrap .cropper-face {
    background: transparent;
}

.at-avatar-modal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.at-avatar-rotate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1.5px solid var(--color-outline-variant);
    background: transparent;
    color: var(--color-on-surface-variant);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s;
}

.at-avatar-rotate-btn:hover {
    background: var(--color-surface-container-high);
}

.at-avatar-rotate-btn .material-symbols-outlined {
    font-size: 16px;
}

.at-avatar-modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.at-avatar-cancel-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: 1.5px solid var(--color-outline-variant);
    background: transparent;
    color: var(--color-on-surface-variant);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.at-avatar-save-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.at-avatar-save-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.anime-description {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.anime-description iframe {
    border: none;
    border-radius: 12px;
    width: 100%;
    aspect-ratio: 16 / 9;
}

/* ===== Favorites Grid ===== */
.fav-section {
    margin-bottom: 1.5rem;
}

.fav-section__header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.875rem;
}

.fav-section__icon {
    font-size: 20px;
    font-variation-settings: 'FILL' 1;
    color: #e05252;
}

.fav-section__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0;
    letter-spacing: -0.01em;
}

/* ── 3×3 grid ── */
.fav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.fav-cell {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-surface-container);
    /* 防止 grid item 因內容撐高破壞 aspect-ratio */
    min-height: 0;
    min-width: 0;
    box-sizing: border-box;
    width: 100%;
}

/* filled cell */
.fav-cell--filled .fav-cell__inner {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    position: relative;
}

.fav-cell--filled img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.fav-cell--filled:hover img {
    transform: scale(1.04);
}

.fav-cell__no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-outline);
    background: var(--color-surface-container-high);
}

.fav-cell__overlay {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    padding: 28px 7px 7px;
    pointer-events: none;
}

.fav-cell__title {
    font-size: 0.6rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: 0.01em;
}

/* remove button — top-right corner */
.fav-cell__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    /* 視覺大小 26px，觸控安全區用 pseudo-element 擴大到 44px */
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.15s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 3;
}

/* 擴大觸控命中區，不影響視覺 */
.fav-cell__remove::before {
    content: '';
    position: absolute;
    inset: -9px;
    border-radius: 50%;
}

.fav-cell__remove:hover {
    background: rgba(220, 53, 69, 0.9);
    transform: scale(1.1);
}

.fav-cell__remove:hover {
    background: rgba(220, 53, 69, 0.85);
}

.fav-cell__remove .material-symbols-outlined {
    font-size: 14px;
    line-height: 1;
}

/* empty cell */
.fav-cell--empty {
    /* button reset — 避免 UA 預設尺寸干擾 aspect-ratio */
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    min-height: 0;
    min-width: 0;
    padding: 0;
    font: inherit;
    /* layout */
    border: 2px dashed var(--color-outline-variant);
    background: transparent;
    cursor: pointer;
    color: var(--color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.fav-cell--empty:not(.fav-cell--placeholder):hover {
    border-color: var(--color-primary);
    background: rgba(108, 155, 210, 0.08);
    color: var(--color-primary);
}

.fav-cell--empty .material-symbols-outlined {
    font-size: 24px;
}

/* ── Drag-to-reorder ────────────────────────────────────── */
.fav-cell--filled {
    cursor: grab;
}
.fav-cell--filled:active {
    cursor: grabbing;
}
/* Ghost placeholder shown during drag */
.fav-cell--ghost {
    opacity: 0.35;
    outline: 2px dashed var(--color-primary);
    outline-offset: -2px;
}
/* The element being dragged */
.fav-cell--chosen {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transform: scale(1.04);
    z-index: 10;
}
/* Remove button keeps pointer cursor when inside a grabbed cell */
.fav-cell--filled .fav-cell__remove {
    cursor: pointer;
}

.fav-cell--placeholder {
    cursor: default;
    opacity: 0.4;
}

/* ===== 個人設置 Modal (Bottom Sheet) ===== */
.at-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
}
.at-settings-modal.is-open {
    pointer-events: auto;
}
.at-settings-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.28s ease;
}
.at-settings-modal.is-open .at-settings-modal__backdrop {
    opacity: 1;
}
.at-settings-modal__sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 540px;
    margin: 0 auto;
    background: var(--color-surface);
    border-radius: 20px 20px 0 0;
    padding: 0 0 max(1.5rem, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    gap: 0;
}
.at-settings-modal.is-open .at-settings-modal__sheet {
    transform: translateY(0);
}
.at-settings-modal__handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-outline-variant);
    margin: 12px auto 0;
    flex-shrink: 0;
}
.at-settings-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.25rem;
}
.at-settings-modal__heading {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0;
}
.at-settings-modal__close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-on-surface-variant);
    transition: background 0.15s;
}
.at-settings-modal__close:hover {
    background: var(--color-surface-container-low);
}
.at-settings-modal__body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}
/* fields */
.at-settings-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.at-settings-field__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-on-surface-variant);
    letter-spacing: 0.02em;
}
.at-settings-field__input {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--color-outline-variant);
    border-radius: 10px;
    background: var(--color-surface-container-lowest, #fff);
    color: var(--color-on-surface);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.at-settings-field__input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108, 155, 210, 0.18);
}
/* slug row: prefix + input */
.at-settings-field__slug-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--color-outline-variant);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--color-surface-container-lowest, #fff);
}
.at-settings-field__slug-wrap:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108, 155, 210, 0.18);
}
.at-settings-field__slug-prefix {
    padding: 0.65rem 0.5rem 0.65rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--color-on-surface-variant);
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}
.at-settings-field__input--slug {
    border: none;
    border-radius: 0;
    padding-left: 0;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
}
.at-settings-field__input--slug:focus {
    border-color: transparent;
    box-shadow: none;
}
.at-settings-field__hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
    opacity: 0.75;
}
/* message */
.at-settings-msg {
    font-size: 0.875rem;
    min-height: 1.2em;
    color: var(--color-on-surface-variant);
}
.at-settings-msg--error   { color: #d32f2f; }
.at-settings-msg--success { color: #388e3c; }
/* footer buttons */
.at-settings-modal__footer {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem 0;
}
.at-settings-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
}
.at-settings-btn:disabled { opacity: 0.55; cursor: default; }
.at-settings-btn--cancel {
    background: var(--color-surface-container-low);
    color: var(--color-on-surface-variant);
}
.at-settings-btn--save {
    background: var(--color-primary);
    color: #fff;
}
.at-settings-btn--save:hover:not(:disabled) { opacity: 0.88; }
/* drawer button variant */
button.drawer-nav-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

/* ===== Favorites Picker (Bottom Sheet) ===== */
.fav-picker {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
}

.fav-picker.is-open {
    pointer-events: auto;
}

.fav-picker__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.fav-picker.is-open .fav-picker__backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.fav-picker__sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface-container-lowest);
    border-radius: 20px 20px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 0);
    max-height: 82dvh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15);
}

.fav-picker.is-open .fav-picker__sheet {
    transform: translateY(0);
}

.fav-picker__handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-outline-variant);
    margin: 10px auto 0;
    flex-shrink: 0;
}

.fav-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    flex-shrink: 0;
}

.fav-picker__heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0;
}

.fav-picker__close {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-on-surface-variant);
    display: flex;
    align-items: center;
    transition: background 0.15s;
}

.fav-picker__close:hover {
    background: var(--color-surface-container-high);
}

.fav-picker__search-wrap {
    position: relative;
    margin: 0 16px 10px;
    flex-shrink: 0;
}

.fav-picker__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-on-surface-variant);
    font-size: 20px;
    pointer-events: none;
}

.fav-picker__input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border-radius: 28px;
    border: 1.5px solid var(--color-outline-variant);
    background: var(--color-surface-container-low);
    font-size: 0.9375rem;
    color: var(--color-on-surface);
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.fav-picker__input:focus {
    border-color: var(--color-primary);
}

.fav-picker__results {
    overflow-y: auto;
    flex: 1;
    padding: 0 16px 16px;
    overscroll-behavior: contain;
}

/* reuse existing .at-search-list card styles inside picker */
.fav-picker__results .at-search-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fav-picker__results .at-search-card {
    border-radius: 12px;
    background: var(--color-surface-container-low);
}

/* "add" indicator on search card inside picker */
.fav-picker__results .at-search-card__link {
    position: relative;
}

.fav-picker__results .at-search-card__link::after {
    content: 'add';
    font-family: 'Material Symbols Outlined';
    font-size: 20px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    opacity: 0.75;
}

.fav-picker__loading {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    color: var(--color-primary);
}

.fav-picker__empty {
    text-align: center;
    color: var(--color-on-surface-variant);
    padding: 2rem 0;
    font-size: 0.9375rem;
}

@keyframes fav-spin {
    to { transform: rotate(360deg); }
}

.fav-spin {
    display: inline-block;
    animation: fav-spin 0.9s linear infinite;
}

body.fav-picker-open {
    overflow: hidden;
}
/* ===== Page Template ===== */
.at-page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-on-surface);
    margin: 0 0 1.25rem;
}

.at-page-content {
    color: var(--color-on-surface);
    line-height: 1.75;
    font-size: 0.95rem;
}

.at-page-content p { margin-bottom: 1rem; }
.at-page-content h2 { font-size: 1.2rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
.at-page-content h3 { font-size: 1.05rem; font-weight: 700; margin: 1.25rem 0 0.5rem; }
.at-page-content ul,
.at-page-content ol { padding-left: 1.4rem; margin-bottom: 1rem; }
.at-page-content li { margin-bottom: 0.25rem; }
.at-page-content a { color: var(--color-primary); text-decoration: none; }
.at-page-content a:hover { text-decoration: underline; }
.at-page-content img { max-width: 100%; border-radius: 8px; }
.at-page-content hr { border: none; border-top: 1px solid var(--color-outline); margin: 1.5rem 0; }

/* ===== 留言 — 劇透切換按鈕 ===== */
.btn-spoiler-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1.5px solid var(--color-outline);
    border-radius: 20px;
    background: transparent;
    color: var(--color-on-surface-variant);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-spoiler-toggle:hover {
    background: var(--color-surface-variant);
}
.btn-spoiler-toggle.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-on-primary);
}

/* ===== 留言 — 劇透遮罩 ===== */
.at-spoiler {
    display: inline-block;
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
}
.at-spoiler__label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 4px;
    background: var(--color-on-surface);
    color: var(--color-on-surface);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background 0.2s;
}
.at-spoiler:hover .at-spoiler__label {
    opacity: 0.85;
}
.at-spoiler__content {
    display: none;
}
/* 展開後 */
.at-spoiler.is-revealed .at-spoiler__label {
    display: none;
}
.at-spoiler.is-revealed .at-spoiler__content {
    display: inline;
}

/* ===== 留言 — 刪除按鈕 ===== */
.btn-comment-delete {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-on-surface-variant);
    font-size: 0.8125rem;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.15s, color 0.15s;
    margin-left: auto;
}
.btn-comment-delete:hover {
    opacity: 1;
    color: #e53935;
}
.btn-comment-delete:disabled {
    pointer-events: none;
    opacity: 0.25;
}

/* ===== 留言 — 已刪除佔位 ===== */
.comment-card.is-deleted {
    opacity: 0.55;
}
.comment-deleted-placeholder {
    font-size: 0.875rem;
    color: var(--color-on-surface-variant);
    font-style: italic;
}

/* ===== 404 ===== */
.at-404-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem;
    min-height: 60vh;
}
.at-404-icon .material-symbols-outlined {
    font-size: 5rem;
    color: var(--color-on-surface-variant);
    opacity: 0.3;
}
.at-404-code {
    font-size: 5rem;
    font-weight: 900;
    color: var(--color-primary);
    line-height: 1;
    margin: 0.5rem 0 0;
}
.at-404-msg {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-on-surface);
    margin: 0.75rem 0 0.25rem;
}
.at-404-sub {
    font-size: 0.9rem;
    color: var(--color-on-surface-variant);
    margin: 0 0 2rem;
}
.at-404-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.at-404-btn:hover { opacity: 0.85; color: var(--color-on-primary); }

/* ===== 留言 — 頭像 & 名稱連結 ===== */
.comment-avatar-link {
    display: block;
    flex-shrink: 0;
}
.comment-avatar-link:hover .comment-avatar,
.comment-avatar-link:hover .comment-reply-avatar {
    opacity: 0.8;
}
.comment-username-link {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-on-surface);
    text-decoration: none;
}
.comment-username-link:hover {
    color: var(--color-primary);
}
