/* ==========================================================================
   Table of Contents
   1.  Variables & Themes
   2.  Global Resets & Base Styles
   3.  Layout & Containers
   4.  Typography & Common Elements
   5.  Components (Buttons, Forms, Badges, Loaders)
   6.  Feedback & Alerts (Flash, Info Boxes)
   7.  Navigation & Header (Header, Sidebar, Footer)
   8.  Timeline & Feed Core (Search, Lists, Cards)
   9.  Interactions & Actions (Likes, Menus, Dropdowns)
   10. Modals & Overlays
   11. Page Specifics (Hero, Settings, Admin, Notifications)
   12. Specialized Views (Canvas, Gallery)
   13. Animations
   14. Media Queries (Mobile & Desktop)
   ========================================================================== */

/* ==========================================================================
   1. Variables & Themes
   ========================================================================== */
:root,
html[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e5ea;
    --bg-tertiary-hover: #dcdce0;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-on-primary-button: #ffffff;
    --border-primary: #f5f5f7;
    --border-secondary: #e5e5ea;
    --border-primary-hover: #1d1d1f;
    --primary-accent: #0071e3;
    --primary-accent-hover: #005ecb;
    --danger-accent: #ff3b30;
    --danger-accent-hover: #c7001e;
    --success-accent: #34c759;
    --success-accent-hover: #2aa14a;
    --warning-bg: #fffbeb;
    --warning-border: #f59e0b;
    --info-bg: #f0f7ff;
    --error-bg: #fff2f2;
    --header-bg: rgba(28, 28, 30, 0.85);
    --header-text: #1d1d1f;
    --header-icon: #1d1d1f;
    --header-icon-hover: #6e6e73;
    --main-shadow: rgba(0, 0, 0, 0.04);
    --modal-shadow: rgba(0, 0, 0, 0.15);
    --flash-shadow: rgba(0, 0, 0, 0.15);
    --glass-inset-shadow-1: rgba(255, 255, 255, 0.95);
    --glass-inset-shadow-2: rgba(255, 255, 255, 0.75);
    --bubble-bg: #f0f0f5;
    --create-post-link-bg-gradient: linear-gradient(rgba(255,255,255,0.9), rgba(255,255,255,0.9));
    --create-post-link-border-gradient: linear-gradient(
        270deg,
        hsl(0, 100%, 85%),
        hsl(60, 100%, 85%),
        hsl(120, 100%, 85%),
        hsl(180, 100%, 85%),
        hsl(240, 100%, 85%),
        hsl(300, 100%, 85%),
        hsl(360, 100%, 85%)
    );
    --create-post-link-border: rgba(220, 220, 220, 0.4);
}

html[data-theme="dark"] {
    --bg-primary: #202124;
    --bg-secondary: #18191c;
    --bg-tertiary: #2a2b2e;
    --bg-tertiary-hover: #35363a;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-on-primary-button: #ffffff;
    --border-primary: #202124;
    --border-secondary: #2a2b2e;
    --border-primary-hover: #e8eaed;
    --primary-accent: #0a84ff;
    --primary-accent-hover: #359dff;
    --danger-accent: #ff453a;
    --danger-accent-hover: #ff1c1c;
    --success-accent: #30d158;
    --success-accent-hover: #28a745;
    --warning-bg: #332b00;
    --warning-border: #ffd60a;
    --info-bg: #0a2a4a;
    --error-bg: #4a0f0f;
    --header-bg: rgba(24, 25, 28, 0.9);
    --header-text: #e8eaed;
    --header-icon: #e8eaed;
    --header-icon-hover: #b0b3b8;
    --main-shadow: rgba(0, 0, 0, 0.08);
    --modal-shadow: rgba(0, 0, 0, 0.35);
    --flash-shadow: rgba(0, 0, 0, 0.35);
    --glass-inset-shadow-1: rgba(48, 48, 48, 0.95);
    --glass-inset-shadow-2: rgba(48, 48, 48, 0.75);    
    --bubble-bg: #18191c;
    --create-post-link-bg-gradient: linear-gradient(
        rgba(42,42,46,0.9),
        rgba(42,42,46,0.9)
    );
    --create-post-link-border: rgba(80, 80, 80, 0.4);
}

/* ==========================================================================
   2. Global Resets & Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 62.5%; /* 1rem = 10px */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-size: 1.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
    padding-bottom: 12rem;
    padding-top: env(safe-area-inset-top, 0rem);
}

body, h1, h2, h3, p, ul, li, textarea, button, input {
    margin: 0;
    padding: 0;
    line-height: 1.7;
    border-radius: 0;
    border: none;
    font-family:
        "LINE Seed JP",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Hiragino Sans",
        "Yu Gothic UI",
        "Meiryo",
        sans-serif;
    font-weight: 400;
}

a {
    color: var(--primary-accent);
    text-decoration: none;
}

strong {
    font-weight: 700;
}

/* ==========================================================================
   Timeline Color Bar (Modified)
   ========================================================================== */
#timeline-wrap {
    position: relative;
    width: 100%;
    height: 3px;
    z-index: 20;
    pointer-events: none;
    top: auto;
    left: auto;
}

#timeline-wrap .layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    background: var(--bg-tertiary);
}

#timeline-wrap .layer.active {
    opacity: 1;
}

html.has-restored-theme #timeline-wrap .layer:first-child {
    opacity: 1;
    background: var(--current-timeline-gradient);
}

@media (min-width: 768px) {
    #timeline-wrap {
        position: absolute;
        height: 4px;
        top: 0;
        left: 0;
    }
}

.theme-preview-bar {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    margin-bottom: 12px;
    background-color: var(--bg-secondary);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    transition: none;
}
/* ==========================================================================
   3. Layout & Containers
   ========================================================================== */
.page-container {
    max-width: 102.4rem;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-container {
    margin-top: 0.8rem;
    margin-bottom: 2.4rem;
    padding: 0 2rem;
}

.content-list-container {
    background-color: var(--bg-secondary);
    border-radius: 2.4rem;
    padding: 4rem;
    max-width: 72.8rem;
    margin: 0 auto;
    min-height: 20rem;
    box-shadow: 0 0.4rem 1.2rem var(--main-shadow);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    background: rgba(0, 0, 0, 0.4);
}

.overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Lists within Main Container */
.main-container ul, .main-container ol {
    padding-left: 2.4rem;
    margin: 1.6rem 0;
}

.main-container ul li, .main-container ol li {
    padding-left: 0.8rem;
    color: var(--text-primary);
}

.main-container ul li::marker, .main-container ol li::marker {
    color: var(--text-secondary);
    font-size: 1.3rem;
}

/* ==========================================================================
   4. Typography & Common Elements
   ========================================================================== */
.content-title {
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 2.4rem;
    line-height: 1.3;
}

.content-title a {
    color: inherit !important;
}

/* Content Headers */
.content-header {
    margin-bottom: 1.6rem;
}

.content-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.6rem;
    margin-bottom: 1.6rem;
    width: auto;
}

.content-header-back {
    margin: -2.4rem -4rem 2.4rem -4rem;
    padding: 0 4rem 1.6rem 4rem;
    width: auto;
    border-bottom: 1px solid var(--border-primary);
}

.content-header-back > * {
    font-size: 1.3rem !important;
}

.content-header-title-group {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
}

.content-header .content-title {
    margin-bottom: 0.8rem;
}

.participant-count {
    font-size: 1.3rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.content-header-actions {
    display: flex;
    gap: 1.2rem;
    flex-shrink: 0;
}

.thread-snippet-text {
    color: inherit;
    font-weight: normal;
}

/* Breadcrumbs (Inline Layout) */
.breadcrumb-title {
    display: block;
    width: 100%;
    line-height: 1.5;
}

.breadcrumb-separator {
    display: inline;
    font-size: 1.6rem;
    color: #ccc;
    margin: 0 0.4rem;
}

.breadcrumb-title .content-title,
.breadcrumb-title .content-title-parent {
    display: inline;
    margin: 0 !important;
    font-size: 2rem;
    font-weight: 700;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
}

.breadcrumb-title .content-title-parent {
    font-weight: 400;
    color: var(--text-secondary);
}

.breadcrumb-title .content-title-parent a,
.breadcrumb-title .content-title a {
    display: inline;
    color: inherit;
    text-decoration: none;
}

.breadcrumb-title .content-title-parent a:hover,
.breadcrumb-title .content-title a:hover {
    color: var(--primary-accent);
    text-decoration: none;
}

.sensitive-badge,
.official-badge {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 0.6rem !important;
    transform: translateY(-0.2rem);
}

.breadcrumb-back-link {
    font-size: 1.6rem;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

/* ==========================================================================
   5. Components (Buttons, Forms, Badges, Loaders)
   ========================================================================== */
/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.8rem;
    border: 0.1rem solid transparent;
    border-radius: 999.9rem;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled, .btn[disabled] {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
    border-color: transparent;
}

.btn--primary {
    background-color: var(--primary-accent);
    color: var(--text-on-primary-button);
}
.btn--primary:active { background-color: var(--primary-accent-hover); }
.btn--primary:hover {
    background-color: var(--primary-accent-hover);
    color: var(--text-on-primary-button);
    text-decoration: none;
}

.btn--primary.is-joined {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn--primary.is-joined:active { background-color: var(--bg-tertiary-hover); }
.btn--primary.is-joined::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.9rem;
    margin-right: 0.6rem;
}

.btn--secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn--secondary:active { background-color: var(--bg-tertiary-hover); }
.btn--secondary:hover { background-color: var(--bg-tertiary-hover); text-decoration: none; }

.btn--danger {
    background-color: var(--danger-accent);
    color: var(--text-on-primary-button);
}
.btn--danger:active { background-color: var(--danger-accent-hover); }
.btn--danger:hover { background-color: var(--danger-accent-hover); }

.btn--warning {
    background-color: var(--warning-border);
    color: #ffffff;
}
html[data-theme="dark"] .btn--warning { color: #000000; }
.btn--warning:hover { opacity: 0.85; }

.btn--pill { border-radius: 999.9rem; }
.btn--large { padding: 1.2rem 2.4rem; font-size: 1.4rem; }
.btn--block { width: 100%; }
.btn--small { padding: 0.4rem 1.2rem !important; font-size: 1.2rem !important; }
.btn--icon-text-mobile .fas { margin-right: 0.6rem; }
.btn--with-dot { position: relative; }

.copy-button {
    margin-left: 0.8rem;
    font-size: 1.1rem;
    vertical-align: middle;
}
.copy-button svg { vertical-align: middle; }

/* Forms */
.form-control {
    width: 100%;
    padding: 1.6rem;
    border: 0.1rem solid var(--border-secondary);
    border-radius: 1.2rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
    font-size: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-accent) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 255, 0.25);
    background-color: var(--bg-secondary);
}
#timeline-search-input.form-control {
    border-color: var(--bg-primary);
    font-size: 1.4rem;
}

.form-group { margin-bottom: 2rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label, .form-group .form-label-heading {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.form-group--card {
    padding: 1rem 1.6rem;
    border: 0.1rem solid var(--border-secondary);
    border-radius: 1.2rem;
    background-color: var(--bg-primary);
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
}
.form-group--card:active {
    background-color: var(--bg-tertiary);
}

.form-label-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0 !important;
    cursor: pointer;
    width: 100%;
}

.form-label-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.4rem;
    flex: 1;
}

/* --- テーマカラー設定 (修正版) --- */
.theme-color-settings {
    display: flex;
    align-items: center; /* 垂直方向の中央揃え */
    gap: 1.6rem;
    background-color: var(--bg-primary);
    padding: 1.2rem;
    border-radius: 1.2rem;
    border: 1px solid var(--border-secondary);
}

.color-picker-wrapper {
    position: relative;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-primary-hover);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: opacity 0.3s, filter 0.3s;
    flex-shrink: 0; /* 潰れないように固定 */
}

.color-picker-wrapper input[type="color"] {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    padding: 0;
    border: none;
    cursor: pointer;
}

.color-picker-wrapper.is-disabled {
    opacity: 0.3;
    filter: grayscale(100%);
}

.theme-toggle-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.8rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 0 !important;
    line-height: 1.4;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary-accent);
    width: 1.6rem;
    height: 1.6rem;
    margin: 0;
}

/* Switches & Checkboxes */
input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    border: initial;
    border-radius: initial;
    width: auto;
    height: auto;
    padding: initial;
    line-height: initial;
}

input[type="checkbox"].checkbox-scaled {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 5.1rem !important;
    height: 3.1rem !important;
    background-color: rgba(120, 120, 128, 0.16);
    border-radius: 999px !important;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-shrink: 0;
    margin: 0;
    border: none;
    outline: none;
    transform: none;
}

html[data-theme="dark"] input[type="checkbox"].checkbox-scaled {
    background-color: rgba(120, 120, 128, 0.32);
}

input[type="checkbox"].checkbox-scaled::after {
    content: '';
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    width: 2.7rem;
    height: 2.7rem;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.15), 0 0.1rem 0.1rem rgba(0, 0, 0, 0.16), 0 0.3rem 0.1rem rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

input[type="checkbox"].checkbox-scaled:checked,
html[data-theme="dark"] input[type="checkbox"].checkbox-scaled:checked {
    background-color: var(--success-accent);
}

input[type="checkbox"].checkbox-scaled:checked::after {
    transform: translateX(2rem);
}

/* View Switcher (Segmented Control) */
.view-switcher-container {
    display: flex;
    justify-content: center;
    margin: 1.2rem 0;
    padding: 0 0.4rem;
}

