html {
    overflow-y: scroll;
}

body {
    background: #f3f6f2;
    color: #26322b;
    font-family: "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
    margin: 0;
}

[hidden] {
    display: none !important;
}

a {
    color: #2f6547;
}

.site-header {
    background: #2d4f3a;
    color: #fff;
}

.site-header .container {
    min-height: 48px;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 0;
    padding-bottom: 0;
}

.site-header h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.site-header h1 a {
    color: #fff;
    text-decoration: none;
}

.site-header h1 a:hover,
.site-header h1 a:focus {
    color: #dce8d5;
    text-decoration: none;
}

.site-header.compact .container {
    padding-top: 0;
    padding-bottom: 0;
}

.admin-entry,
.back-home {
    color: #fff;
    display: inline-block;
    margin-top: 8px;
}

.admin-entry:hover,
.back-home:hover {
    color: #dce8d5;
}

.site-main {
    padding-top: 22px;
    padding-bottom: 32px;
}

.site-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.home-announcement {
    min-width: 0;
    color: darkviolet;
    font-size: 14px;
    font-weight: 600;
    line-height: 34px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
}

.site-filter,
.site-search {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
}

.site-filter {
    flex: 0 0 auto;
}

.site-search {
    justify-content: flex-end;
    margin-left: 0;
}

.site-filter .form-control,
.site-search .form-control {
    height: 34px;
    border-color: #b7cdb3;
    border-radius: 3px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.04);
}

.site-filter .form-control:focus,
.site-search .form-control:focus {
    border-color: #3f6b4c;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.04), 0 0 0 2px rgba(63, 107, 76, 0.14);
}

.site-filter .form-control {
    width: 150px;
}

.site-filter-select {
    padding-right: 28px;
    background-color: #fff;
    background-image: linear-gradient(45deg, transparent 50%, #2f6547 50%), linear-gradient(135deg, #2f6547 50%, transparent 50%);
    background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.site-filter-select::-ms-expand {
    display: none;
}

.site-search .form-control {
    width: 260px;
    max-width: 100%;
}

.site-search .btn {
    margin-left: 0;
}

.site-search .btn-danger {
    background-color: #c9302c;
    border-color: #ac2925;
}

.site-search .btn-danger:hover,
.site-search .btn-danger:focus,
.site-search .btn-danger:active {
    background-color: #ac2925;
    border-color: #761c19;
}

.site-search .btn[hidden] {
    display: none;
}

.search-empty {
    margin-top: 12px;
}

.forum-board {
    margin-bottom: 18px;
    border: 1px solid #cbd8cb;
    background: #fff;
}

.site-page.home-mode-cover [data-home-view-mode="list"] {
    display: none;
}

.site-page.home-mode-list [data-home-view-mode="cover"] {
    display: none;
}

.board-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #3f6b4c;
    color: #fff;
    font-weight: 700;
}

.board-title-bar > span {
    min-width: 0;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    line-height: 1;
}

.view-toggle:hover,
.view-toggle:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    text-decoration: none;
}

.view-toggle .glyphicon {
    font-size: 16px;
    top: 0;
}

.board-list {
    width: 100%;
}

.home-view-cover {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 14px 14px;
}

.cover-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid #cbd8cb;
    background: #f7f9f6;
    color: #26322b;
    text-decoration: none;
}

.cover-card:hover {
    background: #eef3ed;
    color: #26322b;
    text-decoration: none;
}

.cover-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e9efe7;
}

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

.cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #6c7b70;
    font-size: 13px;
}

.cover-info {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
}

.cover-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    color: #26322b;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cover-name .category-tag {
    flex: 0 0 auto;
}

