@charset "utf-8";

/*  Root Variables & Theme
 * ![NagiMemo Skin]
 * 
 * NagiMemo v1.0.0
 * Copyright (c) 2026 Lichiphen
 * Licensed under the MIT License
 * https://gitlab.com/lichiphen/nagimemo/-/blob/main/LICENSE
 */
:root {
    /* Colors - Ivory & Paper */
    --primary-color: #6D5A46;
    --primary-hover: #544436;
    --secondary-color: #6F6860;
    --accent-color: #C08455;
    
    --bg-body: #FDFBF7;
    --bg-card: #FFFFFF;
    --bg-header: #FFFFFF;
    --bg-footer: #F5F2EB;
    
    --text-main: #3E3A36;
    --text-muted: #6F6860;
    --text-light: #8F8780;
    
    --border-color: #EBE8E1;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(62, 58, 54, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(62, 58, 54, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(62, 58, 54, 0.08);
    --shadow-fab: 0 10px 25px -5px rgba(109, 90, 70, 0.3);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    
    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Layout */
    --header-height: 80px;
    --sidebar-width: 320px;
    --content-max-width: 1000px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'LINE Seed JP', 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    /* Sticky Footer */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

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

/* Twemoji Fix (prevent giant size and block display) */
img.emoji {
    height: 1.2em;
    width: 1.2rem;
    margin: 0 .05em 0 .1em;
    vertical-align: -0.2em;
    display: inline-block !important; /* Force inline */
    flex-shrink: 0; /* Prevent shrinking in flex containers */
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    background-color: var(--bg-header);
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 100;
    flex-shrink: 0; /* Prevent header shrinking */
}

.header-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.maintitle {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.maintitle a {
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.mainguide {
    display: none;
}
@media(min-width: 900px) {
    .maintitle {
        font-size: 1.75rem;
    }
}


/* ==========================================================================
   Layout Container
   ========================================================================== */
.contents {
    max-width: var(--content-max-width);
    margin: var(--spacing-lg) auto;
    padding: 0 var(--spacing-sm);
    display: flex;
    gap: var(--spacing-lg);
    align-items: flex-start;
    flex: 1; /* Push footer down */
    width: 100%;
}

.mainarea {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   Sidebar (PC) - Scrolls with page
   ========================================================================== */
.subarea {
    width: var(--sidebar-width);
    flex-shrink: 0;
    /* Removed sticky to allow normal scrolling on PC */
    position: relative; 
}
@media (min-width: 901px) {
    .subarea-content {
        padding-top: 1rem;
    }
}

/* ==========================================================================
   Sidebar (Mobile)
   ========================================================================== */
.sidebar-header-mobile {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}
.sidebar-title {
    font-weight: 700;
    font-size: 1.25rem;
}
.close-sidebar {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

/* Mobile Styling */
@media (max-width: 900px) {
    .contents {
        display: block;
        margin-top: var(--spacing-sm);
    }
    
    .contents .mainarea {
        width: 100%;
        max-width: 100%;
        margin-right: 0;
    }
    
    .subarea {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        max-height: 100vh;
        background: var(--bg-card);
        z-index: 1000;
        padding: var(--spacing-md);
        box-shadow: -5px 0 20px rgba(0,0,0,0.15);
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    
    .subarea.active {
        right: 0;
    }

    .sidebar-header-mobile {
        display: flex;
    }
}

/* Overlays */
#sidebar-overlay, #post-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}
#sidebar-overlay.active, #post-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* FABs (X-style smaller size) */
#fab-menu, #fab-post {
    position: fixed;
    right: 1.25rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-fab);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    -webkit-tap-highlight-color: transparent;
}
.fab-text {
    display: none;
    font-size: 0.9rem;
    font-weight: 700;
    margin-left: 6px;
}
#fab-menu { bottom: 1.25rem; }
#fab-post { bottom: 5rem; background: var(--accent-color); box-shadow: 0 6px 16px -3px rgb(6 182 212 / 0.5); }

/* Hide FAB post button when not logged in (tegalog [[SYS:ISLOGGEDIN]] outputs NO) */
#fab-post.loggedin-NO {
    display: none !important;
}

/* Hide post area wrapper when not logged in */
.postarea-wrapper.loggedin-NO {
    display: none !important;
}

#fab-menu span, #fab-post span {
    font-size: 22px;
    pointer-events: none;
}
#fab-menu:active, #fab-post:active {
    transform: scale(0.92);
    opacity: 0.9;
}

@media (min-width: 901px) {
    #fab-menu, #sidebar-overlay, .close-sidebar {
        display: none !important;
    }
    
    /* PC Scroll FAB */
    #fab-post {
        display: flex !important; /* Force display on PC */
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
        width: auto;
        border-radius: 999px;
        padding: 0 20px;
        right: max(20px, calc((100% - var(--content-max-width)) / 2 + 20px)); /* Align with sidebar column */
        bottom: 30px;
    }
    
    #fab-post.pc-scroll-visible {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
    
    #fab-post .fab-text {
        display: inline-block;
    }
    
    #fab-post span {
        font-size: 20px;
    }

    /* PC Center Modal for Post Area */
    .postarea-wrapper.active {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        max-width: 650px;
        height: auto;
        max-height: 85vh;
        overflow-y: auto;
        z-index: 1002;
        background: #fff;
        border-radius: 24px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        padding: 40px;
        border: 1px solid rgba(0,0,0,0.05);
        animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        display: block !important;
    }
    
    /* Enhance form layout in modal */
    .postarea-wrapper.active .postarea form {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    /* Textarea styling in modal */
    .postarea-wrapper.active textarea.tegalogpost {
        min-height: 180px;
        font-size: 1.1rem;
        padding: 15px;
        border: 2px solid var(--border-color);
        background: #f8fafc;
        border-radius: 12px;
    }
    .postarea-wrapper.active textarea.tegalogpost:focus {
        background: #fff;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    }

    /* Show Overlay on PC */
    #post-overlay.active {
        display: block !important;
    }

    @keyframes modalPop {
        from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
        to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
}


/* ==========================================================================
   Post Card (Skin Onelog)
   ========================================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* 投稿ヘッダーのユーザープロフィール画像 */
.user-profile .usericon {
    width: 50px !important; /* PCサイズ */
    height: 50px !important;
    border-radius: 50%;
    object-fit: cover;
}

@media (max-width: 600px) {
    .user-profile .usericon {
        width: 40px !important; /* スマホサイズ */
        height: 40px !important;
    }
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.2;
}

.post-date {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
}

.post-meta-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.permalink {
    font-size: 0.8rem;
    color: var(--text-light);
    font-family: monospace;
}

.new-marker {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.post-body {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: var(--spacing-md);
    word-break: break-all;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: var(--spacing-sm) calc(var(--spacing-md) * -1) calc(var(--spacing-md) * -1) calc(var(--spacing-md) * -1);
    background: #fafafa;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}
@media (max-width: 600px) {
    .post-footer {
        flex-direction: column;
        align-items: flex-start; /* 左寄せに変更 */
        gap: var(--spacing-sm);
    }
}

.footer-left .category-list {
    display: flex;
    flex-wrap: wrap; /* モバイルで折り返しを許可 */
    align-items: center;
    gap: 0.4rem;
}
.catseparator {
    display: none; /* カンマを非表示にしてチップ風に見せる */
}
.footer-left .category-list a {
    background: var(--bg-body);
    padding: 2px 10px;
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap; /* タグ内での改行を防止 */
    display: inline-block;
}
.footer-left .category-list a:hover {
    background: var(--border-color);
    color: var(--text-main);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-left: auto;
}
@media (max-width: 600px) {
    .footer-right {
        width: 100%;
        justify-content: flex-end;
        padding-top: 4px;
        border-top: 1px dashed var(--border-color);
    }
}

.icon-tiny {
    font-size: 16px;
    vertical-align: middle;
}


/* ==========================================================================
   Sidebar Widgets
   ========================================================================== */
.widget {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
}
@media (min-width: 901px) {
    .widget {
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0 0 var(--spacing-md) 0;
        border-bottom: 1px dashed var(--border-color);
    }
    .widget:last-child {
        border-bottom: none;
    }
}

.widget-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 var(--spacing-sm) 0;
    display: flex;
    align-items: center;
}
.widget-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    margin-right: 8px;
    border-radius: 2px;
}

/* Links lists in sidebar */
.widget ul, .widget li {
    list-style: none;
    padding-left: 10px;
    margin: 0;
}
.widget li {
    margin-bottom: 0;
}
/* Ensure links take full width and handle internal spans for single-line display */
.widget li a {
    color: var(--text-main);
    display: flex; 
    justify-content: flex-start;
    align-items: baseline;
    padding: 8px 0; /* Expanded touch target */
    width: 100%;
}
/* Archives, Hashtags, Categories should stay on one line */
.datelistarea li a,
.hashtaglistarea li a,
.categoryarea li a {
    flex-wrap: nowrap;
    white-space: nowrap;
    
    /* リストメニュー風の装飾 */
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px dashed var(--border-color);
    transition: padding-left 0.2s, background-color 0.2s;
}
.datelistarea li:last-child a,
.hashtaglistarea li:last-child a,
.categoryarea li:last-child a {
    border-bottom: none;
}
.datelistarea li a:hover,
.hashtaglistarea li a:hover,
.categoryarea li a:hover {
    padding-left: 8px;
    background: rgba(0, 0, 0, 0.02);
}

/* Recent Posts and others should be allowed to wrap */
.latestpostarea li a {
    flex-wrap: wrap;
    white-space: normal;
    word-break: break-all;
    line-height: 1.4;
    display: inline-flex; /* Use inline-flex for better alignment with emojis */
    align-items: center;
}
.latestpostarea li a img.emoji {
    margin-left: 4px;
}
.widget li a:hover {
    color: var(--primary-color);
}

/* Fix for "sinking" count on hover in sidebar links */
.widget li a .num {
    flex-shrink: 0;
    margin-left: 0.5rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8em;
    opacity: 0.6;
}

/* ナビゲーションメニュー */
.navigationwidget .utility-links li a {
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px dashed var(--border-color);
    font-weight: 500;
    transition: padding-left 0.2s;
}
.navigationwidget .utility-links li:last-child a {
    border-bottom: none;
}
.navigationwidget .utility-links li a:hover {
    padding-left: 8px;
    background: rgba(0, 0, 0, 0.02);
}
/* アーカイブ等の (n) 件数表示を右端に寄せる */
.datelistarea li a .num,
.hashtaglistarea li a .num,
.categoryarea li a .num {
    margin-left: auto;
}

.navigationwidget .icon-right {
    font-size: 18px;
    color: var(--text-light);
}
.widget li a:hover .num {
    opacity: 1;
}

/* Category Tree specific fix: force single line like Hashtags */
.categoryTree li {
    display: block;
}
.categoryTree li > a,
.categoryTree li > .categorylink {
    display: inline-flex !important;
    flex-wrap: nowrap;
    white-space: nowrap;
    justify-content: flex-start;
}
/* Ensure .num inside category links stays inline */
.categoryTree .num {
    display: inline !important;
}

/* Calendar */
.calendarplace table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.calendarplace th {
    color: var(--primary-color);
    font-weight: normal;
}
.calendarplace td {
    text-align: center;
    padding: 2px;
    width: 32px; /* 固定幅 */
    height: 32px; /* 固定高 */
    vertical-align: middle;
}
.calendarplace td a,
.calendarplace td .nolink {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 auto;
    border-radius: 50%;
    font-size: 0.85rem;
    line-height: 1;
}
.calendarplace td a {
    background: var(--primary-color);
    color: white;
}
.calendarplace td a:hover {
    background: var(--primary-hover);
}
.calendarplace td.today a,
.calendarplace td.today .nolink {
    border: 2px solid var(--primary-color);
}
.calendarlinks {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-sm);
    font-size: 0.9rem;
}

