* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: #222;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.site-header {
    border-bottom: 1px solid #ebedf2;
    background: #fff;
}

.header-inner {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: #123e91;
}

.header-link {
    font-weight: 700;
    color: #555;
}

.site-main {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 58px 0 90px;
}

.gallery-note {
    text-align: center;
    margin: 0 0 46px;
    color: #333;
    font-weight: 700;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid #d9dde6;
    margin-bottom: 18px;
}

.tab {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 15px;
    font-size: 13px;
    color: #6b7280;
    border-top: 1px solid transparent;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
}

.tab:hover,
.tab.active {
    color: #111827;
    background: #fff;
    border-color: #d9dde6;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    font-weight: 800;
}

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 18px;
}

.total-badge {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 4px;
    background: #eef1f6;
    color: #566173;
    font-size: 13px;
    font-weight: 700;
}

.rss-button {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border-radius: 4px;
    background: #4a4d68;
    color: #fff;
    font-weight: 800;
    font-size: 12px;
}

.rss-button::before {
    content: "◔";
    margin-right: 4px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px 22px;
}

.gallery-card {
    background: #fff;
    border: 1px solid #e2e5eb;
    box-shadow: 0 3px 10px rgba(17, 24, 39, .16);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(17, 24, 39, .18);
}

.card-image {
    display: block;
    aspect-ratio: 1 / .78;
    background: #f5f6f8;
    overflow: hidden;
}

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

.no-image {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #8992a3;
    font-weight: 800;
}

.card-body {
    padding: 12px 14px 16px;
}

.card-category {
    color: #3367a9;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 5px;
}

.card-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
    font-weight: 900;
    color: #111827;
}

.card-title a:hover {
    color: #123e91;
}

.card-meta {
    margin-top: 8px;
    color: #7a8495;
    font-size: 12px;
}

.pagination,
.admin-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 38px;
}

.pagination a,
.admin-pagination a {
    min-width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d6dae3;
    border-radius: 4px;
    color: #7a8495;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
}

.pagination a.active,
.admin-pagination a.active {
    background: #4a4d68;
    border-color: #4a4d68;
    color: #fff;
}

.empty-box {
    padding: 60px 20px;
    border: 1px dashed #cbd2df;
    background: #fafbfc;
    text-align: center;
    color: #667085;
    font-weight: 700;
}

.detail-wrap {
    max-width: 720px;
    margin: 0 auto;
}

.detail-header {
    text-align: center;
    margin-bottom: 28px;
}

.detail-category {
    color: #3367a9;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 8px;
}

.detail-header h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.35;
    color: #111827;
}

.detail-desc {
    margin: 15px auto 0;
    color: #4b5563;
    white-space: normal;
}

.detail-meta {
    margin-top: 12px;
    color: #7a8495;
    font-size: 13px;
}

.ios-hint {
    margin: 0 0 18px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
}

.photo-stack {
    display: grid;
    gap: 22px;
}

.photo-item {
    margin: 0;
    background: #fff;
}

.photo-item > a {
    display: block;
    border: 1px solid #e2e5eb;
    background: #f7f8fb;
}

.photo-item img {
    width: 100%;
    height: auto;
}

.photo-item figcaption {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0 0;
    color: #667085;
    font-size: 13px;
}

.download-btn,
.back-btn,
.primary-link,
.secondary-link,
.primary-btn,
.secondary-btn,
.small-btn,
.small-danger-btn {
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 800;
    white-space: nowrap;
}

.download-btn,
.primary-link,
.primary-btn {
    background: #123e91;
    color: #fff;
}