.cover-title-text {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cover-nostalgia {
    display: block;
    width: 100%;
    color: #c62828;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

.cover-nostalgia strong {
    font-weight: 700;
}

.merged-board .board-row:first-child {
    border-top: 0;
}

.board-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px 110px 96px 148px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-top: 1px solid #e2e8e1;
    color: #26322b;
    text-decoration: none;
}

.board-row:hover {
    background: #f6f8f5;
    color: #26322b;
    text-decoration: none;
}

.row-main {
    min-width: 0;
}

.row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.row-main strong,
.row-main em {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-title strong {
    flex: 1 1 auto;
    min-width: 0;
}

.category-tag {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    max-width: 96px;
    min-height: 22px;
    padding: 1px 7px;
    border: 1px solid #b7cdb3;
    border-radius: 3px;
    background: #edf4ea;
    color: #2f6547;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-main em {
    margin-top: 4px;
    color: #6c7b70;
    font-style: normal;
    font-size: 13px;
}

.row-meta {
    color: #66756b;
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
}

.row-meta b,
.row-meta span {
    display: block;
}

.row-meta b {
    color: #8a988c;
    font-size: 12px;
    font-weight: 400;
    margin-bottom: 2px;
}

.board-empty,
.empty-state {
    padding: 18px;
    color: #6c7b70;
    background: #fff;
    border: 1px solid #cbd8cb;
}

.empty-state.inline,
.board-empty {
    border: 0;
}

.detail-shell {
    background: #fff;
    border: 1px solid #cbd8cb;
    padding: 10px;
}

.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: #6c7b70;
    font-size: 13px;
}

.detail-breadcrumb a {
    color: #2f6547;
    font-weight: 700;
    text-decoration: none;
}

.detail-breadcrumb a:hover,
.detail-breadcrumb a:focus {
    color: #233d2d;
    text-decoration: underline;
}

.detail-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: start;
    column-gap: 20px;
    margin-bottom: 18px;
}

.detail-shell > h1,
.detail-title-row h1 {
    font-size: 28px;
}

.detail-shell > h1 {
    margin: 0 0 18px;
}

.detail-title-row h1 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.detail-format-tag,
.detail-audio-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: 8px;
    padding: 1px 8px;
    border: 1px solid #7caf78;
    border-radius: 3px;
    background: #edf7ec;
    color: #2f7d32;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: middle;
}

.detail-audio-tag {
    background: #f3faf2;
}

.detail-contact {
    justify-self: end;
    padding-top: 8px;
    color: darkviolet;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.8;
    text-align: right;
    white-space: nowrap;
}

.detail-title-row .detail-contact strong {
    color: blue !important;
    font-size: inherit;
    font-weight: 700;
}

.detail-meta {
    width: 100%;
    border: 1px solid #d8e1d7;
    border-collapse: collapse;
    table-layout: fixed;
}

.detail-meta th,
.detail-meta td {
    padding: 10px 12px;
    border: 1px solid #d8e1d7;
    vertical-align: top;
}

.detail-meta th {
    background: #f0f4ef;
    color: #4d6353;
    font-weight: 700;
    width: 90px;
}

.detail-meta td {
    overflow-wrap: anywhere;
}

.detail-meta .nostalgia-value {
    color: #c62828;
    font-weight: 700;
}

.admin-table .nostalgia-value {
    color: #c62828;
    font-weight: 700;
}

.admin-table .item-unpublished {
    color: #c62828;
    font-weight: 700;
}

.detail-meta .detail-description {
    min-height: 9em;
    line-height: 1.8;
}

.description,
.screenshots {
    margin-top: 22px;
}

.description h2,
.screenshots h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.description p {
    line-height: 1.8;
    margin: 0;
}

.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.screenshot-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid #cbd8cb;
    background: #f3f6f2;
    cursor: pointer;
}

.screenshot-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.screenshot-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.screenshot-list img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #cbd8cb;
    background: #f3f6f2;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 48px 72px;
    background: rgba(20, 28, 23, 0.86);
}

.image-viewer.is-open {
    display: flex;
}