/* Search */
.search-box-wrapper input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg-body);
    transition: all 0.2s;
}
.search-box-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.search-box-wrapper input[type="submit"] {
    margin-top: 8px;
    width: 100%;
    padding: 10px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.search-box-wrapper input[type="submit"]:hover {
    background: var(--text-main);
}

/* Complex Search Refresh */
.complexsearch {
    margin-top: var(--spacing-sm);
}
.complexsearch .searchbox {
    display: flex;
    gap: 8px;
    margin-bottom: var(--spacing-md);
}
.complexsearch .queryinput {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-body);
    transition: all 0.2s;
}
.complexsearch .queryinput:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.complexsearch .submitbutton {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.complexsearch .submitbutton:hover {
    background: var(--primary-hover);
}

.searchoptions {
    list-style: none;
    padding: 0;
    margin: 0;
}
.searchoptions li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}
.searchoptions .solabel {
    width: 100px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.searchoptions select {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}
.searchoptions select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Date Limit Box (Archives pull-down) */
.datelistarea-pull .datelimitbox {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.datelimitpull {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 36px;
    transition: all 0.2s;
}
.datelimitpull:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.datelistarea-pull .submitbutton {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.datelistarea-pull .submitbutton:hover {
    background: var(--primary-hover);
}

.datelimitboxoptions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.datelimitboxoptions label {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
}
.datelimitboxoptions input[type="radio"] {
    margin-right: 6px;
    accent-color: var(--primary-color);
}


/* ==========================================================================
   Post Area (QuickPost)
   ========================================================================== */
.postarea-wrapper {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-sm) 0;
}

@media (max-width: 900px) {
    .postarea-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        z-index: 1000;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: var(--bg-card);
        transform: translateY(100%);
        padding: var(--spacing-md) 0;
        padding-bottom: 80px; /* Space for FAB buttons */
        visibility: hidden; /* Hidden until animations-ready */
    }
    /* Only enable transition after page load */
    body.animations-ready .postarea-wrapper {
        visibility: visible;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .postarea-wrapper.active {
        transform: translateY(0);
        visibility: visible;
    }
}


.postarea {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
    transition: max-width 0.3s ease;
}

/* PC Top QuickPost: Textarea だけメインカラム幅に合わせる */
@media (min-width: 901px) {
    /* テキストエリアのみ幅を制限 */
    div.postarea-wrapper:not(.active) textarea.tegalogpost {
        max-width: calc(var(--content-max-width) - var(--sidebar-width) - var(--spacing-lg) - var(--spacing-sm) * 2);
        /* 左揃え */
        margin-right: auto;
        margin-left: 0;
    }
}

textarea.tegalogpost {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    font-family: inherit;
    font-size: 16px; /* Prevent zoom on iOS */
    resize: none;
    min-height: 100px;
    transition: border-color 0.2s;
}
textarea.tegalogpost:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Modern Post Area Layout (Mobile) */
@media (max-width: 900px) {
    .postarea {
        display: flex;
        flex-direction: column;
    }
    .postarea form {
        display: flex;
        flex-direction: column;
    }
    /* Move textarea to bottom, buttons to top */
    .postarea form > *:not(textarea):not(.tegalogpost) {
        order: -1;
    }
    .postarea textarea.tegalogpost {
        order: 10;
        margin-top: 0.75rem;
    }
}

.postbutton {
    background: var(--primary-color);
    color: white;
    padding: 12px 28px;
    border-radius: var(--radius-lg);
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.postbutton:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

/* Function Buttons (日時, 装飾, 画像, リンク, # etc.) */
.postarea button,
.postarea input[type="button"] {
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    margin: 4px 8px 4px 0; /* Increased horizontal margin */
    transition: all 0.15s;
}
.postarea button:hover,
.postarea input[type="button"]:hover {
    background: var(--border-color);
    border-color: var(--text-muted);
}

/* Category Chips (Checkbox style) */
.catChecks {
    display: flex !important; /* Force flex to allow gap functionality */
    flex-wrap: wrap;
    gap: 8px 8px; /* Significantly increased spacing between chips */
    width: 100% !important;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 12px;
}
.catChecks label {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 6px 14px 6px 10px; /* Slightly larger padding */
    font-size: 0.85rem; /* Better readability */
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    box-shadow: var(--shadow-sm);
}
.catChecks label:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}
.catChecks input[type="checkbox"] {
    margin-right: 6px;
    accent-color: var(--primary-color);
}
.catChecks input[type="checkbox"]:checked + * {
    color: var(--primary-color);
    font-weight: 500;
}

/* Status Settings (Fixed, Draft, Lock, etc.) */
[id^="stateSet"] {
    display: none; /* Hidden by default, let JS show/hide it */
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0.5rem 0;
    width: auto;
}
[id^="stateSet"] .catChecks {
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
}
[id^="stateSet"] input[type="button"] {
    margin: 0 0 0 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* Sidebar Form Elements (Select, Search, etc.) */
.hashtagEasyInput,
.datelimitpull, /* Directly target the select element inside datelimitbox */
.complexsearch select,
.searcharea input[type="text"],
.searcharea input[type="search"] {
    display: block;
    width: 100% !important;
    padding: 8px 32px 8px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    font-family: inherit !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: #334155 !important;
    cursor: pointer !important;
    margin-bottom: 8px !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-sizing: border-box !important;
    
    appearance: none !important;
    -webkit-appearance: none !important;
    
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='20' viewBox='0 -960 960 960' width='20'%3E%3Cpath fill='%2364748b' d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important;
}

/* Base style for Search Box (Simple & Complex) */
.searchbox .searchinputs,
.complexsearch .searchbox {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-start !important; /* Align to top to avoid margin-bottom issues */
}

.searcharea .queryinput {
    flex: 1 !important;
    margin: 0 !important; /* Remove bottom margin for alignment */
    height: 38px !important; /* Consistent height */
}

.searcharea .submitbutton {
    width: auto !important;
    height: 38px !important; /* Match input height */
    padding: 0 16px !important;
    white-space: nowrap;
    background-color: var(--secondary-color) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    margin: 0 !important;
}
.searcharea .submitbutton:hover {
    background-color: #1e293b !important;
    transform: translateY(-1px) !important;
}


/* Containers shouldn't have background/border */
.datelimitbox, .submitcover {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: contents !important; /* Prevent span from breaking flex alignment */
}


/* Search input and regular inputs shouldn't have the arrow */
.searcharea input[type="text"],
.searcharea input[type="search"] {
    background-image: none !important;
    padding-right: 12px !important;
    cursor: text !important;
}

.hashtagEasyInput option,
.datelimitpull option,
.complexsearch option {
    background-color: #ffffff;
    color: #334155;
    padding: 8px;
}


.hashtagEasyInput:hover,
.datelimitpull:hover,
.complexsearch select:hover,
.searcharea input:hover {
    border-color: var(--primary-color) !important;
    background-color: #f8fafc !important;
}

.hashtagEasyInput:focus,
.datelimitpull:focus,
.complexsearch select:focus,
.searcharea input:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 4px 6px -1px rgb(0 0 0 / 0.1) !important;
}

/* Complex Search Layout Fix */
#complexsearch .complexsearch {
    width: 100%;
}
#complexsearch .queryinput {
    width: 100% !important;
    box-sizing: border-box !important;
}
#complexsearch .searchoptions {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}
#complexsearch .searchoptions li {
    margin-bottom: 12px;
}
#complexsearch .solabel {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 600;
}

