/* Public pages only. Desktop and print styles remain in the existing files. */
@media screen and (max-width: 768px) {
    *, *::before, *::after {
        box-sizing: border-box;
    }

    body, td, th {
        font-size: 16px;
        line-height: 1.7;
        overflow-wrap: anywhere;
    }

    body {
        width: auto;
        min-width: 0;
    }

    #wrapper {
        /* Reserve the 332px footer decoration plus a 16px gap below content. */
        padding-bottom: 348px;
    }

    #header h1 {
        padding: 0 12px;
        font-size: 12px;
        line-height: 1.6;
    }

    #header img {
        max-width: 100%;
        height: auto;
    }

    #search_form, ul.item_list, .pagenation-box, .notfound,
    table.data_list, div.faq-content {
        width: calc(100% - 32px);
        max-width: none;
        margin-right: auto;
        margin-left: auto;
    }

    #search_form {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
        margin-top: 24px;
        padding: 12px;
        font-size: 16px;
    }

    #search_form div.faq {
        display: flex;
        justify-content: flex-end;
        width: 100%;
        height: auto;
        padding: 0;
    }

    #search_form div.faq > a {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 44px;
    }

    #search_form div.faq_text, #search_form div.faq_image {
        float: none;
        margin: 0;
    }

    .search-query {
        display: flex;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }

    #search_form_keyword {
        flex: 1;
        width: 0;
        min-width: 0;
        height: 44px;
        padding: 8px 12px;
        font-size: 16px;
    }

    #search_form input[type=button] {
        width: 72px;
        height: 44px;
        margin: 0;
        font-size: 16px;
    }

    .search-options, .search-sort {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        flex: 1 1 auto;
        gap: 8px;
        max-width: 100%;
    }

    .search-options label {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 44px;
        padding: 0 4px;
    }

    .search-options input[type=radio] {
        width: 20px;
        height: 20px;
        margin: 0;
    }

    .search-sort {
        justify-content: flex-end;
    }

    #search_form select {
        width: 140px;
        max-width: 100%;
        height: 44px;
        padding: 6px;
        font-size: 16px;
    }

    #search_form p {
        width: 100%;
        margin: 0;
        padding-top: 4px;
        text-align: left;
        font-size: 14px;
        line-height: 1.7;
    }

    ul.item_list li {
        min-width: 0;
    }

    div.item_name {
        padding: 12px;
        font-size: 16px;
        line-height: 1.5;
        /* Keep the existing single-line title and ellipsis. */
    }

    div.item_value_list {
        height: auto;
        margin-right: 0;
        padding: 12px 12px 32px;
        overflow: visible;
        font-size: 16px;
        line-height: 1.7;
    }

    .list_no {
        right: 12px;
        bottom: 6px;
        font-size: 16px;
        line-height: 1.5;
    }

    #pagenation-cap {
        float: none;
        margin-bottom: 12px;
        padding-left: 0;
    }

    .pagenation-list {
        display: flex;
        flex-wrap: nowrap;
        white-space: nowrap;
        align-items: center;
        justify-content: center;
        gap: 6px;
        float: none;
    }

    .pagenation-list a, .pagenation-list span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 44px;
        padding: 6px 0;
        font-size: clamp(14px, 4vw, 16px);
        flex: 1 1 0;
    }

    .pagenation-list a.pager-distant,
    .pagenation-list a.pager-edge {
        display: none;
    }

    .pagenation-list .pager_now_page {
        background-size: contain;
    }

    .pagenation-list.bottomArea {
        width: calc(100% - 32px);
        margin: 16px auto;
    }

    table.data_list {
        display: block;
        border-spacing: 0;
    }

    table.data_list tbody, table.data_list tr,
    table.data_list th, table.data_list td {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    table.data_list tr {
        margin-bottom: 16px;
    }

    table.data_list th {
        padding: 10px 12px;
        border-radius: 13px 13px 0 0;
    }

    table.data_list td {
        padding: 12px;
        border-radius: 0 0 13px 13px;
    }

    #footer {
        padding: 20px 16px;
        font-size: 14px;
    }

    h1.faq-h1 {
        margin: 28px 16px;
        font-size: 20px;
    }

    div.faq-content {
        margin-top: 16px;
        margin-bottom: 16px;
        padding: 16px;
        text-align: left;
        font-size: 16px;
    }

    .faq-list {
        margin: 0;
        padding-left: 24px;
    }

    .faq-list a, p.winclose a {
        display: inline-block;
        min-height: 44px;
        padding: 8px 0;
    }

    div.faq-content dd {
        margin: 12px 0 0;
    }

    div.faq-content table {
        width: 100%;
        table-layout: fixed;
    }

    div.faq-content td:first-child {
        width: 40px;
    }

    div.faq-content td.txt {
        padding: 0 0 0 8px;
    }

    div.faq-content img {
        max-width: 40px;
        height: auto;
    }
}

@media screen and (max-width: 360px) {
    .pagenation-list {
        gap: 2px;
    }
}