.segmented-control {
    display: inline-grid; 
    grid-auto-flow: column;
    grid-auto-columns: 1fr; 
    background-color: var(--bg-tertiary);
    padding: 0.3rem;
    border-radius: 0.8rem;
    position: relative;
    z-index: 1;
}

.segment-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.6rem;
    white-space: nowrap;
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.6rem;
    transition: all 0.2s ease;
    line-height: 1;
    gap: 0.6rem;
}

.segment-item i { font-size: 1.3rem; }

.segment-item.is-active {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: default;
    pointer-events: none;
}

.segment-item:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* Filter Group Buttons */
.filter-group {
    display: inline-flex;
    border: 0.1rem solid var(--border-secondary);
    border-radius: 0.4rem;
    overflow: hidden;
    font-size: 1.1rem;
    background: var(--bg-secondary);
}
.filter-item {
    display: block;
    padding: 0.6rem 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-right: 0.1rem solid var(--border-secondary);
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}
.filter-item:last-child { border-right: none; }
.filter-item:hover {
    background: var(--bg-tertiary-hover);
    color: var(--text-primary);
    text-decoration: none;
}
.filter-item.is-active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: bold;
    cursor: default;
    pointer-events: none;
}

/* Form Notices */
.form-notices {
    margin-top: 2rem;
    padding: 1.6rem;
    background-color: var(--info-bg);
    border-radius: 0.8rem;
    font-size: 1.3rem;
}

.form-notice {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    color: var(--text-primary);
}
.form-notice:not(:last-child) { margin-bottom: 1.2rem; }
.form-notice .notice-icon {
    font-size: 1.5rem;
    color: var(--primary-accent);
    margin-top: 0.3rem;
    width: 1.6rem;
    text-align: center;
}
.form-notice p { flex: 1; }
.form-notice a {
    font-weight: 700;
    color: var(--primary-accent);
}
.form-notice a:hover { color: var(--primary-accent-hover); }

.form-disclaimer {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 1.6rem;
    text-align: center;
}
.form-disclaimer a { color: var(--primary-accent); }
.form-disclaimer a:hover { color: var(--primary-accent-hover); }

.form-notice-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 1.6rem;
    text-align: left;
    padding: 0.8rem 1.2rem;
    background-color: var(--bg-primary);
    border-radius: 0.8rem;
}

.form-notice-list {
    margin-top: 0.5rem;
    padding-left: 1.2rem;
    line-height: 1.6;
}

.form-notice-list li {
    margin-bottom: 0.8rem;
}

.form-notice-list li:last-child {
    margin-bottom: 0;
}

.notice-sub-text {
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.2rem;
    display: block; /* 改行させるため */
}

.notice-text {
    line-height: 1.6;
}

.form-notice-content {
    flex: 1;
}

/* Badges */
.official-badge {
    display: inline-flex;
    align-items: center;
    align-self: center;
    justify-content: center;
    color: var(--primary-accent);
    line-height: 1;
    gap: 0.4rem;
    flex-shrink: 0;
}
.official-badge--with-text {
    font-weight: 600;
    font-size: 1.4rem;
}
.official-badge--with-text i { font-size: 1.6rem; }

.sensitive-badge {
    display: inline-flex;
    align-items: center;
    align-self: center;
    justify-content: center;
    color: #9d4edd;
    font-size: 1.4rem;
    flex-shrink: 0;
    vertical-align: middle;
}
html[data-theme="dark"] .sensitive-badge { color: #c77dff; }

.banned-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--success-accent);
    color: #fff;
    font-size: 1.1rem;
    font-weight: normal;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    vertical-align: middle;
}

/* Loaders & Spinners */
.loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
    display: none;
}
.loading-overlay.is-active { display: none; }
.spinner {
    width: 3rem; height: 3rem;
    border: 0.3rem solid rgba(0, 122, 255, 0.2);
    border-top-color: var(--primary-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.content-loading-mask { opacity: 0; transition: opacity 0.3s ease-out; }
.initial-loading-mask { opacity: 0; }
.content-loaded { opacity: 1 !important; transition: opacity 0.3s ease-out; }


/* ==========================================================================
   6. Feedback & Alerts (Flash, Info Boxes)
   ========================================================================== */
/* Flash Messages */
.flash-message-container {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top, 0rem));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2147483647;
    width: 90%;
    max-width: 60rem;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.flash-message-item {
    background-color: var(--header-bg);
    color: var(--text-on-primary-button);
    padding: 1.2rem 2.4rem;
    border-radius: 999rem;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    box-shadow: 0 0.4rem 2rem var(--flash-shadow);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-2rem) scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.flash-message-item.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.flash-message-item.is-hiding {
    opacity: 0;
    transform: translateY(-1rem) scale(0.95);
    transition: all 0.3s ease-in;
    pointer-events: none;
}

html[data-theme="light"] .flash-message-item {
    color: #ffffff;
    background-color: rgba(28, 28, 30, 0.85);
}
html[data-theme="dark"] .flash-message-item {
    color: #ffffff;
    background-color: rgba(50, 50, 50, 0.85);
    border: 0.1rem solid rgba(255,255,255,0.1);
}

/* Info Boxes */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 1.6rem;
    margin: 2.4rem 0;
    padding: 1.6rem 4rem 1.6rem 1.6rem;
    border-radius: 1.2rem;
    position: relative;
}
.main-content-column .info-box:first-child { margin-top: 0; }
.modal-actions + .info-box::before {
    content: "";
    position: absolute;
    top: -2.4rem;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4rem;
    height: 0.4rem;
    border-radius: 4px;
    background-color: var(--border-primary);
}
.modal-actions + .info-box {
    position: relative;
    margin-top: 4.8rem;
    margin-bottom: 0;
}
.js-dismissible-notice { display: none; }

.info-box-close-btn {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 0.8rem;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    opacity: 1;
    font-size: 2.4rem;
    line-height: 3.2rem;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s, color 0.2s;
    padding: 0;
}
html[data-theme="dark"] .info-box-close-btn { background-color: transparent; }

.info-box.is-dismissed {
    transition: opacity 0.3s ease-out, max-height 0.3s ease-out, margin 0.3s ease-out, padding 0.3s ease-out, border 0.3s ease-out;
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    overflow: hidden;
    border-width: 0;
}

.info-box .info-icon {
    font-size: 1.8rem;
    margin-top: 0.3rem;
    width: 2rem;
    text-align: center;
}
.info-box .info-content { flex: 1; }
.info-box .info-content a { font-weight: 700; cursor: pointer; }
.info-box .info-content a:hover { color: var(--primary-accent-hover); }
.info-box h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}
.info-box p {
    font-size: 1.3rem;
    color: var(--text-primary);
}
.info-box .btn { margin-top: 1.2rem; }

/* Info Box Variants */
.info-box--yellow { background-color: var(--warning-bg); }
.info-box--yellow .info-icon { color: var(--warning-border); }

.info-box--red { background-color: var(--error-bg); }
.info-box--red .info-icon { color: var(--danger-accent); }
.info-box--red h3 { color: var(--danger-accent); }

.info-box--blue { background-color: var(--info-bg); }
.info-box--blue .info-icon { color: var(--primary-accent); }

.info-box--agreement { background-color: var(--bg-tertiary); }
.info-box--agreement .info-icon { color: var(--primary-accent); }
.info-box--agreement a {
    font-weight: 700;
    color: var(--primary-accent);
}
.info-box--agreement a:hover {
    color: var(--primary-accent-hover);
}

.info-box--mb-medium { margin-bottom: 1.6rem; }
.info-box__section { margin-bottom: 1rem; }
.info-box__divider {
    border: 0;
    border-top: 0.1rem dashed rgba(0, 0, 0, 0.15);
    margin: 0.8rem 0;
}
html[data-theme="dark"] .info-box__divider { border-top-color: rgba(255, 255, 255, 0.2); }
.info-box__subtitle {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #444;
}
html[data-theme="dark"] .info-box__subtitle { color: #ccc; }
.info-box__highlight {
    border-bottom: 0.1rem solid #999;
    padding-bottom: 0.1rem;
}
.info-box__title--spacious { margin-bottom: 0.8rem; }
.info-box__text { margin-bottom: 0.6rem; }

/* Specific Alerts */
#post-id-notice {
    margin-bottom: 1.6rem;
    padding: 1.2rem 4rem 1.2rem 1.2rem;
    text-align: left;
}
#post-id-notice .info-content p {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 0;
}
#post-id-notice .info-icon {
    font-size: 1.6rem;
    margin-top: 0.2rem;
    margin-left: 0.4rem;
}
#post-id-notice .info-box-close-btn {
    top: 0.6rem;
    right: 0.6rem;
    width: 2.6rem;
    height: 2.6rem;
    line-height: 2.6rem;
}

#home-guide-notice .info-content p,
#timeline-owner-guide .info-content p,
#interaction-guide-infobox .info-content p {
    position: relative;
    padding-left: 2.4rem;
    margin-bottom: 0.5em;
}
#home-guide-notice.info-content p:last-child,
#timeline-owner-guide.info-content p:last-child,
#interaction-guide-infobox .info-content p:last-child { 
    margin-bottom: 0 !important; 
}
#home-guide-notice .info-content p i,
#timeline-owner-guide .info-content p i,
#interaction-guide-infobox .info-content p i {
    position: absolute;
    left: 0;
    top: 0.2em;
    margin-right: 0 !important;
    width: 1.6rem !important;
    text-align: center !important;
}

#yid-issued-notice h3 { margin-bottom: 0.8rem; }
#yid-issued-notice p,
#notification-retention-notice p {
    font-size: 1.3rem;
    margin-bottom: 0;
}

#timeline-list-empty-message,
#timeline-post-list-empty-message,
#mypage-post-list-empty-message {
    display: block;
    padding: 4rem 2rem;
}

.timeline-vibe-alert {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 1.2rem 1.6rem;
    margin-bottom: 1.2rem;
    background-color: var(--bg-primary);
    border-radius: 1rem;
}
.timeline-vibe-alert i {
    font-size: 1.6rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.vibe-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.vibe-main-text { font-size: 1.3rem; font-weight: 700; }
.vibe-sub-text { font-size: 1.1rem; font-weight: 400; color: var(--text-secondary); }
html[data-theme="dark"] .timeline-vibe-alert { background-color: rgba(255, 255, 255, 0.05); }

.censored-post-alert {
    color: var(--text-secondary);
    font-size: 1.3rem;
}
.censored-post-alert p { margin-bottom: 0.8rem; }
.censored-post-alert i {
    color: var(--warning-border);
    margin-right: 0.4rem;
}

/* ==========================================================================
   7. Navigation & Header (Header, Sidebar, Footer)
   ========================================================================== */
.header-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 0 2rem calc(2rem + env(safe-area-inset-bottom, 0rem)) 2rem;
    pointer-events: none;
    transform: translateZ(0);
}

.header-container {
    max-width: 68rem;
    margin: 0 auto;
    position: relative;
    pointer-events: auto;
}

.header {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem 2rem;
    background-color: var(--bg-primary);
    backdrop-filter: blur(1.2rem);
    -webkit-backdrop-filter: blur(1.2rem);
    border-radius: 3.2rem;
    color: var(--header-text);
    overflow: hidden;
    max-height: 6rem;
    transform: translateZ(0);
    will-change: max-height, border-radius;
    box-shadow: none;
    transition: background-color 0.4s ease,
                box-shadow 0.4s ease,
                border-color 0.4s ease,
                backdrop-filter 0.4s ease,
                max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1),
                border-radius 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

html[data-theme="dark"] .header {
    border-color: rgba(255, 255, 255, 0.1);
}

.header-container.is-open .header,
.header.is-scrolled {
    box-shadow: 
        inset 0.1rem 0.1rem 0.2rem var(--glass-inset-shadow-1), 
        inset -0.1rem -0.1rem 0.2rem var(--glass-inset-shadow-2), 
        0 0.4rem 1.6rem var(--modal-shadow);
}

.header-container.is-open .header {
    max-height: 75vh;
    border-radius: 3.2rem;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
    height: 3.6rem;
    -webkit-tap-highlight-color: transparent;
}

.header-main a,
.header-main button {
    cursor: pointer;
}

.header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    height: 3.6rem;
}

.header-logo {
    font-family: 'Oxanium', sans-serif;
    text-transform: lowercase;
    font-size: 2.7rem;
    font-weight: 400;
}
.header-logo a { margin-top: 0.2rem; color: inherit !important; }

/* Header Logo Switching (Mobile: Reload Icon / Desktop: Text) */
.header-logo .logo-text { display: none; }

.header-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    height: 3.6rem;
}

.center-post-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.4rem;
    height: 4.4rem;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-primary);
    
    /* グラデーションボーダー設定 */
    border: 0.3rem solid transparent;
    background-image: linear-gradient(var(--bg-secondary), var(--bg-secondary)), var(--current-timeline-gradient);

    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease, box-shadow 0.2s ease;
    box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.1);
}

.center-post-button.is-visible {
    transform: scale(1);
    opacity: 1;
}

.center-post-button.is-visible:hover {
    transform: scale(1.05);
}
.center-post-button:active {
    transform: scale(0.92);
    filter: brightness(0.99);
    box-shadow: 0 0 0 rgba(0,0,0,0);
    transition: transform 0.1s ease;
}

/* Header Icons */
.header-icon {
    transition: color 0.2s;
    text-decoration: none;
    color: var(--text-secondary);
    background: transparent;
}
.header-icon, .header-logo {
    color: var(--header-icon);
}

.header-icon:hover { text-decoration: none; }
.header-icon:active { color: var(--header-icon-hover); }