.download-btn {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

.back-btn,
.secondary-link,
.secondary-btn {
    background: #eef1f6;
    color: #334155;
}

.back-btn {
    min-height: 38px;
    padding: 0 18px;
}

.detail-actions {
    margin-top: 30px;
    text-align: center;
}

.thumb-strip {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 38px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.thumb-strip a {
    aspect-ratio: 1 / .78;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    background: #f7f8fb;
}

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

.to-top {
    position: fixed;
    right: 28px;
    bottom: 86px;
    width: 42px;
    height: 42px;
    background: #fff;
    border: 2px solid #777;
    color: #333;
    font-size: 21px;
    font-weight: 900;
    cursor: pointer;
}

.site-footer {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3a3a3a;
    color: #d8d8d8;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    padding: 18px;
}

/* Admin */
.admin-body {
    background: #f3f5f9;
}

.admin-header {
    background: #111827;
    color: #fff;
}

.admin-header-inner {
    width: min(1180px, calc(100% - 28px));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.admin-brand {
    font-weight: 900;
    font-size: 20px;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 14px;
}

.admin-nav a {
    color: #e5e7eb;
}

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

.admin-main {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 34px 0 80px;
}

.admin-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-title-row h1 {
    margin: 0;
    font-size: 28px;
}

.admin-user {
    color: #667085;
    font-size: 13px;
    font-weight: 800;
}

.admin-panel,
.install-card,
.login-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .08);
}

.admin-panel {
    padding: 22px;
}

.admin-filter {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea,
input[type="file"] {
    width: 100%;
    border: 1px solid #cfd5df;
    border-radius: 8px;
    min-height: 42px;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 15px;
    background: #fff;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 800;
    color: #344054;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

.primary-btn,
.secondary-btn,
.primary-link,
.secondary-link {
    min-height: 42px;
    padding: 0 16px;
    font-size: 14px;
}

.secondary-btn,
.secondary-link {
    border: 1px solid #d5dbe6;
}

.small-btn,
.small-danger-btn {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.small-btn {
    background: #eef1f6;
    color: #334155;
}

.small-danger-btn {
    background: #fee2e2;
    color: #991b1b;
}

.inline-form {
    display: inline-flex;
    margin-left: 4px;
}

.table-scroll {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 11px 10px;
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    background: #f8fafc;
    color: #475467;
    font-size: 13px;
}

.admin-table a {
    color: #123e91;
    font-weight: 800;
}

.table-empty {
    text-align: center !important;
    color: #667085;
    padding: 30px !important;
}

.admin-thumb {
    width: 80px;
    height: 58px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.admin-no-thumb {
    display: inline-flex;
    width: 80px;
    height: 58px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 900;
}

.admin-form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1.5fr .8fr;
    gap: 16px;
}

.required {
    color: #dc2626;
}

.upload-box {
    border: 1px dashed #b7c0ce;
    border-radius: 12px;
    padding: 16px;
    background: #f8fafc;
}

.upload-box p,
.help-text {
    margin: 9px 0 0;
    color: #667085;
    font-size: 13px;
}

.existing-photos h2,
.two-columns h2,
.category-form h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 14px;
}

.admin-photo-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.admin-photo-card img {
    width: 100%;
    aspect-ratio: 1 / .78;
    object-fit: cover;
    border-radius: 7px;
    background: #f8fafc;
}

.photo-card-meta {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    align-items: center;
    margin-top: 9px;
    color: #667085;
    font-size: 12px;
}

.photo-card-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-card-meta input {
    min-height: 34px;
    padding: 4px 7px;
}

.photo-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 9px;
}

.form-actions,
.install-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.hidden-form {
    display: none;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-weight: 800;
}

.alert-success {
    background: #ecfdf3;
    color: #027a48;
    border: 1px solid #abefc6;
}

.alert-error {
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.category-form {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
}

.narrow-form {
    max-width: 520px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f3f5f9;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    padding: 34px;
    display: grid;
    gap: 16px;
}

.login-logo {
    color: #123e91;
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
    text-align: center;
}

.login-card h1 {
    margin: 0 0 4px;
    text-align: center;
    font-size: 24px;
}

.install-wrap {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 60px 0;
}

.install-card {
    padding: 30px;
}

.install-card h1 {
    margin-top: 0;
}

.config-summary {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    margin: 18px 0;
}

.config-summary div {
    display: flex;
    gap: 12px;
}

.config-summary strong {
    min-width: 70px;
}

.install-list {
    padding-left: 20px;
}

.danger-note {
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    font-weight: 800;
}

@media (max-width: 980px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .admin-photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

@media (max-width: 760px) {
    .header-inner {
        height: 62px;
    }

    .brand {
        font-size: 27px;
    }

    .site-main {
        width: min(100% - 22px, 1080px);
        padding: 34px 0 70px;
    }

    .gallery-note {
        margin-bottom: 26px;
        font-size: 14px;
    }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 1px;
    }

    .tab {
        flex: 0 0 auto;
        padding: 0 12px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .card-title {
        font-size: 15px;
    }

    .photo-item figcaption {
        align-items: flex-start;
        flex-direction: column;
    }

    .download-btn {
        width: 100%;
    }

    .thumb-strip {
        grid-template-columns: repeat(4, 1fr);
    }

    .to-top {
        right: 16px;
        bottom: 72px;
    }

    .admin-header-inner,
    .admin-title-row,
    .admin-filter,
    .form-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-nav {
        padding-bottom: 14px;
    }

    .admin-photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 460px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

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

    .detail-header h1 {
        font-size: 23px;
    }

    .thumb-strip {
        grid-template-columns: repeat(3, 1fr);
    }

    .admin-photo-grid {
        grid-template-columns: 1fr;
    }

    .login-card,
    .install-card,
    .admin-panel {
        padding: 18px;
    }
}