.image-viewer img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    background: #fff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.image-viewer-close,
.image-viewer-nav {
    position: absolute;
    border: 0;
    color: #fff;
    background: rgba(45, 79, 58, 0.86);
    line-height: 1;
}

.image-viewer-close {
    top: 18px;
    right: 22px;
    width: 38px;
    height: 38px;
    font-size: 30px;
}

.image-viewer-nav {
    top: 50%;
    width: 46px;
    height: 68px;
    margin-top: -34px;
    font-size: 54px;
}

.image-viewer-prev {
    left: 18px;
}

.image-viewer-next {
    right: 18px;
}

.image-viewer-close:hover,
.image-viewer-nav:hover {
    background: rgba(63, 107, 76, 0.96);
}

.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-panel {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border: 1px solid #cbd8cb;
    padding: 24px;
}

.login-panel h1 {
    margin: 0 0 18px;
    font-size: 22px;
}

.back-link {
    display: block;
    margin-top: 14px;
    text-align: center;
}

.admin-nav {
    background: #2d4f3a;
    color: #fff;
}

.admin-page,
.admin-page form {
    margin: 0;
    padding: 0;
}

.admin-nav .container {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 0;
}

.admin-nav a,
.admin-nav strong {
    color: #fff;
}

.admin-nav a {
    margin-left: 18px;
}