.menu-button.btn, 
.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 5.6rem;
    width: 4.8rem;
    font-size: 2rem;
    margin-top: -1rem;
    margin-bottom: -1rem;
    padding: 0 !important;
}

.menu-button.btn {
    background: transparent;
    color: var(--header-icon);
    font-size: 1.8rem;
}

/* Expandable Menu (Sidebar/Drawer) */
.expandable-menu-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.header-container.is-open .expandable-menu-inner {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.menu-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 2.4rem 2.4rem 1rem 2.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.header-container.is-open .menu-scroll-area { scrollbar-width: auto; }

.menu-sticky-footer {
    flex-shrink: 0;
    padding: 1.6rem 2.4rem 2.4rem 2.4rem;
    z-index: 10;
    box-shadow: 0 -0.4rem 1.2rem rgba(0, 0, 0, 0.03);
}

.create-timeline-footer-btn {
    margin-bottom: 1.6rem;
    font-size: 1.3rem;
    box-shadow: 0 0.2rem 0.8rem rgba(0, 122, 255, 0.2);
}

.footer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-tertiary);
    border-radius: 1.2rem;
    padding: 1rem 1.6rem;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: center;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.control-label i { font-size: 1.4rem; color: var(--text-primary); }
.control-divider {
    width: 0.1rem;
    height: 2.4rem;
    background-color: var(--border-primary);
    margin: 0 1.2rem;
}

/* Header Switch Overrides */
input[type="checkbox"].checkbox-scaled.small-switch {
    width: 3.6rem !important;
    height: 2.2rem !important;
    margin: 0;
}
input[type="checkbox"].checkbox-scaled.small-switch::after {
    width: 1.8rem;
    height: 1.8rem;
    top: 0.2rem;
    left: 0.2rem;
    box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.15);
}
input[type="checkbox"].checkbox-scaled.small-switch:checked::after {
    transform: translateX(1.4rem);
}

/* Menu Content Styles */
.sidebar-section-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0.8rem 0 0.4rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.sidebar-header-container { margin-bottom: 1.6rem; }

.sidebar-filter-menu { 
    display: flex; 
    gap: 0.8rem;
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 0.4rem;
}

.sidebar-filter-menu::-webkit-scrollbar {
    display: none;
}

.sidebar-filter-link {
    padding: 0.6rem 1.2rem;
    border-radius: 999.9rem;
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--header-icon-hover);
    transition: all 0.2s;
    flex-shrink: 0; 
}
.sidebar-filter-link.is-active,
.sidebar-filter-link.is-active:hover,
.sidebar-filter-link.is-active:active {
    background-color: var(--bg-tertiary-hover) !important;
    color: var(--text-primary);
}
.sidebar-filter-link:hover,
.sidebar-filter-link:active {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary);
    text-decoration: none;
}
.sidebar-list-footer {
    padding: 1.2rem 1.6rem 2.4rem;
    margin-top: 0.8rem;
    border-top: 1px solid var(--border-secondary);
    text-align: center;
    list-style: none;
    font-size: 1.1rem;
}

.sidebar-list-footer .footer-note {
    display: block;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.sidebar-list-footer .footer-link {
    display: inline-block;
    font-size: 1.2rem;
    color: var(--primary-accent);
    text-decoration: none;
    padding: 0.4rem 0.6rem !important;
    border-radius: 0.4rem;
    transition: background-color 0.2s;
}

.sidebar-list-footer .footer-link:hover {
    background-color: var(--bg-tertiary-hover);
}

ul.timeline-list { list-style: none; }
.timeline-list a {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem 0;
    color: var(--header-text);
    border-radius: 0.8rem;
    transition: padding 0.2s, background-color 0.2s;
    position: relative;
    text-decoration: none;
}
.timeline-list a:active { background-color: rgba(255, 255, 255, 0.1); }

.create-timeline-menu-link { color: var(--header-icon-hover) !important; }
.create-timeline-menu-link:active { color: var(--header-icon) !important; }
.create-timeline-menu-link .fa-plus-circle {
    width: 2rem;
    text-align: center;
    margin-right: 0.8rem;
}

.timeline-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.notification-dot-list {
    width: 0.8rem;
    height: 0.8rem;
    background-color: var(--danger-accent);
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: auto;
}

.menu-divider {
    height: 0.1rem;
    background-color: var(--border-secondary);
    margin: 1.6rem 0;
}

.timeline-list-empty-state {
    text-align: center;
    padding: 3.2rem 1.6rem;
    color: #a0a0a0;
}
.timeline-list-empty-state .empty-state-icon {
    font-size: 4.8rem;
    margin-bottom: 2.4rem;
    opacity: 0.8;
}
.timeline-list-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #a0a0a0;
    margin-bottom: 0.8rem;
}
.timeline-list-empty-state p {
    font-size: 1.4rem;
    max-width: 28rem;
    margin: 0 auto 2.4rem;
}

.menu-overlay {
    z-index: 99;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(0.4rem);
    -webkit-backdrop-filter: blur(0.4rem);
}

.sidebar-timeline-item {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-timeline-item > a {
    flex: 1;
    padding-right: 3.6rem !important;
    min-width: 0;
}

.sidebar-delete-btn {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    
    width: 2.8rem;
    height: 2.8rem;
    padding: 0;
    
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    transition: background-color 0.2s, color 0.2s;
    z-index: 2;
}

.sidebar-delete-btn:hover {
    background-color: var(--bg-tertiary-hover);
    color: var(--danger-accent);
}

@media (max-width: 767px) {
    .sidebar-delete-btn {
        width: 3.6rem;
        height: 3.6rem;
        font-size: 1.4rem;
    }
}

/* Theme Switcher in Header */
.theme-switcher {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    font-size: 1.4rem;
    color: var(--header-text);
    min-height: 4rem;
}
.switch {
    position: relative;
    display: inline-block;
    width: 5rem;
    height: 2.8rem;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.4s;
    border-radius: 3.4rem;
}
.slider:before {
    position: absolute;
    content: "";
    height: 2.2rem;
    width: 2.2rem;
    left: 0.3rem;
    bottom: 0.3rem;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary-accent); }
input:checked + .slider:before { transform: translateX(2.2rem); }

/* Footer */
.footer {
    text-align: center;
    padding: 4rem 1.6rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.footer-links { margin-bottom: 1.2rem; }
.footer-links a {
    color: var(--text-secondary);
    margin: 0 1rem;
    text-decoration: none;
    font-size: 1.1rem;
}
.footer-links a:hover { text-decoration: none; }
.copyright { font-size: 1.0rem; }

/* Mobile Top Bar (Static Logo) */
.mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: calc(1.2rem + env(safe-area-inset-top, 0rem)) 0 1.2rem 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.mobile-logo {
    font-family: 'Oxanium', sans-serif;
    text-transform: lowercase;
    font-size: 2.2rem;
    font-weight: 400;
    margin: 0;
    line-height: 1;
}

.mobile-logo a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   8. Timeline & Feed Core (Search, Lists, Cards)
   ========================================================================== */
/* Timeline Headers & Actions */
.header-row-primary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.6rem;
    width: 100%;
}
.header-title-area { flex: 1; min-width: 0; }
.header-join-action { flex-shrink: 0; margin-left: 0.8rem; }

.header-row-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.8rem;
}
.header-row-secondary .btn {
    background-color: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    padding: 0 !important;
    font-size: 1.3rem !important;
    font-weight: 400 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    display: inline-flex;
    align-items: center;
}
.header-row-secondary .btn:hover {
    color: var(--primary-accent) !important;
    text-decoration: none !important;
    background-color: transparent !important;
}
.header-row-secondary .btn.is-active {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}
.header-row-secondary .btn i,
.header-row-secondary .btn svg {
    margin-right: 0.4rem !important;
    font-size: 1.3rem;
}
.header-row-secondary > *:not(:last-child) { margin-right: 1.2rem; }

.timeline-toggle-icon {
    margin-left: 0.4rem !important;
    margin-right: 0 !important;
    font-size: 1.1rem !important;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}
.about-timeline-button.is-expanded .timeline-toggle-icon { transform: rotate(180deg); }

/* Timeline Description */
.timeline-description {
    display: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-top: 1.2rem;
    padding: 1.6rem;
    background-color: var(--bubble-bg);
    border-radius: 1.6rem;
}
.timeline-description .btn { background-color: var(--bg-secondary); }
.timeline-description .btn:hover { background-color: var(--bg-tertiary); }
.timeline-description .btn:active { background-color: var(--bg-tertiary-hover); }
.timeline-description a { color: var(--primary-accent); }
.timeline-description a:hover { text-decoration: none; }
.timeline-description p { margin-bottom: 1em; }
.timeline-description ul, .timeline-description ol {
    margin: 0 0 1em 0;
    padding-left: 2.4rem;
    list-style-position: outside;
}
.timeline-description ul { list-style-type: disc; }
.timeline-description ol { list-style-type: decimal; }
.timeline-description li {
    font-size: inherit;
    padding-left: 0.4rem;
}
.timeline-description > :last-child { margin-bottom: 0; }

.timeline-detail-meta {
    margin-top: 2.4rem; 
    padding-top: 1.2rem; 
    color: var(--text-secondary);
    border-top: 1px solid var(--border-secondary);
    font-size: 1.2rem; 
    display: flex; 
    gap: 1.2rem; 
    flex-wrap: wrap;
}

/* Timeline Search */
.timeline-search-container {
    position: relative;
    margin-bottom: 1.6rem;
}
.timeline-search-container .search-icon {
    position: absolute;
    top: 50%;
    left: 1.6rem;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 1.5rem;
}
.timeline-search-container .form-control {
    padding: 1.2rem;
    padding-left: 4.4rem;
    border-radius: 999.9rem;
}
.timeline-search-container .form-control:focus {
    background-color: var(--bg-secondary);
    border-color: var(--primary-accent);
}
.timeline-search-container.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1.6rem;
    width: 1.8rem;
    height: 1.8rem;
    margin-top: -0.9rem;
    border: 0.2rem solid transparent;
    border-top-color: var(--primary-accent);
    border-right-color: var(--primary-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.search-filter-item {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-filter-item.is-active {
    background-color: var(--bg-primary);
    color: #fff;
    border-color: var(--primary-color);
    font-weight: bold;
}

.search-filter-item:hover {
    background-color: var(--bg-hover);
}

/* --- Expiration Status Bar --- */
.expiration-status {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 1.1rem;
    padding: 0.4rem 1rem;
    border-radius: 0.6rem;
    margin-top: 0.6rem;
    margin-bottom: 0.4rem;
    line-height: 1.4;
    width: fit-content;
}

.expiration-status strong {
    font-weight: 700;
    font-size: 1.2rem;
}

/* 1. 安全な状態 (Safe) - 控えめなグレー/青系 */
.status-safe {
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-secondary);
}
.status-safe i {
    color: var(--primary-accent); /* アイコンだけ少し色をつける */
}

/* 2. 警告状態 (Warning) - 黄色で強調 */
.status-warning {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    font-weight: 600;
}
.status-warning strong {
    color: #d39e00;
    text-decoration: underline;
}
.renew-hint {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
}

/* 3. 期限切れ (Expired) - 赤色 */
.status-expired {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* ダークモード対応 */
html[data-theme="dark"] .status-safe {
    background-color: rgba(255, 255, 255, 0.05);
    color: #b0b0b0;
}
html[data-theme="dark"] .status-warning {
    background-color: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.3);
    color: #ffca2c;
}
html[data-theme="dark"] .status-warning strong {
    color: #ffca2c;
}
html[data-theme="dark"] .status-expired {
    background-color: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
}


/* Search Result Area */
.search-result-area {
    background-color: var(--bg-secondary);
    border-radius: 1.2rem;
    margin-bottom: 2.4rem;
    border: 0.2rem solid var(--primary-accent);
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
}

.search-result-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 700;
}

#search-result-list .timeline-showcase-item {
    margin-left: 0;
    margin-right: 0;
    padding-left: 2.4rem;
    padding-right: 2.4rem;
}

#search-result-pagination {
    text-align: center;
    margin: 1.2rem 0;
}

/* Showcase & Hot Threads */
.timeline-showcase-section { margin-bottom: 3.2rem; }
.showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.6rem;
}

.timeline-showcase-item {
    padding: 1.6rem 4rem;
    border-bottom: 0.1rem solid var(--border-primary);
    border-radius: 0;
    margin: 0 -4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    transition: background-color 0.2s ease-in-out, border-radius 0.2s ease-in-out;
}
.ad-container + .timeline-showcase-item {
    border-top: 0.1rem solid var(--border-primary);
}

.timeline-showcase-item:hover { background-color: var(--bg-tertiary); }
.timeline-showcase-item:first-child { border-top: 0.1rem solid var(--border-primary); }
.timeline-showcase-item.is-muted { display: none !important; }
.timeline-showcase-item .item-info { min-width: 0; }
.timeline-showcase-item h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}
.timeline-showcase-item h3 .timeline-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline;
}
.timeline-showcase-item h3 .official-badge,
.timeline-showcase-item h3 .sensitive-badge {
    font-size: 1.4rem;
    margin-left: 0.6rem;
    order: 2;
    gap: 0;
}
.timeline-showcase-item .item-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0;
}
.timeline-showcase-item .item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 1.2rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    gap: 0.4rem;
    margin-left: 1.6rem;
}
.item-meta span { display: flex; align-items: center; gap: 0.6rem; }
.timeline-showcase-item .banned-badge { margin-right: 0.8rem; }

