* { box-sizing: border-box; }

body {
    margin: 0;
    background: #f3f5f7;
    color: #182533;
    font: 1rem/1.6 system-ui, "Microsoft JhengHei", sans-serif;
}

.blog-list {
    max-width: 42rem;
    margin: 0 auto;
    padding: 1rem;
}

.blog-card {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #e0e5e9;
    border-radius: .75rem;
    background: #fff;
    overflow-wrap: anywhere;
}

.blog-card h2 {
    margin: 0;
    font-size: 1.125rem;
}

.blog-card h2 a {
    display: block;
    min-height: 44px;
    padding: .25rem 0;
    color: #17486d;
}

.blog-card p { margin: .35rem 0 0; }

.blog-date {
    color: #4a5865;
    font-size: .875rem;
}

.blog-card img {
    display: block;
    max-width: 100%;
    max-height: 15rem;
    height: auto;
    margin-top: .75rem;
    border-radius: .5rem;
}

.blog-excerpt { white-space: pre-line; }

.blog-pages {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.blog-pages a {
    min-height: 44px;
    padding: .55rem .8rem;
    border-radius: .5rem;
    background: #17486d;
    color: #fff;
}

a:focus-visible {
    outline: 2px solid #124b75;
    outline-offset: 3px;
}

.mobile-header {
    background: #fff;
    border-bottom: 1px solid #e0e5e9;
}

.mobile-header-inner {
    position: relative;
    max-width: 42rem;
    margin: 0 auto;
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mobile-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.mobile-menu-toggle {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #e0e5e9;
    border-radius: .5rem;
    background: #fff;
    color: #111;
    font: 1.5rem/1 system-ui, sans-serif;
    cursor: pointer;
}

.mobile-menu-toggle:focus-visible {
    outline: 2px solid #124b75;
    outline-offset: 3px;
}

.mobile-menu {
    position: absolute;
    z-index: 1;
    top: 100%;
    right: 1rem;
    width: min(16rem, calc(100% - 2rem));
    overflow: hidden;
    border: 1px solid #e0e5e9;
    border-radius: .5rem;
    background: #fff;
    box-shadow: 0 .25rem 1rem rgb(0 0 0 / 15%);
}

.mobile-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: .5rem 1rem;
    color: #111;
    text-decoration: none;
}

.mobile-menu a + a { border-top: 1px solid #e0e5e9; }

.mobile-menu a:hover,
.mobile-menu a:focus-visible {
    background: #f3f5f7;
    outline-offset: -2px;
}

.blog-card h2 a { text-decoration: none; }
.blog-image-link { display: block; }
.blog-expand {
    display: inline-block;
    margin-left: .25em;
    padding: 0;
    border: 0;
    background: transparent;
    color: #17486d;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: baseline;
    cursor: pointer;
}
.blog-expand[aria-disabled="true"] { opacity: .6; cursor: wait; }
.blog-full { max-width: 100%; overflow-x: auto; }
.blog-full-frame {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    height: 160px;
}
.blog-tools {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: nowrap;
    gap: 24px;
    margin-top: .6rem;
}
.blog-tools button, .blog-tools a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 44px;
    padding: .4rem 0;
    flex: 0 0 auto;
    white-space: nowrap;
    border: 0;
    border-radius: .35rem;
    background: transparent;
    color: #4a5865;
    font: inherit;
    font-size: .95rem;
    text-decoration: none;
    cursor: pointer;
}
.blog-tools svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linejoin: round;
}
.blog-tools [aria-pressed="true"] { color: #1764c0; background: #edf4ff; }
.blog-tools button:hover, .blog-tools a:hover { background: #f3f5f7; }
.blog-status { color: #4a5865; font-size: .85rem; }
.blog-status:empty { display: none; }
.blog-copy-input { position: fixed; top: 0; left: -9999px; }
[hidden] { display: none !important; }


/* Mobile article detail only. */
body.mobile-detail { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.mobile-detail #header, .mobile-detail #sidemenu, .mobile-detail #footer,
.mobile-detail #content > .time, .mobile-detail #content > .postCommand,
.mobile-detail #content > .pageCount { display: none; }
.mobile-detail #page {
    width: 100%;
    max-width: 42rem;
    margin: 0 auto;
    padding: 16px;
    background: transparent;
}
.mobile-detail #content {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 16px;
    background: white;
    border: 1px solid #e0e5e9;
    border-radius: 12px;
    overflow-wrap: anywhere;
}
.mobile-detail #content h1 { margin: 0 0 16px; font-size: 1.4rem; }
.mobile-detail #content h1 a { display: none; }
.mobile-detail #content .postContent { width: auto; float: none; margin: 12px 0; }
.mobile-detail #content img, .mobile-detail #content video {
    max-width: 100%;
    height: auto;
}
.mobile-detail #content iframe, .mobile-detail #content embed,
.mobile-detail #content object { max-width: 100%; }
.mobile-detail #content table { max-width: 100%; }
.mobile-detail .mobile-article-content { overflow-x: auto; white-space: pre-wrap; }
.mobile-detail .mobile-article-content table { white-space: normal; }
.mobile-detail #content > div { min-width: 0; max-width: 100%; }
.mobile-detail #content > table { width: 100%; table-layout: fixed; overflow-wrap: anywhere; }
.mobile-detail #commentform table { width: 100%; table-layout: fixed; }
.mobile-detail #commentform th { width: 56px; }
.mobile-detail #commentform input:not([type="hidden"]),
.mobile-detail #commentform textarea { max-width: 100%; font: inherit; }
.mobile-detail #commentform textarea { width: 100%; }
.mobile-detail #form1, .mobile-detail #post { scroll-margin-top: 16px; }
.detail-toolbar {
    position: fixed;
    z-index: 20;
    inset: auto 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid #e0e5e9;
}
.detail-toolbar-group { display: flex; align-items: center; gap: 24px; }
.detail-toolbar button, .detail-toolbar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #4a5865;
    cursor: pointer;
}
.detail-toolbar svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.detail-toolbar [aria-pressed="true"] { color: #1764c0; }
.detail-status {
    position: fixed;
    z-index: 21;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    padding: 8px;
    background: #fff;
    color: #4a5865;
    border-radius: 8px;
    font-size: .85rem;
}
.detail-status:empty { display: none; }


/* Keep legacy article widths inside the mobile detail page. */
.mobile-detail #page,
.mobile-detail #content,
.mobile-detail #content .postContent,
.mobile-detail #CollapsiblePanel1,
.mobile-detail #CollapsiblePanel1 > .CollapsiblePanelTab,
.mobile-detail #CollapsiblePanel1 > .mobile-article-content {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.mobile-detail #CollapsiblePanel1 > .mobile-article-content {
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.mobile-detail .mobile-article-content :is(div, p, section, article, h1, h2, h3, h4, ul, ol, blockquote, pre) {
    box-sizing: border-box;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere;
}
.mobile-detail .mobile-article-content pre { white-space: pre-wrap; }
.mobile-detail #content img,
.mobile-detail #content video {
    box-sizing: border-box;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
}
.mobile-detail .mobile-article-content :is(iframe, embed, object) {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
}
.mobile-detail .detail-table-scroll {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-detail .detail-table-scroll > table {
    margin-left: 0;
    margin-right: 0;
}
.mobile-detail .detail-toolbar {
    box-sizing: border-box;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
}
.blog-tools .blog-category {
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: 0;
    color: #111;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.blog-tools .blog-category:hover { background: transparent; }


/* Bottom navigation is scoped to the article list. */
body.mobile-list-page { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.list-toolbar {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid #e0e5e9;
}
.list-toolbar-group { display: flex; align-items: center; gap: 24px; }
.list-toolbar button, .list-toolbar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #4a5865;
    cursor: pointer;
}
.list-toolbar svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.list-toolbar [aria-expanded="true"] { color: #1764c0; }
.list-panel {
    position: fixed;
    z-index: 31;
    left: 0;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px 16px;
    border-top: 1px solid #e0e5e9;
    background: #fff;
    box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
}
.list-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.list-panel-close { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: #4a5865; font: inherit; font-size: 24px; cursor: pointer; }
.list-search-form { display: flex; align-items: center; gap: 8px; }
.list-search-form input { flex: 1; min-width: 0; width: 100%; min-height: 44px; padding: 8px; border: 1px solid #a6b1bc; border-radius: 5px; font: inherit; }
.list-search-form button { flex: 0 0 auto; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 5px; background: #17486d; color: white; font: inherit; cursor: pointer; }
.list-category-links a { display: flex; align-items: center; min-height: 48px; padding: 8px 0; color: #182533; text-decoration: none; overflow-wrap: anywhere; }
.list-category-links a + a { border-top: 1px solid #e0e5e9; }