/* Media Query for Mobile Complex Search */
@media (max-width: 600px) {
    .searchbox .searchinputs,
    #complexsearch .complexsearch .searchbox {
        flex-direction: column; /* Stack input and button on mobile */
        align-items: stretch;
    }
    .searcharea .queryinput {
        width: 100% !important;
    }
    .searcharea .submitbutton {
        width: 100% !important; /* Full width button on mobile */
        padding: 10px !important;
    }
    #complexsearch .submitcover {
        display: block !important;
    }
}


.decoBtns {
    display: inline-block;
}
.decoBtns > span, .decoBtns > button {
    display: inline-block;
}

/* ==========================================================================
   Code Block Styling (with Copy Button)
   ========================================================================== */
code.decoration1 {
    display: block;
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    word-break: break-all;
    position: relative;
}

/* Wrapper added by JS for copy button positioning */
.code-block-wrapper {
    position: relative;
    margin: 1em 0;
}

/* Copy Button */
.code-copy-btn {
    position: absolute;
    top: -18px;
    right: 0;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #1e293b;
    border-radius: 6px;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 1; /* Always visible */
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

.code-copy-btn::before {
    content: '';
    width: 14px;
    height: 14px;
    display: inline-block;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16h140.1L432 147.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V147.9c0-12.7-5.1-24.9-14.1-33.9L333.9 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16h140.1L432 147.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V147.9c0-12.7-5.1-24.9-14.1-33.9L333.9 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z'/%3E%3C/svg%3E") no-repeat center / contain;
}


.code-copy-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--primary-color);
}