.close-timeline-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    padding: 0.8rem;
    cursor: pointer;
    margin-top: -0.8rem;
    margin-bottom: -0.8rem;
    margin-left: 0.8rem;
}
.close-timeline-button:hover { color: var(--danger-accent); }

/* Tabs */
.local-tabs {
    display: flex;
    border-bottom: 0.1rem solid var(--border-primary);
    margin-bottom: 0;
    margin-left: -4rem;
    margin-right: -4rem;
    width: auto;
}
.local-tab-item {
    flex: 1;
    text-align: center;
    margin-bottom: -0.1rem;
    padding: 1.2rem 0;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    border-bottom: 0.1rem solid transparent;
    transition: background-color 0.2s ease-out, color 0.2s ease-out, border-bottom-color 0.2s ease-out;
}
.local-tab-item.is-active {
    font-weight: 700;
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}
.local-tab-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}
.local-tab-item:active { background-color: var(--bg-tertiary-hover); }

.local-tabs + .timeline-showcase-section .timeline-showcase-item:first-child,
.local-tabs + .item-feed .item-card:first-child,
.local-tabs + .timeline-showcase-section {
    border-top: none;
}
.timeline-showcase-section { margin-top: 0; }

/* Post Trigger */
.post-trigger-form {
    background-color: var(--bg-primary);
    border: 0.1rem solid var(--border-primary);
    border-radius: 999.9rem;
    padding: 1.6rem 2rem;
    margin-bottom: 2rem;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    color: var(--text-secondary);
    transition: background-color 0.2s, border-primary 0.2s;
}
.post-trigger-form:active { background-color: var(--bg-tertiary); }

/* Item Card (The Post) */
.item-feed .item-card {
    display: flex;
    align-items: flex-start;
    padding: 1.6rem 2rem;
    border-bottom: 0.1rem solid var(--border-primary);
    margin-bottom: 0;
    border-radius: 0;
    overflow: visible;
}

.item-card:first-child { border-top: 0.1rem solid var(--border-primary); }

.ad-container + .item-card {
    border-top: 0.1rem solid var(--border-primary);
}

.item-card {
    margin-left: -4rem;
    margin-right: -4rem;
    width: auto;
    padding-left: 8rem !important;
    padding-right: 8rem !important;
    box-sizing: border-box;
    opacity: 1;
}
.item-card:last-child { margin-bottom: 0; }
.item-card.is-muted, .thread-item-wrapper.is-muted, .item-card.is-hidden, .thread-item-wrapper.is-hidden { display: none !important; }
.item-card.is-deleting, .thread-item-wrapper.is-deleting {
    transition: opacity 0.4s ease-out, transform 0.4s ease-out, max-height 0.4s ease-out, margin 0.4s ease-out, padding 0.4s ease-out;
    opacity: 0;
    transform: translateX(-2rem);
    max-height: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border: none !important;
    overflow: hidden;
    visibility: hidden;
}
.item-card.js-delete-banned-post a {
    pointer-events: none;
    color: var(--text-primary);
}

/* Item Header */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 0.4rem;
}
.item-header-left {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-size: 1.2rem;
    flex-wrap: wrap;
}
.item-header-right {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    gap: 0.8rem;
    align-items: start;
}
.pinned-header {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}
.pinned-header i {
    color: var(--primary-accent);
}
.item-author {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}
.item-context-header {
    margin-bottom: 0.4rem;
    line-height: 1;
    display: flex;
}
.item-timeline-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
}
.item-timeline-label:hover {
    background-color: var(--bg-tertiary-hover);
    color: var(--text-primary);
    text-decoration: none;
}
.item-timeline-label span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-timeline-label i { font-size: 1.0rem; opacity: 0.8; }
.item-timestamp, .item-timestamp a {
    color: var(--text-secondary);
}
.item-timestamp a { text-decoration: none; }

.item-avatar-placeholder {
    flex-shrink: 0;
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
}
.item-avatar-placeholder img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
    max-width: 100%;
    height: auto;
}

/* Item Content */
.item-main {
    flex-grow: 1;
    padding-left: 0;
    min-width: 0;
}
.item-content {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    margin: 0 0 1rem 0;
    max-width: 100%;
    color: var(--text-primary);
    font-size: 1.5rem;
    display: block;
}
.post-text-content {
    word-break: break-word;
    display: block;
    margin-right: 4rem;
    cursor: pointer;
}
.post-text-content p { margin-bottom: 1em; }
.post-text-content strong { font-weight: normal; }
.post-text-content p:last-child { margin-bottom: 0; }

.item-content.is-truncated {
    overflow: hidden;
    position: relative;
    padding-bottom: 3.2rem;
}
.item-content.is-truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--bg-secondary) 60%, var(--bg-secondary) 100%);
    pointer-events: none;
    z-index: 1;
}
html[data-theme="dark"] .item-content.is-truncated::after {
    background: linear-gradient(to bottom, rgba(38, 38, 40, 0) 0%, var(--bubble-bg) 60%, var(--bubble-bg) 100%);
}

.read-more-button {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 3.2rem;
    background-color: transparent;
    padding: 0;
    z-index: 2;
    cursor: pointer;
    border: none;
    display: none;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 0.8rem;
    color: var(--primary-accent);
    opacity: 0.8;
    transition: opacity 0.2s, background-color 0.2s;
    pointer-events: none;
}
.read-more-button:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.03) !important;
    text-decoration: none;
}
html[data-theme="dark"] .read-more-button:hover { background-color: rgba(255, 255, 255, 0.05) !important; }
.read-more-button i { color: var(--primary-accent); font-size: 1.4rem; transition: color 0.3s ease; }
.item-content.is-truncated .read-more-button {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.post-notice-block {
    display: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 0.4rem 0;
}
.post-notice-block p { margin-bottom: 0.8rem; }

/* Quoted Posts */
.original-post-quote {
    border-left: 0.3rem solid var(--border-secondary);
    padding: 0.4rem 1.6rem;
    margin-bottom: 1.6rem;
    border-radius: 0 0.8rem 0.8rem 0;
}
.original-post-quote .quoted-author {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0;
}
.original-post-quote .quoted-content {
    font-size: 1.4rem;
    color: var(--text-secondary);
}
.original-post-quote .quoted-content img {
    max-width: 50% !important;
}

.quoted-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}
.original-post-quote .copy-button {
    font-size: 1.1rem;
    padding: 0.2rem 0.8rem;
    margin-left: auto;
    flex-shrink: 0;
}

.quote-thread-link {
    font-size: 1.1rem;
    color: var(--primary-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.quote-thread-link:hover {
    text-decoration: underline;
    color: var(--primary-accent-hover);
}

.quote-thread-link i {
    font-size: 1rem;
}

/* Thread Replies & Structure */
.reply-to-block {
    font-weight: 700;
    color: var(--primary-accent);
    cursor: pointer;
    display: inline-block;
}
.reply-to-block:hover { color: var(--primary-accent-hover); text-decoration: none; }
.reply-to-block .fa-reply { margin-right: 0.4rem; }

.thread-owner-badge {
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--primary-accent);
    background-color: transparent;
    border: 1px solid var(--primary-accent);
    padding: 0.1rem 0.6rem;
    border-radius: 0.8rem;
    line-height: 1.3;
    white-space: nowrap;
    margin-left: -0.4rem;
}
html[data-theme="dark"] .thread-owner-badge {
    color: var(--primary-accent);
    border-color: var(--primary-accent);
}
.timeline-owner-badge {
    font-size: 1.0rem;
    font-weight: 700;
    color: #e6a23c;
    border: 1px solid #e6a23c;
    background-color: rgba(230, 162, 60, 0.1);
    padding: 0.1rem 0.6rem;
    border-radius: 0.8rem;
    line-height: 1.3;
    white-space: nowrap;
    margin-left: -0.4rem;

}
[data-theme="dark"] .timeline-owner-badge {
    color: #fab005;
    border-color: #fab005;
    background-color: rgba(250, 176, 5, 0.15);
}

.item-feed > .thread-item-wrapper > .item-card {
    border-bottom: 1px solid var(--border-primary) !important;
    margin: -1.6rem -4rem 0 -4rem !important;
    padding: 1.6rem 8rem !important;
}
.thread-item-wrapper .thread-item-wrapper {
    position: relative;
    margin: 0 -4rem !important;
    padding: 0 !important;
    border-bottom: 1px solid var(--border-primary);
}
.item-feed > .thread-item-wrapper:last-child { border-bottom: none; }

.thread-item-wrapper .item-card {
    padding: 1.6rem 8rem !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0;
    position: relative;
    z-index: 1;
}

.thread-replies { margin: 0; padding: 0; border: none; }
.thread-replies .thread-replies .thread-item-wrapper {
    margin: -0.8rem 0 0 0 !important;
    border-bottom: none;
}
#thread-ad-slot + .thread-replies > .thread-item-wrapper:first-child { border-top: 1px solid var(--border-primary); }

.thread-item-wrapper .item-avatar-placeholder {
    position: relative;
    z-index: 2;
    box-shadow: 0 0 0 4px var(--bg-secondary);
    border-radius: 50%;
}
.thread-item-wrapper .item-card::before {
    content: '';
    position: absolute;
    left: 9.9rem;
    top: 0;
    bottom: 0;
    width: 0.2rem;
    background-color: var(--border-secondary);
    z-index: -1;
    display: block;
}
.item-feed > .thread-item-wrapper > .item-card::before { display: none; }
.thread-item-wrapper > .item-card::before { top: 3.6rem; }
.thread-replies .thread-replies .item-card::before { top: 3.6rem; }
.thread-item-wrapper:not(:has(.thread-replies)) > .item-card::before {
    bottom: auto;
    height: 2rem;
    display: none;
}
.thread-item-wrapper .item-card.is-highlighted .post-text-content * {
    font-weight: 700;
}

/* Undo & Swiping Actions */
.is-temporarily-hidden {
    padding: 0 !important;
    transition: all 0.3s ease;
}
.is-temporarily-hidden > *:not(.undo-placeholder) { display: none !important; }
.timeline-showcase-item.is-temporarily-hidden,
.item-card.is-temporarily-hidden {
    padding: 0 !important;
}

.undo-placeholder {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem !important;
    color: var(--text-secondary);
    font-size: 1.3rem;
    width: 100%;
    height: 100%;
    min-height: 5rem;
    animation: fadeIn 0.3s ease;
}
.undo-placeholder .btn--undo {
    padding: 0.4rem 1.2rem;
    font-size: 1.2rem;
    background-color: var(--bg-tertiary);
    border: 0.1rem solid var(--border-primary);
    border-radius: 999px;
    cursor: pointer;
    color: var(--primary-accent);
    margin-left: 1rem;
}
.undo-placeholder .btn--undo:hover { background-color: var(--bg-primary); }

.action-button {
    position: relative;
    top: auto;
    right: auto;
    background: none;
    cursor: pointer;
    font-size: 2rem;
    color: #ffffff;
    padding: 0.4rem;
    line-height: 1;
    opacity: 1;
    transition: opacity 0.2s, color 0.2s;
    width: 8rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.action-button:hover { opacity: 1; color: var(--text-primary); }

.item-card-content {
    padding: 0;
    width: 100%;
    display: flex;
    gap: 1.2rem;
}
.item-card-actions-bg { display: none !important; }
.item-card-actions-bg.is-delete { background-color: var(--danger-accent); }
.item-card-actions-bg.is-delete .action-button:hover { color: #ffcccc; }
.item-card-actions-bg.is-hide { background-color: var(--text-secondary); }
.item-card-actions-bg.is-hide .action-button:hover { color: #dddddd; }
.item-card.is-viewed:not(.is-swiping) .item-card-actions-bg { display: none; }

/* Date Divider & Pagination */
.date-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin: 2.4rem 0;
    position: relative;
    overflow: hidden;
}
.date-divider.is-hidden { display: none !important; }
.date-divider::before {
    content: '';
    width: 100%;
    position: absolute;
    left: 0;
    top: 50%;
    height: 0.1rem;
    background-color: var(--border-primary);
    z-index: 0;
}
.date-divider span {
    padding: 0 1.6rem;
    background-color: var(--bg-secondary);
    z-index: 1;
    margin: 0 auto;
}

.pagination-wrapper { text-align: center; margin-top: 4rem; }
.pagination {
    display: inline-flex;
    align-items: center;
    border-radius: 999.9rem;
    background-color: var(--bg-tertiary);
    padding: 0.6rem;
}
.pagination a, .pagination span {
    padding: 0.8rem 1.6rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    border-radius: 999.9rem;
    min-width: 8rem;
    text-align: center;
    transition: background-color 0.2s;
}
.pagination span.disabled {
    color: var(--text-secondary);
    opacity: 0.6;
    pointer-events: none;
    cursor: default;
}
.pagination span.current-page {
    color: var(--text-primary);
}
.pagination a:active { background-color: var(--bg-secondary); }

/* Frequent Timelines */
.frequent-timelines-section { margin: 1.2rem 0; position: relative; }
.frequent-timelines-heading {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.frequent-timelines-heading i { color: var(--primary-accent); }
.frequent-timelines-list {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.4rem 0;
    margin: 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
}
.frequent-timelines-list::-webkit-scrollbar { display: none; }
.frequent-timeline-card {
    position: relative;
    flex: 0 0 9.2rem;
    height: 6rem;
    background-color: var(--bg-secondary);
    border: 0.1rem solid var(--border-primary);
    border-radius: 1.2rem;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
    box-shadow: 0 0.2rem 0.4rem var(--main-shadow);
}
html[data-theme="dark"] .frequent-timeline-card {
    box-shadow: 0 0.2rem 0.4rem var(--modal-shadow);
}
.frequent-timeline-card:hover {
    text-decoration: none;
    background-color: var(--bg-tertiary);
}
.frequent-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.scroll-fade-wrapper {
    position: relative;
}

.scroll-fade-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 4rem;
    background: linear-gradient(to right, rgba(255,255,255,0), var(--bg-secondary));
    pointer-events: none;
    z-index: 2;
}
html[data-theme="dark"] .scroll-fade-wrapper::after {
    background: linear-gradient(to right, rgba(32,33,36,0), var(--bg-secondary));
}

/* Ad Containers */
.ad-container {
    display: block;
    margin: 2.4rem auto;
    text-align: center;
    background-color: var(--bg-primary);
    padding: 0;
    border-radius: 1.2rem;
}
.thread-ad-container { border-bottom: 0.1rem solid var(--border-primary); }

/* ==========================================================================
   9. Interactions & Actions (Likes, Menus, Dropdowns)
   ========================================================================== */
.item-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    max-width: none;
    margin-top: 1.2rem;
    gap: 1.6rem;
    position: relative;
}
.item-actions > * {
    flex: 1;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}
.item-actions button, .item-actions a {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    padding: 0.8rem 0;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    text-decoration: none;
    transition: color 0.2s;
}
.item-actions i {
    font-size: 1.7rem;
    width: 2rem;
    text-align: center;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.bookmark-button.is-active i { color: var(--primary-accent); }
.bookmark-button:hover { color: var(--primary-accent) !important; }
.reply-button:disabled, .bookmark-button:disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.reply-button:hover { color: var(--primary-accent) !important; }
.like-button:hover { color: var(--danger-accent) !important; }

.like-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.item-card[data-is-mine="true"] .like-button {
    pointer-events: none;
    opacity: 0.5;
    color: var(--text-secondary);
}
.item-card[data-is-mine="true"] .like-button span { display: inline; }

.close-item-button,
.post-dropdown-trigger {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.8rem;
    margin-top: -0.8rem;
    margin-bottom: -0.8rem;
    line-height: 1;
    transition: color 0.2s;
    border-radius: 0.4rem;
}

.gallery-hide-btn.close-item-button {
    margin-top: 0;
}
/* Post Dropdown Menu */
.post-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}
.post-dropdown-trigger:hover,
.post-dropdown-container.is-active .post-dropdown-trigger {
    color: var(--text-primary);
}
.post-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 20rem;
    background: var(--bg-secondary);
    border: 0.1rem solid var(--border-secondary);
    border-radius: 0.6rem;
    box-shadow: 0 0.4rem 2rem var(--modal-shadow);
    z-index: 1000;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    text-align: left;
}

.post-dropdown-container.is-active .post-dropdown-menu { display: block; }

.dropdown-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0.8rem 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}
.dropdown-item i {
    width: 2rem;
    color: var(--text-primary);
    margin-right: 0.5rem;
    text-align: center;
}
.dropdown-item:hover { background-color: var(--bg-tertiary-hover); }
.dropdown-item--danger, .dropdown-item--danger i { color: var(--danger-accent) !important; }
.dropdown-divider {
    border: none;
    border-top: 0.1rem solid var(--border-secondary);
    margin: 0.4rem 0;
}

