:root {
    --gap: 12px;
    --bg: linear-gradient(90deg, rgba(23, 21, 31, 0.8) 3%, rgba(58, 21, 50, 0.8) 16%, rgba(126, 20, 86, 0.8) 38%, rgba(195, 38, 96, 0.8) 59%, rgba(207, 91, 115, 0.8) 71%, rgba(246, 147, 164, 0.8) 84%, rgba(226, 221, 217, 0.8));
    --fg: #e5e7eb;
    --muted: #94a3b8;
    --card: #111827;
}


.dancing-script {
    font-family: "Dancing Script", cursive;
    font-optical-sizing: auto;
    font-weight: weight;
    font-style: normal;
}
  

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Dancing Script", cursive;
}

header {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #223;
}

h1 {
    font-size: 20px;
}

.brand {
    font-weight: 800;
    letter-spacing: .2px;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.brand-text {
    font-weight: 800;
    letter-spacing: .05em;
}

header nav a {
    color: var(--fg);
    background: #6d253f;
    text-decoration: none;
    border: 1px solid #334;
    padding: 6px 10px;
    border-radius: 8px;
}

.search {
    display: flex;
    gap: 8px;
}

.search input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #334;
    color: var(--fg);
    min-width: 220px;
}

button {
    cursor: pointer;
    background: #a42353;
    border: 0;
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
}

.alert {
    margin: 12px;
    padding: 10px;
    border-radius: 8px;
}

.alert.ok {
    background: #064e3b;
}

.alert.error {
    background: #7f1d1d;
}

.card {
    background: var(--card);
    margin: 16px;
    padding: 16px;
    border-radius: 12px;
    display: grid;
    gap: 12px;
    max-width: 600px;
}

.grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    padding: 16px;
}

.item {
    display: block;
    background: #0f172a;
    border: 1px solid #223;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

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

.meta {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--muted);
}

.pager {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 16px;
}

.pager a {
    color: var(--fg);
    text-decoration: none;
    border: 1px solid #334;
    padding: 6px 10px;
    border-radius: 8px;
}

.pager a.current {
    background: #334;
}

.viewer {
    padding: 16px;
    display: grid;
    gap: 12px;
    max-width: 900px;
    margin: auto;
}

.viewer img {
    width: 50%;
    height: auto;
    border-radius: 12px;
    margin: 0 auto;
}

.danger {
    background: #a92f2f;
}


/* Simple lightbox */
[data-lightbox] {
    position: relative;
}

[data-lightbox]::after {
    content: '+';
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, .5);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: bold;
}


/* Responsive tweak */
/* スマホ (〜600px) */
@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    h1 {
        font-size: 18px;
    }

    .brand-text {
        font-size: 18px;
    }

    .search {
        width: 100%;
    }

    .search input {
        flex: 1;
        min-width: 0;
        /* 220px固定を解除して、横幅いっぱい使う */
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 12px;
    }

    .item img {
        height: 120px;
        /* サムネイル小さめに */
    }

    .viewer img {
        width: 100%;
        /* 詳細表示は画面幅いっぱいに */
        height: auto;
    }

    .card {
        margin: 12px;
        padding: 12px;
        max-width: 100%;
    }

    .pager {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* タブレット (601〜900px) */
@media (max-width: 900px) and (min-width: 601px) {
    h1 {
        font-size: 20px;
    }

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

    .viewer img {
        width: 80%;
    }
}

/* PC (901px〜) */
@media (min-width: 901px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .viewer img {
        width: 50%;
    }
}