/* Copy Toast (positioned near click) */
.copy-toast {
    position: fixed;
    padding: 8px 16px;
    background: #10b981;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    pointer-events: none;
    animation: copyToastFade 1.5s ease forwards;
    transform: translate(-50%, -100%);
}

@keyframes copyToastFade {
    0% { opacity: 0; transform: translate(-50%, -80%); }
    15% { opacity: 1; transform: translate(-50%, -100%); }
    85% { opacity: 1; transform: translate(-50%, -100%); }
    100% { opacity: 0; transform: translate(-50%, -120%); }
}


/* ==========================================================================
   Page Navigation
   ========================================================================== */
.pagenavi {
    margin-top: var(--spacing-lg);
    text-align: center;
}
.pagelinks a, .pagenums a {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
}
.pagelinks a:hover, .pagenums a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.pagenums b {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: normal;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Ensure it stays at the bottom of the flex container */
    padding: var(--spacing-lg) 0;
    text-align: left;
    color: var(--text-muted);
}
.footer-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
    width: 100%;
    text-align: left;
}
.footer-nav {
    margin-bottom: var(--spacing-sm);
}
.footer-nav a {
    margin: 0 10px;
    color: var(--text-main);
    font-weight: 500;
}

/* ==========================================================================
   Accordion / Fold Style (decorationO)
   ========================================================================== */