/* Special Buttons inside Dropdown */
.post-dropdown-menu > button,
.post-dropdown-menu > a {
    width: 100% !important;
    height: auto !important;
    padding: 0.8rem 1.5rem !important;
    font-size: 1.4rem !important;
    text-align: left !important;
    display: block !important;
    color: var(--text-primary);
}
.post-dropdown-menu > button i,
.post-dropdown-menu > a i {
    margin-right: 0.5rem !important;
    width: 2rem;
    text-align: center;
}
.post-dropdown-menu > button:hover,
.post-dropdown-menu > a:hover {
    background-color: var(--bg-tertiary) !important;
    text-decoration: none !important;
}

/* Share Actions Row */
.share-actions {
    margin-top: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.share-actions a {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.4rem;
    background-color: var(--bg-secondary);
    border-radius: 999px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    border: 0.1rem solid var(--border-primary);
    transition: background-color 0.2s, border-primary 0.2s;
}
.share-actions a:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--border-primary);
    color: var(--text-primary);
}
.share-actions a .fab { font-size: 1.4rem; }

.btn--share-x, .btn--copy-timeline, .btn--edit-timeline {
    width: 3.6rem;
    height: 3.6rem;
    padding: 0 !important;
    font-size: 1.4rem !important;
    flex-shrink: 0;
}
.btn--share-x i, .btn--copy-timeline i, .btn--edit-timeline i { margin-right: 0 !important; }
.btn--share-x { color: var(--text-primary) !important; }

/* Text Selection Mute Tooltip */
.text-selection-tooltip {
    position: absolute;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 0.4rem;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transform: translateX(-50%);
    display: none;
    white-space: nowrap;
    box-shadow: 0 0.2rem 0.8rem rgba(0,0,0,0.2);
    pointer-events: auto;
}

.text-selection-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -0.5rem;
    border-width: 0.5rem;
    border-style: solid;
    border-color: var(--text-primary) transparent transparent transparent;
}

.text-selection-tooltip i {
    margin-right: 0.4rem;
    color: #ff4444;
}

@media (max-width: 767px) {
    .text-selection-tooltip {
        padding: 0.8rem 1.6rem;
        border-radius: 999rem;
        box-shadow: 0 0.4rem 1.2rem rgba(0,0,0,0.3);
    }
    
    .text-selection-tooltip::after {
        display: none;
    }
}

/* ==========================================================================
   10. Modals & Overlays
   ========================================================================== */
.modal-overlay {
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.6rem;
    backdrop-filter: blur(0.8rem);
    -webkit-backdrop-filter: blur(0.8rem);
}

.modal-content {
    background-color: var(--bg-secondary);
    padding: calc(2.8rem + env(safe-area-inset-top, 0rem)) 2.8rem calc(2.8rem + env(safe-area-inset-bottom, 0rem)) 2.8rem;
    border-radius: 2.4rem;
    width: 100%;
    max-width: 50rem;
    box-shadow: 0 0.4rem 2rem var(--modal-shadow);
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    opacity: 0;
    transform: scale(0.95) translateY(-1rem);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease-out;
}

#content-modal-overlay .modal-content { max-width: 80rem; }
.modal-overlay.is-open .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.modal-close-button {
    position: absolute;
    top: 1.6rem;
    right: 1.6rem;
    background: transparent;
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 0.8rem;
    cursor: pointer;
    font-size: 2.6rem;
    color: var(--text-primary);
    opacity: 1;
    line-height: 3.6rem;
    text-align: center;
    padding: 0;
    transition: opacity 0.2s;
    border: none;
}

.form-modal h2, .view-modal-content h2, .info-modal-content h2 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 2.4rem;
    text-align: center;
}
.form-modal textarea.form-control { resize: vertical; margin-bottom: 1.6rem; }
.modal-actions {
    margin-top: 1.6rem;
    display: flex;
    gap: 1.2rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.modal-actions:has(> :only-child) { justify-content: center; }
.modal-actions .btn { flex-grow: 1; min-width: 10rem; }

/* Info Modal Content */
.info-modal-content p, .view-modal-content p {
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
}
.info-modal-content ul {
    font-size: 1.2rem;
    padding-left: 2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.info-modal-content li { padding-left: 0.8rem; margin-bottom: 1rem; }
.info-modal-content strong { color: var(--text-primary); font-weight: 700; }

/* View Modal */
#view-modal-body {
    background-color: var(--bg-primary);
    padding: 1.6rem;
    border-radius: 0.8rem;
    margin-bottom: 1.6rem;
}
#view-modal-body *:last-child {
    margin-bottom: 0 !Important;
}
#view-modal-body .item-card {
    background-color: transparent;
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: none;
}
#view-modal-body .item-header-right { display: none; }
#view-modal-body .item-avatar-placeholder { background-color: transparent; }

/* Content Modal Body (e.g. Terms) */
#content-modal-body {
    font-size: 1.3rem;
    color: var(--text-primary);
}
#content-modal-body a { color: var(--primary-accent); text-decoration: underline; }
#content-modal-body a:hover { color: var(--primary-accent-hover); }
#content-modal-body h1, #content-modal-body h2, #content-modal-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 700;
}
#content-modal-body h1:first-child, #content-modal-body h2:first-child, #content-modal-body h3:first-child {
    margin-top: 0;
}
#content-modal-body h1 { font-size: 1.9rem; }
#content-modal-body h2 { font-size: 1.7rem; }
#content-modal-body h3 { font-size: 1.5rem; }
#content-modal-body ul, #content-modal-body ol { margin: 1em 0; padding-left: 2em; }
#content-modal-body li { margin-bottom: 0.5em; }

/* Generic & Join Modals */
#generic-confirm-body {
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    white-space: pre-wrap;
    word-break: break-word;
}
#join-confirm-modal-body a { color: var(--primary-accent); text-decoration: underline; }
#join-confirm-modal-body a:hover { color: var(--primary-accent-hover); }
#join-confirm-modal-body h2, #join-confirm-modal-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 700;
}
#join-confirm-modal-body h2 { font-size: 1.7rem; }
#join-confirm-modal-body h3 { font-size: 1.5rem; }
#join-confirm-modal-body ul, #join-confirm-modal-body ol { margin: 1em 0; padding-left: 2em; }
#join-confirm-modal-body li { margin-bottom: 0.5em; }
#join-confirm-modal-body *:last-child { margin-bottom: 0; }

/* ==========================================================================
   11. Page Specifics (Hero, Settings, Admin, Notifications)
   ========================================================================== */
/* Hero Section */
.hero-section {
    padding: 8rem 3.2rem;
    text-align: center;
    margin-bottom: 2.4rem;
    margin-top: 4.8rem;
}
.hero-logo {
    font-family: 'Oxanium', sans-serif;
    text-transform: lowercase;
    font-size: 8rem;
    margin-bottom: 1.6rem;
    color: var(--text-primary);
}
.hero-description {
    font-size: 1.4rem;
    max-width: 50rem;
    margin: 0 auto;
    font-weight: 700;
}
.hero-cta-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    margin-top: 3.2rem;
}
.restore-account-link { font-size: 1.2rem; color: var(--text-secondary); }
.restore-account-link:active { color: var(--text-primary); }

/* Compact Hero (Individual Timeline for Guests) */
.compact-hero {
    margin: 2.4rem -2rem 3.2rem -2rem;
    padding: 2.4rem;
    background-color: var(--bubble-bg);
    text-align: center;
    border: 0.1rem solid var(--border-primary);
}

.compact-hero-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    line-height: 1.3;
}

.compact-hero-text {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.compact-hero-text .link-text {
    color: var(--primary-accent);
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
}

.compact-hero-actions {
    display: flex;
    justify-content: center;
}

.hero-section .btn,
.compact-hero-actions .btn {
    font-weight: 700;
    padding: 1rem 2.4rem;
    font-size: 1.4rem;
    box-shadow: 0 0.4rem 1.2rem rgba(0, 122, 255, 0.25);
}
.compact-hero-actions .btn i {
    margin-right: 0.8rem;
}

/* Error Page */
.error-page-container { text-align: center; padding: 4rem 2rem; }
.error-page-container .error-icon {
    font-size: 4.8rem;
    color: var(--danger-accent);
    margin-bottom: 2.4rem;
}
.error-page-container h2 { font-size: 2.1rem; font-weight: 700; margin-bottom: 1.2rem; }
.error-page-container p {
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-bottom: 2.4rem;
    max-width: 40rem;
    margin-left: auto;
    margin-right: auto;
}

/* Notifications Page */
.notification-section .content-title { margin-bottom: 1rem; }
.notification-list { border-t: 0.1rem solid var(--border-primary); }
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1.6rem;
    padding: 1.6rem 4rem;
    border-bottom: 0.1rem solid var(--border-primary);
    border-radius: 0;
    margin-left: -4rem;
    margin-right: -4rem;
    width: auto;
    text-decoration: none;
    color: var(--text-primary);
    background-color: transparent;
    transition: background-color 0.2s;
}
.ad-container + .notification-item {
    border-top: 0.1rem solid var(--border-primary);
}
.notification-list .notification-item:first-of-type { border-top: 0.1rem solid var(--border-primary); }
.notification-item:hover { background-color: var(--bg-tertiary); text-decoration: none; }
.notification-item:active { background-color: var(--bg-tertiary); }
.notification-item.unread { background-color: rgba(0, 122, 255, 0.04); }
.notification-item.unread:hover { background-color: rgba(0, 122, 255, 0.08); }
.notification-item.unread:active { background-color: rgba(0, 122, 255, 0.12); }
.notification-item.is-viewed { animation: fadeOutBackground 2s ease-out 1s forwards; }
.notification-item.is-viewed:hover {
    background-color: var(--bg-tertiary) !important;
}
.notification-icon {
    font-size: 1.8rem;
    width: 2.4rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.notification-icon.like { color: var(--danger-accent); }
.notification-icon.reply { color: var(--primary-accent); }
.notification-icon.follow { color: #34c759; }

.notification-content { flex: 1; min-width: 0; }
.notification-text {
    font-size: 1.4rem;
    word-break: break-word;
}
.notification-text strong { font-weight: 700; }
.notification-timestamp {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

/* Settings & MyPage */
.mypage-container .content-header-top { flex-wrap: nowrap; }
.mypage-container .timeline-filter-menu { margin-top: 2.4rem; }

.settings-section { margin-top: 2.4rem; }
.settings-section .setting-item {
    margin-bottom: 2.4rem;
    padding: 1.8rem;
    border: 0.1rem solid var(--border-primary);
    border-radius: 1.2rem;
    background-color: var(--bg-secondary);
}
.settings-section .setting-item h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}
.settings-section .setting-item p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1.6rem;
}
.settings-section .user-token-display {
    font-family: monospace;
    background-color: var(--bg-tertiary);
    padding: 1rem 1.2rem;
    border-radius: 0.8rem;
    word-break: break-all;
    font-size: 1.2rem;
    color: var(--text-primary);
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    border: 0.1rem solid var(--border-primary);
}

.mute-word-list {
    list-style: none;
    margin: 1.6rem 0;
    padding: 0 !important;
}
.mute-word-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.6rem;
    border: 0.1rem solid var(--border-primary);
    border-radius: 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    background-color: var(--bg-primary);
}
.mute-word-list li span { word-break: break-all; padding-right: 1.6rem; }
.mute-word-list .remove-mute-word-btn {
    background: none;
    border: none;
    color: var(--danger-accent);
    cursor: pointer;
    padding: 0.4rem;
    font-size: 1.8rem;
    line-height: 1;
}
.mute-word-list .remove-mute-word-btn:hover { color: var(--danger-accent-hover); }