.admin-nav strong {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.admin-nav a:hover {
    color: #dce8d5;
    text-decoration: none;
}

.admin-nav a.admin-logout {
    margin-left: auto;
}

.admin-main {
    padding-top: 24px;
    padding-bottom: 36px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-card,
.admin-section {
    background: #fff;
    border: 1px solid #cbd8cb;
    padding: 18px;
}

.btn-primary {
    background-color: #3f6b4c;
    border-color: #345c40;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #345c40;
    border-color: #2b4d35;
}

.btn-default {
    color: #2d4f3a;
    border-color: #cbd8cb;
}

.btn-default:hover,
.btn-default:focus {
    color: #233d2d;
    background-color: #f6f8f5;
    border-color: #aebead;
}

.dashboard-card span,
.dashboard-card strong {
    display: block;
}

.dashboard-card strong {
    margin: 8px 0 14px;
    font-size: 28px;
}

.admin-section {
    margin-bottom: 18px;
}

.access-log-section {
    margin-top: 18px;
}

.access-log-toolbar {
    align-items: center;
}

.access-log-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.access-log-date {
    width: 150px;
}

.access-log-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
    color: #4d6353;
}

.access-log-table {
    margin-bottom: 0;
}

.access-log-table th:nth-child(1),
.access-log-table td:nth-child(1) {
    width: 120px;
}

.access-log-table th:nth-child(2),
.access-log-table td:nth-child(2) {
    width: 120px;
}

.access-log-time {
    width: 120px;
}

.access-log-time-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.access-log-duration {
    color: #c62828;
    font-weight: 700;
}

.access-log-status {
    color: blue;
    font-weight: 700;
}

.access-log-table th,
.access-log-table td {
    font-size: 12px;
    vertical-align: top !important;
}

.access-log-text {
    max-width: 260px;
    max-height: 76px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.access-log-request {
    max-width: 520px;
    max-height: 100px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.access-log-request div + div {
    margin-top: 4px;
    color: #4d6353;
}

.access-log-ip {
    width: 120px;
    word-break: break-all;
}

.access-log-ip strong,
.access-log-ip span {
    display: block;
}

.access-log-ip span {
    margin-top: 4px;
    color: #4d6353;
}

.admin-section h1,
.toolbar-row h1 {
    margin: 0 0 16px;
    font-size: 22px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.form-action-col {
    padding-top: 25px;
}

.filter-section .btn {
    margin-right: 6px;
}

.category-group-row td {
    background: #3f6b4c !important;
    color: #fff;
    font-weight: 700;
}

.meta-row {
    margin-top: 14px;
}

.item-option-checkbox {
    display: flex;
    align-items: center;
    min-height: 34px;
    margin: 25px 0 0;
    color: #26322b;
    font-weight: 400;
    white-space: nowrap;
}

.item-option-checkbox input {
    margin: 0 6px 0 0;
}

.edit-section .form-group {
    margin-top: 14px;
}

.form-actions {
    margin-top: 18px;
}

.existing-images h2 {
    margin: 18px 0 12px;
    font-size: 18px;
}

.image-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.image-admin-item {
    position: relative;
    display: block;
    border: 1px solid #cbd8cb;
    padding: 8px;
    background: #f7f9f6;
    font-weight: 400;
    cursor: move;
}

.image-admin-item.is-dragging,
.upload-preview-item.is-dragging {
    opacity: 0.55;
}

.upload-preview-sequence {
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 12px;
    background: rgba(45, 79, 58, 0.92);
    color: #fff;
    font-size: 13px;
    line-height: 24px;
    text-align: center;
    font-weight: 700;
    z-index: 1;
}

.image-admin-item img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-bottom: 8px;
}

.image-admin-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.image-admin-sequence {
    color: #2d4f3a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
}

.image-remove-option {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 auto;
    color: #c62828;
    font-weight: 700;
    cursor: pointer;
}

.image-remove-option input,
.cover-remove-option input {
    margin: 0;
    accent-color: #c62828;
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.cover-preview {
    width: 220px;
    max-width: 100%;
    margin-top: 10px;
    border: 1px solid #cbd8cb;
    background: #f7f9f6;
    overflow: hidden;
}

.cover-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.cover-remove-option {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: calc(100% - 16px);
    margin: 8px;
    color: #c62828;
    font-weight: 400;
}

.cover-remove-option input {
    margin: 0;
}

.cover-preview-empty {
    padding: 18px;
    color: #6c7b70;
    font-size: 13px;
}

.upload-preview-item {
    position: relative;
    border: 1px solid #cbd8cb;
    background: #f7f9f6;
    padding: 8px;
    cursor: move;
}

.upload-preview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-bottom: 6px;
}

.upload-preview-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #4d6353;
    font-size: 12px;
}

.upload-preview-item .upload-preview-sequence {
    position: absolute;
    display: block;
    overflow: visible;
    color: #fff;
    font-size: 13px;
    line-height: 24px;
}

.upload-preview-item .btn {
    margin-top: 8px;
    cursor: pointer;
}

.admin-table {
    background: #fff;
}

.action-cell .btn {
    margin-left: 4px;
}

@media (max-width: 767px) {
    .board-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-view-cover {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .site-toolbar {
        align-items: stretch;
        flex-direction: column;
        text-align: left;
    }

    .home-announcement {
        width: 100%;
        line-height: 1.5;
        white-space: normal;
    }

    .site-toolbar-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
        margin-left: 0;
    }

    .site-filter,
    .site-search {
        width: 100%;
        margin-left: 0;
    }

    .site-filter .form-control {
        width: 100%;
    }

    .site-search {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .site-search .form-control {
        width: 100%;
    }

    .row-meta {
        text-align: left;
    }

    .row-meta b,
    .row-meta span {
        display: inline;
    }

    .row-meta b {
        margin-right: 6px;
    }

    .detail-meta,
    .detail-meta tbody,
    .detail-meta tr,
    .detail-meta th,
    .detail-meta td {
        display: block;
        width: 100%;
    }

    .detail-contact {
        max-width: 45vw;
        padding-top: 0;
        white-space: normal;
    }

    .screenshot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .image-viewer {
        padding: 44px 48px;
    }

    .board-title {
        gap: 8px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .admin-nav .container {
        flex-wrap: wrap;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .admin-logout {
        margin-left: 0;
    }

    .toolbar-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .access-log-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .access-log-date,
    .access-log-actions .btn {
        width: 100%;
    }

    .form-action-col {
        padding-top: 14px;
    }
}