.decorationO {
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    margin: 1.5em 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.foldswitch {
    display: block;
    padding: 14px 18px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    user-select: none;
    transition: all 0.2s;
    list-style: none; /* Remove default arrow */
    box-shadow: var(--shadow-sm);
}

.foldswitch::-webkit-details-marker {
    display: none;
}

.foldswitch:hover {
    background: #f8fafc;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.decorationO[open] .foldswitch {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.foldlabel {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

/* Custom Icon: + / - style */
.foldlabel::before {
    content: '+';
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 400;
    color: var(--text-light);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.decorationO[open] .foldlabel::before {
    content: '−'; /* Minus sign */
    color: var(--primary-color);
}

.foldedarea {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    line-height: 1.7;
    background: #ffffff;
    margin: 0; /* 余白なし */
}

@media (max-width: 600px) {
    .decorationO {
        margin: 1em -16px; /* 投稿枠の左右パディング分をネガティブマージンで相殺 */
        border-radius: 0;
    }
    .foldswitch {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 12px 16px;
    }
    .foldedarea {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 16px;
    }
}


/* ==========================================================================
   Legacy / Generic Decorations
   ========================================================================== */
.decorationB { font-weight: bold; }
.decorationI { font-style: italic; }
.decorationU { text-decoration: underline; text-decoration-color: var(--accent-color); text-decoration-style: double; }
.decorationS { font-size: 0.8em; }
.decorationT { font-size: 0.6em; }
.decorationD { text-decoration: line-through; color: var(--text-light); }
.decorationE { font-weight: bold; color: var(--primary-color); background: rgba(37,99,235,0.05); padding: 0 4px; border-radius: 2px; font-style: initial;}

.decorationQ {
    margin: 1.5em 0;
    padding: 1em;
    border-left: 4px solid var(--primary-color);
    background: var(--bg-footer);
    color: var(--text-main);
}
.decorationQ + br { display: none; }

.embeddedimage {
    border-radius: var(--radius-sm);
    max-width: 100%;
}

.url {
    word-break: break-all;
}

/* YouTube Responsive (only for YouTube iframes) */
article iframe[src*="youtube"],
article iframe[src*="youtu.be"],
video.embeddedmovie,
.embeddedmovie,
.embeddedmusic,
.embeddedspotify,
.embeddedapplemusic,
.cardlinkbox {
    margin: 10px 0;
    display: block; /* Ensure margins work on span/inline elements */
}

article iframe[src*="youtube"],
article iframe[src*="youtu.be"],
video.embeddedmovie {
    max-width: 100% !important;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
    border-radius: var(--radius-sm);
    border: none;
}

/* Instagram Responsive */
article .instagram-media,
article iframe.instagram-media {
    max-width: 100% !important;
    width: 100% !important;
    min-width: unset !important;
    margin: 12px auto !important;
    border: none !important; /* Force remove border */
    border-radius: 12px !important;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.12), 0 0 20px rgba(0,0,0,0.05) !important; /* Fluffy shadow */
}

/* ---------------------------------------------------
   Multiple Images Grid Layout (2 columns)
   --------------------------------------------------- */
/*
   Selector Logic:
   1. ".imagelink:has(+ .imagelink)" targets an image followed by another image.
   2. ".imagelink:has(+ .imagelink) + .imagelink" targets the image immediately following the above.
   
   This creates a chain. We want ALL images in a sequence of 2+ to form a grid.
/* ==========================================================================
   Image Grid Layout (JS-driven & Robust)
   ========================================================================== */

/* 1. SINGLE Images (.single-image assigned by JS) */
.single-image {
    display: block;
    width: 100%;
    margin: 0 0 12px 0;
    box-sizing: border-box;
    text-align: center;
}

/* 装飾用クラス: super */
p.decorationF.deco-super {
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1.4;
    margin-block-start: 0.3em;
    margin-block-end: 0.5em;
}

/* ---------------------------------------------------
   Styled Buttons (deco-Color_Button)
   --------------------------------------------------- */
p.decorationF[class*="_Button"] {
    width: 70%;
    margin: 1.5em auto;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
    border: none;
    text-indent: 0; /* Reset any text-indent */
}

p.decorationF[class*="_Button"] a.labeledlink {
    display: block;
    padding: 16px 24px;
    text-align: center;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.05em;
    color: #ffffff;
    transition: background 0.3s ease;
}

p.decorationF[class*="_Button"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

p.decorationF[class*="_Button"]:active {
    transform: translateY(-1px);
}

/* Color Variations */
p.decorationF.deco-Pink_Button  { background: linear-gradient(135deg, #f472b6, #e11d48); }
p.decorationF.deco-Green_Button { background: linear-gradient(135deg, #34d399, #059669); }
p.decorationF.deco-Red_Button   { background: linear-gradient(135deg, #fb7185, #be123c); }
p.decorationF.deco-Blue_Button  { background: linear-gradient(135deg, #60a5fa, #1d4ed8); }
p.decorationF.deco-Black_Button { background: linear-gradient(135deg, #475569, #0f172a); }
p.decorationF.deco-White_Button { 
    background: #ffffff; 
    box-shadow: 0 0 0 1px var(--border-color), 0 4px 12px -2px rgba(0,0,0,0.05);
}
p.decorationF.deco-White_Button a.labeledlink { color: var(--text-main); }
p.decorationF.deco-White_Button:hover { background: var(--bg-body); }

/* Mobile Width Adjustment */
@media (max-width: 900px) {
    p.decorationF[class*="_Button"] {
        width: 100%;
        border-radius: 12px;
    }
    p.decorationF[class*="_Button"] a.labeledlink {
        padding: 14px 20px;
    }
}

.single-image .embeddedimage {
    width: 100%;
    height: auto;
    object-fit: contain; /* Or cover depending on preference */
    border-radius: var(--radius-sm);
}

/* 2. GRID Images (.grid-image assigned by JS) */
.grid-image {
    display: block;
    float: left;
    width: calc(50% - 6px); /* 2 columns with 12px gap */
    margin-right: 12px;
    margin-bottom: 12px;
    box-sizing: border-box;
    text-align: center;
    position: relative;
}

/* Clear float for new rows (odd items: 1, 3, 5...) */
.grid-image.grid-odd {
    clear: left;
}

/* Remove margin at end of rows (even items: 2, 4...) */
.grid-image.grid-even {
    margin-right: 0;
}

.grid-image .embeddedimage {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
}

/* 3. Helper Classes (assigned by JS) */
.grid-hidden-br {
    display: none !important;
}

.grid-clear-br {
    display: block !important;
    clear: both !important;
    content: "";
    margin: 0;
    height: 0;
}

/* Clearfix for container is still good practice */
.post-text::after,
.post-body::after, /* Added post-body just in case */
.onelog::after {
    content: "";
    display: table;
    clear: both;
}

/* Fallback for noscript or before JS loads: display as block stack (safest) */
.imagelink:not(.single-image):not(.grid-image) {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 8px;
}

/* ==========================================================================
   Link Buttons
   ========================================================================== */
.profile-link-area {
    margin-top: var(--spacing-sm);
}

.linkbtn_profile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.linkbtn_profile:hover {
    background-color: var(--bg-body);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.linkbtn_profile .material-symbols-rounded {
    font-size: 20px;
}

/* Ensure images inside fill the container */
.imagelink:has(+ .imagelink) .embeddedimage,
.imagelink + .imagelink .embeddedimage {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1 / 1; 
}
/* Utility */
/* Hide edit button for non-logged-in users (uses body class from skin-cover.html) */
body.loggedin-NO .edit-btn {
    display: none !important;
}

/* ================================================================ */
/* てがろぐVer 4.5.5β以降で使える、カード型リンク用CSSの抜粋です。 */
/* お使いのスキンのCSSに追記するなどしてご活用下さい。              */
/* ================================================================ */

/* ---------------------- */
/* ▼カード型リンクの装飾 */
/* ---------------------- */
.cardlink {
display: inline-block;
width: 100%;
max-width: 500px;               /* 最大幅 (※横幅を制限したくない場合はこれを削除して下さい) */
padding: 0 0.25em 0.5em 0;      /* 内側の余白量 */
font-size: 0.9rem;              /* 文字サイズ */
text-decoration: none;          /* リンク文字の下線を消す */
vertical-align: middle;         /* 行内の上下方向では中央配置 */
}

/* リンクカードの装飾(サイズS/L共通部分) */
/* カード外枠 */
.cardlinkbox {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    display: flex;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
}
/* (マウスが載ったとき) */
.cardlinkbox:hover {
    background-color: rgba(109, 90, 70, 0.02);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
/* ▽リンクカード内の画像枠 (※読み込まれたog:imageは、この枠に《背景画像として》描画されます) */
.cardlinkimage {
background-image: linear-gradient(-30deg, #8a8, #e0f0e0);  /* プレースホルダ的な背景グラデーション(※og:imageの画像指定が読み込まれたら、この値は上書きされます) */
background-size: cover;             /* 背景画像で枠を埋める */
background-position: center center; /* 背景画像を中央に寄せる */
background-repeat: no-repeat;       /* 背景画像を繰り返さない */
}
/* ▽リンクカード内のテキスト枠 */
.cardlinktextbox {
display: flex;          /* Flexbox化 */
flex-direction: column; /* 子要素を縦方向に並べる */
padding: 0.5em 1em;     /* 内側の余白量 */
}
/* ▽リンクカードのテキスト枠内の3要素共通 */
.cardlinktitle,
.cardlinkdescription,
.cardlinkurl {
/* ↓表示行数を制限するための準備 (※システム側では文字数は制限せずに「記述されている全文字」をHTMLに出力しますので、表示分量を制限したい場合はCSSで制御する必要があります。) */
display: -webkit-box;          /* -webkit-line-clampを使うために必要な記述1 ※A */
-webkit-box-orient: vertical;  /* -webkit-line-clampを使うために必要な記述2 ※A */
overflow: hidden;              /* 表示量を制限する場合に必須の記述 */
/* ↓制限の仕様 */
line-clamp: 1;                 /* 1行だけ見せる (将来的にはこれだけで実現可能かも) */
-webkit-line-clamp: 1;         /* 1行だけ見せる (今のブラウザにはこちらが必要で、そのためには上記「※A」も必要) */
text-overflow: ellipsis;       /* 省略記号(三点リーダー) */
}
/* リンクタイトル */
.cardlinktitle {
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
    padding-bottom: 0.4em;
}
/* リンク概要文 */
.cardlinkdescription {
    line-height: 1.5;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-clamp: 2;
    -webkit-line-clamp: 2;
}
/* リンクドメイン */
.cardlinkurl {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: auto;
}

/* ----------------------------------- */
/* リンクカードの装飾(サイズS用の追記) */		/* 前述の「サイズS/L共通部分」と合わせて、1つのカードデザインになります。 */
/* ----------------------------------- */
.cardsize-S {
flex-direction: row;                /* 画像とテキストは横に並べる(Flexbox) */
}
/* ▽リンクカード内の画像枠 */
.cardsize-S .cardlinkimage {
min-width: 100px;           /* 最小の横幅 */
min-height: 100px;          /* 最小の高さ */
border-radius: 6px 0 0 6px; /* 左側だけ角丸 */
flex-shrink: 0;             /* 枠サイズを自動縮小させない */
}
/* ▽リンクカード内のテキスト枠 */
.cardsize-S .cardlinktextbox {
    border-left: 1px solid var(--border-color);
    justify-content: center;
}
/* ▽リンクカードのテキスト枠内の3要素 */
.cardsize-S .cardlinktitle { order: 2; }        /* タイトルは、2番目に表示 */
.cardsize-S .cardlinkdescription { order: 3; }  /* 概要文　は、3番目に表示 */
.cardsize-S .cardlinkurl { order: 1; }          /* ドメインは、1番上に表示 */

/* ----------------------------------- */
/* リンクカードの装飾(サイズL用の追記) */		/* 前述の「サイズS/L共通部分」と合わせて、1つのカードデザインになります。 */
/* ----------------------------------- */
.cardsize-L {
flex-direction: column;             /* 画像とテキストは縦に並べる(Flexbox) */
}
/* ▽リンクカード内の画像枠 */
.cardsize-L .cardlinkimage {
aspect-ratio: 1.91 / 1;     /* 画像枠の縦横比を指定= (横)1.91：(縦)1 */
width: 100%;                /* 横幅は枠最大に拡げる */
height: auto;               /* 高さは自動計算 */
border-radius: 6px 6px 0 0; /* 上側だけ角丸 */
}
/* ▽リンクカード内のテキスト枠 */
.cardsize-L .cardlinktextbox {
    border-top: 1px solid var(--border-color);
}
/* ▽リンクカードのテキスト枠内の3要素 */
.cardsize-L .cardlinktitle { font-weight: bold; }
.cardsize-L .cardlinkdescription { min-height: 3em; }
.cardsize-L .cardlinkurl {
    border-top: 1px dashed var(--border-color);
    margin-top: 0.7em;
    padding-top: 0.5em;
    font-size: 0.75rem;
}

/* ==========================================================================
   Utility / Components
   ========================================================================== */
.linkbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white !important;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px -3px rgba(109, 90, 70, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
    margin: 10px 0;
}

.linkbtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.linkbtn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px -5px rgba(109, 90, 70, 0.5);
}

.linkbtn:hover::before {
    opacity: 1;
}

.linkbtn:active {
    transform: translateY(0) scale(0.98);
}

/* Read More Button (decorationH) */
.readmorebutton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    margin: 1rem 0;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    box-sizing: border-box;
}

.readmorebutton:hover {
    background: var(--bg-body);
    border-color: var(--text-light);
    transform: translateY(-1px);
}

.readmorebutton::before {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.readmoreopen::before {
    content: 'add'; /* Material Symbols "+" */
}

.readmoreclose::before {
    content: 'remove'; /* Material Symbols "-" */
}

/* ==========================================================================
   Auth Control: Hide elements when not logged in
   ========================================================================== */
body.loggedin-NO .Login-Required,
body.loggedin-NO .edit-links,
body.loggedin-NO .edit-btn,
body.loggedin-NO a[href*="mode=edit"],
body.loggedin-NO a[href*="mode=delete"] {
    display: none !important;
}

/* ==========================================================================
   Drag & Drop Overlay
   ========================================================================== */
#drag-drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(109, 90, 70, 0.85); /* Primary color overlay */
    z-index: 9999;
    padding: 20px;
    display: none; /* Toggled by JS */
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Allow events to pass through until active */
    transition: opacity 0.2s;
}
#drag-drop-overlay.active {
    pointer-events: auto; /* Catch the drop */
    opacity: 1;
}
.drag-message {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    border: 4px dashed #fff;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    text-align: center;
}

/* ユーザー要望の追加スタイル */
ul.decorationL {
    margin-block-start: 0.3em;
    margin-block-end: 0.3em;
    padding-inline-start: 20px;
}

/* ==========================================================================
   Profile Modal
   ========================================================================== */
#profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex; /* Always flex, hide via visibility/opacity */
    visibility: hidden;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}
#profile-modal.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
#profile-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
#profile-modal .modal-container {
    background: var(--bg-card);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#profile-modal.active .modal-container {
    transform: translateY(0) scale(1);
}
#profile-modal .modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#profile-modal .modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}
#profile-modal .modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
#profile-modal .modal-close:hover {
    background: var(--bg-body);
    color: var(--text-main);
}
#profile-modal .modal-body {
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* プロフィールアイコンのスタイル調整 */
#profile-modal .modal-body img {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}
/* ==========================================================================
   Password Protected Post Form (passkeyform)
   ========================================================================== */
.passkeyform {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 20px 0;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.passkeybox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.passkeyguide {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

/* Material Icon 鍵を疑似要素で追加 */
.passkeyguide::before {
    content: 'lock';
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    color: var(--primary-color);
}

.passkeyinput {
    width: 100%;
    max-width: 300px;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.2s;
    text-align: center;
    outline: none;
}

.passkeyinput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.submitcover {
    display: block;
    width: 100%;
}

.passkeysubmit {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    max-width: 300px;
}

.passkeysubmit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.passkeysubmit:active {
    transform: translateY(0);
}

@media (min-width: 601px) {
    .passkeybox {
        flex-direction: row;
        justify-content: center;
        flex-wrap: nowrap; /* 折り返さない */
        align-items: center;
    }
    .passkeyguide {
        width: auto; /* 幅を自動に */
        margin-bottom: 0;
    }
    .passkeyinput {
        max-width: 200px;
        margin: 0 8px; /* 左右に余白 */
    }
    .submitcover {
        display: inline-block;
        width: auto;
    }
    .passkeysubmit {
        width: auto;
        white-space: nowrap;
    }
}

/* ==========================================================================
   Tegalog v4.7.4 Beta Support
   ========================================================================== */
/* Recent Image Selection Buttons in QUICKPOST */
.recentimginsertbtns {
    margin: var(--spacing-xs) 0;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.recentimginsert {
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.recentimginsert:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.recentimginsert img {
    display: block;
    width: 60px; /* Custom size for NagiMemo */
    height: 60px;
    object-fit: cover;
}


/* =================================================================
   Override FAB for NagiWrite floating button
   ================================================================= */
#fab-post.floating-post-btn {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    box-shadow: 0 6px 20px rgba(192, 132, 85, 0.4);
    z-index: 2000;
}

#fab-post.floating-post-btn .icon {
    font-size: 24px;
    margin-bottom: -2px;
}

#fab-post.floating-post-btn .text {
    font-size: 11px;
    font-weight: 700;
}

#fab-post.floating-post-btn span {
    pointer-events: none;
}

@media (max-width: 900px) {
    #fab-post.floating-post-btn {
        right: 20px;
        bottom: 20px;
        width: 56px;
        height: 56px;
    }
    #fab-post.floating-post-btn .icon { font-size: 22px; }
    #fab-post.floating-post-btn .text { font-size: 10px; }
}


/* ==========================================================================
   Header Categories (Shared)
   ========================================================================== */
.header-categories {
    display: flex;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-categories a {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.header-categories a::before {
    content: "chevron_right";
    font-family: "Material Symbols Rounded";
    font-variation-settings: "FILL" 0, "wght" 200, "GRAD" -25, "opsz" 24;
    font-size: 18px;
    line-height: 1;
    color: var(--text-light);
}

.header-categories a:hover {
    color: var(--primary-color);
    background-color: var(--bg-body);
    text-decoration: none;
}

.header-categories ul {
    display: flex;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-categories li {
    margin: 0;
    position: relative;
}

.header-categories ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 8px;
    z-index: 1000;
    flex-direction: column;
    gap: 6px;
}

.header-categories li:hover > ul,
.header-categories li:focus-within > ul {
    display: flex;
}

.header-categories li ul a {
    padding: 6px 8px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .header-inner {
        padding: 12px var(--spacing-md);
    }

    .site-header {
        height: auto;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        height: auto;
        padding: 12px var(--spacing-md);
    }

    .maintitle {
        width: 100%;
    }

    .maintitle a {
        align-items: flex-start;
    }

    .header-nav {
        width: 100%;
    }

    .header-categories {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px 0;
        margin-top: 8px;
    }

    .header-categories ul {
        flex-wrap: nowrap;
        gap: 12px;
    }

    .header-categories li {
        flex: 0 0 auto;
    }

    .header-categories li ul {
        display: none !important;
    }
}