.setting-item--danger {
    border-color: var(--danger-accent);
    background-color: var(--error-bg);
}
.setting-item--danger h3 { color: var(--danger-accent); }
.setting-item--danger p { color: var(--text-primary); font-size: 1.3rem; }
.setting-item--danger p strong { font-weight: 700; color: var(--danger-accent); }
.setting-item--danger .btn--danger { font-size: 1.3rem; }
.setting-item--danger .btn--danger i { margin-right: 0.6rem; }

/* Switcher Label Group (for settings) */
.switcher-label-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    max-width: 80%;
}
.switcher-note {
    font-size: 1.0rem;
    color: var(--text-secondary);
    line-height: 1.3;
    font-weight: 400;
}

/* Admin-only Styles */
.admin-info-button {
    padding: 0.4rem 0.6rem !important;
    font-size: 1.1rem !important;
    line-height: 1 !important;
    background-color: transparent !important;
    color: var(--text-secondary) !important;
    border: none !important;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
}
.admin-info-button:hover, .admin-info-button:active {
    opacity: 1;
    color: var(--primary-accent) !important;
    background-color: transparent !important;
    text-decoration: none;
}
.item-header .admin-info-button { margin-left: -0.4rem; }
.timeline-showcase-item h3 .admin-info-button { margin-left: 0.8rem; order: 3; }
.content-header-actions .admin-info-button {
    padding: 0.9rem 1.0rem !important;
    font-size: 1.3rem !important;
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}
.content-header-actions .admin-info-button:hover,
.content-header-actions .admin-info-button:active {
    background-color: var(--bg-tertiary-hover) !important;
    color: var(--primary-accent) !important;
}

.admin-info-modal-body { font-size: 1.2rem; line-height: 1.5; }
.admin-info-header {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 0.1rem solid var(--border-primary);
}
.admin-info-modal-body > .admin-info-header:first-child { margin-top: 0; }

.admin-info-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.admin-info-table th, .admin-info-table td {
    padding: 0.8rem;
    border: 0.1rem solid var(--border-primary);
    vertical-align: top;
    word-break: break-all;
}
.admin-info-table th {
    width: 35%;
    text-align: left;
    font-weight: 700;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 1.1rem;
}
.admin-info-table td {
    width: 65%;
    font-family: monospace;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}
.admin-info-table td em { color: var(--text-secondary); font-style: italic; }

.agreement-check-area {
    margin-top: 2rem;
    padding: 1.6rem;
    background-color: var(--bg-tertiary);
    border-radius: 1.2rem;
    font-size: 1.3rem;
    border: 0.1rem solid var(--border-primary);
}
.agreement-check-area p { margin-bottom: 0.8rem; }
.agreement-check-area p:last-child { margin-bottom: 0; }
.agreement-check-area a {
    font-weight: 700;
    text-decoration: underline;
    color: var(--primary-accent);
    cursor: pointer;
}
.agreement-check-area a:hover {
    text-decoration: none;
    color: var(--primary-accent-hover);
}

/* ==========================================================================
   12. Specialized Views (Canvas, Gallery)
   ========================================================================== */
/* Handwriting Canvas Styles */
#draw-canvas-container {
    user-select: none;
    -webkit-user-select: none;
    border: 0.1rem solid var(--border-secondary);
    background-color: var(--bg-tertiary-hover);
    border-radius: 1.2rem;
    overflow: hidden;
    margin-bottom: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
}
#btn-enter-drawing-mode i,
#btn-exit-drawing-mode i,
#btn-clear-canvas-view i {
    margin-right: 0.4rem;
}
#canvas-area {
    position: relative;
    width: 100%;
    /* aspect-ratio: 1 / 1; はJSで制御するか、あるいは維持 */
    aspect-ratio: 1 / 1; 
    background-color: #fff;
    margin: 0 auto;
    max-width: 600px;
    touch-action: pan-y; /* 通常時は縦スクロールを許可 */
}
canvas {
    display: block;
    width: 100%;
    height: 100%;
    vertical-align: top;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
#draw-canvas-container:not(.is-fullscreen) #canvas-area {
    pointer-events: none;
    width: 50%;           /* ★幅を50%に縮小 */
    margin: 2.4rem auto;  /* ★上下に余白を入れ、左右中央寄せ */
    border: 1px solid var(--border-secondary); /* ★境界線を追加して見やすく */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);   /* ★少し影をつけて浮かせる */
}

.canvas-view-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    background-color: var(--bg-primary);
    border-bottom: 0.1rem solid var(--border-secondary);
}

.view-bar-right {
    display: flex;
    gap: 0.8rem;
}
#canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}
#background-layer {
    position: relative;
    z-index: 1;
}

.canvas-toolbar {
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    border-bottom: 0.1rem solid var(--border-primary);
}

.top-action-bar {
    justify-content: space-between;
    background-color: var(--bg-secondary);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.done-btn {
    font-weight: 700;
    padding: 0.6rem 1.6rem !important;
}

.action-icon-group {
    display: flex;
    gap: 0.4rem;
}

.view-actions {
    display: flex;
    gap: 1rem;
}

#btn-enter-drawing-mode,
#btn-exit-drawing-mode {
    font-weight: 700;
    padding-left: 1.6rem;
    padding-right: 1.6rem;
    box-shadow: 0 2px 6px rgba(0, 113, 227, 0.3);
}

#draw-attention {
    padding: 1.2rem;
    background-color: var(--bg-primary);
    border-top: 0.1rem solid var(--border-secondary);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.tool-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    transition: all 0.2s;
}
.tool-icon-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
.tool-icon-btn:active {
    background-color: var(--bg-tertiary-hover);
}
.tool-icon-btn.is-active {
    background-color: var(--bg-tertiary-hover);
}
.tool-icon-btn.small {
    width: 3rem;
    height: 3rem;
    font-size: 1.4rem;
}

.canvas-toolbar {
    padding: 0.8rem 1.2rem;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.1rem solid var(--border-secondary);
    font-size: 1.2rem;
}
.canvas-toolbar label {
    font-size: 100%;
}

.sub-tool-bar {
    justify-content: space-between;
    background-color: var(--bg-primary);
    font-size: 1.2rem;
}

.tool-settings {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex: 1; /* 横幅を有効活用 */
}

/* 独自のブラシサイズ選択UI */
.brush-size-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 99rem;
    padding: 0.2rem;
    gap: 0.2rem;
}

.brush-btn {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0;
}

.brush-btn .dot {
    display: block;
    background-color: var(--text-secondary);
    border-radius: 50%;
    pointer-events: none; /* クリック判定をボタン本体に */
    transition: background-color 0.2s;
}

.brush-btn:hover {
    background-color: var(--bg-tertiary);
}

.brush-btn.is-active {
    background-color: var(--bg-tertiary-hover);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.brush-btn.is-active .dot {
    background-color: var(--text-primary); /* アクティブ時は色を濃く */
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.color-preview-box {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.4rem;
    overflow: hidden;
    border: 2px solid var(--border-primary-hover);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}
.color-preview-box input[type="color"] {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    padding: 0;
    margin: 0;
    cursor: pointer;
    border: none;
}
.tool-actions-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
/* 戻すボタン & 消しゴムラベル（共通スタイル） */
.undo-btn-pill,
.eraser-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.2rem;
    border-radius: 99rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-secondary);
    transition: all 0.2s;
    cursor: pointer;
    height: 3.2rem; /* 高さを揃える */
    white-space: nowrap;
}

.undo-btn-pill:hover,
.eraser-label:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.undo-btn-pill:active {
    background-color: var(--bg-tertiary-hover);
    transform: translateY(1px);
}

/* 消しゴムトグル */
.eraser-toggle-btn {
    position: relative;
    cursor: pointer;
    margin: 0.8rem 0 0 0;
}
.eraser-toggle-btn input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.eraser-toggle-btn input:checked + .eraser-label {
    background-color: var(--text-primary);
    color: var(--bg-secondary);
    border-color: var(--text-primary);
}

.palette-wrapper {
    background-color: var(--bg-secondary);
    padding: 0.8rem;
    border-bottom: 0.1rem solid var(--border-secondary);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.palette {
    display: flex;
    flex-wrap: wrap;
    width: 37rem;
    gap: 0.2rem;
    margin: 0 auto;
}
.palette div {
    width: 2.6rem;
    height: 2.6rem;
    border: 0.1rem solid rgba(0,0,0,0.1);
    border-radius: 0.4rem;
    cursor: pointer;
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 0.6rem;
}
.canvas-controls select {
    padding: 0.4rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border-secondary);
}
.color-preview-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
input[type="color"] {
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.canvas-icon-btn {
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.canvas-icon-btn i {
    font-size: 1.6rem;
}
.canvas-icon-btn:hover { background-color: var(--bg-tertiary); }
.canvas-icon-btn.is-active {
    background-color: var(--bg-tertiary);
}

.eraser-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-right: 0.6rem;
    cursor: pointer;
    white-space: nowrap;
}

#draw-attention {
    font-size: 1.1rem;
    padding: 1rem;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    border-top: 0.1rem solid var(--border-secondary);
}

.canvas-operation-bar {
    display: flex;
    justify-content: center;
    margin-top: 0.8rem;
}

#btn-clear-canvas {
    background-color: transparent;
    border: 1px solid var(--danger-accent);
    color: var(--danger-accent);
    border-radius: 2rem;
    padding: 0.6rem 1.4rem;
    font-weight: 600;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

#btn-clear-canvas:hover,
#btn-clear-canvas:active {
    background-color: var(--danger-accent);
    color: #fff;
    cursor: pointer;
}

#btn-clear-canvas i { font-size: 1.1em; }

/* Gallery Grid Layout */
.gallery-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-left: -0.4rem;
    margin-right: -0.4rem;
    padding: 0.8rem 0;
    border-bottom: none;
}

.gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
}

.gallery-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image-link img {
    transform: scale(1.05);
}

.gallery-item-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem 0.8rem 0.6rem 0.8rem;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    opacity: 1;
    pointer-events: none;
}

.gallery-meta-btn {
    background: none;
    border: none;
    padding: 0;
    color: #ffffff !important;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: auto;
    transition: transform 0.2s;
    padding: 0.4rem;
}
.like-button.gallery-meta-btn { justify-content: flex-end; }
.like-button.gallery-meta-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.gallery-meta-btn:hover {
    color: #ffffff !important;
    text-decoration: none;
}

.gallery-meta-btn i { font-size: 1.4rem; }

.gallery-grid-wrapper .ad-container {
    grid-column: 1 / -1;
    margin: 2.4rem 0;
    width: 100%;
    min-height: auto;
}

.gallery-hide-btn {
    position: absolute;
    top: 0;
    right: 0.8rem;
    z-index: 3;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.6rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    opacity: 1;
    transition: opacity 0.2s, transform 0.2s;
}

.gallery-hide-btn:hover {
    color: var(--danger-accent);
}

.gallery-item.is-censored {
    background-color: var(--bg-primary);
    border: 1px dashed var(--border-secondary);
    cursor: pointer;
}

.gallery-image-link.censored-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}
html[data-theme="dark"] .gallery-image-link.censored-link {
    background-color: rgba(255, 255, 255, 0.05);
}

.censored-placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.gallery-item.is-censored:hover {
    background-color: var(--bg-tertiary);
}

/* ==========================================================================
   13. Animations
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes like-bubble-flash {
    0% { background-color: rgba(0, 122, 255, 0.2); }
    100% { background-color: var(--bubble-bg); }
}
@keyframes like-push {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
@keyframes floatAndSway {
    0% { transform: translate(-50%, -50%) scale(0.6) rotate(var(--r-start)); opacity: 1; }
    50% { transform: translate(calc(-50% + var(--tx)), -5rem) scale(1.2) rotate(0deg); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--tx-end)), -10rem) scale(0.8) rotate(var(--r-end)); opacity: 0; }
}
@keyframes fadeInPost { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOutBackground {
    from { background-color: rgba(0, 122, 255, 0.1); }
    to { background-color: var(--bg-secondary); }
}
@keyframes floatUpAndFadeOut {
    0% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, -2rem); opacity: 0; }
}
@keyframes notification-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-bg {
    0% { background-color: var(--bg-tertiary); }
    50% { background-color: var(--bg-tertiary-hover); }
    100% { background-color: var(--bg-tertiary); }
}
@keyframes bookmarkPop {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translateY(-2rem) scale(1.3);
    }
    100% {
        opacity: 0;
        transform: translateY(-10rem) scale(1);
    }
}
@keyframes rainbow-border {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.like-button.is-animating i {
    animation: like-push 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
    transform-origin: center center;
}
.like-button.is-animating { animation: none; }

.floating-heart {
    position: absolute; /* 親要素基準に変更 */
    color: var(--danger-accent);
    font-size: 1.1rem;
    pointer-events: none;
    animation-name: floatAndSway;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
    z-index: 10; /* カード内で手前に来ればOKなので値を下げる */
}

