/* Common palette and page proportions */
:root {
    /* blue family matched to the header photo tint (about #359dd9) */
    --primary: #1f7fc4;
    --primary-light: #3597d8;
    --primary-dark: #17679f;
    --primary-soft: #e7f3fb;
    --btn-radius: 6px;   /* rounded corners for buttons and form controls */
    --header-bg: linear-gradient(rgba(26,84,166,.42), rgba(26,84,166,.42)), #49d2fe;
    --ink: #1f2d3d;
    --muted: #5b6b7c;
    --paper: #f4f6fa;
    --line: #dde3ec;
    /* content width follows szz.library.sh.cn: 90% wide, capped at 1440px (94% on narrow screens) */
    --measure: min(90%, 1440px);
}
@media (max-width: 839px) { :root { --measure: 94%; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; }
a { color: var(--primary-light); }

/* Thin black scrollbar (Firefox / new Chrome use the standard props, older WebKit uses the pseudo-elements) */
html { scrollbar-width: thin; scrollbar-color: #1a1a1a transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #000; }

/* Header */
/*
 * Header background: the library banner photo (text removed, res/images/header-bg.jpg).
 * Its edges are a flat sky blue (#49d2fe), so the photo blends into the solid colour on both sides.
 * Layout (both languages): logo on the first row, menu on its own full-width row below,
 * building photo on the right; a light blue tint keeps white text readable.
 */
.container.portal-header {
    width: 100%; max-width: none; padding: 0;
    background:
        linear-gradient(rgba(26,84,166,.42), rgba(26,84,166,.42)),
        url("../images/header-bg.jpg") no-repeat right center / auto 100%,
        #49d2fe;
    box-shadow: 0 2px 6px rgba(23,103,159,.22);
}
.portal-header .navbar-default .navbar-nav > li > a, .portal-banner { text-shadow: 0 1px 2px rgba(0,40,90,.35); }
.portal-masthead { width: var(--measure); margin: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
/* logo row 88px (48px logo + 20px above/below) + menu row 52px = 140px header */
.portal-banner { display: inline-block; padding: 20px 0; flex: none; }
.portal-banner img { width: 353px; max-width: 75vw; display: block; }
.portal-header .navbar { width: 100%; margin: 0; border: 0; border-top: 1px solid rgba(255,255,255,.18); border-radius: 0; background: transparent; min-height: 0; }
.portal-header .container-fluid, .portal-header .navbar-collapse { padding-inline: 0; margin-inline: 0; }
.portal-header #top-nav-menu { margin: 0; }
.portal-header .nav > li { margin-right: 0; }
.portal-header .navbar-default .navbar-nav > li > a { color: #fff; font-size: 15px; padding: 16px 12px; white-space: nowrap; }
.portal-header .navbar-default .navbar-nav > li:first-child > a { padding-left: 0; }
.portal-header .navbar-default .navbar-nav > li > a:hover,
.portal-header .navbar-default .navbar-nav > li > a:focus,
.portal-header .navbar-default .navbar-nav > .open > a,
.portal-header .navbar-default .navbar-nav > .open > a:hover,
.portal-header .navbar-default .navbar-nav > .open > a:focus { background: rgba(255,255,255,.16); color: #fff; }
.portal-header .caret { margin-left: 4px; }
.portal-header .dropdown-menu { border-radius: 0 0 4px 4px; border: 0; border-top: 3px solid var(--primary-light); box-shadow: 0 6px 16px rgba(0,0,0,.12); padding: 6px 0; }
.portal-header .dropdown-menu > li > a { padding: 7px 20px; color: var(--ink); }
.portal-header .dropdown-menu > li > a:hover,
.portal-header .dropdown-menu > li > a:focus { background: var(--primary-soft); color: var(--primary); }
.portal-header .dropdown-submenu > .dropdown-menu { border-radius: 4px; border-top: 0; }
.portal-header .dropdown-submenu:focus-within > .dropdown-menu { display: block; }
.portal-header .navbar-toggle { border-color: rgba(255,255,255,.5); }
.portal-header .navbar-toggle .icon-bar { background: white; }
.portal-header .navbar-default .navbar-toggle:hover,
.portal-header .navbar-default .navbar-toggle:focus { background: var(--primary-light); }
@media (hover: hover) and (min-width: 768px) {
    .portal-header .dropdown:hover > .dropdown-menu { display: block; }
}

/* Landing page */
.container.portal-home { width: var(--measure); max-width: none; padding: 0; }
/* Home: the card grid stretches so the page fills exactly one screen (footer space is in body padding) */
body.home-page { display: flex; flex-direction: column; min-height: 100vh; box-sizing: border-box; }
body.home-page > .portal-home { flex: 1 0 auto; display: flex; flex-direction: column; }
body.home-page > .portal-home::before, body.home-page > .portal-home::after { display: none; }
body.home-page .resource-grid { flex: 1 0 auto; grid-auto-rows: minmax(170px, 1fr); margin: 24px 0; }  /* tiles never shrink below 170px; short screens scroll instead */
.about-data { margin: 28px 0 0; padding: 0 28px; background: #fff; border: 1px solid var(--line); }
/* collapsible intro (<details open>): the whole title bar is the toggle */
.about-data > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; cursor: pointer; list-style: none; user-select: none; }
.about-data > summary::-webkit-details-marker { display: none; }
.about-data > summary::marker { content: ""; }
.about-data > summary:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 4px; border-radius: 4px; }
.about-data h2 { margin: 0; font-size: 20px; font-weight: 600; color: #222; }
.about-toggle { flex: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); transition: transform .25s ease, background-color .2s ease; }
.about-toggle svg { width: 18px; height: 18px; }
.about-data > summary:hover .about-toggle { background: #d4eaf8; }
.about-data[open] .about-toggle { transform: rotate(180deg); }
.about-data p { margin: -6px 0 0; padding-bottom: 22px; font-size: 15px; line-height: 1.9; color: #3a4757; }
@media (prefers-reduced-motion: reduce) { .about-toggle { transition: none; } }
.about-data a { color: var(--primary-light); }
.section-title { font-size: 20px; font-weight: 600; margin: 32px 0 16px; padding-bottom: 10px; color: var(--ink); border-bottom: 1px solid var(--line); }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }

/* Frosted-glass tiles (hues from the reference design); icon and title share one row */
.resource-card {
    --tone: #2f5f7a; --glass: 217,237,247; --alpha: .82;
    position: relative; overflow: hidden; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 18px;
    min-height: 170px; padding: 22px 28px 48px; border-radius: 10px; color: #23313c;
    background: rgba(var(--glass), var(--alpha));
    -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255,255,255,.65);
    box-shadow: 0 8px 24px rgba(31,60,90,.08), inset 0 1px 0 rgba(255,255,255,.75);
    transition: transform .3s ease, box-shadow .3s ease, background-color .3s ease;
}
.resource-card > * { position: relative; z-index: 1; }
/* glossy sheen across the upper-left; brightens and slides on hover */
.resource-card::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.12) 38%, transparent 60%);
    opacity: .8; transition: opacity .3s ease, transform .6s ease; transform: translateX(-4%);
}
.resource-card .card-icon {
    width: 58px; height: 58px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.8); color: var(--tone);
    box-shadow: 0 4px 12px rgba(31,60,90,.08);
    transition: transform .3s ease, background-color .3s ease;
}
.resource-card .card-icon svg { width: 32px; height: 32px; }
.resource-card .card-title { min-width: 0; }
.resource-card h2 { margin: 0; font-size: 30px; font-weight: 500; line-height: 1.3; color: #23313c; letter-spacing: 1px; }
.resource-card b { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; color: #34444f; }
/* "查看更多" button; it sits inside the card link, so clicking it opens the same page */
.resource-card .card-more {
    position: absolute; right: 20px; bottom: 12px;
    padding: 4px 14px; font-size: 14px; line-height: 1.6; border-radius: var(--btn-radius);
    color: #fff; background: rgba(31,127,196,.9); border: 1px solid rgba(255,255,255,.45);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: background-color .3s ease;
}
/* thin bar that slides in along the bottom edge on hover */
.resource-card::after { content: ""; position: absolute; left: 0; bottom: 0; z-index: 1; height: 3px; width: 100%; background: var(--tone); transform: scaleX(0); transform-origin: left; transition: transform .35s ease; }
.resource-card:hover, .resource-card:focus {
    text-decoration: none; color: #23313c; transform: translateY(-4px);
    background: rgba(var(--glass), 1);
    box-shadow: 0 16px 32px rgba(31,60,90,.16), inset 0 1px 0 rgba(255,255,255,.9);
}
.resource-card:hover::before, .resource-card:focus::before { opacity: 1; transform: translateX(0); }
.resource-card:hover::after, .resource-card:focus::after { transform: scaleX(1); }
.resource-card:hover .card-icon, .resource-card:focus .card-icon { transform: scale(1.1); background: rgba(255,255,255,.85); }
.resource-card:hover .card-more, .resource-card:focus .card-more { background: rgba(23,103,159,.95); }
/* Tile hues, in page order (RGB of the reference colours) */
.tone-1 { --glass: 153,204,204; --tone: #2f6b6b; }
.tone-2 { --glass: 153,204,255; --tone: #2c5f97; }
.tone-3 { --glass: 153,221,255; --tone: #22678f; }
.tone-4 { --glass: 217,237,247; --tone: #3a6b86; --alpha: .9; }
.tone-5 { --glass: 244,247,249; --tone: #4a6378; --alpha: .95; border-color: #dfe5ea; }
.tone-6 { --glass: 153,204,204; --tone: #2f6b6b; }
.tone-7 { --glass: 153,220,236; --tone: #22697c; }
.tone-8 { --glass: 184,214,222; --tone: #3b6370; }
.tone-9 { --glass: 204,233,240; --tone: #34697a; --alpha: .9; }
/* Browsers without backdrop-filter: make the tiles more opaque so text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .resource-card { --alpha: .95; }
}
@media (prefers-reduced-motion: reduce) {
    .resource-card, .resource-card::before, .resource-card::after, .resource-card .card-icon, .resource-card .card-more { transition: none; }
    .resource-card:hover { transform: none; }
}

/* Footer */
/* Footer stays pinned to the bottom of the viewport; backtop.js pads the body by its height */
.site-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; margin: 0; background: var(--header-bg); color: #fff; text-shadow: 0 1px 2px rgba(0,40,90,.3); text-align: center; font-size: 13px; line-height: 1.8; padding: 10px 16px; box-shadow: 0 -1px 4px rgba(0,0,0,.08); }
.site-footer p { margin: 0; }
body:has(> .site-footer) { padding-bottom: 90px; }

/* Back-to-top button, shown only when the page can scroll */
.back-to-top {
    position: fixed; right: 20px; bottom: 90px; z-index: 1001; display: none;
    width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--primary); color: #fff; opacity: .85; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.back-to-top.is-visible { display: flex; align-items: center; justify-content: center; }
.back-to-top:hover, .back-to-top:focus { opacity: 1; background: var(--primary-light); outline: none; }
.back-to-top svg { width: 20px; height: 20px; }

/* Collection lists, record detail, guides and registration */
/* content pages: body is a column so the white content box can grow down to the fixed footer */
body:has(> .main.news-g-fixed) { display: flex; flex-direction: column; min-height: 100vh; box-sizing: border-box; }
body:has(> .main.news-g-fixed) > .main.news-g-fixed { flex: 1 0 auto; }
body .main.news-g-fixed {
    width: var(--measure); max-width: none; min-height: 0; margin: 24px auto 0 !important;
    padding: clamp(18px,3vw,40px); border: 1px solid var(--line);
    border-radius: 4px; background: #fff; box-shadow: none;
}
.main #info { padding: 0 !important; }
.main fieldset { min-width: 0; }
.main legend, .main h1 { padding: 0 0 14px; color: #222; font-size: 24px; font-weight: 600; line-height: 1.4; border-bottom: 1px solid var(--line); }
.main .am-form-group { margin-bottom: 16px; max-width: 100%; }
.main .am-input-group { max-width: 690px; }
.main .am-form-field, .main input[type=text] { border-color: #c5cfdc; border-radius: var(--btn-radius); }
/* every button inside content pages gets the same rounded corners */
.main .am-btn, .main button, .main input[type=button], .main input[type=submit] { border-radius: var(--btn-radius); }
/* search box + 查询 button read as one rounded control */
.main .am-input-group > .am-form-field, .main .am-input-group > input[type=text] { border-radius: var(--btn-radius) 0 0 var(--btn-radius) !important; }
.main .am-input-group-btn > .am-btn, .main .am-input-group-btn > button { border-radius: 0 var(--btn-radius) var(--btn-radius) 0 !important; }
.main .am-form-field:focus, .main input[type=text]:focus { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(31,127,196,.15); }
.main #btnSearch, .main .am-btn-primary, .main #wikiword .am-btn-secondary { background: var(--primary); color: white; border-color: var(--primary); }
.main #btnSearch:hover, .main .am-btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.main #wikiword { display: flex; flex-wrap: wrap; gap: 6px; float: none; padding: 0; }
.main #wikiword .am-btn { width: auto !important; min-width: 36px; margin: 0 !important; border-radius: var(--btn-radius); padding: 6px 10px; }
.main #wikiword .am-btn-default { color: var(--ink); background: #fff; border-color: var(--line); }
.main #wikiword .am-btn:hover { background: var(--primary-soft); color: var(--primary); }

/* Tables: plain and readable */
/* roomier rows: about 56px for a single line of text, 48px header */
.main .am-table { font-size: 15px; line-height: 1.7; border: 1px solid var(--line); border-collapse: collapse; background: #fff; }
.main .am-table > thead > tr > th { background: #f2f5f9; color: var(--ink); font-size: 14px; font-weight: 600; border: 0; border-bottom: 1px solid var(--line); padding: 13px 18px; vertical-align: middle; }
.main .am-table > tbody > tr > td { border: 0; border-top: 1px solid #eceff4; padding: 15px 18px; vertical-align: middle; overflow-wrap: anywhere; }
.main .am-table-striped > tbody > tr:nth-child(odd) > td { background: transparent; }
.main .am-table-hover > tbody > tr:hover > td { background: #f7f9fc; }
.main .am-pagination > .am-active > a { background: var(--primary); border-color: var(--primary); }
.main .am-pagination > li > a { color: var(--primary); }

/*
 * List pager (res/plugin/jquery.pagination.js): page links, "跳至 [ ] 页" box and GO button
 * all share one 34px control size. The plugin writes inline styles on the jump box, hence !important.
 */
#pager { margin-top: 8px; }
#pager::after { content: ""; display: table; clear: both; }
#pager .pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; margin: 12px 0 0; padding: 0; }
#pager .pagination > li { display: block; float: none; margin: 0; }
#pager .pagination > li > a {
    float: none; display: block; min-width: 34px; height: 34px; margin: 0; padding: 0 11px;
    font-size: 14px; line-height: 32px; text-align: center; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: var(--btn-radius);
    transition: background-color .15s, border-color .15s, color .15s;
}
#pager .pagination > li > a:hover, #pager .pagination > li > a:focus { color: var(--primary); background: var(--primary-soft); border-color: #b3d7ef; }
#pager .pagination > li.active > a, #pager .pagination > li.active > a:hover { color: #fff; background: var(--primary); border-color: var(--primary); cursor: default; }
#pager .pagination > li.disabled > a, #pager .pagination > li.disabled > a:hover { color: #aab3bf; background: #f7f9fc; border-color: var(--line); cursor: not-allowed; }
#pager .pagination > li > div {
    float: none !important; padding: 0 !important; margin-left: 10px;
    display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted);
}
#pager #pagerInput {
    width: 52px !important; height: 34px; padding: 0 6px !important; margin: 0;
    font-size: 14px; text-align: center; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: var(--btn-radius); box-shadow: none; outline: none;
}
#pager #pagerInput:focus { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(31,127,196,.15); }
#pager #pagerButton {
    height: 34px; min-width: 44px; padding: 0 12px; margin: 0;
    font-size: 14px; line-height: 32px; color: var(--primary);
    background: #fff; border: 1px solid var(--line); border-radius: var(--btn-radius); cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
#pager #pagerButton:hover, #pager #pagerButton:focus { color: #fff; background: var(--primary); border-color: var(--primary); }
@media (max-width: 600px) {
    #pager .pagination { justify-content: center; }
    #pager .pagination > li > div { margin: 6px 0 0; width: 100%; justify-content: center; }
}
.results-scroll { overflow: auto; }
.results-heading { display: flex; align-items: baseline; gap: 14px; border-top: 1px solid var(--line); padding: 18px 0 12px; }
.results-heading h2 { font-size: 18px; font-weight: 600; margin: 0; }
.results-heading span { color: var(--muted); }
.initial-filter { clear: both; background: #f6f8fb; border: 1px solid var(--line); border-radius: 6px; padding: 16px 20px; margin: 12px 0 22px; }
.initial-filter h2 { margin: 0 0 10px; font-size: 15px; }
.initial-filter #wikiword { margin-bottom: 0; }
.family-view .am-form-group { float: none; padding-inline: 0; }
.family-view #txtSearch, .family-view #btnSearch { height: 42px; }
.family-view #btnSearch { padding-inline: 28px; }

/* Developer guide and API key registration */
.dev-page .page-head { margin-bottom: 28px; }
.dev-page .page-head h1 { margin: 0 0 12px; }
.dev-page .page-lead { margin: 0; font-size: 15px; line-height: 1.9; color: #3a4757; }
.dev-page .page-columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.dev-page h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; color: var(--ink); }
.dev-page p { font-size: 14px; line-height: 1.8; }
.dev-page code { font-family: Consolas, "Courier New", monospace; font-size: 13px; color: #24364b; background: #f2f5f9; padding: 1px 5px; border-radius: 3px; }
.doc-section + .doc-section { margin-top: 32px; }
.doc-section > p { margin: 0 0 12px; color: #3a4757; }
.dev-page .example-table { margin-bottom: 8px; }
.dev-page .example-table code { background: transparent; padding: 0; overflow-wrap: anywhere; }
.dev-page .example-table .col-no { width: 64px; }
.dev-page .example-table .col-result { width: 140px; }
.dev-page .field-help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.doc-list a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #fff; transition: border-color .2s, background-color .2s; }
.doc-list a:hover, .doc-list a:focus { border-color: var(--primary-light); background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.doc-list img { width: 18px; height: 18px; flex: none; }

.page-aside { display: grid; gap: 20px; position: sticky; top: 20px; }
.side-card { padding: 22px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 4px; }
.side-card > p { margin: 0 0 14px; color: #3a4757; }
.side-card .field-help { margin: 0 0 14px; }
.side-card-plain { background: #fff; }
.dev-page .side-card .am-btn-default { width: auto; border-color: var(--primary); color: var(--primary); background: #fff; border-radius: var(--btn-radius); }
.dev-page .side-card .am-btn-default:hover { background: var(--primary-soft); }
.step-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 2; color: #3a4757; }

/* Form fields shared by the test form and the registration form */
.dev-page .form-field { margin-bottom: 16px; }
.dev-page .form-field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.dev-page .form-field input, .dev-page .form-field textarea { width: 100%; font-size: 14px; border: 1px solid #c5cfdc; border-radius: var(--btn-radius); padding: 8px 12px; box-shadow: none; }
.dev-page .form-field input:focus, .dev-page .form-field textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(31,127,196,.15); }
.dev-page .req { color: #c62828; margin-left: 3px; font-weight: normal; }
.dev-page .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.dev-page .form-grid .span-2 { grid-column: 1 / -1; }
.dev-page .form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 4px; }
.dev-page .side-card .form-actions { justify-content: flex-start; }
.dev-page .form-note { font-size: 13px; color: var(--muted); }
.dev-page .form-actions .am-btn { width: auto; min-width: 120px; margin: 0 !important; border-radius: var(--btn-radius); padding: 8px 22px; }
.dev-page .side-card .form-actions .am-btn { width: 100%; }
.form-result:empty { display: none; }
.form-result { margin-top: 18px; padding: 14px 16px; border-radius: 4px; font-size: 14px; line-height: 1.8; border: 1px solid var(--line); background: #f7f9fc; }
.form-result p { margin: 4px 0 0; }
.form-result.is-success { border-color: #b7dfbf; background: #eef8f0; color: #1e5b2a; }
.form-result.is-error { border-color: #f1c2c0; background: #fdf0ef; color: #a42a22; }
/* login.js writes its failure message as a badge; show it as a plain error line instead */
.form-result .am-badge { display: block; padding: 0; background: transparent; color: #a42a22; font-size: 14px !important; font-weight: normal; text-align: left; white-space: normal; }
.form-result:has(.am-badge) { border-color: #f1c2c0; background: #fdf0ef; }

@media (max-width: 991px) {
    .dev-page .page-columns { grid-template-columns: 1fr; }
    .page-aside { position: static; }
}
@media (max-width: 600px) {
    .dev-page .form-grid { grid-template-columns: 1fr; }
    .dev-page .form-actions { flex-direction: column-reverse; align-items: stretch; }
    .dev-page .form-actions .am-btn { width: 100%; }
}

/* English labels are about twice as wide as Chinese ones: tighten spacing on narrower screens so the menu stays on one row */
@media (min-width: 768px) and (max-width: 1279px) {
    .portal-header.lang-en .navbar-default .navbar-nav > li > a { padding: 16px 9px; font-size: 14px; }
}
@media (min-width: 768px) and (max-width: 1199px) {
    .portal-header.lang-en .navbar-default .navbar-nav > li > a { padding: 16px 6px; font-size: 13px; }
    .portal-header.lang-en .caret { margin-left: 2px; }
}
@media (max-width: 991px) {
    .resource-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 767px) {
    /* too narrow for the building photo next to the logo: keep only the tinted sky colour */
    .container.portal-header { background: var(--header-bg); }
    .portal-masthead { position: relative; }
    .portal-banner img { width: 260px; }
    .portal-banner { padding-block: 12px; }
    .portal-header .navbar { border-top: 0; position: static; }
    .portal-header .navbar-header { margin: 0; }
    .portal-header .navbar-toggle { position: absolute; right: 0; top: 11px; margin: 0; }
    .portal-header .navbar-collapse.in, .portal-header .navbar-collapse.collapsing { margin-bottom: 8px; }
    .portal-header .navbar-default .navbar-nav > li > a { padding: 10px 4px; }
    .portal-header .navbar-collapse { max-height: 68vh; overflow-y: auto; border: 0; box-shadow: none; }
    .portal-header .open .dropdown-menu { background: #fff; }
    .portal-header .open .dropdown-submenu > .dropdown-menu { position: static; display: block; float: none; padding-left: 12px; box-shadow: none; }
    .resource-grid, body.home-page .resource-grid { grid-template-columns: 1fr; gap: 14px; grid-auto-rows: auto; }
    .resource-card { min-height: 0; gap: 14px; padding: 18px 18px; }
    .resource-card .card-icon { width: 46px; height: 46px; }
    .resource-card .card-icon svg { width: 26px; height: 26px; }
    .resource-card .card-title { flex: 1; }
    .resource-card .card-more { position: static; flex: none; padding: 3px 10px; font-size: 12px; }
    .resource-card h2 { font-size: 21px; }
    .about-data { padding: 0 20px; }
    .main .am-form-group:has(> table) { overflow-x: auto; }
    /* section tabs (上海年华 / 印章 pages): one swipeable row instead of overflowing the screen */
    .main .am-tabs-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .main .am-tabs-nav::-webkit-scrollbar { display: none; }
    .main .am-tabs-nav > li { flex: none; float: none; display: block; width: auto; }
    .main .am-tabs-nav > li > a { padding: 8px 12px; white-space: nowrap; }
    /* list tables: keep readable column widths and scroll sideways inside the box instead of squeezing text */
    .main .am-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .main .am-table > thead > tr > th, .main .am-table > tbody > tr > td { min-width: 5.5em; padding: 12px 12px; overflow-wrap: break-word; word-break: normal; }
    .main .am-table > tbody > tr > td { max-width: 20em; }
    .family-view .am-table { min-width: 580px; }
    .am-modal-dialog { max-width: 100vw; }
}
