:root {
    --border: #e2e2e2;
    --text: #222;
    --muted: #777;
    --accent: #2d6cdf;
}
* { box-sizing: border-box; }
body {
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    background: #fafafa;
    color: var(--text);
    margin: 0;
}
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}
.site-title {
    font-weight: bold;
    font-size: 1.2em;
    color: var(--text);
    text-decoration: none;
}
.site-title a { color: inherit; text-decoration: none; }
.site-nav a {
    margin-left: 14px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9em;
}

/* Facebookページ風のトップヘッダー */
.fb-page-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.fb-cover {
    display: block;
    height: 220px;
    background-size: cover;
    background-position: center;
    background-color: #d8dde3;
}
.fb-cover-placeholder { width: 100%; height: 100%; }
.fb-identity {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.fb-avatar {
    display: block;
    width: 88px;
    height: 88px;
    flex: none;
    margin-top: -44px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: #e4e6eb;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.fb-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    background: var(--accent);
}
.fb-identity-text { padding-top: 10px; padding-bottom: 8px; }
.fb-identity-text .site-title {
    display: block;
    font-size: 1.4em;
    margin: 0;
}
.fb-bio {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9em;
    line-height: 1.4;
    white-space: pre-wrap;
}
.top-utility-bar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.top-utility-bar-inner {
    max-width: 560px;
    margin: 0 auto;
    padding: 8px 20px;
    text-align: right;
    font-size: 0.85em;
}
.top-utility-bar-inner a {
    margin-left: 14px;
    color: var(--accent);
    text-decoration: none;
}
.refresh-link { color: var(--text) !important; }
/* トップページ右上のプルダウンメニュー */
.top-menu { display: inline-block; position: relative; margin-left: 14px; text-align: left; }
.top-menu summary {
    display: inline-block;
    cursor: pointer;
    color: var(--accent);
    list-style: none;
    user-select: none;
}
.top-menu summary::-webkit-details-marker { display: none; }
.top-menu-list {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 30;
    min-width: 170px;
    max-width: 80vw;
    margin: 6px 0 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.top-menu-list li a {
    display: block;
    margin: 0;
    padding: 9px 14px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-menu-list li a:hover { background: #eef2f7; }
.fb-tags {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 20px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag {
    display: inline-block;
    background: #eef2f7;
    color: var(--accent);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 0.8em;
    text-decoration: none;
}
.tag-active { background: var(--accent); color: #fff; }
.tag-clear { background: #fdeaea; color: #c00; }
.tag-count { opacity: 0.7; }
.post-tags { padding: 0 14px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.feed, .admin-main {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px;
}
.post-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}
.post-date {
    padding: 10px 14px;
    font-size: 0.85em;
    color: var(--muted);
}
.post-date a { color: inherit; text-decoration: none; }
.post-photo-count {
    margin-left: 8px;
    color: var(--muted);
}

/* 一覧(タイムライン)での写真表示: 最大3枚をずらして重ねるスクラップブック風 */
.photo-stack-link { display: block; text-decoration: none; }
.photo-stack {
    position: relative;
    height: 230px;
    margin: 18px auto 6px;
    width: 88%;
}
.photo-stack img {
    position: absolute;
    width: 62%;
    height: 78%;
    object-fit: cover;
    border: 6px solid #fff;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    background: #fff;
}
.photo-stack .stack-photo-a {
    left: 4%;
    top: 22px;
    transform: rotate(-4deg);
    z-index: 3;
    width: 66%;
    height: 82%;
}
.photo-stack .stack-photo-b {
    right: 2%;
    top: 0;
    transform: rotate(7deg);
    z-index: 1;
}
.photo-stack .stack-photo-c {
    right: 8%;
    top: 34px;
    transform: rotate(13deg);
    z-index: 2;
    width: 46%;
    height: 62%;
}
.post-gallery {
    display: grid;
    gap: 2px;
}
.gallery-count-1 { grid-template-columns: 1fr; }
.gallery-count-2 { grid-template-columns: 1fr 1fr; }
.gallery-count-3 { grid-template-columns: 1fr 1fr; }
.gallery-count-4 { grid-template-columns: 1fr 1fr; }
.post-gallery img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
/* 画像ビューア */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }
.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
}
.lightbox-close, .lightbox-nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    cursor: pointer;
    line-height: 1;
}
.lightbox-close {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
}
.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 64px;
    font-size: 40px;
    border-radius: 6px;
}
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox.single .lightbox-nav { display: none; }
.lightbox-counter {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 0.9em;
}

.post-text {
    padding: 12px 14px;
    line-height: 1.4;
    white-space: pre-wrap;
}
.post-text a {
    color: var(--accent);
    word-break: break-all;
}
.embed { padding: 0 14px 14px; }
.embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.embed-map iframe { aspect-ratio: 4 / 3; }
.empty { text-align: center; color: var(--muted); margin: 40px 0; }
.pager {
    display: flex;
    justify-content: space-between;
    padding: 10px 0 40px;
    font-size: 0.9em;
}
.site-footer { text-align: center; color: var(--muted); font-size: 0.85em; padding: 20px 0; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--muted); }
.footer-links-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 10px;
}
.footer-links-row .footer-extra-link:not(:last-child)::after {
    content: "・";
    margin-left: 10px;
    color: var(--border);
}

/* 管理画面 */
.admin-body { background: #f3f4f6; }
.login-box {
    max-width: 360px;
    margin: 60px auto;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-align: center;
}
form label { display: block; font-weight: bold; margin: 14px 0 4px; }
form input[type=text], form input[type=password], form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1em;
}
form button {
    margin-top: 18px;
    padding: 10px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
}
.error { color: #c00; }
.post-table { width: 100%; border-collapse: collapse; background: #fff; }
.post-table th, .post-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    font-size: 0.9em;
}
.existing-images { display: flex; flex-wrap: wrap; gap: 10px; }
.existing-image { display: flex; flex-direction: column; align-items: center; font-size: 0.8em; }
.existing-image img { width: 100px; height: 100px; object-fit: cover; border-radius: 6px; }
.settings-current-image { margin: 6px 0; display: flex; align-items: center; gap: 12px; font-size: 0.85em; }
.settings-current-image img { max-width: 240px; max-height: 120px; border-radius: 6px; border: 1px solid var(--border); }
.settings-current-image .settings-avatar-preview { max-width: 100px; max-height: 100px; border-radius: 50%; object-fit: cover; }
.done { color: #0a7d2e; font-weight: bold; }
input[type="datetime-local"] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1em;
}