.floating-bookmark {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    color: var(--primary-accent);
    font-size: 2rem;
    width: 1em;
    text-align: center;
    margin-left: -0.5em;
    margin-top: -0.5em;
    animation: bookmarkPop 1.5s ease-out forwards;
    text-shadow: 0 0.2rem 0.5rem rgba(0,0,0,0.2);
}

.notification-dot.is-updating { animation: notification-pulse 0.4s ease-in-out; }

html[data-theme="light"] .item-content.is-pressing {
    background-color: #e8e8ed;
    transform: none;
    transition: background-color 0.1s ease-out;
}
html[data-theme="dark"] .item-content.is-pressing {
    background-color: #303032;
    transform: none;
    transition: background-color 0.1s ease-out;
}
.item-content.is-like-bouncing {
    animation-name: like-bubble-flash;
    animation-duration: 0.5s;
    animation-timing-function: ease-out;
    transform: none;
}

.notification-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.8rem;
    height: 5.6rem;
    margin-top: -1rem;
    margin-bottom: -1rem;
}
.notification-icon-wrapper .header-icon { width: 100%; height: 100%; margin: 0; }
.notification-dot {
    position: absolute;
    top: 1.2rem;
    right: 0.8rem;
    min-width: 1.7rem;
    height: 1.7rem;
    background-color: var(--primary-accent);
    border-radius: 0.85rem;
    border: 0.2rem solid var(--bg-primary);
    color: white;
    font-size: 1.0rem;
    line-height: 1.3rem;
    text-align: center;
    padding: 0 0.3rem;
    box-sizing: border-box;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease-out;
    pointer-events: none;
}
.notification-dot.is-visible { transform: scale(1); opacity: 1; }

.new-posts-indicator {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top, 0rem));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    background-color: var(--primary-accent);
    border-radius: 999.9rem;
    box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.new-posts-indicator button {
    background: none;
    border: none;
    color: var(--text-on-primary-button);
    padding: 0.8rem 1.6rem;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: block;
    width: 100%;
}

.like-count-plus {
    position: absolute;
    font-size: 1.2rem;
    color: var(--danger-accent);
    pointer-events: none;
    transform: translateX(-50%);
    opacity: 1;
}
.like-count-plus.is-fading { animation: floatUpAndFadeOut 0.8s ease-out forwards; }

/* ==========================================================================
   Post Editor (Textarea with Toolbar) - 修正版 v2
   ========================================================================== */

.post-editor-wrapper {
    background-color: var(--bg-primary);
    border: 0.1rem solid var(--border-secondary);
    border-radius: 1.2rem;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.post-editor-wrapper:focus-within {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 255, 0.25);
    background-color: var(--bg-secondary);
}

.post-editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.6rem;
    background-color: var(--bg-tertiary);
    border-bottom: 0.1rem solid var(--border-secondary);
    font-size: 1.2rem;
    
    /* モバイル対策 */
    overflow-x: auto; 
    white-space: nowrap;
}

.toolbar-left {
    display: flex;
    gap: 1.6rem;
    align-items: center;
}

/* ★修正ポイント: 詳細度を上げ、強制的に横並びにする */
.post-editor-toolbar label.toolbar-toggle-item {
    display: inline-flex !important; /* 強制的にFlexbox化 */
    flex-direction: row !important;  /* 強制的に横並び */
    align-items: center !important;  /* 垂直中央揃え */
    gap: 0.8rem !important;          /* スイッチと文字の間隔 */
    
    width: auto !important;          /* 親のwidth:100%指定を打ち消す */
    margin: 0 !important;            /* 親のmargin-bottomを打ち消す */
    white-space: nowrap !important;  /* 折り返し禁止 */
    
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.post-editor-toolbar label.toolbar-toggle-item:hover {
    color: var(--text-primary);
}

/* トグルスイッチ本体の強制調整 */
.post-editor-toolbar label.toolbar-toggle-item input {
    display: inline-block !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

/* ラベルテキスト部分 */
.toggle-label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    flex-shrink: 0 !important;
}

.post-editor-textarea {
    border: none !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 1.6rem !important;
    min-height: 20rem; 
    resize: none; 
}

.post-editor-textarea:focus {
    outline: none !important;
    background-color: transparent !important;
}

.post-editor-toolbar .checkbox-scaled.small-switch {
    background-color: rgba(120, 120, 128, 0.2);
}

/* ==========================================================================
   Handwriting Canvas Fullscreen Mode
   ========================================================================== */

#draw-canvas-container.is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background-color: var(--bg-tertiary-hover) !important;
    border-radius: 0;
    border: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* 全画面時はViewバーと注釈を隠す */
#draw-canvas-container.is-fullscreen .canvas-view-bar,
#draw-canvas-container.is-fullscreen #draw-attention {
    display: none;
}

/* 全画面時は描画ツールを表示 */
#draw-canvas-container.is-fullscreen .drawing-tools-wrapper {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    
    /* ★修正: ツールバーの幅をキャンバス(600px)に合わせる */
    max-width: 600px; 
    margin: 0 auto;   /* 左右中央寄せ */
    
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    border-radius: 0 0 1.2rem 1.2rem;
    overflow: hidden;
    z-index: 20;
}

/* 全画面時のキャンバスエリア調整 */
#draw-canvas-container.is-fullscreen #canvas-area {
    flex-grow: 1;
    min-height: 0;
    width: 100%;
    height: 0; /* flexで伸ばす */
    flex-basis: 0;
    overflow: hidden;
    background-color: var(--bg-tertiary-hover);
    display: block;
    pointer-events: auto; /* 描画可能にする */
    touch-action: none;   /* スクロール禁止 */
    cursor: crosshair;
}

/* キャンバスを中央配置 */
#draw-canvas-container.is-fullscreen canvas {
    position: absolute !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    box-shadow: 0 0 2rem rgba(0,0,0,0.2);
}

/* ツールバーのスタイル */
.fullscreen-header {
    padding: 0.8rem 1.6rem;
    background-color: var(--bg-primary);
    border-bottom: 0.1rem solid var(--border-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#draw-canvas-container.is-fullscreen .palette-wrapper,
#draw-canvas-container.is-fullscreen .canvas-toolbar,
#draw-canvas-container.is-fullscreen .fullscreen-bar {
    flex-shrink: 0;
    width: 100%;
}

#draw-canvas-container.is-fullscreen #draw-attention {
    display: none;
}

#draw-canvas-container.is-fullscreen #canvas-area {
    position: relative;
    flex-grow: 1;
    min-height: 0;
    width: 100%;
    height: 0;
    flex-basis: 0;
    overflow: hidden;
    background-color: var(--bg-tertiary-hover);
    display: block;
}

#draw-canvas-container.is-fullscreen canvas {
    position: absolute !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    box-shadow: none !important;
    background: transparent;
}
#draw-canvas-container.is-fullscreen #background-layer {
    box-shadow: none;
}

.fullscreen-bar {
    padding: 0.8rem 1.6rem;
    background-color: var(--bg-primary);
    border-bottom: 0.1rem solid var(--border-secondary);
    order: 0;
}

#btn-exit-fullscreen {
    display: none;
}

#draw-canvas-container.is-fullscreen #btn-enter-fullscreen {
    display: none;
}

#draw-canvas-container.is-fullscreen #btn-exit-fullscreen {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
}

#draw-canvas-container.is-fullscreen .canvas-toolbar {
    flex-shrink: 0;
}


/* ==========================================================================
   14. Media Queries (Mobile & Desktop)
   ========================================================================== */
/* Hover Interactions (Desktop mainly) */
@media (hover: hover) {
    a:hover { text-decoration: none; }
    .header-icon:hover,.menu-button.btn:hover,.header-logo a:hover { color: var(--header-icon-hover); text-decoration: none; }
    .center-post-button:hover { background-color: var(--bg-tertiary-hover); }
    .timeline-list a:hover { padding-left: 1.6rem; background-color: var(--bg-tertiary-hover); text-decoration: none; }
    .create-timeline-menu-link:hover { color: var(--header-icon) !important; }
    .restore-account-link:hover { color: var(--text-primary); text-decoration: none; }
    .sidebar-filter-link:hover { background-color: var(--bg-tertiary-hover); text-decoration: none; }
    .sidebar-filter-link.is-active:hover { background-color: var(--primary-accent-hover); }
    .post-trigger-form:hover { background-color: var(--bg-tertiary); }
    html[data-theme="dark"] .post-trigger-form:hover { border-color: #555; }
    .item-timestamp a:hover { text-decoration: none; }
    .read-more-button:hover i { color: var(--primary-accent-hover); }
    .item-actions button.like-button:hover { color: var(--danger-accent); }
    .item-actions button.reply-button:hover { color: var(--primary-accent); }
    .close-item-button:hover, .delete-item-button:hover { color: var(--danger-accent); }
    .btn--primary:hover {
        background-color: var(--primary-accent-hover);
        color: var(--text-on-primary-button);
        text-decoration: none;
    }
    .btn--primary.is-joined:hover {
        background-color: var(--bg-tertiary-hover);
        color: var(--text-primary);
    }
    .btn--secondary:hover { background-color: var(--bg-tertiary-hover); text-decoration: none; }
    .btn--danger:hover { background-color: var(--danger-accent-hover); }
    .btn--warning:hover { opacity: 0.85; }
    .mute-word-list .remove-mute-word-btn:hover { color: var(--danger-accent-hover); }
    .modal-close-button:hover { background: transparent; opacity: 0.4; }
    .pagination a:hover { background-color: var(--bg-secondary); text-decoration: none; }
    .footer-links a:hover { color: var(--text-primary); text-decoration: none; }
    .new-posts-indicator button:hover { background-color: rgba(0, 0, 0, 0.1); }
    .info-box-close-btn:hover { background-color: transparent; opacity: 0.4; }
    html[data-theme="dark"] .info-box-close-btn:hover {
        background-color: transparent;
        opacity: 0.8;
        color: var(--text-primary);
    }
    .gallery-hide-btn { opacity: 0; }
    .gallery-item:hover .gallery-hide-btn { opacity: 1; }
}

/* Desktop Media Query (>= 768px) */
@media (min-width: 768px) {
    .header-wrapper {
        top: 0;
        bottom: auto;
        padding: calc(1.6rem + env(safe-area-inset-top, 0rem)) 2rem 0 2rem;
    }
    .header-container { max-width: 70.8rem; }
    .header { flex-direction: column-reverse; }
    body {
        padding-bottom: 2rem;
        padding-top: 8rem;
    }
    .sidebar-home-link { display: none; }
    .header-container.is-open .header { max-height: 80vh; }
    .new-posts-indicator { top: 9rem; }
    .flash-message-container { top: 9rem; }
    .mobile-top-bar { display: none; }
    .header-logo .logo-text { display: inline; }
    .header-logo .logo-icon { display: none; }
    .gallery-grid-wrapper {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.4rem;
    }
}

/* Mobile Media Query (< 768px) */
@media (max-width: 767px) {
    body {
        font-size: 1.4rem;
        padding-bottom: 10rem;
        padding-top: 0;
    }
    body.has-canvas {
        touch-action: pan-y;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    .canvas-icon-btn, 
    .btn,
    .eraser-wrapper {
        touch-action: manipulation;
    }    
    .hidden-mobile { display: none; }
    .info-box { margin: 1.2rem 0; }

    .header-join-action .btn { font-size: 1.2rem; line-height: 1; }
    .item-header-left { font-size: 1.1rem; }

    .page-container {
        padding-left: 1.6rem;
        padding-right: 1.6rem;
    }
    .header-wrapper {
        padding: 0 1.6rem calc(1.6rem + env(safe-area-inset-bottom, 0rem));
    }
    .header {
        box-shadow: 0 0.4rem 1.6rem var(--modal-shadow);
    }
    .notification-dot {
        top: 1rem;
        right: 0.2rem;
    }
    .menu-scroll-area { padding: 1rem 0; }

    .menu-sticky-footer { padding: 1.6rem 0; }

    .local-tabs, .item-card, .timeline-showcase-item {
        margin-left: -1.2rem;
        margin-right: -1.2rem;
    }
    .local-tab-item {
        padding: 0.8rem 0;
        font-size: 1.3rem;
    }

    .item-card, .timeline-showcase-item {
        padding: 1.2rem !important;
    }
    .main-container {
        margin-top: 0;
        margin-bottom: 0;
        padding: 0;
    }
    .hero-section {
        padding: 4.8rem 1.6rem;
        margin-top: 2.4rem;
    }
    .hero-logo { font-size: 5rem; }
    .content-list-container {
        padding: 1.2rem;
        border-radius: 0;
        border-left-style: none;
        border-right-style: none;
    }
    .form-notices { padding: 1.6rem; }
    .date-divider { margin: 2rem 0; }
    .header {
        padding: 0.8rem 1.6rem;
        border-radius: 2.8rem;
        max-height: 5.6rem;
    }
    .header-main { height: 4rem; }
    .center-post-button { width: 4.6rem; height: 4.6rem; font-size: 1.8rem; }
    .header-container.is-open .header {
        max-height: 70vh;
        border-radius: 2.8rem;
    }
    .header-right { gap: 0.8rem !important; }
    .header-logo { font-size: 2.4rem; }
    .breadcrumb-back-link { font-size: 1.9rem; }
    .breadcrumb-title { margin-top: 0.4rem; }
    .breadcrumb-title .content-title { font-size: 1.6rem; line-height: 1.4; }
    .breadcrumb-separator { font-size: 1.8rem; }
    .timeline-filter-menu { gap: 0.8rem; }
    .sidebar-filter-link { font-size: 1.2rem; }
    .timeline-list a { padding: 0.8rem 0; }

    .content-header { margin-bottom: 0.8rem; }
    .content-header-top { margin-bottom: 0.8rem; }

    .content-header-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
        max-width: 100%;
        padding-bottom: 0.4rem;
        margin-bottom: -0.4rem;
    }
    .content-header-back {
        margin: -1.2rem -1.2rem 1.2rem -1.2rem;
        padding: 0.8rem 1.2rem;
    }

    .content-header-actions::-webkit-scrollbar { display: none; }
    .content-title { font-size: 1.6rem; line-height: 1.4; }
    .item-content {
        font-size: 1.4rem;
    }
    .post-text-content { margin-right: 1.2rem; }

    .item-card-content { gap: 0.8rem; }

    .item-timestamp { font-size: inherit; }
    .timeline-showcase-item h3 { font-size: 1.5rem; }
    .timeline-showcase-item .item-description { font-size: 1.2rem; }
    .btn { font-size: 1.3rem; padding: 0.9rem 1.6rem; }
    .btn--large { font-size: 1.4rem; padding: 1.2rem 2.4rem; }
    #draw-canvas-container {
        margin-bottom: 1.2rem;
    }
    
    .form-control { padding: 1.2rem; font-size: 1.5rem; }
    .form-group { margin-bottom: 1.2rem; }
    .form-group label, .form-group .form-label-heading { font-size: 1.4rem; }
    .modal-content { padding: 2.4rem; border-radius: 2.4rem; }
    .form-modal h2, .view-modal-content h2, .info-modal-content h2 { font-size: 1.9rem; }
    .modal-actions .btn { font-size: 1.4rem; }

    .flash-message-container {
        width: 90%;
        top: calc(0.8rem + env(safe-area-inset-top, 0rem));
    }
    .notification-text { font-size: 1.4rem; }
    .notification-timestamp { font-size: 1.1rem; }
    .notification-item {
        margin-left: -1.2rem;
        margin-right: -1.2rem;
        padding: 1.2rem 2.4rem;
    }
    .new-posts-indicator { top: calc(0.8rem + env(safe-area-inset-top, 0rem)); }
    .new-posts-indicator button { padding: 0.8rem 1.6rem; font-size: 1.2rem; }
    .btn--icon-text-mobile { font-size: 1.2rem; line-height: 1; }
    .read-more-button {
        width: 4.4rem;
        height: 4.4rem;
        bottom: 0;
    }
    .read-more-button i { font-size: 1.5rem; }
    .header-row-secondary {
        overflow-x: visible !important;
        flex-wrap: wrap !important;
    }
    .header-row-secondary .btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
    .header-row-secondary .participant-count,
    .header-row-secondary .btn {
        font-size: 1.2rem !important;
    }

    .header-row-secondary .btn i,
    .header-row-secondary .btn svg {
        font-size: 1.2rem;
    }
    .header-row-secondary > *:not(:last-child) { margin-right: 0.8rem; }

    .pagination-wrapper {  margin-top: 1.2rem; }

    .timeline-detail-meta {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 1.2rem;
        
        margin-left: -1.6rem;     
        margin-right: -1.6rem;
        padding: 1.2rem 1.6rem 0 1.6rem;
        
        scrollbar-width: none;
        -ms-overflow-style: none;
        
        border-top: 1px solid var(--border-secondary);
        margin-top: 1.2rem;
        width: auto;
    }
    
    .timeline-detail-meta::-webkit-scrollbar {
        display: none;
    }

    .meta-item {
        flex-shrink: 0;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        
        background-color: var(--bg-primary);
        border: 1px solid var(--border-secondary);
        padding: 0.4rem 1rem;
        border-radius: 999px;
        font-size: 1.1rem;
    }  
      
    /* Thread Line Mobile Adjustments */
    .item-feed > .thread-item-wrapper > .item-card {
        margin: -1.6rem -1.2rem 0 -1.2rem!important;
        padding-left: 1.6rem !important;
        padding-right: 1.6rem !important;
    }
    .thread-item-wrapper .thread-item-wrapper { margin: 0 -1.2rem !important; }
    .thread-item-wrapper .item-card {
        padding-left: 1.2rem !important;
        padding-right: 1.2rem !important;
    }
    .thread-item-wrapper .item-card::before {
        left: 3.6rem; /* 1.6rem padding + 2rem (half of 4rem icon) */
    }

    .menu-button.btn,
    .header-icon,
    .notification-icon-wrapper {
        width: 4.0rem !important;
    }

    .frequent-timelines-list::after {
        content: '';
        display: block;
        width: 1rem;
        flex-shrink: 0;
    }
    .ad-container { box-sizing: border-box; margin: 0 -1.2rem !important; padding: 0 !important; border-radius: 0; }
    #timeline-top-ad-slot { margin-bottom: 1.2rem !important; }
    .gallery-grid-wrapper .ad-container { background-color: transparent; margin: 1.2rem 0 !important; }
    .compact-hero {
        margin: 0;
        padding: 2rem;
    }
    .compact-hero-title { font-size: 1.6rem; }
    .compact-hero-text {
        font-size: 1.2rem;
        text-align: left;
    }
    .segment-item { padding: 0.6rem 1.2rem; }
    
    .canvas-toolbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* スクロールバーを隠す */
    }
    .canvas-toolbar::-webkit-scrollbar { display: none; }

    .original-post-quote .quoted-content {
        font-size: 1.3rem;
    }
    
    /* 2. 要素間の余白を詰める */
    .tool-settings {
        gap: 0.8rem; /* 1.6remから縮小 */
    }
    .brush-size-group {
        gap: 0; /* ボタン間の隙間をなくす */
    }

    /* 3. ブラシサイズボタンを少し小さくする */
    .brush-btn {
        width: 2.8rem;  /* 3.2remから縮小 */
        height: 2.8rem;
    }
    
    /* 4. 「消しゴム」と「戻す」ボタンをアイコンのみにする */
    .undo-btn-pill,
    .eraser-label {
        padding: 0; /* パディングをリセット */
        border-radius: 50%; /* 完全な丸に */
        width: 3.6rem;
        height: 3.6rem;
        justify-content: center;
    }
    
    /* テキスト部分を隠す */
    .undo-btn-pill span,
    .eraser-label span { 
        display: none; 
    }
    
    .undo-btn-pill i,
    .eraser-label i {
        margin: 0;
        font-size: 1.4rem;
    }
    
}

@media (max-width: 900px) {
    #content-modal-overlay .modal-content { max-width: 90vw; }
}

/* --- Sticky Title Bar --- */
.sticky-title-bar {
    position: fixed;
    left: 50%;
    transform: translateY(-1.2rem) translateX(-50%);
    
    width: max-content;
    max-width: 90%;
    height: auto;
    padding: 0.8rem 1.6rem;
    
    background-color: var(--bg-secondary);
    border-radius: 999rem;
    box-shadow: 
        inset 0.1rem 0.1rem 0.2rem var(--glass-inset-shadow-1), 
        inset -0.1rem -0.1rem 0.2rem var(--glass-inset-shadow-2), 
        0 0.4rem 0.8rem var(--main-shadow);
    z-index: 95;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    pointer-events: none;
    
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    background-color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .sticky-title-bar {
    background-color: rgba(32, 33, 36, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

.sticky-title-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) translateX(-50%);
}

/* --- Notification Adjustment --- */
.flash-message-container,
.new-posts-indicator {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s ease, opacity 0.3s ease;
}

body.has-sticky-title .flash-message-container,
body.has-sticky-title .new-posts-indicator {
    transform: translateX(-50%) translateY(5.5rem) !important;
}

/* --- Inner Content --- */
.sticky-title-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 100%;
}

.sticky-title-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30rem;
}

.sticky-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-left: 0.8rem;
}

/* --- Mobile (< 768px) --- */
@media (max-width: 767px) {
    .sticky-title-bar {
        top: 1rem;
        max-width: calc(100% - 2rem);
    }
    .sticky-title-text {
        font-size: 1.2rem;
        max-width: 20rem;
    }
}

/* --- PC (>= 768px) --- */
@media (min-width: 768px) {
    .sticky-title-bar {
        top: auto;
        left: auto;
        bottom: 3rem;
        right: 3rem;
        
        max-width: 30rem;
        
        transform: translateY(2rem);
        opacity: 0;
        
        box-shadow: 0 0.4rem 1.6rem var(--modal-shadow);
        background-color: var(--bg-secondary);
    }

    .sticky-title-bar.is-visible {
        opacity: 1;
        transform: translateY(0);
    }

    .sticky-title-bar:hover {
        transform: translateY(-0.2rem);
        box-shadow: 0 0.6rem 2rem var(--modal-shadow);
        transition: all 0.2s ease;
    }

    body.has-sticky-title .flash-message-container,
    body.has-sticky-title .new-posts-indicator {
        transform: translateX(-50%) !important;
    }
}

/* ==========================================================================
   Header Layout & Post Buttons (Responsive)
   ========================================================================== */

/* --- ユーティリティ: 表示切り替え --- */
.mobile-only { display: none !important; }
.desktop-only { display: flex !important; }

/* --- [モバイル用] FAB投稿ボタン (虹色ボーダー + 浮遊) --- */
.floating-post-button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 90;
    
    color: var(--text-primary);
    border-radius: 50%;
    border: 0.3rem solid transparent;
    
    background-image: linear-gradient(var(--bg-secondary), var(--bg-secondary)), var(--current-timeline-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    
    box-shadow: 0 0.4rem 1.2rem var(--modal-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.floating-post-button .fa-plus { display: block; }
.floating-post-button .fa-pen { display: none; }
.floating-post-button:active { transform: scale(0.92); }


/* === Mobile Media Query (< 768px) === */
@media (max-width: 767px) {
    /* 表示切り替え */
    .mobile-only { display: flex !important; }
    .desktop-only { display: none !important; }

    /* ヘッダーレイアウト調整 */
    .header-main {
        position: relative; /* 中央配置の基準 */
        justify-content: space-between;
    }

    .header-center {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .header-center .menu-button {
        width: 4.8rem;
        height: 100%;
        font-size: 2rem;
        margin: 0;
        color: var(--header-icon);
    }

    /* FAB投稿ボタンの位置 */
    .floating-post-button {
        position: absolute;
        bottom: 6.8rem; /* メニューバーの上 */
        right: 0;
        width: 6rem;
        height: 6rem;
        font-size: 1.8rem;
        animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s, visibility 0.2s;
    }
    .header-container.is-open .floating-post-button {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: scale(0.8); /* 少し縮小しながら消える演出 */
    }    
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Similar Timeline Suggestions */
.similar-timelines-box {
    margin-top: 0.8rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--primary-accent);
    border-radius: 0.8rem;
    padding: 1.2rem;
    animation: fadeIn 0.2s ease-out;
}

.similar-timelines-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-accent);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.similar-timelines-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 20rem;
    overflow-y: auto;
}

.similar-timeline-item {
    display: block;
    padding: 0.8rem;
    border-radius: 0.6rem;
    background-color: var(--bg-secondary);
    margin-bottom: 0.4rem;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    transition: background-color 0.2s;
}

.similar-timeline-item:last-child {
    margin-bottom: 0;
}

.similar-timeline-item:hover {
    background-color: var(--bg-tertiary);
    text-decoration: none;
}

.similar-item-title {
    font-size: 1.3rem;
    font-weight: 700;
    display: block;
}

.similar-item-meta {
    font-size: 1.1rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    margin-top: 0.2rem;
}

/* style.css */

.sidebar-pin-btn {
    position: absolute;
    left: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    
    width: 2.8rem;
    height: 2.8rem;
    padding: 0;
    
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary); /* 通常時はグレー */
    font-size: 1.1rem;
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    transition: background-color 0.2s, color 0.2s;
    z-index: 2;
    opacity: 0.4; /* 主張しすぎないように薄く */
}

.sidebar-pin-btn:hover {
    background-color: var(--bg-tertiary-hover);
    opacity: 1;
}

.sidebar-pin-btn.is-pinned {
    color: var(--primary-accent);
    opacity: 1;
}
.sidebar-pin-btn.is-pinned i {
    transform: rotate(45deg); /* 刺さっている感 */
}

.sidebar-timeline-item > a.has-pin-btn {
    padding-left: 3.6rem !important; /* ピンボタンの分だけ右にずらす */
}

@media (max-width: 767px) {
    .sidebar-pin-btn {
        width: 3.6rem;
        height: 3.6rem;
        font-size: 1.3rem;
    }
    .sidebar-timeline-item > a.has-pin-btn {
        padding-left: 4.4rem !important;
    }
}

.frequent-card-pin-badge {
    position: absolute;
    top: 0.4rem;
    left: 0.6rem;
    font-size: 1rem;
    color: var(--border-secondary); /* 青色で強調 */
    z-index: 1;
}

.frequent-card-pin-badge i {
    transform: rotate(45deg); /* 刺さっているような角度をつける */
}




