/* CHARACTER CMS v1 — 既存 css/style.css の追加分 */
:root{--bg:#f7f7f7;--surface:#f7f7f7;--surface-alt:#ececec;--ink:#303030;--ink-soft:#3d3d3d;--muted:#777;--line:#4b4b4b;--line-soft:#d8d8d8;--accent:#303030;--font-heading:"Montserrat","Noto Sans JP",sans-serif;--font-body:"Noto Sans JP",sans-serif}
.cms-public-main{min-width:0}.cms-kicker{margin:0 0 7px;color:var(--muted);font-size:.65rem;font-weight:800;letter-spacing:.14em}
.cms-character-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:22px 16px}.cms-character-card{color:var(--ink);text-decoration:none}.cms-character-thumb{display:grid;place-items:center;height:230px;overflow:hidden;margin-bottom:10px;border:2px solid var(--line);border-radius:12px;background:var(--surface-alt);color:var(--muted);font-size:.65rem;letter-spacing:.1em}.cms-character-thumb img{width:100%;height:100%;object-fit:cover}.cms-character-card small,.cms-character-card span{display:block;color:var(--muted);font-size:.68rem}.cms-character-card strong{display:block;margin:4px 0;font-size:.95rem}
.cms-character-hero{display:grid;grid-template-columns:minmax(280px,.9fr) minmax(0,1.1fr);gap:42px;align-items:start}.cms-standing-viewer,.cms-expression-viewer{min-width:0}.cms-viewer-stage{display:grid;grid-template-columns:34px minmax(0,1fr) 34px;gap:8px;align-items:center}.cms-viewer-stage>button{appearance:none;height:56px;border:1px solid var(--line);background:transparent;color:var(--ink);cursor:pointer;font-size:1.4rem}.cms-viewer-stage img{display:block;width:100%;height:540px;object-fit:contain}.cms-viewer-stage.compact img{height:420px}.cms-no-standing{display:grid;place-items:center;height:460px;border:1px solid var(--line-soft);color:var(--muted);font-size:.7rem;letter-spacing:.1em}.cms-viewer-meta{display:flex;justify-content:space-between;gap:12px;margin-top:10px;color:var(--muted);font-size:.68rem;font-weight:700}.cms-viewer-choices{display:flex;gap:6px;overflow-x:auto;margin-top:10px;padding-bottom:4px}.cms-viewer-choices button{flex:0 0 auto;min-width:38px;padding:7px 8px;border:1px solid var(--line-soft);background:transparent;color:var(--muted);cursor:pointer}.cms-viewer-choices button.is-active{border-color:var(--line);color:var(--ink)}.character-profile-text{width:100%;max-width:none;line-height:1.95}
.cms-reference-block+.cms-reference-block{margin-top:34px}.cms-reference-label{margin:0 0 12px;color:var(--muted);font-size:.68rem;font-weight:800;letter-spacing:.12em}.cms-reference-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}.cms-reference-grid figure{margin:0}.cms-reference-grid img{display:block;width:100%;max-height:520px;object-fit:contain;border:1px solid var(--line-soft)}.cms-reference-grid figcaption{margin-top:7px;color:var(--muted);font-size:.7rem}.cms-expression-group+.cms-expression-group{margin-top:30px}.cms-expression-group h3{margin:0 0 12px;font-size:.76rem;letter-spacing:.07em}
.related-content{margin-top:56px}.related-content-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.related-content-card{display:block;min-height:128px;padding:18px 18px 16px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);color:var(--ink);text-decoration:none}.related-content-card .related-kicker{display:block;margin-bottom:8px;color:var(--muted);font-size:.62rem;font-weight:800;letter-spacing:.14em}.related-content-card strong{display:block;margin-bottom:7px;font-size:.95rem}.related-content-card p{margin:0;color:var(--ink-soft);font-size:.78rem;line-height:1.75}.related-content-card .related-arrow{display:inline-block;margin-top:12px;font-size:.72rem;font-weight:800}
.cms-spoiler-details{border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.cms-spoiler-details summary{padding:17px 4px;cursor:pointer;list-style:none}.cms-spoiler-details summary strong,.cms-spoiler-details summary small{display:block}.cms-spoiler-details summary small{margin-top:3px;color:var(--muted);font-size:.68rem}.cms-spoiler-inner{padding:8px 0 24px}.cms-spoiler-warning{padding-left:12px;border-left:2px solid var(--line);font-size:.75rem}.cms-spoiler-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px;margin-top:24px}.cms-spoiler-image-grid figure{margin:0}.cms-spoiler-image-grid img{width:100%;height:190px;object-fit:cover;border:1px solid var(--line)}.cms-spoiler-image-grid figcaption{margin-top:6px;font-size:.72rem}.cms-spoiler-image-grid small{display:block;color:var(--muted)}
.cms-filter-panel{display:grid;grid-template-columns:minmax(250px,1.4fr) repeat(3,minmax(140px,.6fr)) auto;gap:12px;align-items:end;margin-bottom:22px;padding:16px 0;border-top:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft)}.cms-filter-panel label{display:block}.cms-filter-label{display:block;margin-bottom:6px;color:var(--muted);font-size:.62rem;font-weight:800;letter-spacing:.1em}.cms-filter-panel input[type=search],.cms-filter-panel select{width:100%;min-height:38px;box-sizing:border-box;border:1px solid var(--line-soft);background:var(--surface);color:var(--ink)}.cms-filter-panel>button{min-height:38px;padding:0 16px;border:1px solid var(--line);background:var(--ink);color:#fff;cursor:pointer}.cms-character-filter{display:flex;flex-wrap:wrap;gap:6px}.cms-character-filter label{position:relative}.cms-character-filter input{position:absolute;opacity:0;pointer-events:none}.cms-character-filter span{display:block;padding:7px 9px;border:1px solid var(--line-soft);cursor:pointer;font-size:.72rem}.cms-character-filter input:checked+span{border-color:var(--line);background:var(--surface-alt)}.cms-filter-mini-actions{display:flex;gap:5px;margin-top:7px}.cms-filter-mini-actions button{padding:3px 7px;border:1px solid var(--line-soft);background:transparent;color:var(--muted);cursor:pointer;font-size:.58rem;font-weight:800;letter-spacing:.07em}
.cms-question-table-wrap,.cms-answer-matrix-wrap,.cms-table-scroll{overflow:auto;max-width:100%;border:1px solid var(--line-soft)}.cms-question-table,.cms-answer-matrix,.cms-edit-table{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0;background:var(--surface)}.cms-question-table th,.cms-question-table td,.cms-answer-matrix th,.cms-answer-matrix td,.cms-edit-table th,.cms-edit-table td{min-width:220px;padding:12px;vertical-align:top;border-right:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft);text-align:left;font-size:.76rem;line-height:1.75}.cms-question-table thead th,.cms-answer-matrix thead th{position:sticky;top:0;z-index:4;background:var(--surface-alt)}.cms-question-table .sticky-col,.cms-answer-matrix .sticky-col{position:sticky;left:0;z-index:3;min-width:250px;max-width:320px;background:var(--surface)}.cms-question-table thead .sticky-col,.cms-answer-matrix thead .sticky-col{z-index:6;background:var(--surface-alt)}.cms-question-table th small,.cms-answer-matrix th small{display:block;margin-bottom:4px;color:var(--muted);font-size:.61rem;letter-spacing:.08em}.cms-spoiler-cell{width:100%;min-height:90px;padding:0;border:0;background:transparent;color:inherit;text-align:left;cursor:pointer}.cms-spoiler-cover{display:grid;place-items:center;min-height:90px;padding:12px;border:1px solid var(--line);background:var(--surface-alt);font-size:.68rem;font-weight:800;letter-spacing:.08em;text-align:center}.cms-spoiler-cover small{display:block;margin-top:6px;color:var(--muted)}.cms-private-cell,.cms-hidden-spoiler{color:var(--muted);font-size:.68rem;font-weight:800;letter-spacing:.08em}
.cms-admin{margin:0;background:#f7f7f7;color:#303030;font-family:var(--font-body)}.cms-admin *{box-sizing:border-box}.cms-admin-header{position:sticky;top:0;z-index:30;display:flex;justify-content:space-between;gap:20px;align-items:center;padding:14px max(18px,calc((100vw - 1200px)/2));border-bottom:1px solid #303030;background:rgba(247,247,247,.96)}.cms-admin-brand{color:#303030;text-decoration:none;font-weight:900;letter-spacing:.08em}.cms-admin-header nav{display:flex;flex-wrap:wrap;gap:14px}.cms-admin-header nav a{color:#555;text-decoration:none;font-size:.72rem;font-weight:800}.cms-admin-main{width:min(calc(100% - 36px),1200px);margin:36px auto 80px}.cms-admin-title{display:flex;justify-content:space-between;align-items:end;gap:20px;margin-bottom:22px}.cms-admin-title h1{margin:0;font-size:1.55rem}.cms-panel{margin-bottom:22px;padding:22px;border:1px solid #bdbdbd;background:#f7f7f7}.cms-panel h1,.cms-panel h2{margin-top:0}.cms-panel h2{padding-bottom:9px;border-bottom:1px solid #303030;font-size:.9rem;letter-spacing:.08em}.cms-form label{display:block;margin-bottom:14px}.cms-form label>span,.cms-image-fields label>span{display:block;margin-bottom:5px;color:#777;font-size:.65rem;font-weight:800;letter-spacing:.08em}.cms-form input[type=text],.cms-form input[type=password],.cms-form input[type=number],.cms-form input[type=file],.cms-form input:not([type]),.cms-form textarea,.cms-form select,.cms-edit-table input,.cms-edit-table select,.cms-answer-matrix textarea,.cms-answer-matrix select{width:100%;min-height:38px;padding:8px 9px;border:1px solid #c8c8c8;background:#fff;color:#303030;font:inherit}.cms-form textarea,.cms-answer-matrix textarea{resize:vertical}.cms-field-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0 14px}.cms-check{display:flex!important;gap:8px;align-items:center}.cms-check input{width:auto!important}.cms-check span{margin:0!important;color:#303030!important}.cms-button{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:0 15px;border:1px solid #303030;background:#303030;color:#fff;text-decoration:none;font-size:.72rem;font-weight:800;letter-spacing:.06em;cursor:pointer}.cms-button.ghost{background:transparent;color:#303030}.cms-actions{display:flex;flex-wrap:wrap;gap:8px}.cms-notice{margin-bottom:18px;padding:12px 14px;border-left:3px solid #303030;background:#ececec}.cms-help,.cms-empty{color:#777;font-size:.75rem}.cms-admin-list article{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:14px 4px;border-bottom:1px solid #d8d8d8}.cms-admin-list article:first-child{border-top:1px solid #d8d8d8}.cms-admin-list article small,.cms-admin-list article strong,.cms-admin-list article span{display:block}.cms-admin-list article small,.cms-admin-list article span{color:#777;font-size:.68rem}.cms-admin-list article strong{margin:3px 0}.cms-image-admin-list article{display:grid;grid-template-columns:120px 1fr;gap:16px;margin-bottom:14px;padding:12px;border:1px solid #d8d8d8}.cms-image-admin-list img{width:120px;height:150px;object-fit:contain;background:#ececec}.cms-image-fields{display:grid;grid-template-columns:160px 1fr 1fr 180px 100px;gap:10px}.cms-image-fields .danger{grid-column:1/-1}.cms-sticky-save{position:sticky;bottom:16px;z-index:20;display:flex;justify-content:flex-end;padding:10px;border:1px solid #303030;background:rgba(247,247,247,.96)}.cms-inline-add{display:grid;grid-template-columns:2fr 1fr 100px 180px auto;gap:10px;align-items:end}.cms-inline-add label{margin:0}.cms-wide-input{min-width:420px}.cms-answer-matrix textarea{min-width:260px}.cms-answer-matrix select{margin-top:7px}.cms-login{max-width:620px;margin:60px auto}.cms-check-list{display:grid;gap:8px;margin:20px 0}.cms-check-list>div{display:flex;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid #d8d8d8}.cms-check-list .is-ng{font-weight:800}
@media(max-width:900px){.cms-character-hero{grid-template-columns:1fr;gap:28px}.cms-viewer-stage img{height:480px}.cms-filter-panel{grid-template-columns:1fr 1fr}.cms-field-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cms-inline-add{grid-template-columns:1fr 1fr}.cms-image-fields{grid-template-columns:1fr 1fr}.cms-admin-header{align-items:flex-start;flex-direction:column}.related-content-grid{grid-template-columns:1fr;gap:0}}
@media(max-width:560px){.cms-viewer-stage{grid-template-columns:30px minmax(0,1fr) 30px}.cms-viewer-stage img,.cms-viewer-stage.compact img{height:400px}.cms-filter-panel,.cms-field-grid,.cms-inline-add,.cms-image-fields{grid-template-columns:1fr}.cms-question-table th,.cms-question-table td{min-width:190px}.cms-question-table .sticky-col{min-width:190px;max-width:220px}.cms-image-admin-list article{grid-template-columns:1fr}.cms-image-admin-list img{width:100%;height:220px}}


/* =========================================================
   v1.2 STRUCTURED MEMO
   ========================================================= */

.cms-memo-groups{display:grid;gap:28px;}
.cms-memo-group h3{margin:0 0 10px;padding-bottom:8px;border-bottom:1px solid var(--line);font-size:.72rem;letter-spacing:.1em;}
.cms-memo-table{border-top:1px solid var(--line);}
.cms-memo-row{display:grid;grid-template-columns:130px minmax(0,1fr);gap:18px;padding:18px 0;border-bottom:1px solid var(--line-soft);font-size:.78rem;line-height:1.8;}
.cms-memo-row>strong{font-size:.68rem;letter-spacing:.08em;}
.cms-memo-row small,.cms-memo-text small{display:block;margin-top:6px;color:var(--muted);font-size:.58rem;letter-spacing:.08em;}
.cms-memo-text{padding:20px 0;border-bottom:1px solid var(--line-soft);font-size:.8rem;line-height:1.95;}
.cms-memo-text>strong{display:block;margin-bottom:8px;font-size:.72rem;letter-spacing:.08em;}
.cms-memo-legacy{margin-bottom:24px;padding-bottom:22px;border-bottom:1px solid var(--line-soft);font-size:.8rem;line-height:1.9;}

.cms-memo-admin-list,[data-new-memo-list]{display:grid;gap:10px;margin-bottom:12px;}
.cms-memo-admin-row{padding:14px;border:1px solid #d8d8d8;}
.cms-memo-admin-row.is-new{border-style:dashed;}
.cms-memo-admin-grid{display:grid;grid-template-columns:1fr 180px 1fr 150px 90px;gap:10px;align-items:start;}
.cms-memo-body-field{grid-column:1/-1;}
.cms-mini-remove{min-height:38px;border:1px solid #bdbdbd;background:transparent;color:#555;cursor:pointer;font-size:.65rem;font-weight:800;}

/* v1.2 SCENARIO ASSET GROUPS */
.cms-scenario-block+.cms-scenario-block{margin-top:42px;}
.cms-scenario-title{margin:0 0 22px;padding:9px 0;border-top:2px solid var(--line);border-bottom:1px solid var(--line-soft);font-size:.85rem;letter-spacing:.1em;}
.cms-scenario-block .cms-reference-block+.cms-reference-block{margin-top:30px;}
.cms-reference-grid figcaption small{display:block;margin-bottom:3px;color:var(--muted);font-size:.6rem;letter-spacing:.07em;}
.cms-expression-group h4{margin:0 0 12px;color:var(--ink-soft);font-size:.72rem;letter-spacing:.08em;}

@media(max-width:700px){
    .cms-memo-row{grid-template-columns:100px minmax(0,1fr);gap:12px;}
    .cms-memo-admin-grid{grid-template-columns:1fr 1fr;}
    .cms-memo-body-field{grid-column:1/-1;}
}
@media(max-width:460px){
    .cms-memo-row{grid-template-columns:1fr;gap:6px;}
    .cms-memo-admin-grid{grid-template-columns:1fr;}
    .cms-memo-body-field{grid-column:auto;}
}


/* =========================================================
   v1.3 ACCORDION +/- ICON
   既存CSSに依存せず必ず表示する
   ========================================================= */

.cms-character-view details.character-accordion > summary,
.cms-character-view details.cms-spoiler-details > summary,
.cms-character-view details.cms-scenario-details > summary,
.cms-admin details.cms-admin-asset-scenario > summary {
    position: relative;
    padding-right: 44px;
    list-style: none;
}

.cms-character-view details.character-accordion > summary::-webkit-details-marker,
.cms-character-view details.cms-spoiler-details > summary::-webkit-details-marker,
.cms-character-view details.cms-scenario-details > summary::-webkit-details-marker,
.cms-admin details.cms-admin-asset-scenario > summary::-webkit-details-marker {
    display: none;
}

.cms-character-view details.character-accordion > summary::after,
.cms-character-view details.cms-spoiler-details > summary::after,
.cms-character-view details.cms-scenario-details > summary::after,
.cms-admin details.cms-admin-asset-scenario > summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    color: var(--ink);
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.cms-character-view details.character-accordion[open] > summary::after,
.cms-character-view details.cms-spoiler-details[open] > summary::after,
.cms-character-view details.cms-scenario-details[open] > summary::after,
.cms-admin details.cms-admin-asset-scenario[open] > summary::after {
    content: "−";
}


/* =========================================================
   v1.3 STANDING: SCENARIO / SESSION CATEGORY
   ========================================================= */

.cms-standing-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.cms-standing-tabs button {
    padding: 7px 10px;
    border: 1px solid var(--line-soft);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.cms-standing-tabs button.is-active {
    border-color: var(--line);
    background: var(--surface-alt);
    color: var(--ink);
}

.cms-standing-category-panel[hidden] {
    display: none !important;
}

.cms-standing-category-label {
    margin: 0 0 9px;
    color: var(--muted);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .08em;
}


/* =========================================================
   v1.3 PUBLIC: SCENARIO ACCORDION
   ========================================================= */

.cms-scenario-details {
    border-top: 1px solid var(--line);
}

.cms-scenario-details:last-child {
    border-bottom: 1px solid var(--line);
}

.cms-scenario-details > summary {
    padding: 14px 6px;
    cursor: pointer;
}

.cms-scenario-details > summary strong,
.cms-scenario-details > summary small {
    display: block;
}

.cms-scenario-details > summary strong {
    font-size: .76rem;
    letter-spacing: .08em;
}

.cms-scenario-details > summary small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .6rem;
    letter-spacing: .06em;
}

.cms-scenario-details-inner {
    padding: 8px 4px 30px;
}

.cms-spoiler-scenario-list {
    margin-top: 28px;
}

.cms-asset-spoiler-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .08em;
}


/* =========================================================
   v1.3 ADMIN ASSET MANAGER
   ========================================================= */

.cms-panel-heading-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.cms-panel-heading-row > div:first-child {
    min-width: 0;
}

.cms-asset-toolbar {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.cms-asset-toolbar .cms-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: .62rem;
}

.cms-admin-asset-groups {
    display: grid;
    gap: 10px;
    margin: 18px 0 28px;
}

.cms-admin-asset-scenario {
    border: 1px solid #bdbdbd;
    background: #f7f7f7;
}

.cms-admin-asset-scenario > summary {
    padding: 14px 16px;
    cursor: pointer;
}

.cms-admin-asset-scenario > summary strong,
.cms-admin-asset-scenario > summary small {
    display: block;
}

.cms-admin-asset-scenario > summary strong {
    font-size: .8rem;
    letter-spacing: .08em;
}

.cms-admin-asset-scenario > summary small {
    margin-top: 3px;
    color: #777;
    font-size: .6rem;
    letter-spacing: .08em;
}

.cms-admin-asset-scenario-inner {
    padding: 0 14px 18px;
}

.cms-admin-asset-set + .cms-admin-asset-set {
    margin-top: 24px;
}

.cms-admin-asset-set-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: end;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid #d8d8d8;
}

.cms-admin-asset-set-heading h3 {
    margin: 0;
    font-size: .72rem;
    letter-spacing: .07em;
}

.cms-admin-asset-set-heading small {
    color: #777;
    font-size: .56rem;
    letter-spacing: .06em;
}

.cms-sortable-assets {
    display: grid;
    gap: 8px;
}

.cms-asset-admin-card {
    display: grid !important;
    grid-template-columns: 120px minmax(0,1fr) !important;
    gap: 14px !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid #d8d8d8 !important;
    background: #f7f7f7;
}

.cms-asset-admin-card.is-dragging {
    opacity: .42;
}

.cms-asset-preview {
    position: relative;
}

.cms-asset-preview img {
    width: 120px !important;
    height: 120px !important;
    object-fit: cover !important;
}

.cms-order-badge {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    place-items: center;
    min-width: 25px;
    height: 25px;
    padding: 0 5px;
    border: 1px solid #303030;
    background: rgba(247,247,247,.94);
    color: #303030;
    font-size: .62rem;
    font-weight: 800;
}

.cms-asset-admin-card .cms-image-fields {
    grid-template-columns:
        145px
        minmax(130px,1fr)
        minmax(120px,1fr)
        minmax(120px,1fr)
        150px
        110px;
    align-items: end;
}

.cms-asset-order-controls {
    display: grid;
    grid-template-columns: 32px 38px 32px;
    gap: 4px;
    align-items: center;
}

.cms-order-button,
.cms-drag-handle {
    min-height: 36px;
    border: 1px solid #bdbdbd;
    background: transparent;
    color: #303030;
    cursor: pointer;
    font-weight: 800;
}

.cms-drag-handle {
    cursor: grab;
    font-size: 1rem;
    letter-spacing: -3px;
}

.cms-drag-handle:active {
    cursor: grabbing;
}

.cms-asset-admin-card .danger {
    grid-column: auto !important;
    margin: 0;
}

.cms-asset-add {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 2px solid #303030;
}

@media (max-width: 1050px) {
    .cms-asset-admin-card .cms-image-fields {
        grid-template-columns: repeat(3,minmax(0,1fr));
    }
}

@media (max-width: 720px) {
    .cms-panel-heading-row,
    .cms-admin-asset-set-heading {
        display: block;
    }

    .cms-asset-toolbar {
        margin-top: 10px;
    }

    .cms-admin-asset-set-heading small {
        display: block;
        margin-top: 4px;
    }

    .cms-asset-admin-card {
        grid-template-columns: 92px minmax(0,1fr) !important;
    }

    .cms-asset-preview img {
        width: 92px !important;
        height: 92px !important;
    }

    .cms-asset-admin-card .cms-image-fields {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 500px) {
    .cms-asset-admin-card {
        grid-template-columns: 1fr !important;
    }

    .cms-asset-preview img {
        width: 100% !important;
        height: 180px !important;
    }

    .cms-asset-admin-card .cms-image-fields {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   v1.4 OLD-STYLE PREVIEW
   ========================================================= */

.cms-character-view .cms-preview-category-panel[hidden] {
    display: none !important;
}

.cms-character-view .cms-preview-standing-tabs,
.cms-character-view .cms-preview-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.cms-character-view .cms-preview-standing-tabs button,
.cms-character-view .cms-preview-category-tabs button {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .02em;
}

.cms-character-view .cms-preview-standing-tabs button.is-active,
.cms-character-view .cms-preview-category-tabs button.is-active {
    background: var(--ink);
    color: var(--surface);
}

.cms-character-view .cms-only-category-label {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .06em;
}


/* ---------- standing: old preview proportions ---------- */

.cms-character-view .cms-standing-viewer .cms-viewer-stage {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 8px;
}

.cms-character-view .cms-standing-viewer .cms-viewer-stage img {
    width: min(100%, 390px);
    height: 430px;
    margin: 0 auto;
    border: 1px solid var(--line);
    background: var(--surface-alt);
    object-fit: contain;
}

.cms-character-view .cms-standing-viewer .cms-viewer-stage > button {
    width: 30px;
    height: 48px;
    justify-self: center;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1rem;
}

.cms-character-view .cms-standing-viewer .cms-viewer-choices {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 7px;
}

.cms-character-view .cms-standing-viewer .cms-viewer-choices button {
    flex: 0 0 auto;
    min-width: 38px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: .6rem;
}

.cms-character-view .cms-standing-viewer .cms-viewer-choices button.is-active {
    background: var(--ink);
    color: var(--surface);
}


/* ---------- kind-first sections ---------- */

.cms-character-view .cms-kind-sections {
    display: grid;
    gap: 0;
}

.cms-character-view .cms-kind-section {
    padding: 26px 0 32px;
    border-bottom: 1px solid var(--line-soft);
}

.cms-character-view .cms-kind-section:first-child {
    padding-top: 4px;
}

.cms-character-view .cms-kind-section:last-child {
    border-bottom: 0;
}

.cms-character-view .cms-reference-label {
    margin: 0 0 14px;
    color: var(--ink);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .12em;
}


/* ---------- expression: like the old preview ---------- */

.cms-character-view .cms-expression-viewer {
    max-width: 720px;
    margin: 0 auto;
}

.cms-character-view .cms-expression-viewer .cms-viewer-stage {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 10px;
}

.cms-character-view .cms-expression-viewer .cms-viewer-stage img,
.cms-character-view .cms-expression-viewer .cms-viewer-stage.compact img {
    width: min(100%, 440px);
    height: 330px;
    margin: 0 auto;
    border: 1px solid var(--line);
    background: var(--surface-alt);
    object-fit: contain;
}

.cms-character-view .cms-expression-viewer .cms-viewer-stage > button {
    width: 30px;
    height: 48px;
    justify-self: center;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1rem;
}

.cms-character-view .cms-expression-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    margin-top: 13px;
    padding: 2px 0 8px;
}

.cms-character-view .cms-expression-thumb {
    flex: 0 0 76px;
    width: 76px;
    padding: 4px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    text-align: center;
}

.cms-character-view .cms-expression-thumb.is-active {
    box-shadow: inset 0 0 0 2px var(--ink);
}

.cms-character-view .cms-expression-thumb-image {
    display: block;
    width: 66px;
    height: 62px;
    overflow: hidden;
    margin: 0 auto;
    background: var(--surface-alt);
}

.cms-character-view .cms-expression-thumb-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cms-character-view .cms-expression-thumb-label {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    padding: 0;
    font-size: .54rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-character-view .cms-expression-thumb small {
    display: block;
    overflow: hidden;
    margin-top: 2px;
    padding: 0;
    color: var(--muted);
    font-size: .46rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ---------- non-expression reference images ---------- */

.cms-character-view .cms-reference-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.cms-character-view .cms-reference-grid figure {
    margin: 0;
}

.cms-character-view .cms-reference-grid figure > img {
    display: block;
    width: 100%;
    max-height: 520px;
    border: 1px solid var(--line-soft);
    background: var(--surface-alt);
    object-fit: contain;
}

.cms-character-view .cms-reference-grid figcaption {
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: .65rem;
}

.cms-character-view .cms-reference-grid figcaption small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: .52rem;
}


/* ---------- spoiler keeps outer accordion only ---------- */

.cms-character-view .cms-spoiler-assets {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line-soft);
}


/* =========================================================
   v1.4 SCENARIO DISPLAY ORDER ADMIN
   ========================================================= */

.cms-scenario-order-panel {
    display: grid;
    grid-template-columns: minmax(170px, .7fr) minmax(0, 2fr);
    gap: 18px;
    margin: 18px 0;
    padding: 14px;
    border: 1px solid #bdbdbd;
    background: #ececec;
}

.cms-scenario-order-panel > div:first-child strong,
.cms-scenario-order-panel > div:first-child small {
    display: block;
}

.cms-scenario-order-panel > div:first-child strong {
    font-size: .7rem;
    letter-spacing: .08em;
}

.cms-scenario-order-panel > div:first-child small {
    margin-top: 5px;
    color: #777;
    font-size: .62rem;
    line-height: 1.55;
}

.cms-scenario-order-list {
    display: grid;
    gap: 5px;
}

.cms-scenario-order-item {
    display: grid;
    grid-template-columns: 30px minmax(0,1fr) 34px 34px;
    gap: 5px;
    align-items: center;
    min-height: 38px;
    padding: 5px 6px;
    border: 1px solid #c9c9c9;
    background: #f7f7f7;
}

.cms-scenario-order-item > span {
    color: #777;
    font-size: .6rem;
    font-weight: 800;
}

.cms-scenario-order-item > strong {
    overflow: hidden;
    font-size: .68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-scenario-order-item > button {
    min-height: 30px;
    border: 1px solid #bdbdbd;
    background: transparent;
    color: #303030;
    cursor: pointer;
}


/* cache-fix + mobile */
@media (max-width: 700px) {
    .cms-scenario-order-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .cms-character-view .cms-preview-standing-tabs,
    .cms-character-view .cms-preview-category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 6px;
    }

    .cms-character-view .cms-standing-viewer .cms-viewer-stage img {
        height: 390px;
    }

    .cms-character-view .cms-expression-viewer .cms-viewer-stage img,
    .cms-character-view .cms-expression-viewer .cms-viewer-stage.compact img {
        height: 290px;
    }

    .cms-character-view .cms-expression-thumb {
        flex-basis: 68px;
        width: 68px;
    }

    .cms-character-view .cms-expression-thumb-image {
        width: 58px;
        height: 58px;
    }
}


/* =========================================================
   v1.4.1 STANDING CATEGORY BUTTONS
   立ち絵カテゴリはプレビューより下へ
   ========================================================= */

.cms-character-view .cms-preview-standing-tabs {
    margin: 14px 0 0;
    padding-top: 10px;
    padding-bottom: 0;
    border-top: 1px solid var(--line-soft);
}

@media (max-width: 560px) {
    .cms-character-view .cms-preview-standing-tabs {
        margin-top: 12px;
        padding-top: 8px;
        padding-bottom: 5px;
    }
}


/* =========================================================
   v1.5 SPOILER SCENARIOS
   ========================================================= */

.cms-spoiler-legacy {
    margin-bottom: 24px;
}

.cms-spoiler-scenario-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 22px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.cms-spoiler-scenario-tabs button {
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-size: .63rem;
    font-weight: 800;
}

.cms-spoiler-scenario-tabs button.is-active {
    background: var(--ink);
    color: var(--surface);
}

.cms-spoiler-scenario-panel[hidden] {
    display: none !important;
}

.cms-spoiler-scenario-title {
    margin: 18px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: .78rem;
    letter-spacing: .08em;
}

.cms-spoiler-scenario-panel
.cms-spoiler-assets {
    margin-top: 28px;
}


/* =========================================================
   v1.5 RELATION BOARD INDEX
   ========================================================= */

.cms-relations-filter-note {
    margin-bottom: 22px;
    color: var(--muted);
    font-size: .75rem;
}

.cms-relations-filter-note a {
    margin-left: 8px;
    color: var(--ink);
}

.cms-relation-board-index {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(230px,1fr)
        );
    gap: 14px;
}

.cms-relation-board-card {
    position: relative;
    display: block;
    min-height: 160px;
    padding: 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}

.cms-relation-board-card
.cms-relation-board-number {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.cms-relation-board-card small,
.cms-relation-board-card strong,
.cms-relation-board-card > span:last-child {
    display: block;
}

.cms-relation-board-card small {
    color: var(--muted);
    font-size: .6rem;
    letter-spacing: .08em;
}

.cms-relation-board-card strong {
    margin: 7px 0;
    font-size: .95rem;
}

.cms-relation-board-card p {
    margin: 0 0 12px;
    color: var(--ink-soft);
    font-size: .75rem;
    line-height: 1.75;
}

.cms-relation-board-card > span:last-child {
    margin-top: 12px;
    font-size: .65rem;
    font-weight: 800;
}


/* =========================================================
   v1.5 DISTRIBUTION BOARD
   ========================================================= */

.cms-relation-board-description {
    max-width: 760px;
    margin-bottom: 24px;
    color: var(--ink-soft);
    font-size: .8rem;
    line-height: 1.9;
}

.cms-relation-board {
    position: relative;
    width: 100%;
    min-height: 620px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--surface);
}

.cms-relation-axis {
    position: absolute;
    z-index: 1;
    background: var(--line-soft);
    pointer-events: none;
}

.cms-relation-axis.x {
    top: 50%;
    left: 3%;
    right: 3%;
    height: 1px;
}

.cms-relation-axis.y {
    top: 3%;
    bottom: 3%;
    left: 50%;
    width: 1px;
}

.cms-relation-axis-label {
    position: absolute;
    z-index: 2;
    max-width: 180px;
    padding: 3px 5px;
    background: rgba(247,247,247,.9);
    color: var(--ink);
    font-size: .66rem;
    font-weight: 800;
    line-height: 1.5;
}

.cms-relation-axis-label.left {
    top: 50%;
    left: 2.5%;
    transform: translateY(-50%);
}

.cms-relation-axis-label.right {
    top: 50%;
    right: 2.5%;
    transform: translateY(-50%);
    text-align: right;
}

.cms-relation-axis-label.top {
    top: 2%;
    left: 50%;
    transform: translateX(-50%);
    writing-mode: vertical-rl;
}

.cms-relation-axis-label.bottom {
    bottom: 2%;
    left: 50%;
    transform: translateX(-50%);
    writing-mode: vertical-rl;
}

.cms-relation-board-title {
    position: absolute;
    z-index: 0;
    top: 50%;
    left: 50%;
    width: 80%;
    transform: translate(-50%,-50%);
    color: rgba(48,48,48,.09);
    font-family: var(--font-heading);
    font-size: clamp(1.5rem,4vw,3.6rem);
    font-weight: 900;
    text-align: center;
    pointer-events: none;
}

.cms-relation-node {
    position: absolute;
    z-index: 5;
    width: 52px;
    height: 52px;
    padding: 0;
    overflow: hidden;
    transform: translate(-50%,-50%);
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--surface-alt);
    box-shadow: 0 1px 5px rgba(0,0,0,.18);
    cursor: pointer;
    touch-action: none;
}

.cms-relation-node img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cms-relation-node > span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--ink);
    font-weight: 900;
}

.cms-relation-node.admin-node {
    cursor: grab;
}

.cms-relation-node.admin-node.is-dragging {
    z-index: 20;
    cursor: grabbing;
    box-shadow: 0 4px 18px rgba(0,0,0,.28);
}


/* =========================================================
   v1.5 RELATION ADMIN
   ========================================================= */

.cms-relation-add-character {
    display: grid;
    grid-template-columns: minmax(220px,420px) 1fr;
    gap: 18px;
    align-items: end;
}

.cms-relation-board-admin {
    min-height: 580px;
    user-select: none;
}

.cms-relation-item-editor-list {
    display: grid;
    gap: 12px;
}

.cms-relation-item-editor {
    padding: 14px;
    border: 1px solid #d8d8d8;
}

.cms-relation-editor-person {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.cms-relation-editor-person img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
}

.cms-relation-editor-person strong,
.cms-relation-editor-person small {
    display: block;
}

.cms-relation-editor-person small {
    color: #777;
    font-size: .62rem;
}


/* =========================================================
   v1.5 INDEX BOARD
   ========================================================= */

.cms-relation-index-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(190px,1fr)
        );
    gap: 12px;
}

.cms-relation-index-item {
    display: grid;
    grid-template-columns: 54px minmax(0,1fr);
    grid-template-rows: auto auto auto;
    gap: 2px 10px;
    align-items: center;
    min-height: 98px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.cms-relation-index-icon {
    grid-row: 1 / 4;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-alt);
}

.cms-relation-index-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cms-relation-index-item small {
    color: var(--muted);
    font-size: .58rem;
}

.cms-relation-index-item strong {
    font-size: .78rem;
}

.cms-relation-index-item > span:last-child {
    font-size: .58rem;
    font-weight: 800;
}


/* =========================================================
   v1.5 RELATION MODAL
   ========================================================= */

html.cms-modal-open {
    overflow: hidden;
}

.cms-relation-modal[hidden] {
    display: none !important;
}

.cms-relation-modal {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
}

.cms-relation-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(20,20,20,.5);
    cursor: default;
}

.cms-relation-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(640px,100%);
    max-height: min(78vh,720px);
    overflow: auto;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.cms-relation-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-size: 1.4rem;
}

.cms-relation-modal-content h3 {
    margin: 0 0 16px;
    padding-right: 34px;
}

.cms-relation-modal-body {
    line-height: 1.95;
}

.cms-relation-modal-content > small {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    font-size: .6rem;
}


/* =========================================================
   v1.5 RELATION SPOILER GATE
   ========================================================= */

.cms-relation-spoiler-gate {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.cms-relation-spoiler-gate > summary {
    padding: 16px 4px;
    cursor: pointer;
}

.cms-relation-spoiler-gate > summary strong,
.cms-relation-spoiler-gate > summary small {
    display: block;
}

.cms-relation-spoiler-gate > summary small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .65rem;
}

.cms-relation-gated-content {
    padding: 14px 0 26px;
}

@media (max-width: 720px) {
    .cms-relation-board {
        min-height: 520px;
    }

    .cms-relation-node {
        width: 46px;
        height: 46px;
    }

    .cms-relation-axis-label {
        max-width: 120px;
        font-size: .58rem;
    }

    .cms-relation-add-character {
        grid-template-columns: 1fr;
    }

    .cms-spoiler-scenario-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .cms-spoiler-scenario-tabs button {
        flex: 0 0 auto;
    }
}

@media (max-width: 520px) {
    .cms-relation-board {
        min-height: 460px;
    }

    .cms-relation-node {
        width: 42px;
        height: 42px;
    }

    .cms-relation-index-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   v1.5.1 RELATION FACE ICON FIX
   全身立ち絵がfallbackになった時は頭側を切り抜く
   ========================================================= */

.cms-relation-node img.is-standing-fallback,
.cms-relation-index-icon img.is-standing-fallback,
.cms-relation-editor-person img.is-standing-fallback {
    object-position: center 8%;
}

/* ICON / FACE / EXPRESSION は従来どおり中央 */
.cms-relation-node img:not(.is-standing-fallback),
.cms-relation-index-icon img:not(.is-standing-fallback),
.cms-relation-editor-person img:not(.is-standing-fallback) {
    object-position: center center;
}


/* =========================================================
   v1.6 RELATION MAP
   ========================================================= */

.cms-relation-map-board {
    background-image:
        linear-gradient(
            rgba(48,48,48,.035) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(48,48,48,.035) 1px,
            transparent 1px
        );
    background-size: 28px 28px;
}

.cms-relation-lines {
    position: absolute;
    z-index: 3;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.cms-relation-lines marker path {
    fill: var(--ink-soft);
}

.cms-relation-line {
    stroke: var(--ink-soft);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.cms-relation-line.is-dashed {
    stroke-dasharray: 7 5;
}

.cms-relation-line.is-dotted {
    stroke-dasharray: 2 5;
    stroke-linecap: round;
}

.cms-relation-map-board
.cms-relation-node {
    z-index: 6;
}

.cms-relation-link-label {
    position: absolute;
    z-index: 8;
    max-width: 150px;
    padding: 4px 7px;
    transform: translate(-50%,-50%);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: .56rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
    box-shadow:
        0 1px 4px rgba(0,0,0,.08);
}

.cms-relation-link-label.admin-label {
    pointer-events: none;
}

.cms-relation-new-link {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(150px,1fr)
        );
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid #d8d8d8;
    background: #ececec;
}

.cms-relation-link-editor-list {
    display: grid;
    gap: 12px;
}

.cms-relation-link-editor {
    padding: 14px;
    border: 1px solid #d8d8d8;
}

.cms-relation-link-editor-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 12px;
}

.cms-relation-link-editor-head strong {
    font-size: .78rem;
}

.cms-relation-link-editor-head small {
    color: #777;
    font-size: .58rem;
}

.cms-relation-modal-label {
    display: inline-block;
    margin: 0 0 14px;
    padding: 4px 8px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 800;
}

@media (max-width: 560px) {
    .cms-relation-link-label {
        max-width: 110px;
        padding: 3px 5px;
        font-size: .5rem;
    }
}


/* =========================================================
   v1.7 RELATION CATEGORIES
   ========================================================= */

.cms-relation-category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 22px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--line-soft);
}

.cms-relation-category-nav a {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    padding: 6px 9px;
    border: 1px solid var(--line-soft);
    background: var(--surface);
    color: var(--ink);
    font-size: .65rem;
    font-weight: 800;
    text-decoration: none;
}

.cms-relation-category-nav a small {
    color: var(--muted);
    font-size: .52rem;
}

.cms-admin-relation-category,
.cms-relation-public-category {
    margin-top: 30px;
    scroll-margin-top: 18px;
}

.cms-admin-relation-category:first-of-type,
.cms-relation-public-category:first-of-type {
    margin-top: 0;
}

.cms-admin-relation-category-head,
.cms-relation-category-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.cms-admin-relation-category-head h3,
.cms-relation-category-heading h3 {
    margin: 0;
    font-size: .8rem;
    letter-spacing: .08em;
}

.cms-admin-relation-category-head small,
.cms-relation-category-heading small {
    color: var(--muted);
    font-size: .55rem;
}


/* =========================================================
   v1.7 RELATION ONLY PEOPLE
   ========================================================= */

.cms-relation-person-current-icon {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 12px 0 18px;
}

.cms-relation-person-current-icon img,
.cms-relation-person-icon {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-alt);
}

.cms-relation-person-current-icon img,
.cms-relation-person-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cms-relation-person-icon > span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-weight: 900;
}

.cms-relation-people-list {
    display: grid;
    gap: 8px;
}

.cms-relation-people-list > article {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #d8d8d8;
}

.cms-relation-person-card-main {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.cms-relation-person-card-main small,
.cms-relation-person-card-main strong,
.cms-relation-person-card-main span {
    display: block;
}

.cms-relation-person-card-main small,
.cms-relation-person-card-main span {
    color: #777;
    font-size: .62rem;
}

.cms-relation-person-card-main strong {
    margin: 2px 0;
    font-size: .78rem;
}

.cms-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #303030;
    cursor: pointer;
    font: inherit;
    font-size: .65rem;
    text-decoration: underline;
}

.cms-link-button.danger {
    color: #8a3030;
}

.cms-relation-only-note {
    margin-top: 16px;
    color: var(--muted);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .08em;
}

@media (max-width: 620px) {
    .cms-relation-category-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 9px;
    }

    .cms-relation-category-nav a {
        flex: 0 0 auto;
    }

    .cms-relation-people-list > article {
        align-items: flex-start;
    }
}


/* =========================================================
   v1.7.1 CATEGORY DISPLAY FIX
   ========================================================= */

.cms-board-type-en {
    margin-left: 4px;
    color: var(--muted);
    font-size: .48rem;
    font-weight: 700;
    letter-spacing: .06em;
}

.cms-field-grid label > small {
    display: block;
    margin-top: 4px;
    color: #777;
    font-size: .58rem;
    line-height: 1.5;
}


/* =========================================================
   v1.8 NOVELS
   Based on the existing 屋根裏の本棚 NOVELS pages
   ========================================================= */

/* ---------- LIST ---------- */

.cms-novels-page .works-intro {
    max-width: 840px;
    margin: 0 0 34px;
    color: var(--ink-soft);
    font-size: .86rem;
    line-height: 1.9;
}

.novel-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.novel-filter a {
    padding: 5px 9px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: var(--surface);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-decoration: none;
}

.novel-filter a.is-active,
.novel-filter a:hover {
    background: var(--ink);
    color: var(--surface);
}

.novel-list {
    border-top: 1px solid var(--line);
}

.novel-item {
    display: grid;
    grid-template-columns:
        92px
        minmax(0,1fr)
        auto;
    gap: 18px;
    align-items: start;
    padding: 22px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}

.novel-item:hover .novel-title {
    text-decoration: underline;
    text-underline-offset: 5px;
}

.novel-date {
    padding-top: 3px;
    color: var(--muted);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    white-space: nowrap;
}

.novel-series {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .1em;
}

.novel-title {
    display: block;
    margin-bottom: 7px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .03em;
}

.novel-summary {
    display: block;
    margin: 0 0 10px;
    color: var(--ink-soft);
    font-size: .78rem;
    line-height: 1.75;
}

.novel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.novel-tag {
    color: var(--muted);
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .05em;
}

.novel-tag + .novel-tag::before {
    content: "/";
    margin-right: 6px;
    color: var(--line);
}

.novel-spoiler {
    color: var(--ink);
    font-weight: 800;
}

.novel-arrow {
    padding-top: 2px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
}

.cms-novel-filter-note {
    margin: -16px 0 24px;
    color: var(--muted);
    font-size: .72rem;
}

.cms-novel-filter-note a {
    margin-left: 7px;
    color: var(--ink);
}


/* ---------- DETAIL ---------- */

.novel-page {
    padding-top: 30px;
}

.novel-back {
    display: inline-block;
    margin-bottom: 34px;
    color: var(--muted);
    text-decoration: none;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.novel-back:hover {
    color: var(--ink);
}

.novel-article {
    width: min(100%,720px);
    margin: 0 auto;
}

.novel-header {
    margin-bottom: 44px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.novel-header-kicker {
    margin: 0 0 7px;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.novel-header h2 {
    display: block;
    margin: 0 0 13px;
    padding: 0;
    border: 0;
    font-size: clamp(1.25rem,4vw,1.7rem);
    line-height: 1.55;
    letter-spacing: .06em;
}

.novel-header h2::before {
    display: none;
}

.novel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    color: var(--muted);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .05em;
}

.novel-meta a {
    color: inherit;
}

.novel-warning {
    margin: 0 0 34px;
    padding: 12px 0 12px 14px;
    border-left: 2px solid var(--ink);
    color: var(--ink-soft);
    font-size: .76rem;
    line-height: 1.8;
}

.novel-reading-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    align-items: center;
    margin: 0 0 18px;
}

.novel-reading-toolbar > span {
    margin-right: 4px;
    color: var(--muted);
    font-size: .56rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.novel-reading-toolbar button {
    min-width: 58px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: .62rem;
    font-weight: 800;
}

.novel-reading-toolbar button.is-active {
    background: var(--ink);
    color: var(--surface);
}

.novel-reading-shell {
    position: relative;
}

.novel-body {
    font-family:
        "Yu Mincho",
        "Hiragino Mincho ProN",
        "Hiragino Mincho Pro",
        serif;
    color: var(--ink);
    font-size: 1rem;
    line-height: 2.15;
    letter-spacing: .02em;
}

.novel-body.is-horizontal p {
    margin: 0 0 1.65em;
    text-align: justify;
    text-justify: inter-ideograph;
}

.novel-body .scene-break {
    margin: 2.8em 0;
    text-align: center;
    letter-spacing: .35em;
    color: var(--muted);
}

.novel-body .novel-chapter {
    margin: 3em 0 1.6em;
    padding: 0 0 .5em;
    border-bottom: 1px solid var(--line-soft);
    font-size: 1.05rem;
    letter-spacing: .08em;
}

.novel-body ruby rt {
    font-size: .5em;
}

.novel-emphasis {
    font-style: normal;
    text-emphasis: filled sesame;
    -webkit-text-emphasis: filled sesame;
}


/* ---------- VERTICAL READING ---------- */

.novel-body.is-vertical {
    width: 100%;
    height: min(74vh,720px);
    min-height: 520px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 30px 28px;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    line-height: 2;
    letter-spacing: .08em;
    scrollbar-width: thin;
}

.novel-body.is-vertical p {
    margin: 0 0 0 1.8em;
    text-align: justify;
}

.novel-body.is-vertical .scene-break {
    margin: 0 2.8em;
    letter-spacing: .35em;
}

.novel-body.is-vertical .novel-chapter {
    margin: 0 3em 0 2em;
    padding: 0 0 0 .7em;
    border: 0;
    border-left: 1px solid var(--line-soft);
}

.novel-body.is-vertical .novel-emphasis {
    text-emphasis-position: over right;
    -webkit-text-emphasis-position: over right;
}


/* ---------- spoiler ---------- */

.novel-spoiler-gate {
    margin-top: 8px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.novel-spoiler-gate > summary {
    padding: 15px 4px;
    cursor: pointer;
}

.novel-spoiler-gate > summary strong,
.novel-spoiler-gate > summary small {
    display: block;
}

.novel-spoiler-gate > summary small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .62rem;
}

.novel-spoiler-content {
    padding: 24px 0 8px;
}


/* ---------- afterword / bottom nav ---------- */

.novel-note {
    margin-top: 54px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--font-body);
    font-size: .74rem;
    line-height: 1.85;
}

.novel-bottom-nav {
    width: min(100%,720px);
    display: grid;
    grid-template-columns:
        minmax(0,1fr)
        auto
        minmax(0,1fr);
    gap: 20px;
    align-items: start;
    margin: 50px auto 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.novel-bottom-nav > span:last-child {
    text-align: right;
}

.novel-bottom-nav a {
    color: var(--ink);
    text-decoration: none;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.novel-bottom-nav a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.novel-page-top {
    width: min(100%,720px);
    margin: 18px auto 0;
    text-align: right;
}

.novel-page-top button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: .62rem;
    font-weight: 800;
}


/* ---------- ADMIN ---------- */

.cms-admin-novel-list {
    display: grid;
}

.cms-admin-novel-list > article {
    display: grid;
    grid-template-columns:
        105px
        minmax(0,1fr)
        auto;
    gap: 14px;
    align-items: start;
    padding: 13px 0;
    border-bottom: 1px solid #d8d8d8;
}

.cms-admin-novel-date {
    color: #777;
    font-size: .63rem;
}

.cms-admin-novel-main small,
.cms-admin-novel-main strong,
.cms-admin-novel-main span {
    display: block;
}

.cms-admin-novel-main small,
.cms-admin-novel-main span {
    color: #777;
    font-size: .6rem;
}

.cms-admin-novel-main strong {
    margin: 3px 0;
    font-size: .78rem;
}

.cms-novel-character-picker {
    display: grid;
    grid-template-columns:
        repeat(auto-fit,minmax(170px,1fr));
    gap: 6px;
}

.cms-novel-character-picker label {
    display: flex;
    gap: 7px;
    align-items: center;
    padding: 8px;
    border: 1px solid #d8d8d8;
    cursor: pointer;
}

.cms-novel-character-picker small {
    display: block;
    color: #777;
    font-size: .5rem;
}

.cms-novel-editor-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
}

.cms-novel-editor-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.cms-novel-editor-tools button {
    padding: 5px 8px;
    border: 1px solid #bdbdbd;
    background: transparent;
    color: #303030;
    cursor: pointer;
    font-size: .62rem;
    font-weight: 800;
}

.cms-novel-markup-help {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.cms-novel-markup-help code {
    padding: 3px 6px;
    border: 1px solid #d8d8d8;
    background: #ececec;
    font-size: .58rem;
}

.cms-novel-body-editor {
    min-height: 620px;
    font-family:
        "Yu Mincho",
        "Hiragino Mincho ProN",
        monospace;
    font-size: .9rem;
    line-height: 1.9;
}

.cms-novel-draft-status {
    margin: 8px 0 0;
    color: #777;
    font-size: .58rem;
}


/* ---------- RESPONSIVE ---------- */

@media (max-width: 680px) {
    .novel-item {
        grid-template-columns: 1fr auto;
        gap: 7px 12px;
        padding: 19px 0;
    }

    .novel-date {
        grid-column: 1 / -1;
        padding: 0;
    }

    .novel-bottom-nav {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .novel-bottom-nav > span:last-child {
        text-align: left;
    }

    .cms-admin-novel-list > article {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .cms-novel-editor-heading {
        display: block;
    }

    .cms-novel-editor-tools {
        justify-content: flex-start;
        margin: 10px 0;
    }
}

@media (max-width: 600px) {
    .novel-body {
        font-size: .95rem;
        line-height: 2.05;
    }

    .novel-body.is-vertical {
        height: 68vh;
        min-height: 430px;
        padding: 22px 18px;
    }
}


/* =========================================================
   v1.9 BLOG
   Based on existing DIARY pages
   ========================================================= */

/* ---------- public list ---------- */

.cms-blog-page .blog-category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.cms-blog-page .blog-category-nav a {
    padding: 5px 9px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: var(--surface);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-decoration: none;
}

.cms-blog-page .blog-category-nav a:hover,
.cms-blog-page .blog-category-nav a.is-active {
    background: var(--ink);
    color: var(--surface);
}

.cms-blog-page .diary-archive-list {
    border-top: 1px solid var(--line);
}

.cms-blog-page .archive-item {
    display: grid;
    grid-template-columns:
        100px
        96px
        minmax(0,1fr)
        auto;
    gap: 14px;
    align-items: center;
    padding: 15px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}

.cms-blog-page .archive-date {
    color: var(--muted);
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .05em;
}

.cms-blog-page .archive-tag {
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.cms-blog-page .archive-title {
    font-size: .78rem;
    font-weight: 700;
}

.cms-blog-page .archive-external {
    color: var(--muted);
    font-size: .72rem;
}


/* ---------- public post ---------- */

.cms-blog-post-page .diary-post {
    width: min(100%,820px);
    margin: 0 auto;
}

.cms-blog-post-page .diary-header {
    margin-bottom: 34px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.cms-blog-post-page .diary-date,
.cms-blog-post-page .diary-post-category {
    display: inline-block;
    margin: 0 10px 8px 0;
    color: var(--muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.cms-blog-post-page .diary-header .diary-title {
    margin: 0;
}

.cms-blog-post-page .diary-body {
    line-height: 1.95;
}

.cms-blog-post-page .diary-body > * {
    margin-top: 0;
    margin-bottom: 28px;
}

.cms-blog-post-page .diary-text-block p {
    margin: 0 0 1.45em;
}

.cms-blog-post-page .diary-body > h2.diary-title {
    margin-top: 42px;
    margin-bottom: 16px;
}

.diary-image-block {
    margin: 0 0 30px;
}

.diary-image-block img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.diary-image-block figcaption {
    margin-top: 7px;
    color: var(--muted);
    font-size: .66rem;
    text-align: center;
}

.diary-youtube-block {
    margin-bottom: 30px;
}

.diary-support-banner .support-description {
    display: block;
    margin-top: 4px;
    font-size: .68rem;
    font-weight: 400;
}

.diary-quote-block {
    margin: 0 0 30px;
    padding: 14px 18px;
    border-left: 2px solid var(--ink);
    background: var(--surface-alt);
}

.diary-quote-block p {
    margin: 0;
}

.diary-quote-block cite {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: .64rem;
    font-style: normal;
}

.diary-divider {
    margin: 38px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.diary-embed-block {
    max-width: 100%;
    overflow-x: auto;
}


/* ---------- admin list ---------- */

.cms-admin-blog-list {
    display: grid;
}

.cms-admin-blog-list > article {
    display: grid;
    grid-template-columns:
        105px
        minmax(0,1fr)
        auto;
    gap: 14px;
    align-items: start;
    padding: 13px 0;
    border-bottom: 1px solid #d8d8d8;
}

.cms-admin-blog-date {
    color: #777;
    font-size: .63rem;
}

.cms-admin-blog-main small,
.cms-admin-blog-main strong,
.cms-admin-blog-main span {
    display: block;
}

.cms-admin-blog-main small,
.cms-admin-blog-main span {
    color: #777;
    font-size: .6rem;
}

.cms-admin-blog-main strong {
    margin: 3px 0;
    font-size: .78rem;
}


/* ---------- block editor ---------- */

.cms-blog-blocks-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cms-blog-add-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.cms-blog-add-buttons button {
    padding: 5px 8px;
    border: 1px solid #bdbdbd;
    background: transparent;
    color: #303030;
    cursor: pointer;
    font-size: .6rem;
    font-weight: 800;
}

.cms-blog-block-list {
    display: grid;
    gap: 10px;
}

.cms-blog-block-editor {
    padding: 12px;
    border: 1px solid #d8d8d8;
    background: #fafafa;
}

.cms-blog-block-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e2e2e2;
}

.cms-blog-block-toolbar > span {
    font-size: .63rem;
    font-weight: 900;
    letter-spacing: .08em;
}

.cms-blog-block-toolbar > div {
    display: flex;
    gap: 4px;
}

.cms-blog-block-toolbar button {
    min-width: 30px;
    min-height: 28px;
    border: 1px solid #bdbdbd;
    background: transparent;
    color: #303030;
    cursor: pointer;
}

.cms-blog-current-image {
    display: block;
    width: min(100%,320px);
    max-height: 220px;
    margin: 0 0 10px;
    object-fit: contain;
    object-position: left center;
    border: 1px solid #d8d8d8;
    background: #eee;
}

@media (max-width: 700px) {
    .cms-blog-page .archive-item {
        grid-template-columns:
            1fr
            auto;
        gap: 5px 12px;
    }

    .cms-blog-page .archive-date {
        grid-column: 1 / -1;
    }

    .cms-blog-page .archive-tag {
        grid-column: 1;
    }

    .cms-blog-page .archive-title {
        grid-column: 1;
    }

    .cms-blog-page .archive-external {
        grid-column: 2;
        grid-row: 2 / span 2;
    }

    .cms-admin-blog-list > article {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .cms-blog-blocks-head {
        display: block;
    }

    .cms-blog-add-buttons {
        justify-content: flex-start;
        margin-top: 10px;
    }
}


/* =========================================================
   v1.9.1 RESPONSIVE WIDE LAYOUT
   NOVELS / BLOG
   PC・iPad・スマホで読み幅を分ける
   ========================================================= */

/* ---------------------------------------------------------
   DESKTOP
   1200px以上:
   サイト幅をしっかり使う。
   本文だけは長すぎないよう少し余白を残す。
   --------------------------------------------------------- */

@media (min-width: 1200px) {

    .cms-novels-page .main-content,
    .cms-novel-view-page .main-content,
    .cms-blog-page .main-content,
    .cms-blog-post-page .main-content {
        width: 100%;
        max-width: none;
    }

    /* 一覧は横幅いっぱい */
    .cms-novels-page .novel-list,
    .cms-novels-page .works-intro,
    .cms-novels-page .novel-filter,
    .cms-blog-page .diary-list-section,
    .cms-blog-page .diary-archive-list {
        width: 100%;
        max-width: none;
    }

    /* 小説本文は広め。従来720px → 980px */
    .cms-novel-view-page .novel-article,
    .cms-novel-view-page .novel-bottom-nav,
    .cms-novel-view-page .novel-page-top {
        width: min(100%, 980px);
        max-width: none;
    }

    /* BLOG本文はさらに広め */
    .cms-blog-post-page .diary-post {
        width: min(100%, 1080px);
        max-width: none;
    }

    /* 縦書きはPCで横方向をたっぷり使う */
    .cms-novel-view-page .novel-body.is-vertical {
        height: min(78vh, 820px);
        min-height: 620px;
        padding: 36px 42px;
    }
}


/* ---------------------------------------------------------
   TABLET / iPad
   768px〜1199px:
   横いっぱいにしすぎず、左右に余白を残す。
   --------------------------------------------------------- */

@media (min-width: 768px) and (max-width: 1199px) {

    .cms-novels-page .main-content,
    .cms-novel-view-page .main-content,
    .cms-blog-page .main-content,
    .cms-blog-post-page .main-content {
        width: 100%;
        max-width: none;
    }

    .cms-novel-view-page .novel-article,
    .cms-novel-view-page .novel-bottom-nav,
    .cms-novel-view-page .novel-page-top {
        width: min(100%, 860px);
        max-width: none;
        padding-left: 18px;
        padding-right: 18px;
        box-sizing: border-box;
    }

    .cms-blog-post-page .diary-post {
        width: min(100%, 920px);
        max-width: none;
        padding-left: 18px;
        padding-right: 18px;
        box-sizing: border-box;
    }

    .cms-novels-page .novel-list,
    .cms-blog-page .diary-archive-list {
        width: 100%;
    }

    .cms-novel-view-page .novel-body.is-vertical {
        height: 72vh;
        min-height: 520px;
        padding: 28px 28px;
    }
}


/* ---------------------------------------------------------
   MOBILE
   767px以下:
   画面幅をそのまま使い、左右余白はコンパクト。
   本文は読みやすさ優先。
   --------------------------------------------------------- */

@media (max-width: 767px) {

    .cms-novels-page .main-content,
    .cms-novel-view-page .main-content,
    .cms-blog-page .main-content,
    .cms-blog-post-page .main-content {
        width: 100%;
        max-width: none;
    }

    .cms-novel-view-page .novel-article,
    .cms-novel-view-page .novel-bottom-nav,
    .cms-novel-view-page .novel-page-top,
    .cms-blog-post-page .diary-post {
        width: 100%;
        max-width: none;
        padding-left: 10px;
        padding-right: 10px;
        box-sizing: border-box;
    }

    .cms-novels-page .novel-list,
    .cms-blog-page .diary-archive-list {
        width: 100%;
    }

    /* スマホ横書きはやや小さめ */
    .cms-novel-view-page .novel-body {
        font-size: .95rem;
        line-height: 2.05;
    }

    /* スマホ縦書きは高さを抑えて横スクロール */
    .cms-novel-view-page .novel-body.is-vertical {
        height: 66vh;
        min-height: 420px;
        padding: 20px 14px;
        font-size: .92rem;
        line-height: 1.9;
    }

    .cms-blog-post-page .diary-body {
        font-size: .94rem;
        line-height: 1.9;
    }
}


/* ---------------------------------------------------------
   VERY SMALL MOBILE
   --------------------------------------------------------- */

@media (max-width: 420px) {

    .cms-novel-view-page .novel-article,
    .cms-novel-view-page .novel-bottom-nav,
    .cms-novel-view-page .novel-page-top,
    .cms-blog-post-page .diary-post {
        padding-left: 6px;
        padding-right: 6px;
    }

    .cms-novel-view-page .novel-reading-toolbar {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .cms-blog-page .archive-item {
        padding-left: 0;
        padding-right: 0;
    }
}


/* =========================================================
   v2.0 GALLERY CMS
   ========================================================= */
.cms-gallery-list-section{width:100%}
.cms-gallery-type-nav{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:18px}
.cms-gallery-type-nav a,.cms-gallery-tag-cloud a{padding:5px 8px;border:1px solid var(--line);background:var(--surface);color:var(--muted);font-size:.62rem;font-weight:800;text-decoration:none}
.cms-gallery-type-nav a.is-active,.cms-gallery-type-nav a:hover{background:var(--ink);color:var(--surface)}
.cms-gallery-tag-cloud{display:flex;flex-wrap:wrap;gap:5px;margin:0 0 24px}
.cms-gallery-tag-cloud a small{margin-left:4px;font-size:.5rem}
.cms-gallery-active-tag,.cms-gallery-filter-note{margin:0 0 14px;color:var(--muted);font-size:.7rem}
.cms-gallery-active-tag a,.cms-gallery-filter-note a{margin-left:6px;color:var(--ink)}
.cms-gallery-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:22px 16px}
.cms-gallery-card{display:block;color:var(--ink);text-decoration:none}
.cms-gallery-card-image{position:relative;display:block;aspect-ratio:1/1;overflow:hidden;background:var(--surface-alt)}
.cms-gallery-card-image>img{width:100%;height:100%;object-fit:cover;transition:transform .2s ease}
.cms-gallery-card:hover .cms-gallery-card-image>img{transform:scale(1.02)}
.cms-gallery-image-count,.cms-gallery-rating-badge{position:absolute;bottom:8px;padding:4px 6px;background:rgba(247,247,247,.92);color:var(--ink);font-size:.54rem;font-weight:900}
.cms-gallery-image-count{right:8px}.cms-gallery-rating-badge{left:8px}
.cms-gallery-card-info{display:block;padding-top:9px}
.cms-gallery-card-info small,.cms-gallery-card-info strong,.cms-gallery-card-characters,.cms-gallery-card-tags{display:block}
.cms-gallery-card-info small{color:var(--muted);font-size:.58rem;font-weight:800}
.cms-gallery-card-info strong{margin:4px 0 5px;font-size:.82rem}
.cms-gallery-card-characters{color:var(--ink-soft);font-size:.64rem}
.cms-gallery-card-tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:5px;color:var(--muted);font-size:.56rem}

.cms-gallery-post{width:min(100%,1180px);margin:0 auto}
.cms-gallery-post-header{width:min(100%,920px);margin:0 auto 32px;padding-bottom:18px;border-bottom:1px solid var(--line)}
.cms-gallery-post-header h2{margin-bottom:10px}
.cms-gallery-post-meta,.cms-gallery-post-tags{display:flex;flex-wrap:wrap;gap:6px 14px;color:var(--muted);font-size:.64rem}
.cms-gallery-post-meta a,.cms-gallery-post-tags a{color:inherit}
.cms-gallery-post-description{margin:16px 0 0;color:var(--ink-soft);font-size:.78rem;line-height:1.9}
.cms-gallery-gate{width:min(100%,1180px);margin:0 auto;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.cms-gallery-gate>summary{padding:16px 6px;cursor:pointer}
.cms-gallery-gate>summary strong,.cms-gallery-gate>summary small{display:block}
.cms-gallery-gate>summary small{margin-top:3px;color:var(--muted);font-size:.62rem}
.cms-gallery-gated-content{padding:22px 0}

.cms-gallery-viewer-stage{display:grid;grid-template-columns:50px minmax(0,1fr) 50px;gap:10px;align-items:center}
.cms-gallery-viewer-stage>button:not(.cms-gallery-main-button){width:44px;height:60px;border:0;background:transparent;color:var(--ink);cursor:pointer;font-size:2rem}
.cms-gallery-main-button{display:block;width:100%;padding:0;border:0;background:transparent;cursor:zoom-in}
.cms-gallery-main-button img{display:block;width:100%;max-height:82vh;object-fit:contain}
.cms-gallery-viewer-meta{display:flex;justify-content:space-between;gap:16px;width:calc(100% - 120px);margin:8px auto 0;color:var(--muted);font-size:.62rem}
.cms-gallery-thumbs{display:flex;gap:6px;justify-content:center;margin-top:12px;overflow-x:auto;padding-bottom:5px}
.cms-gallery-thumbs button{width:60px;height:60px;flex:0 0 60px;padding:0;overflow:hidden;border:1px solid transparent;background:var(--surface-alt);cursor:pointer}
.cms-gallery-thumbs button.is-active{border-color:var(--ink)}
.cms-gallery-thumbs img{width:100%;height:100%;object-fit:cover}
.cms-gallery-comic-view{width:min(100%,900px);margin:0 auto}
.cms-gallery-comic-view figure{margin:0 0 18px}
.cms-gallery-comic-view img{display:block;width:100%;height:auto}
.cms-gallery-comic-view figcaption{margin-top:5px;color:var(--muted);font-size:.62rem;text-align:center}
.cms-gallery-grid-view{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:8px}
.cms-gallery-grid-view button{aspect-ratio:1/1;padding:0;overflow:hidden;border:0;background:var(--surface-alt);cursor:zoom-in}
.cms-gallery-grid-view img{width:100%;height:100%;object-fit:cover}

.cms-gallery-lightbox[hidden]{display:none!important}
.cms-gallery-lightbox{position:fixed;z-index:1200;inset:0;display:grid;place-items:center;padding:18px}
.cms-gallery-lightbox-backdrop{position:absolute;inset:0;border:0;background:rgba(20,20,20,.78)}
.cms-gallery-lightbox-dialog{position:relative;z-index:1;display:grid;place-items:center;width:100%;height:100%;pointer-events:none}
.cms-gallery-lightbox-dialog img{max-width:94vw;max-height:88vh;object-fit:contain;pointer-events:auto}
.cms-gallery-lightbox-dialog p{max-width:820px;margin:8px auto 0;color:#fff;font-size:.68rem;text-align:center}
.cms-gallery-lightbox-close{position:fixed;z-index:2;top:14px;right:18px;width:42px;height:42px;border:0;background:transparent;color:#fff;cursor:pointer;font-size:2rem;pointer-events:auto}

.cms-admin-gallery-list{display:grid}
.cms-admin-gallery-list>article{display:grid;grid-template-columns:72px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid #d8d8d8}
.cms-admin-gallery-thumb{display:grid;place-items:center;width:72px;height:72px;overflow:hidden;background:#eee;color:#777;font-size:.5rem}
.cms-admin-gallery-thumb img{width:100%;height:100%;object-fit:cover}
.cms-admin-gallery-main small,.cms-admin-gallery-main strong,.cms-admin-gallery-main span{display:block}
.cms-admin-gallery-main small,.cms-admin-gallery-main span{color:#777;font-size:.58rem}
.cms-admin-gallery-main strong{margin:3px 0;font-size:.78rem}
.cms-gallery-character-picker{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:6px}
.cms-gallery-character-picker label{display:flex;gap:7px;align-items:center;padding:8px;border:1px solid #d8d8d8}
.cms-gallery-character-picker small{display:block;color:#777;font-size:.5rem}
.cms-gallery-images-head{display:flex;justify-content:space-between;gap:18px;align-items:center;margin-bottom:12px}
.cms-gallery-upload-button{display:inline-flex;padding:7px 10px;border:1px solid #bdbdbd;cursor:pointer;font-size:.62rem;font-weight:800}
.cms-gallery-upload-button input{display:none}
.cms-gallery-image-editor-list{display:grid;gap:10px}
.cms-gallery-image-editor{display:grid;grid-template-columns:180px minmax(0,1fr);gap:12px;padding:10px;border:1px solid #d8d8d8}
.cms-gallery-image-editor>img{width:180px;height:180px;object-fit:contain;background:#eee}
.cms-gallery-image-toolbar{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:8px}
.cms-gallery-image-toolbar button{min-width:30px;min-height:28px;border:1px solid #bdbdbd;background:transparent;cursor:pointer}

@media(max-width:900px){
.cms-gallery-card-grid{grid-template-columns:repeat(auto-fill,minmax(180px,1fr))}
}
@media(max-width:700px){
.cms-gallery-card-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 8px}
.cms-gallery-viewer-stage{grid-template-columns:34px minmax(0,1fr) 34px;gap:3px}
.cms-gallery-viewer-meta{width:calc(100% - 80px)}
.cms-gallery-grid-view{grid-template-columns:repeat(2,minmax(0,1fr))}
.cms-admin-gallery-list>article{grid-template-columns:60px minmax(0,1fr)}
.cms-admin-gallery-list .cms-actions{grid-column:1/-1}
.cms-admin-gallery-thumb{width:60px;height:60px}
.cms-gallery-image-editor{grid-template-columns:1fr}
.cms-gallery-image-editor>img{width:100%;height:220px}
.cms-gallery-images-head{display:block}
.cms-gallery-upload-button{margin-top:8px}
}


/* =========================================================
   v2.0.1 GALLERY VIEW SIZE FIX
   GALLERY個別ページの画像を作品主役サイズに修正
   ========================================================= */

/*
 * 既存サイト側の img / button / figure 指定に負けないよう、
 * GALLERY個別ページ内だけ明示的に上書き。
 */

.cms-gallery-view-page .main-content {
    width: 100%;
    max-width: none;
}

.cms-gallery-view-page .cms-gallery-post {
    width: 100%;
    max-width: none;
}

.cms-gallery-view-page .cms-gallery-post-header {
    width: min(100%, 980px);
    max-width: none;
}

.cms-gallery-view-page .cms-gallery-viewer {
    width: 100%;
    max-width: none;
}

.cms-gallery-view-page .cms-gallery-main-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
}

.cms-gallery-view-page .cms-gallery-main-button img,
.cms-gallery-view-page [data-gallery-main] {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: min(100%, 920px) !important;
    max-height: 82vh !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    object-fit: contain !important;
}

.cms-gallery-view-page .cms-gallery-viewer-stage {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.cms-gallery-view-page .cms-gallery-viewer-meta {
    width: min(calc(100% - 120px), 920px);
}

.cms-gallery-view-page .cms-gallery-thumbs {
    width: min(100%, 920px);
    margin-left: auto;
    margin-right: auto;
}

.cms-gallery-view-page .cms-gallery-thumbs img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
}


/* ---------------------------------------------------------
   PC
   --------------------------------------------------------- */

@media (min-width: 1200px) {

    .cms-gallery-view-page .cms-gallery-main-button img,
    .cms-gallery-view-page [data-gallery-main] {
        max-width: 920px !important;
        max-height: 84vh !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-stage {
        grid-template-columns:
            56px
            minmax(0, 1fr)
            56px;
        gap: 14px;
    }
}


/* ---------------------------------------------------------
   iPad / Tablet
   --------------------------------------------------------- */

@media (min-width: 768px) and (max-width: 1199px) {

    .cms-gallery-view-page .cms-gallery-post {
        padding-left: 18px;
        padding-right: 18px;
        box-sizing: border-box;
    }

    .cms-gallery-view-page .cms-gallery-main-button img,
    .cms-gallery-view-page [data-gallery-main] {
        max-width: min(100%, 820px) !important;
        max-height: 78vh !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-stage {
        width: 100%;
        grid-template-columns:
            44px
            minmax(0, 1fr)
            44px;
        gap: 8px;
    }

    .cms-gallery-view-page .cms-gallery-viewer-meta {
        width: min(calc(100% - 100px), 820px);
    }
}


/* ---------------------------------------------------------
   Smartphone
   --------------------------------------------------------- */

@media (max-width: 767px) {

    .cms-gallery-view-page .main-content {
        padding-left: 0;
        padding-right: 0;
    }

    .cms-gallery-view-page .character-back,
    .cms-gallery-view-page .cms-gallery-post-header {
        margin-left: 12px;
        margin-right: 12px;
    }

    .cms-gallery-view-page .cms-gallery-post {
        width: 100%;
        padding: 0;
    }

    .cms-gallery-view-page .cms-gallery-main-button img,
    .cms-gallery-view-page [data-gallery-main] {
        width: auto !important;
        max-width: calc(100vw - 36px) !important;
        max-height: 72vh !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-stage {
        width: 100%;
        grid-template-columns:
            30px
            minmax(0, 1fr)
            30px;
        gap: 2px;
    }

    .cms-gallery-view-page
    .cms-gallery-viewer-stage
    > button:not(.cms-gallery-main-button) {
        width: 30px;
        height: 54px;
        font-size: 1.6rem;
    }

    .cms-gallery-view-page .cms-gallery-viewer-meta {
        width: calc(100% - 72px);
        max-width: none;
    }

    .cms-gallery-view-page .cms-gallery-thumbs {
        width: calc(100% - 24px);
    }
}


/* ---------------------------------------------------------
   COMIC
   漫画は縦読み幅を保つ
   --------------------------------------------------------- */

.cms-gallery-view-page .cms-gallery-comic-view img {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 900px !important;
    max-height: none !important;
    margin: 0 auto;
    object-fit: contain !important;
}


/* ---------------------------------------------------------
   GRID
   サムネはカードサイズのまま
   --------------------------------------------------------- */

.cms-gallery-view-page .cms-gallery-grid-view img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
}


/* =========================================================
   v2.0.2 GALLERY VIEWER HARD RESET
   SINGLE / SLIDESHOW を既存サイトCSSから隔離
   ========================================================= */

.cms-gallery-view-page .cms-gallery-viewer,
.cms-gallery-view-page .cms-gallery-viewer-stage,
.cms-gallery-view-page .cms-gallery-main-button,
.cms-gallery-view-page .cms-gallery-viewer-meta {
    box-sizing: border-box !important;
}

.cms-gallery-view-page .cms-gallery-viewer {
    display: block !important;
    width: 100% !important;
    max-width: 1180px !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

.cms-gallery-view-page .cms-gallery-viewer-stage {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 920px) 52px !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 1060px !important;
    min-width: 0 !important;
    min-height: 240px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 12px !important;
}

.cms-gallery-view-page .cms-gallery-main-button {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 920px !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    overflow: visible !important;
    cursor: zoom-in !important;
}

.cms-gallery-view-page .cms-gallery-main-button > img,
.cms-gallery-view-page img[data-gallery-main] {
    display: block !important;
    width: min(100%, 920px) !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 920px !important;
    max-height: 84vh !important;
    margin: 0 auto !important;
    padding: 0 !important;
    object-fit: contain !important;
    float: none !important;
    position: static !important;
    transform: none !important;
}

.cms-gallery-view-page .cms-gallery-viewer-stage > button[data-gallery-prev],
.cms-gallery-view-page .cms-gallery-viewer-stage > button[data-gallery-next] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: static !important;
    float: none !important;
    width: 52px !important;
    height: 72px !important;
    min-width: 52px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 2rem !important;
    line-height: 1 !important;
}

.cms-gallery-view-page .cms-gallery-viewer-meta {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    width: min(100%, 920px) !important;
    max-width: 920px !important;
    min-width: 0 !important;
    margin: 10px auto 0 !important;
    padding: 0 !important;
    gap: 20px !important;
    float: none !important;
    position: static !important;
}

.cms-gallery-view-page [data-gallery-caption],
.cms-gallery-view-page [data-gallery-counter] {
    display: block !important;
    position: static !important;
    float: none !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.cms-gallery-view-page [data-gallery-counter] {
    flex: 0 0 auto !important;
    margin-left: auto !important;
}

.cms-gallery-view-page .cms-gallery-thumbs {
    display: flex !important;
    width: min(100%, 920px) !important;
    max-width: 920px !important;
    margin: 14px auto 0 !important;
    padding: 0 0 6px !important;
    gap: 7px !important;
    overflow-x: auto !important;
}


/* TABLET */
@media (min-width: 768px) and (max-width: 1199px) {
    .cms-gallery-view-page .cms-gallery-viewer-stage {
        grid-template-columns: 44px minmax(0, 820px) 44px !important;
        max-width: 930px !important;
        gap: 8px !important;
    }

    .cms-gallery-view-page .cms-gallery-main-button {
        max-width: 820px !important;
    }

    .cms-gallery-view-page .cms-gallery-main-button > img,
    .cms-gallery-view-page img[data-gallery-main] {
        width: min(100%, 820px) !important;
        max-width: 820px !important;
        max-height: 78vh !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-meta,
    .cms-gallery-view-page .cms-gallery-thumbs {
        width: min(100%, 820px) !important;
        max-width: 820px !important;
    }
}


/* SMARTPHONE */
@media (max-width: 767px) {
    .cms-gallery-view-page .cms-gallery-viewer {
        width: 100% !important;
        padding: 0 8px !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-stage {
        grid-template-columns: 28px minmax(0, 1fr) 28px !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 160px !important;
        gap: 2px !important;
    }

    .cms-gallery-view-page .cms-gallery-main-button {
        width: 100% !important;
        max-width: none !important;
    }

    .cms-gallery-view-page .cms-gallery-main-button > img,
    .cms-gallery-view-page img[data-gallery-main] {
        width: 100% !important;
        max-width: calc(100vw - 76px) !important;
        max-height: 72vh !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-stage > button[data-gallery-prev],
    .cms-gallery-view-page .cms-gallery-viewer-stage > button[data-gallery-next] {
        width: 28px !important;
        min-width: 28px !important;
        height: 54px !important;
        font-size: 1.5rem !important;
    }

    .cms-gallery-view-page .cms-gallery-viewer-meta {
        width: calc(100% - 64px) !important;
        max-width: none !important;
        margin-top: 7px !important;
    }

    .cms-gallery-view-page .cms-gallery-thumbs {
        width: calc(100% - 20px) !important;
        max-width: none !important;
    }
}


/* =========================================================
   v2.0.3 SINGLE IMAGE GRID FIX
   ========================================================= */

/*
 * MULTI:
 *   ← | IMAGE | →
 *
 * SINGLE:
 *   IMAGE
 */
.cms-gallery-view-page
.cms-gallery-viewer.is-single
.cms-gallery-viewer-stage {
    display: grid !important;
    grid-template-columns: minmax(0, 920px) !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 1060px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    gap: 0 !important;
}

.cms-gallery-view-page
.cms-gallery-viewer.is-single
.cms-gallery-main-button {
    grid-column: 1 !important;
    width: 100% !important;
    max-width: 920px !important;
    justify-self: center !important;
}

.cms-gallery-view-page
.cms-gallery-viewer.is-single
.cms-gallery-main-button > img,
.cms-gallery-view-page
.cms-gallery-viewer.is-single
img[data-gallery-main] {
    display: block !important;
    width: min(100%, 920px) !important;
    max-width: 920px !important;
    height: auto !important;
    max-height: 84vh !important;
    margin: 0 auto !important;
    object-fit: contain !important;
}

.cms-gallery-view-page
.cms-gallery-viewer.is-single
.cms-gallery-viewer-meta {
    width: min(100%, 920px) !important;
    max-width: 920px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}


/* iPad */
@media (min-width: 768px) and (max-width: 1199px) {
    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-viewer-stage {
        grid-template-columns: minmax(0, 820px) !important;
        max-width: 900px !important;
    }

    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-main-button,
    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-main-button > img,
    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    img[data-gallery-main],
    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-viewer-meta {
        max-width: 820px !important;
    }
}


/* Smartphone */
@media (max-width: 767px) {
    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-viewer-stage {
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        max-width: none !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box !important;
    }

    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-main-button {
        width: 100% !important;
        max-width: none !important;
    }

    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-main-button > img,
    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    img[data-gallery-main] {
        width: 100% !important;
        max-width: calc(100vw - 24px) !important;
        max-height: 72vh !important;
    }

    .cms-gallery-view-page
    .cms-gallery-viewer.is-single
    .cms-gallery-viewer-meta {
        width: calc(100% - 24px) !important;
        max-width: none !important;
    }
}


/* =========================================================
   v2.1 MUSIC / CASSETTE PLAYER
   ========================================================= */

.cms-music-page .main-content {
    width: 100%;
    max-width: none;
}

.cms-music-section {
    width: 100%;
}

.cms-music-album-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 26px;
}

.cms-music-album-nav a {
    padding: 6px 9px;
    border: 1px solid var(--line);
    color: var(--muted);
    text-decoration: none;
    font-size: .62rem;
    font-weight: 800;
}

.cms-music-album-nav a.is-active,
.cms-music-album-nav a:hover {
    background: var(--ink);
    color: var(--surface);
}

.cms-cassette-player {
    width: 100%;
    margin-top: 28px;
}

.cms-cassette-layout {
    display: grid;
    grid-template-columns:
        minmax(360px, 1fr)
        minmax(300px, .8fr);
    gap: 44px;
    align-items: center;
}


/* ---------- CASSETTE BODY ---------- */

.cms-cassette-shell {
    position: relative;
    width: 100%;
    max-width: 720px;
    aspect-ratio: 1.65 / 1;
    margin: 0 auto;
    padding: 28px 34px 34px;
    box-sizing: border-box;
    border: 2px solid var(--ink);
    border-radius: 18px;
    background:
        linear-gradient(
            to bottom,
            #eee 0 14%,
            #f6f6f6 14% 82%,
            #e9e9e9 82% 100%
        );
    box-shadow:
        inset 0 0 0 7px #f7f7f7,
        inset 0 0 0 8px #c8c8c8;
}

.cms-cassette-shell::before,
.cms-cassette-shell::after {
    content: "";
    position: absolute;
    top: 12px;
    width: 9px;
    height: 9px;
    border: 1px solid var(--ink);
    border-radius: 50%;
}

.cms-cassette-shell::before {
    left: 14px;
}

.cms-cassette-shell::after {
    right: 14px;
}

.cms-cassette-top {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 18px;
    padding: 0 8px;
    font-size: .68rem;
    letter-spacing: .1em;
}

.cms-cassette-side-label strong {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: 5px;
    border: 1px solid var(--ink);
    font-size: .8rem;
}

.cms-cassette-album {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.cms-cassette-paper {
    padding: 18px 26px 16px;
    border: 1px solid var(--ink);
    background: #f8f7f2;
}

.cms-cassette-track-title {
    min-height: 1.4em;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-family:
        "Yu Mincho",
        "Hiragino Mincho ProN",
        serif;
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 700;
    letter-spacing: .06em;
}

.cms-cassette-window {
    display: grid;
    grid-template-columns:
        88px
        minmax(80px, 1fr)
        88px;
    gap: 18px;
    align-items: center;
    width: min(100%, 470px);
    margin: 0 auto 18px;
    padding: 14px 20px;
    border: 2px solid var(--ink);
    background: #252525;
}

.cms-cassette-reel {
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #f2f2f2;
}

.cms-cassette-reel-inner {
    position: relative;
    width: 70%;
    height: 70%;
    border: 7px dotted #222;
    border-radius: 50%;
    box-sizing: border-box;
}

.cms-cassette-reel-inner::after {
    content: "";
    position: absolute;
    inset: 27%;
    border-radius: 50%;
    background: #222;
}

.cms-cassette-tape-window {
    position: relative;
    display: block;
    height: 52px;
    overflow: hidden;
    border: 1px solid #777;
    background: #111;
}

.cms-cassette-tape-window span {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 4px;
    transform: translateY(-50%);
    background: #555;
}

.cms-cassette-paper-meta {
    display: grid;
    grid-template-columns:
        auto
        1fr
        auto;
    gap: 14px;
    align-items: center;
    color: var(--muted);
    font-size: .6rem;
    letter-spacing: .05em;
}

.cms-cassette-paper-meta > span:nth-child(2) {
    text-align: center;
}

.cms-cassette-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    width: 62%;
    margin: 24px auto 0;
    padding: 13px 20px 9px;
    border: 1px solid var(--ink);
    border-bottom: 0;
    clip-path:
        polygon(
            8% 0,
            92% 0,
            100% 100%,
            0 100%
        );
}

.cms-cassette-bottom span {
    width: 12px;
    height: 12px;
    margin: auto;
    border: 1px solid var(--ink);
    border-radius: 50%;
}


/* ---------- REEL ANIMATION ---------- */

@keyframes cms-cassette-spin {
    to {
        transform: rotate(360deg);
    }
}

.cms-cassette-player.is-playing
.cms-cassette-reel-inner {
    animation:
        cms-cassette-spin
        1.5s linear infinite;
}


/* ---------- INFO / CONTROLS ---------- */

.cms-cassette-info {
    min-width: 0;
}

.cms-cassette-info h3 {
    margin: 8px 0 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    font-size: clamp(1.15rem, 2vw, 1.7rem);
}

.cms-cassette-character {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.cms-cassette-memo {
    min-height: 3.5em;
    margin: 0 0 22px;
    color: var(--ink-soft);
    font-size: .74rem;
    line-height: 1.85;
}

.cms-cassette-progress-row {
    display: grid;
    grid-template-columns:
        46px
        minmax(0, 1fr)
        46px;
    gap: 9px;
    align-items: center;
    margin: 0 0 18px;
    color: var(--muted);
    font-size: .58rem;
}

.cms-cassette-progress-row input,
.cms-cassette-volume input {
    width: 100%;
    accent-color: #222;
}

.cms-cassette-progress-row > span:last-child {
    text-align: right;
}

.cms-cassette-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

.cms-cassette-controls > button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--ink);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-size: .72rem;
}

.cms-cassette-controls
.cms-cassette-play {
    width: 58px;
    height: 58px;
    font-size: 1.1rem;
}

.cms-cassette-volume {
    display: grid;
    grid-template-columns:
        auto
        92px;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    color: var(--muted);
    font-size: .55rem;
    font-weight: 800;
}

.cms-cassette-side-switch {
    display: flex;
    gap: 6px;
}

.cms-cassette-side-switch button {
    padding: 6px 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: .58rem;
    font-weight: 800;
}

.cms-cassette-side-switch button.is-active {
    background: var(--ink);
    color: var(--surface);
}


/* ---------- TRACK LIST ---------- */

.cms-music-track-list {
    margin-top: 42px;
    border-top: 1px solid var(--line);
}

.cms-music-track-row {
    display: grid;
    grid-template-columns:
        60px
        minmax(0, 1fr)
        70px
        34px;
    gap: 16px;
    align-items: center;
    width: 100%;
    padding: 14px 6px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.cms-music-track-row:hover,
.cms-music-track-row.is-active {
    background: rgba(0,0,0,.035);
}

.cms-music-track-number,
.cms-music-track-side {
    color: var(--muted);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.cms-music-track-main strong,
.cms-music-track-main small {
    display: block;
}

.cms-music-track-main strong {
    margin-bottom: 3px;
    font-size: .78rem;
}

.cms-music-track-main small {
    color: var(--muted);
    font-size: .56rem;
}


/* ---------- ADMIN ---------- */

.cms-admin-music-list > article {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #d8d8d8;
}

.cms-admin-music-list small,
.cms-admin-music-list strong,
.cms-admin-music-list span {
    display: block;
}

.cms-admin-music-list small,
.cms-admin-music-list span {
    color: #777;
    font-size: .58rem;
}

.cms-admin-music-list strong {
    margin: 3px 0;
    font-size: .8rem;
}

.cms-music-track-editor-list {
    display: grid;
    gap: 10px;
}

.cms-music-track-editor,
.cms-music-new-track {
    padding: 12px;
    border: 1px solid #d8d8d8;
    background: #fafafa;
}

.cms-music-track-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e1e1e1;
}

.cms-music-track-toolbar button {
    min-width: 30px;
    min-height: 28px;
    border: 1px solid #bdbdbd;
    background: transparent;
    cursor: pointer;
}

.cms-music-track-flags {
    display: flex;
    gap: 20px;
}

.cms-music-audio-path {
    color: #777;
    font-size: .58rem;
}

.cms-music-new-track {
    margin-top: 18px;
}

.cms-music-new-track h3 {
    margin-top: 0;
}


/* ---------- TABLET ---------- */

@media (min-width: 768px) and (max-width: 1100px) {
    .cms-cassette-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .cms-cassette-info {
        width: min(100%, 720px);
        margin: 0 auto;
    }
}


/* ---------- MOBILE ---------- */

@media (max-width: 767px) {
    .cms-cassette-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .cms-cassette-shell {
        padding: 22px 20px 26px;
        border-radius: 13px;
    }

    .cms-cassette-top {
        margin-bottom: 11px;
    }

    .cms-cassette-paper {
        padding: 13px 14px;
    }

    .cms-cassette-window {
        grid-template-columns:
            58px
            minmax(48px, 1fr)
            58px;
        gap: 9px;
        padding: 10px 12px;
    }

    .cms-cassette-paper-meta {
        grid-template-columns: 1fr 1fr;
    }

    .cms-cassette-paper-meta
    > span:nth-child(2) {
        text-align: right;
    }

    .cms-cassette-paper-meta
    > span:nth-child(3) {
        grid-column: 1 / -1;
    }

    .cms-cassette-bottom {
        width: 70%;
        margin-top: 15px;
    }

    .cms-cassette-controls {
        flex-wrap: wrap;
    }

    .cms-cassette-volume {
        flex-basis: 100%;
        grid-template-columns: auto 1fr;
        margin: 4px 0 0;
    }

    .cms-music-track-row {
        grid-template-columns:
            48px
            minmax(0, 1fr)
            28px;
        gap: 9px;
    }

    .cms-music-track-side {
        display: none;
    }

    .cms-admin-music-list > article {
        align-items: flex-start;
    }
}


/* =========================================================
   v2.2 MOVIES CMS
   ========================================================= */

.cms-movies-page .main-content {
    width: 100%;
    max-width: none;
}

.cms-movie-category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: 30px;
}

.cms-movies-page
.movie-spoiler-accordion {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.cms-movies-page
.movie-spoiler-accordion
> summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 18px 4px;
    cursor: pointer;
}

.cms-movies-page
.movie-spoiler-accordion
> summary::-webkit-details-marker {
    display: none;
}

.cms-movies-page
.movie-spoiler-summary-main {
    min-width: 0;
}

.cms-movies-page
.movie-spoiler-summary-main strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
}

.cms-movies-page
.movie-spoiler-summary-main small {
    display: block;
    color: var(--muted);
    font-size: .68rem;
    line-height: 1.7;
}

.cms-movies-page .movie-spoiler-toggle::before {
    content: "＋ VIEW";
}

.cms-movies-page
.movie-spoiler-accordion[open]
.movie-spoiler-toggle::before {
    content: "－ CLOSE";
}

.cms-movies-page .movie-spoiler-inner {
    padding: 8px 0 26px;
}

.cms-movies-page .movie-spoiler-warning {
    margin: 0 0 20px;
    padding: 11px 0 11px 14px;
    border-left: 2px solid var(--ink);
    color: var(--ink-soft);
    font-size: .74rem;
    line-height: 1.8;
}

.cms-movies-page .movie-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(240px,1fr)
        );
    gap: 28px 18px;
}

.cms-movies-page .movie-item {
    min-width: 0;
}

.cms-movies-page .movie-poster {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface-alt);
}

.cms-movies-page .movie-poster img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
}

.cms-movies-page .movie-poster.thumb-error::before {
    content: "THUMBNAIL";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: .6rem;
}

.cms-movies-page .play-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0);
    transition: background .18s ease;
}

.cms-movies-page .play-overlay span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid #fff;
    border-radius: 50%;
    background: rgba(0,0,0,.35);
    color: #fff;
}

.cms-movies-page .movie-poster:hover .play-overlay {
    background: rgba(0,0,0,.12);
}

.cms-movies-page .movie-info {
    padding-top: 9px;
}

.cms-movies-page .movie-badge {
    display: inline-block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: .55rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.cms-movies-page .movie-info h3 {
    margin: 0 0 5px;
    font-size: .78rem;
    line-height: 1.55;
}

.cms-movies-page .movie-description,
.cms-movie-characters {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: .62rem;
    line-height: 1.65;
}

.cms-movies-page .movie-date {
    color: var(--muted);
    font-size: .55rem;
}


/* admin */

.cms-movie-admin-category-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cms-admin-movie-list {
    display: grid;
}

.cms-admin-movie-list > article {
    display: grid;
    grid-template-columns:
        128px
        minmax(0,1fr)
        auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #d8d8d8;
}

.cms-admin-movie-thumb {
    display: grid;
    place-items: center;
    width: 128px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #eee;
    color: #777;
    font-size: .5rem;
}

.cms-admin-movie-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cms-admin-movie-main small,
.cms-admin-movie-main strong,
.cms-admin-movie-main span {
    display: block;
}

.cms-admin-movie-main small,
.cms-admin-movie-main span {
    color: #777;
    font-size: .57rem;
}

.cms-admin-movie-main strong {
    margin: 3px 0;
    font-size: .75rem;
}

.cms-movie-thumb-preview {
    width: min(100%,420px);
    margin-top: 10px;
}

.cms-movie-thumb-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #eee;
}

@media (max-width: 700px) {
    .cms-movies-page .movie-grid {
        grid-template-columns:
            repeat(2,minmax(0,1fr));
        gap: 18px 8px;
    }

    .cms-admin-movie-list > article {
        grid-template-columns:
            90px
            minmax(0,1fr);
    }

    .cms-admin-movie-thumb {
        width: 90px;
    }

    .cms-admin-movie-list .cms-actions {
        grid-column: 1 / -1;
    }

    .cms-movie-admin-category-head {
        display: block;
    }
}

@media (max-width: 420px) {
    .cms-movies-page .movie-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   v2.3 HOME CMS
   ========================================================= */

.cms-home-page .main-content {
    width: 100%;
    max-width: none;
}

.cms-home-page .info-section,
.cms-home-page .about-section {
    margin-bottom: 54px;
}

.cms-home-update-category {
    display: inline-block;
    margin: 0 7px;
    color: var(--muted);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.cms-home-updates .update-list li {
    line-height: 1.8;
}

.cms-home-updates .update-list a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.cms-home-about .about-container {
    display: grid;
    grid-template-columns:
        minmax(140px, 220px)
        minmax(0, 1fr);
    gap: clamp(28px, 5vw, 68px);
    align-items: start;
}

.cms-home-about .about-avatar {
    width: 100%;
    max-width: 220px;
}

.cms-home-about .about-avatar img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.cms-home-profile-body {
    max-width: 850px;
    line-height: 2;
}

.cms-home-profile-notice {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .7rem;
}

.cms-home-page .profile-links {
    margin-top: 24px;
}

.cms-home-page .link-group + .link-group {
    margin-top: 15px;
}

.cms-home-page .link-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.cms-home-page .link-items a {
    display: inline-block;
    padding: 3px 0;
}

.cms-home-page .contact-links {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(220px, 1fr)
        );
    gap: 10px;
}

.cms-home-page .contact-btn {
    min-height: 84px;
}


/* ---------- ADMIN ---------- */

.cms-home-section-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 14px 0 20px;
}

.cms-home-editor-list {
    display: grid;
    gap: 10px;
}

.cms-home-editor-list > article,
.cms-home-add-box {
    padding: 12px;
    border: 1px solid #d8d8d8;
    background: #fafafa;
}

.cms-home-editor-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dedede;
}

.cms-home-editor-toolbar button {
    min-width: 30px;
    min-height: 28px;
    border: 1px solid #bdbdbd;
    background: transparent;
    cursor: pointer;
}

.cms-home-row-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}

.cms-home-add-box {
    margin-top: 18px;
}

.cms-home-add-box h3 {
    margin-top: 0;
}


/* ---------- TABLET ---------- */

@media (min-width: 768px) and (max-width: 1000px) {
    .cms-home-about .about-container {
        grid-template-columns:
            170px
            minmax(0, 1fr);
        gap: 32px;
    }
}


/* ---------- MOBILE ---------- */

@media (max-width: 767px) {
    .cms-home-page .info-section,
    .cms-home-page .about-section {
        margin-bottom: 40px;
    }

    .cms-home-about .about-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .cms-home-about .about-avatar {
        max-width: 150px;
    }

    .cms-home-page .contact-links {
        grid-template-columns: 1fr;
    }

    .cms-home-update-category {
        display: block;
        margin: 2px 0;
    }
}


/* =========================================================
   v2.3.1 PROFILE CARD
   ========================================================= */

.cms-home-about .cms-profile-card {
    padding: clamp(22px, 3.5vw, 38px);
    border: 1px solid var(--line);
    background: rgba(255,255,255,.34);
}

.cms-home-about .about-avatar {
    max-width: 160px;
}

.cms-home-about .about-avatar img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--line);
}

.cms-profile-heading {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.cms-profile-heading .profile-name {
    margin: 0 0 5px;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    letter-spacing: .05em;
}

.cms-profile-role {
    margin: 0;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.cms-profile-tagline {
    margin: 8px 0 0;
    font-size: .76rem;
}

.cms-profile-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    max-width: 330px;
}

.cms-profile-tags span {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid var(--line);
    font-size: .54rem;
    font-weight: 800;
    letter-spacing: .08em;
    white-space: nowrap;
}

.cms-home-links {
    margin-top: 18px !important;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.cms-home-links .link-group {
    display: grid;
    grid-template-columns: 88px minmax(0,1fr);
    align-items: start;
}

.cms-home-links .link-label {
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .08em;
}

@media (max-width: 767px) {
    .cms-home-about .cms-profile-card {
        padding: 18px;
    }

    .cms-home-about .about-avatar {
        max-width: 120px;
    }

    .cms-profile-heading {
        display: block;
    }

    .cms-profile-tags {
        justify-content: flex-start;
        max-width: none;
        margin-top: 15px;
    }

    .cms-home-links .link-group {
        grid-template-columns: 1fr;
        gap: 7px;
    }
}


/* =========================================================
   v2.4 SESSION BOX
   ========================================================= */
.cms-session-admin-list,
.cms-session-edit-grid { display:grid; gap:12px; }
.cms-session-admin-list > article,
.cms-session-edit-grid > article {
    border:1px solid var(--line,#ddd);
    padding:14px;
    background:#fff;
}
.cms-session-admin-list > article {
    display:flex; justify-content:space-between; gap:20px; align-items:center;
}
.cms-session-admin-actions { display:flex; gap:7px; align-items:center; flex-wrap:wrap; }

.cms-session-public { background:#f7f7f5; }
.cms-session-box-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
    gap:14px;
}
.cms-session-box-card {
    color:inherit; text-decoration:none; border:1px solid #d9d9d4;
    background:#fff; min-height:180px; display:grid;
}
.cms-session-box-card img { width:100%; aspect-ratio:16/9; object-fit:cover; }
.cms-session-box-card > div { padding:18px; }
.cms-session-box-card h2 { margin:.2em 0; }

.cms-session-lock {
    width:min(520px,calc(100% - 32px)); margin:15vh auto; padding:30px;
    border:1px solid #d8d8d3; background:#fff;
}
.cms-session-lock form { display:flex; gap:8px; margin-top:20px; }
.cms-session-lock input { flex:1; min-width:0; padding:12px; border:1px solid #aaa; }
.cms-session-lock button { padding:10px 15px; border:1px solid #111; background:#111; color:#fff; }
.cms-session-lock-error { font-weight:700; }

.cms-session-hero {
    padding:clamp(34px,6vw,80px) 0 34px;
    border-bottom:1px solid #d7d7d2;
}
.cms-session-hero h1 { margin:.15em 0; font-size:clamp(2rem,6vw,5rem); }
.cms-session-scenario { font-size:1rem; font-weight:700; }
.cms-session-section { padding:36px 0; border-bottom:1px solid #d7d7d2; }
.cms-session-members {
    display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:10px;
}
.cms-session-member {
    color:inherit; text-decoration:none; display:flex; align-items:center; gap:12px;
    border:1px solid #d7d7d2; background:#fff; padding:10px;
}
.cms-session-member img,
.cms-session-member-placeholder {
    width:58px; height:58px; object-fit:cover; border-radius:50%; flex:0 0 auto;
}
.cms-session-member-placeholder {
    display:grid; place-items:center; border:1px solid #ccc; font-size:.65rem;
}
.cms-session-member small,
.cms-session-member strong { display:block; }

.cms-session-resource-grid {
    display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:12px;
}
.cms-session-resource {
    border:1px solid #d7d7d2; background:#fff; padding:18px;
}
.cms-session-resource h3 { margin:.2em 0 .7em; }
.cms-session-meta { font-size:.7rem; opacity:.7; }
.cms-session-open {
    display:inline-block; margin-top:10px; color:inherit; font-weight:800;
    text-underline-offset:4px;
}
.cms-session-video { position:relative; aspect-ratio:16/9; margin:12px 0; }
.cms-session-video iframe { position:absolute; inset:0; width:100%; height:100%; border:0; }

@media(max-width:767px){
    .cms-session-admin-list > article { display:block; }
    .cms-session-admin-actions { margin-top:12px; }
    .cms-session-lock form { display:block; }
    .cms-session-lock button { width:100%; margin-top:8px; }
}


/* =========================================================
   v2.5 SESSION LOG MAKER - ADMIN ONLY
   ========================================================= */

.cms-log-maker-list {
    display:grid;
    gap:10px;
}

.cms-log-maker-list > article {
    display:flex;
    justify-content:space-between;
    gap:20px;
    align-items:center;
    padding:14px;
    border:1px solid #d8d8d8;
    background:#fafafa;
}

.cms-log-maker-list h2 {
    margin:3px 0;
    font-size:.9rem;
}

.cms-log-section-head {
    display:flex;
    justify-content:space-between;
    gap:18px;
    align-items:flex-start;
    margin-bottom:12px;
}

.cms-log-character-list,
.cms-log-block-list {
    display:grid;
    gap:10px;
}

.cms-log-character-card,
.cms-log-block-card {
    padding:12px;
    border:1px solid #d8d8d8;
    background:#fafafa;
}

.cms-log-block-card[data-type="episode"] { border-left:4px solid #333; }
.cms-log-block-card[data-type="chat"] { border-left:4px solid #777; }
.cms-log-block-card[data-type="still"] { border-left:4px solid #aaa; }

.cms-log-editor-toolbar {
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:center;
    margin-bottom:10px;
    padding-bottom:7px;
    border-bottom:1px solid #dedede;
}

.cms-log-editor-toolbar button,
.cms-log-block-buttons button {
    min-height:30px;
    padding:5px 9px;
    border:1px solid #aaa;
    background:#fff;
    cursor:pointer;
    font-size:.58rem;
    font-weight:800;
}

.cms-log-block-buttons {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-bottom:14px;
    position:sticky;
    top:0;
    z-index:5;
    padding:8px 0;
    background:#f7f7f7;
}

@media(max-width:767px){
    .cms-log-maker-list > article,
    .cms-log-section-head,
    .cms-log-editor-toolbar {
        display:block;
    }

    .cms-log-maker-list .cms-actions,
    .cms-log-editor-toolbar > div {
        margin-top:9px;
    }
}


/* =========================================================
   v2.5.2 LOG-SCOPED IMAGE LIBRARY
   ========================================================= */

.cms-log-asset-upload {
    display:grid;
    grid-template-columns:1fr 1fr auto;
    gap:10px;
    align-items:end;
    margin-bottom:16px;
}

.cms-log-asset-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
    gap:10px;
}

.cms-log-asset-grid > article {
    min-width:0;
    padding:8px;
    border:1px solid #d8d8d8;
    background:#fafafa;
}

.cms-log-asset-grid img {
    display:block;
    width:100%;
    aspect-ratio:1 / 1;
    object-fit:cover;
    margin-bottom:7px;
    background:#eee;
}

.cms-log-asset-grid strong,
.cms-log-asset-grid small {
    display:block;
    overflow-wrap:anywhere;
}

.cms-log-asset-grid small {
    opacity:.55;
    font-size:.58rem;
    margin:4px 0 8px;
}

.cms-log-asset-grid button {
    border:0;
    background:transparent;
    padding:0;
    text-decoration:underline;
    cursor:pointer;
    font-size:.58rem;
}

@media(max-width:767px){
    .cms-log-asset-upload {
        grid-template-columns:1fr;
    }
}

/* v2.5.3 LOG MAKER FIX */
.cms-log-editor-form.is-log-ready::before{
    content:"LOG EDITOR READY";
    display:block;
    margin:0 0 10px;
    font-size:.58rem;
    font-weight:800;
    letter-spacing:.12em;
    opacity:.45;
}


/* v2.5.4 LOG MAKER INLINE JS DIAGNOSTICS */
.cms-log-data-status,
.cms-log-js-status {
    margin:0 0 10px;
    padding:7px 9px;
    border:1px solid #bbb;
    background:#fafafa;
    font-size:.62rem;
    letter-spacing:.05em;
}

.cms-log-js-status {
    border-style:dashed;
    opacity:.65;
}

.cms-log-js-status.is-ready {
    border-style:solid;
    opacity:1;
}

.cms-log-js-status.is-ready::before {
    content:"● ";
}


/* v2.5.5 LOG MAKER robust renderer */
.cms-log-js-status.is-error{
    border-color:#8d2a2a;
    background:#fff4f4;
    opacity:1;
    color:#8d2a2a;
    font-weight:700;
}

.cms-log-block-list:empty::after,
.cms-log-character-list:empty::after{
    content:"NO RENDERED ITEMS";
    display:block;
    padding:10px;
    border:1px dashed #bbb;
    font-size:.62rem;
    opacity:.55;
}


/* v2.5.8 LOG BLOCK ACCORDION */
.cms-log-block-divider{
    width:1px;
    align-self:stretch;
    background:#bbb;
    margin:0 2px;
}

.cms-log-block-card{
    padding:0;
    overflow:hidden;
}

.cms-log-editor-toolbar{
    margin:0;
    padding:7px 8px;
    border-bottom:1px solid #dedede;
    background:#f7f7f7;
}

.cms-log-block-toggle{
    min-width:0;
    flex:1 1 auto;
    display:flex;
    align-items:center;
    gap:7px;
    padding:0;
    border:0;
    background:transparent;
    text-align:left;
    cursor:pointer;
}

.cms-log-block-toggle strong{
    flex:0 0 auto;
}

.cms-log-block-toggle small{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    opacity:.55;
    font-size:.58rem;
}

.cms-log-block-arrow{
    width:1.2em;
    flex:0 0 1.2em;
    text-align:center;
    font-size:.7rem;
}

.cms-log-block-tools{
    display:flex;
    flex:0 0 auto;
    gap:4px;
}

.cms-log-block-body{
    padding:12px;
}

.cms-log-block-card.is-collapsed .cms-log-editor-toolbar{
    border-bottom:0;
}

.cms-log-block-card.is-collapsed{
    background:#f7f7f7;
}

@media(max-width:767px){
    .cms-log-editor-toolbar{
        display:flex;
    }

    .cms-log-block-tools{
        margin-top:0;
    }

    .cms-log-block-toggle small{
        display:none;
    }
}


/* =========================================================
   v2.6 SESSION BOX IMAGE UPLOAD
   ========================================================= */

.cms-session-upload-preview{
    display:flex;
    align-items:center;
    gap:10px;
    margin:7px 0 12px;
    padding:7px;
    border:1px solid #d8d8d8;
    background:#fafafa;
}

.cms-session-upload-preview img{
    width:120px;
    height:76px;
    object-fit:cover;
    display:block;
    background:#eee;
}

.cms-session-upload-preview.is-icon img{
    width:64px;
    height:64px;
    border-radius:50%;
}

.cms-session-upload-preview small{
    font-size:.58rem;
    opacity:.55;
    letter-spacing:.08em;
}

.cms-session-resource-image{
    margin:10px 0 12px;
}

.cms-session-resource-image img{
    display:block;
    width:100%;
    max-height:340px;
    object-fit:contain;
    background:#f5f5f5;
    border:1px solid #e4e4e4;
}


/* =========================================================
   v2.7 SOFT MONO UI
   落ち着いたモノクロ + 灰色で視認性を上げる共通UI
   ========================================================= */

:root{
    --soft-bg:#f3f3f4;
    --soft-surface:#ffffff;
    --soft-surface-2:#f8f8f8;
    --soft-surface-3:#ececee;
    --soft-line:#d7d7da;
    --soft-line-strong:#bdbdc2;
    --soft-text:#242428;
    --soft-muted:#707078;
    --soft-dark:#343438;
    --soft-shadow:0 5px 18px rgba(0,0,0,.045);
    --soft-radius:12px;
}

body{
    background:var(--soft-bg);
    color:var(--soft-text);
}

.cms-panel,
.cms-session-box-card,
.cms-session-resource,
.cms-session-member,
.cms-log-block-card,
.cms-log-character-card{
    border-color:var(--soft-line);
    border-radius:var(--soft-radius);
    background:var(--soft-surface);
    box-shadow:var(--soft-shadow);
}

.cms-panel{
    padding:22px;
}

.cms-admin-title{
    padding:10px 0 18px;
}

.cms-admin-title h1,
.cms-panel h2,
.cms-session-section h2{
    color:var(--soft-text);
}

.cms-kicker,
.cms-help,
.cms-session-meta,
.cms-empty{
    color:var(--soft-muted);
}

.cms-button,
.cms-log-block-buttons button,
.cms-log-editor-toolbar button,
.cms-session-open,
.cms-session-lock button{
    border-radius:999px;
    border:1px solid var(--soft-dark);
    background:var(--soft-dark);
    color:#fff;
    transition:
        background .16s ease,
        color .16s ease,
        border-color .16s ease,
        transform .16s ease;
}

.cms-button:hover,
.cms-log-block-buttons button:hover,
.cms-log-editor-toolbar button:hover,
.cms-session-open:hover,
.cms-session-lock button:hover{
    transform:translateY(-1px);
    background:#1f1f22;
}

.cms-button.ghost,
.cms-log-editor-toolbar button{
    background:var(--soft-surface);
    color:var(--soft-text);
    border-color:var(--soft-line-strong);
}

.cms-button.ghost:hover,
.cms-log-editor-toolbar button:hover{
    background:var(--soft-surface-3);
}

.cms-form input,
.cms-form textarea,
.cms-form select,
.cms-session-lock input{
    border:1px solid var(--soft-line);
    border-radius:8px;
    background:var(--soft-surface-2);
    color:var(--soft-text);
}

.cms-form input:focus,
.cms-form textarea:focus,
.cms-form select:focus,
.cms-session-lock input:focus{
    outline:2px solid #a9a9ae;
    outline-offset:1px;
    border-color:#9a9aa0;
    background:#fff;
}

.cms-log-block-card{
    margin-bottom:10px;
}

.cms-log-editor-toolbar{
    background:var(--soft-surface-2);
    border-color:var(--soft-line);
    border-radius:var(--soft-radius) var(--soft-radius) 0 0;
}

.cms-log-block-card.is-collapsed .cms-log-editor-toolbar{
    border-radius:var(--soft-radius);
}

.cms-log-block-toggle small{
    color:var(--soft-muted);
    opacity:1;
}

.cms-log-block-body{
    background:var(--soft-surface);
    border-radius:0 0 var(--soft-radius) var(--soft-radius);
}

.cms-session-box-grid{
    gap:18px;
}

.cms-session-box-card{
    overflow:hidden;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
}

.cms-session-box-card:hover{
    transform:translateY(-2px);
    border-color:var(--soft-line-strong);
    box-shadow:0 9px 24px rgba(0,0,0,.07);
}

.cms-session-box-card > img{
    background:var(--soft-surface-3);
}

.cms-session-member-placeholder{
    background:var(--soft-surface-3);
    color:var(--soft-muted);
}

.cms-session-resource-image img,
.cms-session-upload-preview{
    background:var(--soft-surface-2);
    border-color:var(--soft-line);
}

.cms-session-lock{
    background:var(--soft-surface);
    border:1px solid var(--soft-line);
    border-radius:16px;
    box-shadow:var(--soft-shadow);
}

.cms-notice{
    border-radius:10px;
}

.cms-log-data-status,
.cms-log-js-status{
    border-radius:9px;
}

@media(max-width:767px){
    .cms-panel{
        padding:16px;
        border-radius:10px;
    }

    .cms-session-box-grid{
        gap:12px;
    }
}


/* =========================================================
   v2.9 SCENARIO LIBRARY
   ========================================================= */

.cms-scenario-filter{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin:0 0 22px;
}

.cms-scenario-filter a{
    display:inline-flex;
    align-items:center;
    min-height:30px;
    padding:4px 11px;
    border:1px solid #cfcfcf;
    border-radius:999px;
    background:#f7f7f7;
    color:#444;
    text-decoration:none;
    font-size:.76rem;
}

.cms-scenario-filter a:hover,
.cms-scenario-filter a.is-active{
    background:#383838;
    border-color:#383838;
    color:#fff;
}

.cms-scenario-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:16px;
}

.cms-scenario-card{
    min-width:0;
    overflow:hidden;
    border:1px solid #d2d2d2;
    border-radius:10px;
    background:#fafafa;
}

.cms-scenario-card-link{
    display:block;
    height:100%;
    color:inherit;
    text-decoration:none;
}

.cms-scenario-card-image{
    position:relative;
    aspect-ratio:16/10;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#ececec;
    color:#888;
    font-size:.72rem;
}

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

.cms-scenario-card-badges{
    position:absolute;
    left:8px;
    bottom:8px;
    display:flex;
    flex-wrap:wrap;
    gap:5px;
}

.cms-scenario-card-badges span,
.cms-scenario-state-tags span,
.cms-scenario-tags span{
    display:inline-flex;
    align-items:center;
    min-height:22px;
    padding:2px 8px;
    border:1px solid #bdbdbd;
    border-radius:999px;
    background:rgba(250,250,250,.96);
    color:#383838;
    font-size:.68rem;
    line-height:1.25;
}

.cms-scenario-card-copy{
    padding:13px 14px 15px;
}

.cms-scenario-card-copy h3{
    margin:2px 0 5px;
    font-size:1rem;
    line-height:1.5;
}

.cms-scenario-author{
    margin:0;
    color:#777;
    font-size:.75rem;
}

.cms-scenario-mini-meta{
    display:flex;
    flex-wrap:wrap;
    gap:5px 12px;
    margin:9px 0 0;
    color:#555;
    font-size:.76rem;
}

.cms-scenario-tags{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
    margin-top:9px;
}

.cms-scenario-card:hover{
    border-color:#999;
}

.cms-scenario-detail{
    max-width:900px;
    margin:0 auto;
}

.cms-scenario-detail-head{
    display:grid;
    grid-template-columns:minmax(220px,340px) minmax(0,1fr);
    gap:28px;
    align-items:start;
    margin-bottom:28px;
}

.cms-scenario-detail-image{
    aspect-ratio:16/10;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
    border:1px solid #d2d2d2;
    border-radius:10px;
    background:#ececec;
    color:#888;
    font-size:.72rem;
}

.cms-scenario-detail-image img{
    display:block;
    width:100%;
    height:100%;
    object-fit:cover;
}

.cms-scenario-detail-title h1{
    margin:3px 0 6px;
    color:#303030;
    font-size:clamp(1.55rem,3vw,2.3rem);
    line-height:1.4;
}

.cms-scenario-state-tags{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin:16px 0;
}

.cms-scenario-purchase{
    display:inline-flex;
    align-items:center;
    min-height:38px;
    padding:7px 15px;
    border-radius:999px;
    background:#383838;
    color:#fff;
    text-decoration:none;
    font-size:.76rem;
    font-weight:bold;
}

.cms-scenario-detail-panel{
    margin:0 0 18px;
    padding:22px;
    border:1px solid #d4d4d4;
    border-radius:10px;
    background:#fafafa;
}

.cms-scenario-detail-panel > h2{
    margin:0 0 18px;
    padding:0 0 9px;
    border-bottom:1px solid #d8d8d8;
    font-size:1rem;
}

.cms-scenario-info-table{
    margin:0;
}

.cms-scenario-info-table > div{
    display:grid;
    grid-template-columns:90px minmax(0,1fr);
    gap:14px;
    padding:7px 0;
    border-bottom:1px solid #e4e4e4;
}

.cms-scenario-info-table > div:last-child{
    border-bottom:0;
}

.cms-scenario-info-table dt{
    color:#777;
    font-size:.76rem;
}

.cms-scenario-info-table dd{
    margin:0;
    font-size:.9rem;
}

.cms-scenario-copy-block{
    margin-top:24px;
}

.cms-scenario-copy-block h3{
    margin:0 0 8px;
    font-size:.9rem;
}

.cms-scenario-copy-block p{
    margin:0;
    font-size:.9rem;
    line-height:1.9;
}

.cms-scenario-locked{
    text-align:center;
}

.cms-scenario-access-form{
    display:flex;
    justify-content:center;
    gap:8px;
    margin-top:16px;
}

.cms-scenario-access-form input{
    min-width:220px;
    padding:8px 10px;
    border:1px solid #cfcfcf;
    border-radius:7px;
    background:#fff;
}

.cms-scenario-access-form button{
    padding:8px 16px;
    border:0;
    border-radius:999px;
    background:#383838;
    color:#fff;
    cursor:pointer;
}

.cms-scenario-back{
    margin:28px 0 0;
    font-size:.8rem;
}

.cms-scenario-admin-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.cms-scenario-admin-list > article{
    display:grid;
    grid-template-columns:110px minmax(0,1fr) auto;
    gap:15px;
    align-items:center;
    padding:10px;
    border:1px solid #d6d6d6;
    border-radius:10px;
    background:#fafafa;
}

.cms-scenario-admin-thumb{
    width:110px;
    aspect-ratio:16/10;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:7px;
    background:#ececec;
    color:#888;
    font-size:.65rem;
}

.cms-scenario-admin-thumb img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.cms-scenario-admin-copy h2{
    margin:2px 0;
    font-size:.95rem;
}

.cms-scenario-admin-copy p{
    margin:0;
    font-size:.75rem;
}

.cms-scenario-checks{
    display:flex;
    flex-wrap:wrap;
    gap:8px 16px;
}

.cms-scenario-edit-preview{
    margin-top:12px;
}

.cms-scenario-edit-preview img{
    display:block;
    max-width:380px;
    max-height:240px;
    object-fit:contain;
    border:1px solid #d6d6d6;
    border-radius:8px;
    background:#eee;
}

@media(max-width:900px){
    .cms-scenario-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .cms-scenario-detail-head{
        grid-template-columns:1fr;
    }

    .cms-scenario-detail-image{
        max-width:520px;
    }
}

@media(max-width:620px){
    .cms-scenario-grid{
        grid-template-columns:1fr;
    }

    .cms-scenario-admin-list > article{
        grid-template-columns:82px minmax(0,1fr);
    }

    .cms-scenario-admin-thumb{
        width:82px;
    }

    .cms-scenario-admin-actions{
        grid-column:1 / -1;
    }

    .cms-scenario-info-table > div{
        grid-template-columns:1fr;
        gap:2px;
    }

    .cms-scenario-access-form{
        flex-direction:column;
    }

    .cms-scenario-access-form input{
        min-width:0;
        width:100%;
    }
}


/* =========================================================
   v3.0 TRIGGER CHECK
   ========================================================= */

.cms-trigger-intro,
.cms-trigger-load,
.cms-trigger-profile,
.cms-trigger-group,
.cms-trigger-other,
.cms-trigger-actions,
.cms-trigger-discord{
    margin:0 0 16px;
    padding:20px;
    border:1px solid #cfcfcf;
    border-radius:10px;
    background:#fafafa;
}

.cms-trigger-title-row,
.cms-trigger-actions{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:18px;
}

.cms-trigger-label{
    margin:0 0 3px;
    color:#777;
    font-size:.66rem;
    font-weight:bold;
    letter-spacing:.08em;
}

.cms-trigger-intro h2,
.cms-trigger-load h2,
.cms-trigger-profile h2,
.cms-trigger-group h2,
.cms-trigger-other h2,
.cms-trigger-actions h2,
.cms-trigger-discord h2{
    margin:0 0 8px;
    padding:0;
    border:0;
    font-size:1.08rem;
}

.cms-trigger-intro > p{
    max-width:760px;
    margin:10px 0 0;
    font-size:.88rem;
    line-height:1.85;
}

.cms-trigger-code-box{
    min-width:190px;
    padding:10px 12px;
    border:1px solid #aaa;
    border-radius:9px;
    background:#f1f1f1;
    text-align:center;
}

.cms-trigger-code-box small{
    display:block;
    color:#777;
    font-size:.62rem;
    letter-spacing:.08em;
}

.cms-trigger-code-box strong{
    display:block;
    margin:2px 0 7px;
    font-size:1.25rem;
    letter-spacing:.14em;
}

.cms-trigger-code-box button,
.cms-trigger-load-form button,
.cms-trigger-save,
.cms-trigger-copy-text{
    border:0;
    border-radius:999px;
    background:#383838;
    color:#fff;
    cursor:pointer;
    font:inherit;
    font-size:.74rem;
    font-weight:bold;
}

.cms-trigger-code-box button{
    padding:5px 12px;
}

.cms-trigger-guide-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
    margin-top:18px;
}

.cms-trigger-guide-grid article{
    padding:10px 12px;
    border:1px solid #ddd;
    border-radius:8px;
    background:#f5f5f5;
}

.cms-trigger-guide-grid small,
.cms-trigger-guide-grid strong,
.cms-trigger-guide-grid span{
    display:block;
}

.cms-trigger-guide-grid small{
    color:#777;
    font-size:.64rem;
}

.cms-trigger-guide-grid strong{
    margin:2px 0;
    font-size:.84rem;
}

.cms-trigger-guide-grid span{
    color:#777;
    font-size:.7rem;
}

.cms-trigger-load{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:end;
    gap:20px;
}

.cms-trigger-load p{
    margin:0;
    color:#666;
    font-size:.8rem;
}

.cms-trigger-load-form{
    display:flex;
    gap:7px;
}

.cms-trigger-load-form input,
.cms-trigger-profile input,
.cms-trigger-note input,
.cms-trigger-other textarea,
.cms-trigger-discord textarea{
    width:100%;
    padding:9px 10px;
    border:1px solid #ccc;
    border-radius:7px;
    background:#fff;
    color:#333;
    font:inherit;
}

.cms-trigger-load-form input{
    width:170px;
    text-transform:uppercase;
    letter-spacing:.1em;
}

.cms-trigger-load-form button{
    padding:8px 16px;
}

.cms-trigger-group-head{
    margin-bottom:12px;
    padding-bottom:9px;
    border-bottom:1px solid #ddd;
}

.cms-trigger-items{
    display:flex;
    flex-direction:column;
}

.cms-trigger-item{
    display:grid;
    grid-template-columns:minmax(240px,.9fr) minmax(240px,1.1fr);
    gap:16px;
    align-items:center;
    padding:10px 0;
    border-bottom:1px solid #e7e7e7;
}

.cms-trigger-item:last-child{
    border-bottom:0;
}

.cms-trigger-item-main{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}

.cms-trigger-item-main > strong{
    font-size:.84rem;
    line-height:1.6;
}

.cms-trigger-radios{
    display:flex;
    gap:4px;
    flex:0 0 auto;
}

.cms-trigger-radios label{
    position:relative;
    cursor:pointer;
}

.cms-trigger-radios input{
    position:absolute;
    opacity:0;
    pointer-events:none;
}

.cms-trigger-radios span{
    display:flex;
    align-items:center;
    justify-content:center;
    width:31px;
    height:31px;
    border:1px solid #c7c7c7;
    border-radius:8px;
    background:#f7f7f7;
    color:#666;
    font-size:.82rem;
    font-weight:bold;
}

.cms-trigger-radios input:checked + span{
    border-color:#444;
    background:#444;
    color:#fff;
}

.cms-trigger-note{
    display:grid;
    grid-template-columns:42px minmax(0,1fr);
    gap:7px;
    align-items:center;
}

.cms-trigger-note > span{
    color:#777;
    font-size:.68rem;
}

.cms-trigger-note input{
    padding:7px 9px;
    font-size:.8rem;
}

.cms-trigger-other textarea,
.cms-trigger-discord textarea{
    resize:vertical;
    line-height:1.8;
}

.cms-trigger-actions{
    align-items:center;
}

.cms-trigger-actions p{
    margin:0;
    color:#666;
    font-size:.8rem;
}

.cms-trigger-save{
    flex:0 0 auto;
    padding:11px 18px;
}

.cms-trigger-copy-text{
    margin-top:9px;
    padding:8px 15px;
}

.cms-trigger-discord textarea{
    background:#f3f3f3;
    font-size:.8rem;
}

@media(max-width:760px){
    .cms-trigger-title-row,
    .cms-trigger-actions{
        flex-direction:column;
    }

    .cms-trigger-code-box{
        width:100%;
    }

    .cms-trigger-guide-grid{
        grid-template-columns:1fr;
    }

    .cms-trigger-load{
        grid-template-columns:1fr;
    }

    .cms-trigger-load-form input{
        width:100%;
    }

    .cms-trigger-item{
        grid-template-columns:1fr;
        gap:7px;
    }

    .cms-trigger-item-main{
        align-items:flex-start;
        flex-direction:column;
    }

    .cms-trigger-note{
        grid-template-columns:1fr;
        gap:3px;
    }

    .cms-trigger-save{
        width:100%;
    }
}


/* =========================================================
   v3.1 PLAYER CHECK / SAFETY CHECK
   Original UI for kabenuma
   ========================================================= */

.page-trigger-check .main-content{
    max-width:980px;
    margin-left:auto;
    margin-right:auto;
}

.tc-page-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:24px;
    margin:0 0 16px;
    padding:24px;
    border:1px solid #cfcfcf;
    border-radius:12px;
    background:#fafafa;
}

.tc-kicker{
    margin:0 0 4px;
    color:#747474;
    font-size:.66rem;
    font-weight:700;
    letter-spacing:.08em;
}

.tc-page-head h1{
    margin:0;
    color:#303030;
    font-size:clamp(1.55rem,3vw,2.2rem);
    line-height:1.35;
}

.tc-lead{
    max-width:650px;
    margin:9px 0 0;
    color:#555;
    font-size:.88rem;
    line-height:1.85;
}

.tc-code-card{
    flex:0 0 205px;
    padding:11px 13px;
    border:1px solid #999;
    border-radius:10px;
    background:#efefef;
    text-align:center;
}

.tc-code-card > span{
    display:block;
    color:#777;
    font-size:.62rem;
    letter-spacing:.08em;
}

.tc-code-card strong{
    display:block;
    margin:3px 0 8px;
    color:#303030;
    font-size:1.25rem;
    letter-spacing:.13em;
}

.tc-code-card button,
.tc-load-card button,
.tc-save-card button,
.tc-discord-card button,
.tc-toolbar button{
    border:1px solid #444;
    border-radius:999px;
    background:#3b3b3b;
    color:#fff;
    cursor:pointer;
    font:inherit;
    font-size:.72rem;
    font-weight:700;
}

.tc-code-card button{
    padding:5px 12px;
}

.tc-flow{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:9px;
    margin:0 0 12px;
}

.tc-flow article{
    padding:13px 14px;
    border:1px solid #d3d3d3;
    border-radius:10px;
    background:#f7f7f7;
}

.tc-flow small{
    display:inline-block;
    margin-bottom:5px;
    padding:2px 7px;
    border-radius:999px;
    background:#444;
    color:#fff;
    font-size:.61rem;
    font-weight:700;
}

.tc-flow strong{
    display:block;
    color:#333;
    font-size:.86rem;
}

.tc-flow p{
    margin:3px 0 0;
    color:#777;
    font-size:.71rem;
    line-height:1.6;
}

.tc-legend{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:7px;
    margin:0 0 10px;
}

.tc-legend > div{
    display:grid;
    grid-template-columns:34px minmax(0,1fr);
    grid-template-areas:
        "symbol label"
        "symbol help";
    align-items:center;
    min-width:0;
    padding:8px 9px;
    border:1px solid #d5d5d5;
    border-radius:9px;
    background:#fafafa;
}

.tc-legend b{
    grid-area:symbol;
    color:#333;
    font-size:1rem;
    text-align:center;
}

.tc-legend strong{
    grid-area:label;
    font-size:.72rem;
}

.tc-legend span{
    grid-area:help;
    color:#777;
    font-size:.61rem;
    line-height:1.35;
}

.tc-privacy-note{
    margin:0 0 18px;
    padding:9px 12px;
    border-left:3px solid #777;
    background:#ededed;
    color:#555;
    font-size:.74rem;
    line-height:1.7;
}

.tc-load-card,
.tc-basic-card,
.tc-other-card,
.tc-save-card,
.tc-discord-card{
    margin:0 0 15px;
    padding:18px 20px;
    border:1px solid #d0d0d0;
    border-radius:11px;
    background:#fafafa;
}

.tc-load-card,
.tc-save-card{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:20px;
}

.tc-load-card h2,
.tc-basic-card h2,
.tc-other-card h2,
.tc-save-card h2,
.tc-discord-card h2{
    margin:0 0 5px;
    color:#333;
    font-size:1rem;
}

.tc-load-card p,
.tc-basic-card p,
.tc-other-card p,
.tc-save-card p,
.tc-discord-card p{
    margin:0;
    color:#777;
    font-size:.76rem;
    line-height:1.65;
}

.tc-load-card form{
    display:flex;
    gap:7px;
    flex:0 0 auto;
}

.tc-load-card input,
.tc-basic-card input,
.tc-other-card textarea,
.tc-discord-card textarea{
    border:1px solid #c8c8c8;
    border-radius:7px;
    background:#fff;
    color:#333;
    font:inherit;
}

.tc-load-card input{
    width:165px;
    padding:8px 10px;
    text-transform:uppercase;
    letter-spacing:.1em;
}

.tc-load-card button{
    padding:7px 15px;
}

.tc-basic-card input{
    width:100%;
    margin-top:10px;
    padding:9px 10px;
}

.tc-toolbar{
    display:flex;
    align-items:center;
    gap:7px;
    margin:0 0 9px;
}

.tc-toolbar button{
    padding:5px 11px;
    background:#f7f7f7;
    color:#444;
    border-color:#aaa;
}

.tc-toolbar span{
    margin-left:auto;
    color:#888;
    font-size:.68rem;
}

.tc-groups{
    display:flex;
    flex-direction:column;
    gap:9px;
    margin-bottom:15px;
}

.tc-group{
    overflow:hidden;
    border:1px solid #cfcfcf;
    border-radius:11px;
    background:#fafafa;
}

.tc-group > summary{
    display:grid;
    grid-template-columns:42px minmax(0,1fr) auto;
    align-items:center;
    gap:11px;
    padding:13px 15px;
    background:#eeeeee;
    cursor:pointer;
    list-style:none;
}

.tc-group > summary::-webkit-details-marker{
    display:none;
}

.tc-group > summary::after{
    content:"＋";
    width:25px;
    height:25px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid #aaa;
    border-radius:50%;
    background:#f7f7f7;
    color:#555;
    font-size:.78rem;
}

.tc-group[open] > summary::after{
    content:"−";
}

.tc-group-number{
    display:flex;
    align-items:center;
    justify-content:center;
    width:36px;
    height:27px;
    border-radius:7px;
    background:#444;
    color:#fff;
    font-size:.66rem;
    font-weight:700;
}

.tc-group-title{
    min-width:0;
}

.tc-group-title strong{
    display:block;
    color:#333;
    font-size:.9rem;
}

.tc-group-title small{
    display:block;
    margin-top:1px;
    color:#777;
    font-size:.68rem;
    line-height:1.5;
}

.tc-count{
    justify-self:end;
    padding:3px 8px;
    border:1px solid #777;
    border-radius:999px;
    background:#f7f7f7;
    color:#555;
    font-size:.62rem;
    font-weight:700;
}

.tc-count.is-zero{
    border-color:#ccc;
    color:#aaa;
}

.tc-group-body{
    padding:5px 15px 9px;
}

.tc-item{
    padding:10px 0;
    border-bottom:1px solid #e2e2e2;
}

.tc-item:last-child{
    border-bottom:0;
}

.tc-item-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:15px;
}

.tc-item-name{
    min-width:0;
}

.tc-item-name strong{
    display:block;
    color:#3c3c3c;
    font-size:.82rem;
    line-height:1.6;
}

.tc-note-toggle{
    margin-top:2px;
    padding:0;
    border:0;
    background:transparent;
    color:#858585;
    cursor:pointer;
    font:inherit;
    font-size:.65rem;
    text-decoration:underline;
    text-underline-offset:2px;
}

.tc-scale{
    display:flex;
    gap:4px;
}

.tc-scale label{
    position:relative;
}

.tc-scale input{
    position:absolute;
    opacity:0;
    pointer-events:none;
}

.tc-scale span{
    display:flex;
    align-items:center;
    justify-content:center;
    min-width:36px;
    height:33px;
    padding:0 5px;
    border:1px solid #bdbdbd;
    border-radius:8px;
    background:#f7f7f7;
    color:#5e5e5e;
    cursor:pointer;
    font-size:.76rem;
    font-weight:700;
    transition:
        background .12s ease,
        color .12s ease,
        border-color .12s ease;
}

.tc-scale label:hover span{
    border-color:#777;
}

.tc-scale input:checked + span{
    border-color:#404040;
    background:#404040;
    color:#fff;
}

.tc-item-note{
    display:none;
    padding-top:8px;
}

.tc-item-note.is-open{
    display:block;
}

.tc-item-note textarea{
    width:100%;
    min-height:58px;
    padding:8px 10px;
    resize:vertical;
    border:1px solid #ccc;
    border-radius:7px;
    background:#f4f4f4;
    color:#444;
    font:inherit;
    font-size:.76rem;
    line-height:1.7;
}

.tc-other-card textarea,
.tc-discord-card textarea{
    width:100%;
    margin-top:10px;
    padding:10px 11px;
    resize:vertical;
    line-height:1.75;
}

.tc-save-card{
    align-items:center;
    border-color:#999;
}

.tc-save-card > button{
    flex:0 0 auto;
    padding:10px 18px;
}

.tc-discord-card > button{
    margin-top:9px;
    padding:7px 14px;
}

.tc-discord-card textarea{
    background:#f2f2f2;
    font-size:.76rem;
}

@media(max-width:820px){
    .tc-legend{
        grid-template-columns:repeat(3,minmax(0,1fr));
    }
}

@media(max-width:680px){
    .tc-page-head,
    .tc-load-card,
    .tc-save-card{
        flex-direction:column;
        align-items:stretch;
    }

    .tc-code-card{
        flex-basis:auto;
        width:100%;
    }

    .tc-flow{
        grid-template-columns:1fr;
    }

    .tc-legend{
        grid-template-columns:1fr;
    }

    .tc-load-card form{
        width:100%;
    }

    .tc-load-card input{
        width:100%;
        min-width:0;
    }

    .tc-toolbar{
        flex-wrap:wrap;
    }

    .tc-toolbar span{
        width:100%;
        margin-left:0;
    }

    .tc-group > summary{
        grid-template-columns:36px minmax(0,1fr) auto;
        gap:8px;
        padding:11px 12px;
    }

    .tc-count{
        display:none;
    }

    .tc-item-row{
        grid-template-columns:1fr;
        gap:7px;
    }

    .tc-scale{
        overflow-x:auto;
        padding-bottom:2px;
    }

    .tc-scale span{
        min-width:39px;
    }

    .tc-save-card > button{
        width:100%;
    }
}


/* =========================================================
   v3.2 GM AGGREGATION
   ========================================================= */

.tc-mode-switch{
    display:flex;
    gap:7px;
    margin:0 0 12px;
}

.tc-mode-switch a{
    display:inline-flex;
    align-items:center;
    min-height:32px;
    padding:5px 12px;
    border:1px solid #aaa;
    border-radius:999px;
    background:#f7f7f7;
    color:#555;
    text-decoration:none;
    font-size:.7rem;
    font-weight:700;
}

.tc-mode-switch a.is-active{
    background:#404040;
    border-color:#404040;
    color:#fff;
}

.page-trigger-gm .main-content{
    max-width:1040px;
    margin-left:auto;
    margin-right:auto;
}

.tgm-page-head{
    margin:0 0 14px;
    padding:22px;
    border:1px solid #cfcfcf;
    border-radius:12px;
    background:#fafafa;
}

.tgm-page-head h1{
    margin:0;
    color:#303030;
    font-size:clamp(1.55rem,3vw,2.15rem);
}

.tgm-lead{
    max-width:720px;
    margin:8px 0 0;
    color:#666;
    font-size:.86rem;
    line-height:1.8;
}

.tgm-load-card,
.tgm-roster-card,
.tgm-output-card,
.tgm-group-card{
    margin:0 0 15px;
    padding:18px 20px;
    border:1px solid #d0d0d0;
    border-radius:11px;
    background:#fafafa;
}

.tgm-load-card{
    display:grid;
    grid-template-columns:minmax(0,.8fr) minmax(320px,1.2fr);
    gap:18px;
    align-items:end;
}

.tgm-load-card h2,
.tgm-roster-card h2,
.tgm-output-card h2,
.tgm-group-card h2,
.tgm-person-card h2{
    margin:0 0 5px;
    color:#333;
    font-size:1rem;
}

.tgm-load-card p,
.tgm-output-card p{
    margin:0;
    color:#777;
    font-size:.75rem;
    line-height:1.65;
}

.tgm-load-card form{
    display:flex;
    gap:8px;
    align-items:flex-end;
}

.tgm-load-card textarea{
    flex:1 1 auto;
    min-height:92px;
    padding:9px 10px;
    border:1px solid #c8c8c8;
    border-radius:8px;
    background:#fff;
    color:#333;
    resize:vertical;
    font:inherit;
    font-size:.8rem;
    line-height:1.6;
    text-transform:uppercase;
}

.tgm-load-card button,
.tgm-output-card button{
    flex:0 0 auto;
    padding:8px 14px;
    border:1px solid #444;
    border-radius:999px;
    background:#404040;
    color:#fff;
    cursor:pointer;
    font:inherit;
    font-size:.72rem;
    font-weight:700;
}

.tgm-roster{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
}

.tgm-roster span{
    display:flex;
    align-items:center;
    gap:7px;
    padding:5px 10px;
    border:1px solid #bbb;
    border-radius:999px;
    background:#f3f3f3;
}

.tgm-roster strong{
    font-size:.74rem;
}

.tgm-roster small{
    color:#888;
    font-size:.6rem;
    letter-spacing:.07em;
}

.tgm-tabs{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin:0 0 12px;
}

.tgm-tabs button{
    padding:7px 13px;
    border:1px solid #aaa;
    border-radius:999px;
    background:#f7f7f7;
    color:#555;
    cursor:pointer;
    font:inherit;
    font-size:.72rem;
    font-weight:700;
}

.tgm-tabs button.is-active{
    border-color:#404040;
    background:#404040;
    color:#fff;
}

.tgm-view{
    display:none;
}

.tgm-view.is-active{
    display:block;
}

.tgm-output-card{
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:10px;
}

.tgm-output-card textarea{
    width:100%;
    min-height:180px;
    padding:10px 11px;
    border:1px solid #ccc;
    border-radius:8px;
    background:#f1f1f1;
    color:#333;
    resize:vertical;
    font:inherit;
    font-size:.78rem;
    line-height:1.75;
}

.tgm-output-card button{
    justify-self:start;
}

.tgm-group-card > header{
    margin-bottom:8px;
    padding-bottom:8px;
    border-bottom:1px solid #ddd;
}

.tgm-attention-list{
    display:flex;
    flex-direction:column;
}

.tgm-attention-row{
    display:grid;
    grid-template-columns:30px minmax(0,1fr);
    gap:9px;
    padding:10px 0;
    border-bottom:1px solid #e5e5e5;
}

.tgm-attention-row:last-child{
    border-bottom:0;
}

.tgm-pick{
    padding-top:2px;
}

.tgm-pick input{
    position:absolute;
    opacity:0;
}

.tgm-pick span{
    display:block;
    width:22px;
    height:22px;
    border:1px solid #999;
    border-radius:6px;
    background:#f7f7f7;
    cursor:pointer;
}

.tgm-pick input:checked + span{
    background:#404040;
    box-shadow:inset 0 0 0 5px #f7f7f7;
}

.tgm-attention-main > strong{
    display:block;
    color:#333;
    font-size:.84rem;
}

.tgm-person-tags{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
    margin-top:6px;
}

.tgm-person-tags span{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:3px 7px;
    border:1px solid #bbb;
    border-radius:999px;
    background:#f5f5f5;
    color:#555;
    font-size:.66rem;
}

.tgm-person-tags b{
    color:#333;
    font-size:.62rem;
}

.tgm-person-tags .state-ng,
.tgm-matrix td.state-ng{
    border-color:#666;
    background:#dddddd;
}

.tgm-person-tags .state-consult,
.tgm-matrix td.state-consult{
    background:#e8e8e8;
}

.tgm-person-tags .state-caution,
.tgm-matrix td.state-caution{
    background:#f0f0f0;
}

.tgm-notes{
    margin-top:8px;
    padding:8px 10px;
    border-left:3px solid #999;
    background:#f1f1f1;
}

.tgm-notes p{
    margin:0 0 3px;
    color:#555;
    font-size:.7rem;
    line-height:1.6;
}

.tgm-notes p:last-child{
    margin-bottom:0;
}

.tgm-notes strong{
    margin-right:6px;
    color:#333;
}

.tgm-people-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
}

.tgm-person-card{
    min-width:0;
    padding:17px;
    border:1px solid #d0d0d0;
    border-radius:10px;
    background:#fafafa;
}

.tgm-person-card > header{
    margin-bottom:12px;
    padding-bottom:9px;
    border-bottom:1px solid #ddd;
}

.tgm-person-section{
    margin-top:12px;
}

.tgm-person-section h3,
.tgm-person-other h3{
    margin:0 0 5px;
    color:#555;
    font-size:.75rem;
}

.tgm-person-answer{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:6px 10px;
    padding:5px 0;
    border-bottom:1px solid #e8e8e8;
}

.tgm-person-answer > span{
    font-size:.72rem;
}

.tgm-person-answer > b{
    font-size:.68rem;
    white-space:nowrap;
}

.tgm-person-answer > small{
    grid-column:1 / -1;
    color:#777;
    font-size:.66rem;
    line-height:1.55;
}

.tgm-person-other{
    margin-top:14px;
    padding-top:10px;
    border-top:1px solid #ddd;
}

.tgm-person-other p{
    margin:0;
    color:#666;
    font-size:.72rem;
    line-height:1.7;
}

.tgm-matrix-wrap{
    overflow:auto;
    border:1px solid #ccc;
    border-radius:10px;
    background:#fafafa;
}

.tgm-matrix{
    width:100%;
    min-width:780px;
    border-collapse:collapse;
    font-size:.7rem;
}

.tgm-matrix th,
.tgm-matrix td{
    padding:7px 8px;
    border-right:1px solid #ddd;
    border-bottom:1px solid #ddd;
    text-align:left;
    vertical-align:top;
}

.tgm-matrix th{
    background:#f1f1f1;
    color:#444;
}

.tgm-matrix td strong{
    display:block;
    font-size:.66rem;
}

.tgm-matrix td small{
    display:block;
    margin-top:3px;
    color:#777;
    font-size:.62rem;
    line-height:1.45;
}

.tgm-matrix-group th{
    background:#444;
    color:#fff;
    font-size:.68rem;
    letter-spacing:.03em;
}

@media(max-width:760px){
    .tgm-load-card{
        grid-template-columns:1fr;
    }

    .tgm-load-card form{
        flex-direction:column;
        align-items:stretch;
    }

    .tgm-load-card button{
        width:100%;
    }

    .tgm-people-grid{
        grid-template-columns:1fr;
    }
}


/* =========================================================
   v3.2.1 PUBLIC BACKGROUND REAPPLY
   最新CSSに背景修正を再適用
   ========================================================= */

html,
body:not(.cms-admin),
body.cms-session-public {
    background: #f7f7f7 !important;
    background-color: #f7f7f7 !important;
    background-image: none !important;
}

body:not(.cms-admin) {
    min-height: 100vh;
}

body:not(.cms-admin) > .container,
body:not(.cms-admin) > main,
body:not(.cms-admin) .main-content,
body.cms-session-public > .container {
    background-color: transparent !important;
}


/* =========================================================
   v3.3 TRIGGER CHECK EXPANDED / EXPORT
   ========================================================= */

.tc-export-buttons{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:10px;
}

.tc-export-buttons button{
    margin-top:0 !important;
}

/* FINAL PUBLIC BACKGROUND — keep this LAST */
html,
body:not(.cms-admin),
body.cms-session-public{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}

body:not(.cms-admin){
    min-height:100vh;
}

body:not(.cms-admin) > .container,
body:not(.cms-admin) > main,
body:not(.cms-admin) .main-content,
body.cms-session-public > .container{
    background-color:transparent !important;
}


/* =========================================================
   v3.3.1 PUBLIC BACKGROUND HARD FIX
   Screenshot-confirmed two-tone background fix.
   Keep this block LAST.
   ========================================================= */

html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) .site-wrapper,
body:not(.cms-admin) .page-wrapper,
body:not(.cms-admin) .cms-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content,
body:not(.cms-admin) > .container,
body.cms-session-public > .container {
    background-color: #f7f7f7 !important;
    background-image: none !important;
}

html,
body:not(.cms-admin) {
    min-height: 100%;
}

body:not(.cms-admin) {
    min-height: 100vh;
}

/* Prevent full-width decorative layers from painting another gray. */
body:not(.cms-admin)::before,
body:not(.cms-admin)::after,
body:not(.cms-admin) main::before,
body:not(.cms-admin) main::after,
body:not(.cms-admin) .main-content::before,
body:not(.cms-admin) .main-content::after {
    background-color: transparent !important;
    background-image: none !important;
}

/* Trigger pages: explicitly paint the complete document area #f7f7f7. */
body.page-trigger-check,
body.page-trigger-gm,
body.page-trigger-check main,
body.page-trigger-gm main,
body.page-trigger-check .main-content,
body.page-trigger-gm .main-content {
    background: #f7f7f7 !important;
}


/* =========================================================
   v3.4 SCENARIO × PLAYER TRIGGER MATCH
   ========================================================= */

.cms-scenario-trigger-admin-head{
    display:flex;
    justify-content:space-between;
    gap:18px;
    align-items:flex-start;
}

.cms-scenario-trigger-admin-actions{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}

.cms-scenario-trigger-groups{
    display:flex;
    flex-direction:column;
    gap:8px;
    margin-top:14px;
}

.cms-scenario-trigger-group{
    overflow:hidden;
    border:1px solid #d0d0d0;
    border-radius:9px;
    background:#fafafa;
}

.cms-scenario-trigger-group > summary{
    display:grid;
    grid-template-columns:34px auto minmax(0,1fr) auto;
    gap:8px;
    align-items:center;
    padding:10px 12px;
    background:#efefef;
    cursor:pointer;
    list-style:none;
}

.cms-scenario-trigger-group > summary::-webkit-details-marker{
    display:none;
}

.cms-scenario-trigger-group > summary > span{
    display:flex;
    justify-content:center;
    padding:3px 5px;
    border-radius:5px;
    background:#444;
    color:#fff;
    font-size:.62rem;
    font-weight:700;
}

.cms-scenario-trigger-group > summary > strong{
    color:#333;
    font-size:.8rem;
}

.cms-scenario-trigger-group > summary > small{
    color:#777;
    font-size:.67rem;
}

.cms-scenario-trigger-group > summary > b{
    color:#777;
    font-size:.6rem;
}

.cms-scenario-trigger-group-body{
    padding:6px 12px 9px;
}

.cms-scenario-trigger-row{
    display:grid;
    grid-template-columns:minmax(250px,.9fr) minmax(260px,1.1fr);
    gap:10px;
    align-items:center;
    padding:7px 0;
    border-bottom:1px solid #e5e5e5;
}

.cms-scenario-trigger-row:last-child{
    border-bottom:0;
}

.cms-scenario-trigger-check{
    display:flex;
    align-items:flex-start;
    gap:8px;
    color:#444;
    font-size:.76rem;
    line-height:1.55;
}

.cms-scenario-trigger-check input{
    margin-top:3px;
}

.cms-scenario-trigger-note{
    width:100%;
    padding:7px 9px;
    border:1px solid #ccc;
    border-radius:6px;
    background:#fff;
    color:#444;
    font:inherit;
    font-size:.72rem;
}

.cms-scenario-trigger-note:disabled{
    opacity:.45;
    background:#eee;
}

.cms-scenario-match-head p{
    max-width:720px;
    color:#666;
    font-size:.78rem;
    line-height:1.7;
}

.cms-scenario-match-form{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
    align-items:end;
    margin-top:12px;
}

.cms-scenario-match-form textarea{
    min-height:78px;
    padding:8px 10px;
    border:1px solid #c8c8c8;
    border-radius:7px;
    background:#fff;
    resize:vertical;
    font:inherit;
    font-size:.77rem;
    line-height:1.55;
    text-transform:uppercase;
}

.cms-scenario-match-form button,
.cms-scenario-match-copy-button{
    padding:8px 14px;
    border:1px solid #444;
    border-radius:999px;
    background:#404040;
    color:#fff;
    cursor:pointer;
    font:inherit;
    font-size:.7rem;
    font-weight:700;
}

.cms-scenario-match-summary{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:14px;
}

.cms-scenario-match-summary article{
    display:flex;
    align-items:center;
    gap:7px;
    padding:6px 9px;
    border:1px solid #ccc;
    border-radius:8px;
    background:#f7f7f7;
}

.cms-scenario-match-summary strong{
    color:#333;
    font-size:.72rem;
}

.cms-scenario-match-summary span,
.cms-scenario-match-summary small{
    font-size:.62rem;
}

.cms-scenario-match-summary span{
    padding:2px 6px;
    border-radius:999px;
    background:#e9e9e9;
}

.cms-scenario-match-summary .is-danger{
    background:#d8d8d8;
    font-weight:700;
}

.cms-scenario-match-summary .is-caution{
    background:#e8e8e8;
}

.cms-scenario-match-summary .is-ok{
    background:#f1f1f1;
}

.cms-scenario-match-results{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-top:14px;
}

.cms-scenario-match-section{
    overflow:hidden;
    border:1px solid #d0d0d0;
    border-radius:9px;
    background:#fafafa;
}

.cms-scenario-match-section > h3{
    margin:0;
    padding:8px 11px;
    border-bottom:1px solid #d7d7d7;
    background:#ececec;
    color:#333;
    font-size:.76rem;
}

.cms-scenario-match-section.state-ng > h3{
    background:#d8d8d8;
}

.cms-scenario-match-person{
    padding:9px 11px;
    border-bottom:1px solid #e4e4e4;
}

.cms-scenario-match-person:last-child{
    border-bottom:0;
}

.cms-scenario-match-person h4{
    margin:0 0 5px;
    color:#555;
    font-size:.7rem;
}

.cms-scenario-match-row{
    padding:6px 0;
    border-top:1px dashed #ddd;
}

.cms-scenario-match-row:first-of-type{
    border-top:0;
}

.cms-scenario-match-row > strong{
    display:block;
    color:#333;
    font-size:.75rem;
}

.cms-scenario-match-row p{
    margin:3px 0 0;
    color:#666;
    font-size:.67rem;
    line-height:1.55;
}

.cms-scenario-match-row p b{
    display:inline-block;
    min-width:58px;
    color:#444;
    font-size:.6rem;
    letter-spacing:.04em;
}

.cms-scenario-match-copy{
    width:100%;
    min-height:180px;
    margin-top:13px;
    padding:9px 10px;
    border:1px solid #ccc;
    border-radius:7px;
    background:#f2f2f2;
    color:#444;
    resize:vertical;
    font:inherit;
    font-size:.7rem;
    line-height:1.65;
}

.cms-scenario-match-copy-button{
    margin-top:7px;
}

.cms-scenario-match-empty{
    color:#777;
}

/* Keep requested public background as final CSS rule. */
html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}

@media(max-width:720px){
    .cms-scenario-trigger-admin-head{
        flex-direction:column;
    }

    .cms-scenario-trigger-group > summary{
        grid-template-columns:32px minmax(0,1fr) auto;
    }

    .cms-scenario-trigger-group > summary > small{
        grid-column:2 / -1;
    }

    .cms-scenario-trigger-row{
        grid-template-columns:1fr;
    }

    .cms-scenario-match-form{
        grid-template-columns:1fr;
    }

    .cms-scenario-match-form button{
        width:100%;
    }
}


/* =========================================================
   v3.4.1 DISCORD EXPORT
   ========================================================= */

.cms-discord-export{
    margin-top:16px;
    padding-top:14px;
    border-top:1px solid #d2d2d2;
}

.cms-discord-export-head h3{
    margin:.15rem 0 .35rem;
    color:#333;
    font-size:.92rem;
}

.cms-discord-export-head p{
    max-width:760px;
    margin:0;
    color:#666;
    font-size:.72rem;
    line-height:1.65;
}

.cms-discord-export-tabs{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:12px;
}

.cms-discord-export-tabs button{
    padding:6px 10px;
    border:1px solid #bdbdbd;
    border-radius:999px;
    background:#f7f7f7;
    color:#555;
    cursor:pointer;
    font:inherit;
    font-size:.65rem;
    font-weight:700;
    letter-spacing:.03em;
}

.cms-discord-export-tabs button.is-active{
    border-color:#444;
    background:#444;
    color:#fff;
}

.cms-discord-export .cms-scenario-match-copy{
    display:none;
}

.cms-discord-export .cms-scenario-match-copy.is-active{
    display:block;
}

.cms-discord-export-actions{
    display:flex;
    flex-wrap:wrap;
    gap:9px;
    align-items:center;
    margin-top:7px;
}

.cms-discord-export-actions [data-copy-status]{
    color:#777;
    font-size:.65rem;
}

/* requested public background must remain last */
html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}


/* =========================================================
   v3.5 MATCH STRENGTH + PLAYSTYLE
   ========================================================= */

.cms-scenario-trigger-row{
    grid-template-columns:
        minmax(220px,.8fr)
        94px
        minmax(240px,1.1fr);
}

.cms-scenario-trigger-strength{
    width:100%;
    padding:7px 8px;
    border:1px solid #ccc;
    border-radius:6px;
    background:#fff;
    color:#444;
    font:inherit;
    font-size:.7rem;
}

.cms-scenario-trigger-strength:disabled{
    opacity:.45;
    background:#eee;
}

.cms-scenario-match-filterbar{
    display:flex;
    flex-wrap:wrap;
    gap:8px 14px;
    margin-top:12px;
    padding:8px 10px;
    border:1px solid #d1d1d1;
    border-radius:8px;
    background:#f1f1f1;
}

.cms-scenario-match-filterbar label{
    display:flex;
    align-items:center;
    gap:6px;
    color:#555;
    font-size:.68rem;
}

.cms-scenario-match-row-head{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:7px;
}

.cms-strength-badge{
    display:inline-flex;
    align-items:center;
    min-height:20px;
    padding:2px 6px;
    border:1px solid #c7c7c7;
    border-radius:999px;
    background:#f2f2f2;
    color:#666;
    font-size:.58rem;
    font-weight:700;
}

.cms-strength-badge.strength-strong{
    border-color:#777;
    background:#dedede;
    color:#333;
}

.cms-strength-badge.strength-light{
    background:#fafafa;
    color:#888;
}

.page-playstyle .tc-mode-switch{
    margin-bottom:12px;
}

.page-playstyle .tc-discord-card textarea{
    width:100%;
    min-height:260px;
    padding:10px 12px;
    border:1px solid #ccc;
    border-radius:8px;
    background:#f4f4f4;
    color:#444;
    resize:vertical;
    font:inherit;
    font-size:.72rem;
    line-height:1.65;
}

.playstyle-mode-switch a{
    min-width:130px;
    text-align:center;
}

@media(max-width:720px){
    .cms-scenario-trigger-row{
        grid-template-columns:1fr;
    }

    .cms-scenario-trigger-strength{
        max-width:140px;
    }
}

/* requested public background must remain final */
html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}

/* =========================================================
   v3.6 HANDOUT DIAGNOSIS
   ========================================================= */
.cms-scenario-match-section.state-dislike{border-color:#bfc5c8}
.cms-handout-admin{display:grid;gap:22px}
.cms-handout-admin-head,.cms-handout-admin-subhead{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.cms-handout-admin-subhead{align-items:center;margin-bottom:10px}
.cms-handout-admin-subhead h3{margin:0;font-size:.86rem}
.cms-handout-admin-section{padding-top:16px;border-top:1px solid #d8d8d8}
.cms-handout-admin-row,.cms-ho-question-admin-row{display:grid;gap:10px;margin-top:12px;padding:14px;border:1px solid #d1d1d1;border-radius:9px;background:#fafafa}
.cms-handout-admin-row select[multiple]{min-height:170px}
.cms-ho-question-admin-row fieldset{margin:0;padding:10px;border:1px solid #d5d5d5;border-radius:8px}
.cms-ho-question-admin-row legend{padding:0 5px;color:#666;font-size:.68rem}
.cms-ho-target-grid{display:flex;flex-wrap:wrap;gap:7px 10px}
.cms-ho-target-grid label{display:flex;align-items:center;gap:5px;font-size:.7rem}
.cms-handout-diagnosis{margin-top:18px}
.cms-handout-diagnosis-head h2{margin:.15rem 0 .35rem}
.cms-handout-diagnosis-head p{color:#666}
.cms-handout-disclaimer{margin:14px 0;padding:12px 14px;border:1px solid #aaa;border-radius:9px;background:#f0f0f0}
.cms-handout-disclaimer strong{display:block;margin-bottom:4px;font-size:.78rem}
.cms-handout-disclaimer p{margin:0;color:#666;font-size:.68rem;line-height:1.65}
.cms-handout-diagnosis-form{display:grid;gap:14px}
.cms-handout-diagnosis-form>label{display:grid;gap:6px}
.cms-handout-diagnosis-form>label>span{font-size:.62rem;font-weight:700;letter-spacing:.06em}
.cms-handout-diagnosis-form>label>small{color:#777;font-size:.63rem}
.cms-handout-question-list{display:grid;gap:10px}
.cms-handout-question{margin:0;padding:12px;border:1px solid #d2d2d2;border-radius:9px}
.cms-handout-question legend{padding:0 6px;color:#444;font-size:.74rem;font-weight:700}
.cms-handout-question-scale{display:flex;flex-wrap:wrap;gap:7px}
.cms-handout-question-scale label{cursor:pointer}
.cms-handout-question-scale input{position:absolute;opacity:0;pointer-events:none}
.cms-handout-question-scale span{display:inline-flex;align-items:center;gap:4px;padding:7px 9px;border:1px solid #c8c8c8;border-radius:999px;background:#f7f7f7;color:#555;font-size:.66rem}
.cms-handout-question-scale input:checked+span{border-color:#444;background:#444;color:#fff}
.cms-handout-diagnosis-submit{justify-self:start;padding:9px 14px;border:1px solid #444;border-radius:8px;background:#444;color:#fff;cursor:pointer;font:inherit;font-size:.7rem;font-weight:700}
.cms-handout-result{margin-top:18px;padding-top:16px;border-top:1px solid #d2d2d2}
.cms-handout-result-title h3{margin:.1rem 0 .25rem}
.cms-handout-result-title p{margin:0;color:#777;font-size:.65rem}
.cms-handout-result-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px;margin-top:12px}
.cms-handout-result-grid article{padding:13px;border:1px solid #d0d0d0;border-radius:9px;background:#fafafa}
.cms-handout-result-grid article.is-top{border-color:#555;box-shadow:0 0 0 1px #555 inset}
.cms-handout-rank{display:flex;justify-content:space-between;gap:8px;margin-bottom:10px}
.cms-handout-rank span{font-size:.72rem;font-weight:700}
.cms-handout-rank small{color:#777;font-size:.58rem}
.cms-handout-result-grid h4{margin:.2rem 0 .35rem}
.cms-handout-result-grid article>p:last-child{color:#666;font-size:.68rem;line-height:1.6}
@media(max-width:720px){
    .cms-handout-admin-head,.cms-handout-admin-subhead{align-items:stretch;flex-direction:column}
    .cms-handout-question-scale{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
    .cms-handout-question-scale span{width:100%;justify-content:center}
}
/* requested public background must remain final */
html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}


/* =========================================================
   v3.8 TRPG SCHEDULE
   ========================================================= */
.cms-trpg-schedule{max-width:980px;margin:0 auto;padding-bottom:72px}
.cms-schedule-head{display:flex;justify-content:space-between;gap:24px;align-items:end;padding:28px 0 18px;border-bottom:1px solid #cfcfcf}
.cms-schedule-head h1{margin:.1rem 0 .45rem;font-size:clamp(2rem,7vw,4.6rem);letter-spacing:-.04em}
.cms-schedule-head>div:first-child>p:last-child{margin:0;color:#666}
.cms-schedule-count{min-width:110px;padding:12px;border:1px solid #bbb;border-radius:10px;text-align:right;background:#fafafa}
.cms-schedule-count span{display:block;color:#777;font-size:.58rem;letter-spacing:.12em}
.cms-schedule-count strong{font-size:2rem;line-height:1}
.cms-schedule-jump,.cms-session-subnav{display:flex;flex-wrap:wrap;gap:7px;margin:14px 0 22px}
.cms-schedule-jump a,.cms-session-subnav a{padding:7px 10px;border:1px solid #bbb;border-radius:999px;background:#fafafa;color:#555;text-decoration:none;font-size:.64rem;font-weight:700}
.cms-session-subnav a.is-active{background:#444;color:#fff;border-color:#444}
.cms-schedule-section{margin-top:28px}
.cms-schedule-section-head{margin-bottom:10px}
.cms-schedule-section-head h2{margin:.15rem 0}
.cms-schedule-list{display:grid;gap:10px}
.cms-schedule-card{display:grid;grid-template-columns:minmax(190px,.75fr) 2fr;gap:18px;padding:15px;border:1px solid #ccc;border-radius:10px;background:#fafafa}
.cms-schedule-date{display:flex;flex-direction:column;gap:7px;padding-right:14px;border-right:1px solid #ddd}
.cms-schedule-date span{align-self:flex-start;padding:3px 7px;border:1px solid #bbb;border-radius:999px;color:#666;font-size:.57rem;font-weight:700}
.cms-schedule-date strong{font-size:.76rem;line-height:1.6}
.cms-schedule-copy h3{margin:.15rem 0 .35rem;font-size:1.05rem}
.cms-schedule-scenario{margin:.2rem 0;color:#555;font-size:.74rem}
.cms-schedule-scenario a{color:inherit;text-decoration:underline;text-underline-offset:3px}
.cms-schedule-members,.cms-schedule-memo{margin:.55rem 0 0;color:#777;font-size:.66rem;line-height:1.65}
.cms-schedule-memo{padding-top:.5rem;border-top:1px solid #e0e0e0}
.cms-schedule-card.status-tentative{border-style:dashed}
.cms-schedule-card.status-recruiting{box-shadow:inset 3px 0 0 #777}
.cms-schedule-section.is-archive .cms-schedule-card{opacity:.72}
.cms-schedule-card.status-cancelled{text-decoration-color:#999}
.cms-schedule-admin-list{display:grid;gap:9px}
.cms-schedule-admin-list>article{display:grid;grid-template-columns:minmax(170px,.8fr) 2fr auto;gap:14px;align-items:center;padding:12px;border:1px solid #d0d0d0;border-radius:9px;background:#fafafa}
.cms-schedule-admin-list h2{margin:.15rem 0;font-size:.9rem}
.cms-schedule-admin-list p{margin:.15rem 0;color:#777;font-size:.67rem}
.cms-schedule-admin-date{display:grid;gap:4px}
.cms-schedule-admin-date span{color:#777;font-size:.58rem}
.cms-schedule-admin-date strong{font-size:.68rem}
@media(max-width:720px){
    .cms-schedule-head{align-items:stretch;flex-direction:column}
    .cms-schedule-count{align-self:flex-start;text-align:left}
    .cms-schedule-card{grid-template-columns:1fr}
    .cms-schedule-date{padding-right:0;padding-bottom:10px;border-right:0;border-bottom:1px solid #ddd}
    .cms-schedule-admin-list>article{grid-template-columns:1fr}
}
/* requested public background must remain final */
html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}


/* =========================================================
   v3.9 PPP CONNECT + SESSION REPORT
   ========================================================= */
.cms-ppp-secret-state,
.cms-ppp-report-meta{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:8px 14px;
    margin-top:12px;
    padding:10px 12px;
    border:1px solid #ccc;
    border-radius:8px;
    background:#f7f7f7;
}
.cms-ppp-secret-state span,
.cms-ppp-report-meta span{
    color:#777;
    font-size:.6rem;
    letter-spacing:.08em;
}
.cms-ppp-secret-state strong,
.cms-ppp-report-meta strong{
    font-size:.72rem;
}
.cms-ppp-report-meta small{
    margin-left:auto;
    color:#888;
    font-size:.6rem;
}
.cms-ppp-report-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
}
.cms-ppp-report-head h2{margin-top:.15rem}
.cms-session-ppp-report{
    padding:16px;
    border:1px solid #c9c9c9;
    border-radius:10px;
    background:#fafafa;
}
.cms-session-ppp-report h3{
    margin:.15rem 0 .35rem;
}
.cms-session-ppp-report p{
    color:#666;
}
.cms-character-session-history .section-lead{
    color:#777;
    font-size:.72rem;
}
.cms-character-session-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
    gap:10px;
}
.cms-character-session-grid article{
    padding:14px;
    border:1px solid #ccc;
    border-radius:9px;
    background:#fafafa;
}
.cms-character-session-grid h3{
    margin:.2rem 0 .4rem;
    font-size:.9rem;
}
.cms-character-session-grid time{
    color:#777;
    font-size:.65rem;
}
.cms-character-session-links{
    display:flex;
    flex-wrap:wrap;
    gap:6px 12px;
    margin-top:10px;
}
.cms-character-session-links a,
.cms-schedule-link a{
    color:#444;
    font-size:.64rem;
    font-weight:700;
    text-underline-offset:3px;
}
.cms-schedule-link{margin-top:.55rem}
.cms-admin-action-row{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:14px;
}
.cms-admin-action-row button[disabled]{
    opacity:.45;
    cursor:not-allowed;
}
@media(max-width:720px){
    .cms-ppp-report-head{flex-direction:column}
    .cms-ppp-report-meta small{margin-left:0;width:100%}
}


/* =========================================================
   v3.9.1 SESSION LOG / PLAY REPORT SEPARATION
   ========================================================= */
.cms-log-report-link-box{
    margin-top:14px;
    padding:14px;
    border:1px solid #ccc;
    border-radius:10px;
    background:#fafafa;
}
.cms-log-report-link-box h3{
    margin:.15rem 0 .35rem;
}
.cms-log-report-link-box select{
    width:100%;
}

/* requested public background must remain final */
/* v3.9.2 PPP public report */
.cms-ppp-share-select{margin:14px 0;padding:14px;border:1px solid #ccc;border-radius:10px;background:#fafafa}
.cms-ppp-share-checks{display:flex;flex-wrap:wrap;gap:8px 16px;margin-top:10px}
.cms-ppp-share-checks label{display:flex;align-items:center;gap:7px;min-width:140px}
.cms-ppp-share-checks input{width:auto}
.cms-ppp-safe-note{margin-top:12px}

/* requested public background must remain final */

/* v4.0 FELLOW CHARACTERS */
.cms-fellow-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;margin:28px 0}
.cms-fellow-card{display:flex;align-items:center;gap:14px;padding:14px;border:1px solid #ccc;border-radius:10px;text-decoration:none}
.cms-fellow-card img,.cms-fellow-profile img{width:76px;height:76px;object-fit:cover;object-position:50% 20%;border-radius:10px}
.cms-fellow-card small{display:block;margin-top:4px}
.cms-fellow-profile{display:flex;gap:20px;align-items:center;margin:28px 0;padding-bottom:24px;border-bottom:1px solid #ccc}
.cms-fellow-profile img{width:120px;height:120px}
.cms-fellow-relation{padding:12px 0;border-top:1px solid #ddd}
.cms-fellow-relation span{margin-left:10px;font-size:.85em;opacity:.7}
.cms-fellow-relation-edit{padding:12px 0;border-top:1px solid #ddd}
@media(max-width:640px){.cms-fellow-profile{align-items:flex-start}.cms-fellow-profile img{width:88px;height:88px}}
/* requested public background must remain final */

/* v4.1 SCENARIO IMPRESSIONS */
.cms-scenario-impression-head{display:flex;justify-content:space-between;gap:20px;align-items:end;margin-bottom:16px}
.cms-scenario-impression-card{padding:16px 0;border-top:1px solid #ccc}
.cms-scenario-impression-meta{display:flex;gap:8px;align-items:center;font-size:11px;letter-spacing:.08em}
.cms-scenario-impression-meta span,.cms-scenario-impression-meta b{padding:3px 7px;border:1px solid #bbb;border-radius:999px}
.cms-scenario-impression-card details{margin-top:10px;border:1px solid #ccc;border-radius:10px;background:#fafafa}
.cms-scenario-impression-card summary{cursor:pointer;padding:12px 14px;font-weight:700}
.cms-scenario-impression-body{padding:12px 14px;line-height:1.9}
.cms-scenario-impression-card> .cms-scenario-impression-body{padding-left:0;padding-right:0}
@media(max-width:640px){.cms-scenario-impression-head{display:block}}
/* requested public background must remain final */

/* =========================================================
   v4.2 ADMIN TOOL DASHBOARD
   ========================================================= */
.cms-admin-mini-nav{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
}
.cms-admin-mini-nav a{
    font-size:12px;
    letter-spacing:.06em;
}
.cms-dashboard-title{
    margin-bottom:26px;
}
.cms-dashboard-title p:last-child{
    margin:.4rem 0 0;
    opacity:.68;
}
.cms-tool-group{
    margin:0 0 38px;
}
.cms-tool-group-head{
    margin-bottom:14px;
}
.cms-tool-group-head h2{
    margin:.15rem 0 .35rem;
}
.cms-tool-group-head>p:last-child{
    margin:0;
    max-width:760px;
    opacity:.68;
}
.cms-tool-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
    gap:12px;
}
.cms-tool-card{
    display:flex;
    min-height:160px;
    flex-direction:column;
    padding:17px 18px;
    border:1px solid #cfcfcf;
    border-radius:11px;
    background:#fbfbfb;
    text-decoration:none;
    transition:transform .12s ease,border-color .12s ease,background .12s ease;
}
.cms-tool-card:hover{
    transform:translateY(-2px);
    border-color:#999;
    background:#fff;
}
.cms-tool-card small{
    margin-bottom:7px;
    font-size:10px;
    letter-spacing:.12em;
    opacity:.55;
}
.cms-tool-card strong{
    font-size:18px;
}
.cms-tool-card p{
    margin:10px 0 16px;
    line-height:1.7;
    font-size:13px;
    opacity:.72;
}
.cms-tool-card span{
    margin-top:auto;
    font-size:11px;
    letter-spacing:.08em;
}
.cms-tool-group-system{
    padding-top:6px;
    border-top:1px solid #d8d8d8;
}
@media(max-width:640px){
    .cms-tool-grid{grid-template-columns:1fr}
    .cms-tool-card{min-height:0}
}
/* requested public background must remain final */

/* v4.4 REPORTS + PRIVATE TABLE PORTAL */
.cms-report-page-head,.cms-table-tools-head{max-width:760px;margin:0 0 26px}
.cms-report-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}
.cms-report-card{display:block;border:1px solid #bbb;border-radius:10px;overflow:hidden;background:#fbfbfb;text-decoration:none}
.cms-report-card img{width:100%;aspect-ratio:16/9;object-fit:cover}
.cms-report-card>div{display:flex;flex-direction:column;gap:5px;padding:14px}
.cms-report-card small,.cms-report-card span{font-size:.75rem;opacity:.65}
.cms-report-view{max-width:860px;margin:0 auto}
.cms-report-view>header{padding:26px 0 18px;border-bottom:1px solid #aaa}
.cms-report-view>header h1{margin:.2rem 0}
.cms-report-hero{margin:22px 0}.cms-report-hero img{width:100%;max-height:580px;object-fit:contain;background:#eee}
.cms-report-cast{margin:22px 0;border-top:1px solid #ccc}
.cms-report-cast>div{display:grid;grid-template-columns:minmax(80px,150px) 1fr;gap:16px;padding:9px 0;border-bottom:1px solid #ddd}
.cms-report-result{display:flex;flex-direction:column;gap:4px;margin:26px 0;padding:18px;border:1px solid #bbb;border-radius:8px}
.cms-report-note{margin:26px 0;line-height:1.9}
.cms-report-member-row{display:grid;grid-template-columns:160px 1fr 1fr;gap:8px;margin:8px 0}
.cms-table-tools-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:24px 0}
.cms-table-tools-grid a{display:flex;min-height:150px;flex-direction:column;padding:18px;border:1px solid #bdbdbd;border-radius:10px;background:#fbfbfb;text-decoration:none}
.cms-table-tools-grid small{font-size:10px;letter-spacing:.1em;opacity:.55}
.cms-table-tools-grid strong{margin:10px 0 6px;font-size:1.05rem}
.cms-table-tools-grid span{margin-top:auto;font-size:.8rem;opacity:.7}
@media(max-width:640px){.cms-report-member-row,.cms-table-tools-grid{grid-template-columns:1fr}.cms-report-cast>div{grid-template-columns:1fr;gap:2px}}
/* requested public background must remain final */

/* v4.5 CCFOLIA PAWN MAKER */
.cms-ccfolia-row{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:8px;margin:7px 0}
.cms-ccfolia-param{display:grid;grid-template-columns:1.2fr 2fr;gap:8px;margin:7px 0}
.cms-ccfolia-row-head{font-size:10px;font-weight:800;letter-spacing:.08em;opacity:.55}
.cms-ccfolia-icon-preview{display:block;width:120px;height:120px;object-fit:cover;margin-top:12px;border:1px solid #bbb;border-radius:8px}
.cms-ccfolia-checks{display:flex;flex-wrap:wrap;gap:10px 18px;margin:14px 0}
.cms-ccfolia-export textarea{width:100%;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:1.65}
@media(max-width:640px){.cms-ccfolia-row,.cms-ccfolia-param{grid-template-columns:1fr}.cms-ccfolia-row-head{display:none}}
/* requested public background must remain final */

/* =========================================================
   v4.5.1 RESTORE CHARACTER HUB
   scoped only: CHARACTERS / RELATIONS / Q&A
   ========================================================= */
.cms-character-hub{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin:0 0 28px;
}
.cms-character-hub-card{
    position:relative;
    display:flex;
    flex-direction:column;
    min-width:0;
    padding:14px 16px 15px;
    border:1px solid #d0d0d0;
    border-radius:9px;
    background:#f7f7f7;
    color:#3d3d3d;
    text-decoration:none;
    transition:border-color .16s ease,background .16s ease,transform .16s ease;
}
.cms-character-hub-card small{
    margin-bottom:4px;
    color:#858585;
    font-size:.65rem;
    letter-spacing:.05em;
}
.cms-character-hub-card strong{
    color:#303030;
    font-size:.9rem;
    letter-spacing:.03em;
}
.cms-character-hub-card span{
    margin-top:3px;
    color:#777;
    font-size:.72rem;
    line-height:1.55;
}
.cms-character-hub-card::after{
    content:"→";
    position:absolute;
    right:13px;
    top:14px;
    color:#999;
    font-size:.78rem;
}
.cms-character-hub-card:hover{
    transform:translateY(-1px);
    border-color:#8d8d8d;
    background:#fff;
}
.cms-character-hub-card.is-current{
    border-color:#555;
}
.cms-character-hub-card.is-current::before{
    content:"";
    position:absolute;
    left:0;
    top:12px;
    bottom:12px;
    width:3px;
    border-radius:0 999px 999px 0;
    background:#444;
}
@media(max-width:680px){
    .cms-character-hub{grid-template-columns:1fr;gap:7px}
    .cms-character-hub-card{padding:11px 14px 12px}
    .cms-character-hub-card span{font-size:.7rem}
}

/* requested public background must remain final */
/* v4.6 CHARACTER SHEET STORAGE */
.cms-sheet-search{display:grid;grid-template-columns:1fr 160px auto;gap:8px;margin-bottom:18px}.cms-sheet-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px}.cms-sheet-card{padding:15px;border:1px solid #bbb;border-radius:10px;background:#fafafa}.cms-sheet-card small{font-size:10px;letter-spacing:.08em;opacity:.6}.cms-sheet-card h2{margin:6px 0}.cms-keeper-badge{display:inline-block;padding:3px 7px;border:1px solid #777;border-radius:999px;font-size:9px}.cms-sheet-stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-bottom:14px}.cms-sheet-stat-grid label{padding:9px;border:1px solid #d0d0d0;border-radius:8px}.cms-sheet-stat-grid small{display:block;margin-top:4px;font-size:9px}.cms-sheet-skill-head,.cms-sheet-skill-row{display:grid;grid-template-columns:85px minmax(150px,1.7fr) repeat(6,minmax(55px,.6fr));gap:5px;margin:5px 0}.cms-sheet-skill-head{font-size:9px;font-weight:700;opacity:.6}.cms-sheet-skill-row input{min-width:0;padding:6px}.cms-keeper-note{margin:16px 0;padding:15px;border:1px solid #555;border-radius:9px;background:#eee}.cms-convert-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:6px 18px;margin:16px 0}.cms-ccfolia-export textarea{width:100%;margin-top:12px;font-family:monospace;font-size:12px}@media(max-width:800px){.cms-sheet-stat-grid{grid-template-columns:repeat(2,1fr)}.cms-sheet-skill-head{display:none}.cms-sheet-skill-row{grid-template-columns:repeat(2,1fr);padding:8px;border:1px solid #ddd;border-radius:8px}}@media(max-width:600px){.cms-sheet-search,.cms-convert-grid{grid-template-columns:1fr}.cms-sheet-skill-row{grid-template-columns:1fr}}
/* requested public background must remain final */

/* =========================================================
   v4.6.1 CHARACTER SHEET EDITOR — READABILITY REBUILD
   ========================================================= */
.cms-sheet-editor{
    max-width:1180px;
    margin:0 auto;
}
.cms-sheet-editor .cms-panel.cms-sheet-section{
    padding:22px;
    margin:0 0 18px;
    border:1px solid #c9c9c9;
    border-radius:12px;
    background:#fbfbfb;
}
.cms-sheet-section-head{
    display:flex;
    justify-content:space-between;
    gap:20px;
    align-items:flex-end;
    padding-bottom:12px;
    margin-bottom:16px;
    border-bottom:1px solid #d5d5d5;
}
.cms-sheet-section-head h2{
    margin:2px 0 0;
    font-size:1.15rem;
}
.cms-sheet-section-head>p{
    margin:0;
    max-width:500px;
    color:#707070;
    font-size:.76rem;
    line-height:1.7;
}
.cms-sheet-edition-badge{
    padding:6px 9px;
    border:1px solid #aaa;
    border-radius:999px;
    font-size:10px;
    font-weight:700;
    letter-spacing:.05em;
}
.cms-sheet-tabs{
    position:sticky;
    top:8px;
    z-index:20;
    display:flex;
    gap:4px;
    margin:0 0 16px;
    padding:7px;
    border:1px solid #bcbcbc;
    border-radius:10px;
    background:rgba(247,247,247,.96);
    backdrop-filter:blur(8px);
}
.cms-sheet-tabs a{
    flex:1 1 auto;
    padding:8px 10px;
    border-radius:6px;
    text-align:center;
    text-decoration:none;
    font-size:10px;
    font-weight:800;
    letter-spacing:.06em;
}
.cms-sheet-tabs a:hover{background:#e9e9e9}

.cms-sheet-basic-grid{
    display:grid;
    grid-template-columns:minmax(0,1.5fr) minmax(240px,.65fr);
    gap:22px;
}
.cms-sheet-icon-box{
    padding:14px;
    border:1px dashed #c3c3c3;
    border-radius:10px;
}
.cms-sheet-icon,
.cms-sheet-icon-empty{
    width:100%;
    aspect-ratio:1/1;
    max-height:260px;
    margin:0 0 12px;
    object-fit:contain;
    border:1px solid #c8c8c8;
    border-radius:8px;
    background:#f1f1f1;
}
.cms-sheet-icon-empty{
    display:grid;
    place-items:center;
    color:#aaa;
    font-size:11px;
    letter-spacing:.08em;
}
.cms-sheet-stat-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:9px;
}
.cms-stat-card,
.cms-derived-card{
    display:block;
    padding:10px;
    border:1px solid #d0d0d0;
    border-radius:9px;
    background:#f7f7f7;
}
.cms-stat-card>span,
.cms-derived-card>span{
    display:block;
    margin-bottom:5px;
    font-size:11px;
    font-weight:800;
}
.cms-stat-card input,
.cms-derived-card input{
    width:100%;
    font-size:1rem;
    font-weight:700;
}
.cms-stat-card small{
    display:flex;
    gap:4px;
    align-items:center;
    margin-top:6px;
    color:#666;
    font-size:9px;
}
.cms-stat-card small b{color:#333;font-size:11px}
.cms-stat-card small i{font-style:normal;opacity:.65}
.cms-derived-wrap{
    margin-top:16px;
    padding-top:14px;
    border-top:1px solid #ddd;
}
.cms-sheet-stat-grid.derived{
    grid-template-columns:repeat(7,minmax(0,1fr));
}

/* Skills: one clear card per source category */
.cms-skill-groups{
    display:grid;
    gap:14px;
}
.cms-skill-category{
    overflow:hidden;
    border:1px solid #c8c8c8;
    border-radius:10px;
    background:#f7f7f7;
}
.cms-skill-category>header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border-bottom:1px solid #d5d5d5;
    background:#ededed;
}
.cms-skill-category>header h3{
    margin:2px 0 0;
    font-size:.98rem;
}
.cms-skill-category>header>span{
    color:#777;
    font-size:9px;
    font-weight:800;
    letter-spacing:.08em;
}
.cms-skill-table-wrap{
    overflow-x:auto;
}
.cms-skill-table{
    width:100%;
    min-width:760px;
    border-collapse:collapse;
    table-layout:fixed;
}
.cms-skill-table th,
.cms-skill-table td{
    padding:6px;
    border-bottom:1px solid #dedede;
    border-right:1px solid #e2e2e2;
    vertical-align:middle;
}
.cms-skill-table th{
    padding-top:8px;
    padding-bottom:8px;
    color:#666;
    background:#f4f4f4;
    font-size:9px;
    font-weight:800;
    letter-spacing:.05em;
}
.cms-skill-table th:first-child{width:30%}
.cms-skill-table th:not(:first-child){width:11.66%}
.cms-skill-table td:last-child,
.cms-skill-table th:last-child{border-right:0}
.cms-skill-table tr:last-child td{border-bottom:0}
.cms-skill-table input{
    width:100%;
    min-width:0;
    padding:7px 6px;
    border:1px solid transparent;
    background:transparent;
    text-align:center;
}
.cms-skill-table input:focus{
    border-color:#999;
    background:#fff;
}
.cms-skill-table .cms-skill-name{
    text-align:left;
    font-weight:700;
}
.cms-skill-table .cms-skill-base{
    color:#555;
    font-weight:700;
}
.cms-skill-table .cms-skill-total{
    border-color:#aaa;
    background:#ececec;
    font-weight:800;
}
.cms-custom-skill-grid{
    display:grid;
    grid-template-columns:140px minmax(180px,1.5fr) repeat(6,minmax(72px,.65fr));
    gap:6px;
    padding:12px;
}
.cms-skill-category.is-additional>header{
    background:#f4f4f4;
}

/* Weapons remain table-like, but breathe */
.cms-sheet-weapon-head,
.cms-sheet-weapon-row{
    gap:6px;
}
.cms-sheet-weapon-row input{
    padding:7px;
}
.cms-keeper-note{
    border-left:4px solid #555;
    background:#ededed;
}
.cms-sheet-savebar{
    z-index:30;
    bottom:10px;
    box-shadow:0 6px 22px rgba(0,0,0,.10);
}

@media(max-width:900px){
    .cms-sheet-basic-grid{grid-template-columns:1fr}
    .cms-sheet-icon-box{max-width:360px}
    .cms-sheet-stat-grid,
    .cms-sheet-stat-grid.derived{grid-template-columns:repeat(4,minmax(0,1fr))}
    .cms-custom-skill-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
    .cms-sheet-editor .cms-panel.cms-sheet-section{padding:15px}
    .cms-sheet-section-head{display:block}
    .cms-sheet-section-head>p{margin-top:7px}
    .cms-sheet-tabs{
        position:static;
        overflow-x:auto;
        flex-wrap:nowrap;
    }
    .cms-sheet-tabs a{flex:0 0 auto}
    .cms-sheet-stat-grid,
    .cms-sheet-stat-grid.derived{grid-template-columns:repeat(2,minmax(0,1fr))}
    .cms-custom-skill-grid{grid-template-columns:1fr}
}

/* requested public background must remain final */

/* =========================================================
   v4.6.2 CHARACTER SHEET UI HOTFIX
   Explicit form layout: do not inherit old inline admin forms.
   ========================================================= */
.cms-sheet-editor,
.cms-sheet-editor *{
    box-sizing:border-box;
}
.cms-sheet-editor label{
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    gap:5px !important;
    min-width:0 !important;
    margin:0 0 12px !important;
}
.cms-sheet-editor label>span{
    display:block !important;
    margin:0 !important;
    font-size:10px !important;
    font-weight:800 !important;
    letter-spacing:.06em !important;
    color:#5c5c5c !important;
}
.cms-sheet-editor input,
.cms-sheet-editor select,
.cms-sheet-editor textarea{
    display:block !important;
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    margin:0 !important;
    padding:8px 9px !important;
    border:1px solid #b9b9b9 !important;
    border-radius:6px !important;
    background:#fff !important;
    color:#333 !important;
    font:inherit !important;
    line-height:1.35 !important;
}
.cms-sheet-editor textarea{
    resize:vertical !important;
}
.cms-sheet-editor .cms-field-grid{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px 12px !important;
}
.cms-sheet-editor .cms-sheet-section{
    overflow:visible !important;
}
.cms-sheet-editor .cms-sheet-basic-grid{
    align-items:start !important;
}
.cms-sheet-editor .cms-sheet-icon-box{
    min-width:0 !important;
}
.cms-sheet-editor .cms-stat-card,
.cms-sheet-editor .cms-derived-card{
    margin:0 !important;
}
.cms-sheet-editor .cms-stat-card input,
.cms-sheet-editor .cms-derived-card input{
    text-align:center !important;
    font-size:16px !important;
}
.cms-sheet-editor .cms-skill-table input{
    margin:0 !important;
    padding:7px 6px !important;
    border-color:transparent !important;
    border-radius:4px !important;
    background:transparent !important;
}
.cms-sheet-editor .cms-skill-table input:focus{
    border-color:#999 !important;
    background:#fff !important;
}
.cms-sheet-editor .cms-skill-table .cms-skill-total{
    border-color:#aaa !important;
    background:#ececec !important;
}
.cms-sheet-editor .cms-sheet-weapon-row input{
    padding:7px !important;
}
.cms-sheet-editor .cms-keeper-note textarea,
.cms-sheet-editor #notes>label textarea{
    min-height:130px !important;
}
.cms-sheet-editor .cms-keeper-note{
    margin:18px 0 !important;
}
.cms-sheet-editor .cms-sheet-savebar .cms-button{
    width:auto !important;
    margin:0 !important;
}
@media(max-width:700px){
    .cms-sheet-editor .cms-field-grid{
        grid-template-columns:1fr !important;
    }
}

/* requested public background must remain final */

/* =========================================================
   v4.6.3 WEAPON TABLE + AUTO CHAT PALETTE
   ========================================================= */
.cms-combat-summary{
    display:grid;
    grid-template-columns:minmax(180px,280px);
    margin:0 0 14px;
}
.cms-weapon-table-wrap{
    width:100%;
    margin:0 0 16px;
    overflow-x:auto;
    border:1px solid #c8c8c8;
    border-radius:9px;
    background:#f7f7f7;
}
.cms-weapon-table{
    width:100%;
    min-width:900px;
    border-collapse:collapse;
    table-layout:fixed;
}
.cms-weapon-table th,
.cms-weapon-table td{
    padding:6px;
    border-right:1px solid #dedede;
    border-bottom:1px solid #dedede;
}
.cms-weapon-table th{
    background:#ececec;
    color:#555;
    font-size:9px;
    font-weight:800;
    letter-spacing:.04em;
}
.cms-weapon-table th:nth-child(1){width:18%}
.cms-weapon-table th:nth-child(2){width:9%}
.cms-weapon-table th:nth-child(3){width:14%}
.cms-weapon-table th:nth-child(4){width:10%}
.cms-weapon-table th:nth-child(5){width:10%}
.cms-weapon-table th:nth-child(6){width:9%}
.cms-weapon-table th:nth-child(7){width:9%}
.cms-weapon-table th:nth-child(8){width:21%}
.cms-weapon-table td:last-child,
.cms-weapon-table th:last-child{border-right:0}
.cms-weapon-table tbody tr:last-child td{border-bottom:0}
.cms-sheet-editor .cms-weapon-table input{
    width:100% !important;
    margin:0 !important;
    padding:7px 6px !important;
    border:1px solid transparent !important;
    border-radius:4px !important;
    background:transparent !important;
}
.cms-sheet-editor .cms-weapon-table input:focus{
    border-color:#999 !important;
    background:#fff !important;
}
.cms-chatpalette-box{
    margin:0 0 18px;
    padding:15px;
    border:1px solid #c8c8c8;
    border-radius:10px;
    background:#f2f2f2;
}
.cms-chatpalette-head{
    display:flex;
    justify-content:space-between;
    gap:16px;
    align-items:center;
    margin-bottom:10px;
}
.cms-chatpalette-head h3{
    margin:2px 0 0;
}
.cms-sheet-editor #auto-palette-preview{
    min-height:220px !important;
    font-family:ui-monospace,SFMono-Regular,Consolas,monospace !important;
    font-size:12px !important;
    line-height:1.65 !important;
    background:#fff !important;
}
.cms-sheet-editor #chat-palette{
    min-height:220px !important;
    font-family:ui-monospace,SFMono-Regular,Consolas,monospace !important;
}
@media(max-width:640px){
    .cms-chatpalette-head{
        display:block;
    }
    .cms-chatpalette-head .cms-button{
        margin-top:10px !important;
        width:100% !important;
    }
}

/* requested public background must remain final */

/* v4.6.4 CHARACTER SHEET ICON UPLOAD */
.cms-sheet-card{display:grid;grid-template-columns:82px minmax(0,1fr);overflow:hidden}
.cms-sheet-card-thumb,.cms-sheet-card-noimage{width:82px;height:100%;min-height:126px}
.cms-sheet-card-thumb{object-fit:cover;background:#eee}
.cms-sheet-card-noimage{display:grid;place-items:center;background:#ececec;color:#aaa;font-size:9px;font-weight:800;letter-spacing:.08em}
.cms-sheet-card-content{min-width:0;padding:14px}
.cms-sheet-card-content>div{margin-top:8px}
.cms-sheet-icon-box input[type=file]{padding:8px !important;background:#f7f7f7 !important}
@media(max-width:640px){.cms-sheet-card{grid-template-columns:68px minmax(0,1fr)}.cms-sheet-card-thumb,.cms-sheet-card-noimage{width:68px}}
/* requested public background must remain final */

/* =========================================================
   v4.7 KP ASSET TOOLS
   ========================================================= */
.cms-kp-assets-intro{
    display:grid;
    grid-template-columns:minmax(0,1fr) 260px;
    gap:16px;
    margin:0 0 18px;
}
.cms-kp-assets-intro>div{
    padding:16px 18px;
    border:1px solid #c7c7c7;
    border-radius:10px;
    background:#fbfbfb;
}
.cms-kp-assets-intro strong{
    display:block;
    margin:3px 0 8px;
    font-size:1rem;
}
.cms-kp-assets-intro p{
    margin:0;
    color:#666;
    font-size:.78rem;
    line-height:1.7;
}
.cms-kp-assets-note{
    display:flex;
    flex-direction:column;
    justify-content:center;
}
.cms-kp-assets-note span{
    display:inline-block;
    align-self:flex-start;
    margin-bottom:7px;
    padding:4px 7px;
    border:1px solid #888;
    border-radius:999px;
    font-size:9px;
    font-weight:800;
    letter-spacing:.08em;
}
.cms-kp-assets-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
    margin:0 0 20px;
}
.cms-kp-asset-card{
    display:flex;
    min-height:190px;
    flex-direction:column;
    padding:18px;
    border:1px solid #bdbdbd;
    border-radius:12px;
    background:#fbfbfb;
    color:#333;
    text-decoration:none;
    transition:transform .14s ease,border-color .14s ease,background .14s ease;
}
.cms-kp-asset-card:hover{
    transform:translateY(-2px);
    border-color:#777;
    background:#fff;
}
.cms-kp-asset-card small{
    margin-bottom:8px;
    color:#777;
    font-size:9px;
    font-weight:800;
    letter-spacing:.1em;
}
.cms-kp-asset-card strong{
    font-size:1.08rem;
}
.cms-kp-asset-card p{
    margin:10px 0 18px;
    color:#666;
    font-size:.78rem;
    line-height:1.75;
}
.cms-kp-asset-card span{
    margin-top:auto;
    font-size:10px;
    font-weight:800;
    letter-spacing:.06em;
}
.cms-kp-assets-roadmap{
    margin-top:18px;
}
@media(max-width:760px){
    .cms-kp-assets-intro,
    .cms-kp-assets-grid{
        grid-template-columns:1fr;
    }
}
/* requested public background must remain final */

/* v4.7.1 KP ASSET HUB */
.cms-kp-assets-status{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 28px}
.cms-kp-assets-status>div{display:flex;flex-direction:column;gap:4px;padding:14px 16px;border:1px solid #c8c8c8;border-radius:10px;background:#fbfbfb}
.cms-kp-assets-status small{font-size:9px;font-weight:800;letter-spacing:.1em;color:#777}
.cms-kp-assets-status strong{font-size:.95rem}.cms-kp-assets-status span{font-size:.72rem;color:#707070}
.cms-kp-tool-section{margin:0 0 30px}
.cms-kp-tool-section>header{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:12px;padding-bottom:9px;border-bottom:1px solid #999}
.cms-kp-tool-section>header h2{margin:2px 0 0;font-size:1rem}
.cms-kp-tool-section>header>span{font-size:9px;font-weight:800;letter-spacing:.08em;color:#888}
.cms-kp-assets-grid{display:grid !important;grid-template-columns:repeat(3,minmax(0,1fr)) !important;gap:10px !important;margin:0 !important}
.cms-kp-asset-card{display:flex !important;min-height:165px !important;flex-direction:column !important;padding:15px 16px !important;border:1px solid #c3c3c3 !important;border-radius:10px !important;background:#fbfbfb !important;color:#333 !important;text-decoration:none !important}
.cms-kp-asset-card:hover{border-color:#777 !important;background:#fff !important;transform:translateY(-1px)}
.cms-kp-asset-card small{margin-bottom:8px !important;font-size:9px !important;font-weight:800 !important;letter-spacing:.09em !important;color:#777 !important}
.cms-kp-asset-card strong{font-size:.95rem !important;color:#2f2f2f !important}
.cms-kp-asset-card p{margin:9px 0 14px !important;color:#666 !important;font-size:.74rem !important;line-height:1.65 !important}
.cms-kp-asset-card>span{margin-top:auto !important;font-size:10px !important;font-weight:800 !important;color:#555 !important}
@media(max-width:900px){.cms-kp-assets-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important}}
@media(max-width:620px){.cms-kp-assets-status,.cms-kp-assets-grid{grid-template-columns:1fr !important}}
/* requested public background must remain final */

/* =========================================================
   v4.8 KP SCENARIO EDITOR + PREP
   ========================================================= */
.cms-editor-title{align-items:flex-start}.cms-editor-actions{display:flex;gap:8px;flex-wrap:wrap}
.cms-scenario-editor-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:18px;align-items:start}
.cms-scenario-editor-paper{min-width:0;padding:24px;border:1px solid #c6c6c6;border-radius:12px;background:#fff}
.cms-doc-toolbar{position:sticky;top:0;z-index:10;display:flex;gap:6px;flex-wrap:wrap;margin:-10px -10px 22px;padding:10px;border-bottom:1px solid #ddd;background:rgba(255,255,255,.96)}
.cms-doc-toolbar button,.cms-doc-block header button,.cms-doc-image-tools button{padding:7px 9px;border:1px solid #bbb;border-radius:6px;background:#f7f7f7;color:#333;font:inherit;font-size:11px;font-weight:700;cursor:pointer}
.cms-doc-block{margin:0 0 14px;padding:14px;border:1px solid #d0d0d0;border-radius:9px;background:#fff}
.cms-doc-block.type-heading{border-color:transparent;border-bottom:1px solid #aaa;border-radius:0;padding-left:0;padding-right:0}
.cms-doc-block.type-check{background:#f7f7f7}.cms-doc-block.type-info{border-left:4px solid #888}.cms-doc-block.type-secret{border-style:dashed;background:#fafafa}.cms-doc-block.type-memo{background:#efefef}
.cms-doc-block header{display:flex;justify-content:space-between;align-items:center;margin-bottom:9px}.cms-doc-block header small{font-size:9px;font-weight:800;letter-spacing:.1em;color:#777}.cms-doc-block header div{display:flex;gap:4px}
.cms-doc-block label{display:block;margin:0 0 9px}.cms-doc-block label>span{display:block;margin-bottom:5px;font-size:9px;font-weight:800;letter-spacing:.08em;color:#777}
.cms-doc-block input,.cms-doc-block textarea{width:100%;padding:9px;border:1px solid #bbb;border-radius:6px;background:#fff;font:inherit;line-height:1.65}
.cms-doc-heading-input{border:0 !important;border-radius:0 !important;padding:5px 0 !important;font-size:1.25rem !important;font-weight:800}
.cms-check-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.cms-doc-image{display:block;max-width:100%;max-height:520px;margin:10px auto;border-radius:7px}.cms-doc-image-tools{margin-bottom:8px}
.cms-doc-empty{padding:50px 20px;text-align:center;color:#999;border:1px dashed #ccc;border-radius:9px}
.cms-scenario-editor-side{position:sticky;top:12px;border:1px solid #c6c6c6;border-radius:12px;background:#fbfbfb;overflow:hidden}
.cms-editor-tabs{display:grid;grid-template-columns:repeat(3,1fr);border-bottom:1px solid #ccc}.cms-editor-tabs button{padding:11px 5px;border:0;border-right:1px solid #ddd;background:#eee;font-size:9px;font-weight:800;letter-spacing:.07em}.cms-editor-tabs button.active{background:#fff}
.cms-editor-sidepanel{display:none;padding:15px}.cms-editor-sidepanel.active{display:block}#outline-list{display:flex;flex-direction:column;gap:4px}#outline-list button{padding:8px;border:0;border-bottom:1px solid #ddd;background:transparent;text-align:left;font-size:12px;cursor:pointer}
.cms-variable-row{display:grid;grid-template-columns:.8fr 1.2fr 30px;gap:5px;margin-bottom:6px}.cms-variable-row input{min-width:0;padding:7px;border:1px solid #bbb;border-radius:5px}.cms-variable-row button{border:1px solid #bbb;border-radius:5px;background:#eee}
.cms-prep-item{display:grid !important;grid-template-columns:24px 1fr !important;align-items:center !important;gap:5px !important;margin:0 0 6px !important}.cms-prep-item input[type=checkbox]{width:auto !important}.cms-prep-item input[type=text]{width:100% !important;padding:7px !important}
.cms-prep-progress{margin:0 0 12px}.cms-prep-progress span{display:block;margin-bottom:5px;font-size:10px;font-weight:800}.cms-prep-progress>div{height:6px;background:#ddd;border-radius:99px;overflow:hidden}.cms-prep-progress i{display:block;height:100%;width:0;background:#555;transition:width .2s}
.cms-scenario-exportbar{display:flex;align-items:center;gap:10px;margin-top:15px}.cms-scenario-exportbar span{font-size:11px;color:#777}
@media(max-width:980px){.cms-scenario-editor-layout{grid-template-columns:1fr}.cms-scenario-editor-side{position:static}.cms-scenario-editor-paper{padding:14px}}
@media(max-width:620px){.cms-check-grid{grid-template-columns:1fr}.cms-scenario-exportbar{display:block}.cms-scenario-exportbar span{display:block;margin-top:8px}}
/* requested public background must remain final */

/* v4.9 scenario runtime */
.cms-editor-tabs{grid-template-columns:repeat(2,1fr)}
.cms-heading-options{display:flex;align-items:center;gap:10px;margin-top:7px}.cms-heading-options label{display:flex!important;align-items:center;gap:5px;margin:0!important;font-size:10px;font-weight:800}.cms-heading-options input{width:auto!important}.cms-heading-options select{padding:6px;border:1px solid #bbb;border-radius:5px;background:#fff;font-size:10px}
#outline-list button b{display:inline-block;margin-right:4px;padding:2px 4px;border:1px solid #aaa;border-radius:3px;font-size:7px}#outline-list button small{float:right;color:#888;font-size:8px}
/* requested public background must remain final */

/* =========================================================
   v5.0 SESSION PREP / Notion-like board
   ========================================================= */
.cms-prep-overview,.cms-prep-next,.cms-prep-add,.cms-prep-settings{margin-top:18px}
.cms-prep-overview-head,.cms-prep-detail-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}
.cms-prep-project-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:16px}
.cms-prep-project-card{display:block;padding:16px;border:1px solid #c7c7c7;border-radius:10px;background:#fff;color:#333!important;text-decoration:none!important}
.cms-prep-project-card:hover{border-color:#777}.cms-prep-project-card.is-archived{opacity:.58}
.cms-prep-card-top,.cms-prep-project-card footer{display:flex;justify-content:space-between;gap:8px}.cms-prep-card-top small,.cms-prep-project-card footer{font-size:9px;letter-spacing:.08em;color:#777}.cms-prep-card-top strong{font-size:1.2rem}.cms-prep-project-card h3{margin:12px 0 4px}.cms-prep-project-card p{margin:0 0 14px;color:#777;font-size:12px}
.cms-prep-meter,.cms-prep-score>div{height:7px;overflow:hidden;border-radius:99px;background:#ddd}.cms-prep-meter i,.cms-prep-score i{display:block;height:100%;background:#555}
.cms-prep-project-card footer{margin-top:9px}
.cms-prep-dialog{width:min(560px,calc(100% - 30px));border:1px solid #aaa;border-radius:12px;padding:20px;background:#fff}.cms-prep-dialog::backdrop{background:rgba(0,0,0,.3)}.cms-prep-dialog label,.cms-prep-settings label{display:block;margin:10px 0}.cms-prep-dialog label span,.cms-prep-settings label span{display:block;margin-bottom:4px;font-size:9px;font-weight:800;letter-spacing:.09em}.cms-prep-dialog input,.cms-prep-dialog select,.cms-prep-settings input,.cms-prep-settings select,.cms-prep-settings textarea{width:100%;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff}.cms-prep-dialog-actions{display:flex;justify-content:flex-end;gap:7px;margin-top:14px}
.cms-prep-detail-head{padding:20px;border:1px solid #c5c5c5;border-radius:11px;background:#fff}.cms-prep-score{flex:0 0 150px}.cms-prep-score strong{display:block;font-size:2.3rem;line-height:1}.cms-prep-score span{display:block;margin:6px 0 11px;font-size:9px;letter-spacing:.08em;color:#777}.cms-prep-meta{flex:1}.cms-prep-meta h2{margin:3px 0 5px}
.cms-prep-links{display:flex;gap:7px;flex-wrap:wrap;margin:12px 0}.cms-prep-links a{padding:7px 9px;border:1px solid #bbb;border-radius:6px;background:#fff;color:#333!important;text-decoration:none!important;font-size:9px;font-weight:800;letter-spacing:.05em}
.cms-prep-next{padding:16px;border:1px solid #c4c4c4;border-radius:10px;background:#eee}.cms-prep-next-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.cms-prep-next article{padding:12px;border:1px solid #c5c5c5;border-radius:8px;background:#fff}.cms-prep-next small,.cms-prep-next span{display:block;font-size:9px;color:#777}.cms-prep-next strong{display:block;margin:5px 0}
.cms-prep-board{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:18px;align-items:start}.cms-prep-column{min-width:0;padding:10px;border:1px solid #c7c7c7;border-radius:10px;background:#efefef}.cms-prep-column>header{display:flex;justify-content:space-between;margin:1px 2px 10px;font-size:10px;font-weight:800;letter-spacing:.08em}.cms-prep-column>header b{padding:1px 6px;border-radius:99px;background:#d5d5d5}
.cms-prep-task{margin-bottom:8px;padding:11px;border:1px solid #c7c7c7;border-radius:8px;background:#fff}.cms-prep-task-title{width:100%;border:0!important;border-bottom:1px solid #ddd!important;border-radius:0!important;padding:5px 0!important;font-weight:800}.cms-prep-task-tags{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:8px 0}.cms-prep-task label{display:grid;grid-template-columns:48px 1fr;gap:5px;align-items:center;margin:5px 0}.cms-prep-task label>span{font-size:8px;font-weight:800;color:#777}.cms-prep-task input,.cms-prep-task select,.cms-prep-task textarea{min-width:0;width:100%;padding:6px;border:1px solid #ccc;border-radius:5px;background:#fff;font-size:10px}.cms-prep-task textarea{resize:vertical}.cms-prep-task-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:7px}.cms-prep-task-bottom a{font-size:9px;font-weight:800;color:#333!important}.cms-prep-task-bottom label{display:flex!important;grid-template-columns:none!important;width:auto!important;font-size:8px}.cms-prep-task-bottom input{width:auto!important}
.cms-prep-add{padding:15px;border:1px solid #c5c5c5;border-radius:10px;background:#fff}.cms-prep-add-form{display:grid;grid-template-columns:2fr repeat(3,1fr);gap:6px}.cms-prep-add-form input,.cms-prep-add-form select{min-width:0;padding:7px;border:1px solid #bbb;border-radius:5px}.cms-prep-add-form input[name=custom_url],.cms-prep-add-form input[name=note],.cms-prep-add-form button{grid-column:auto}
.cms-prep-settings{padding:14px;border:1px solid #ccc;border-radius:10px;background:#fafafa}.cms-prep-settings summary{cursor:pointer;font-size:10px;font-weight:800;letter-spacing:.08em}
@media(max-width:1050px){.cms-prep-project-grid,.cms-prep-board{grid-template-columns:1fr 1fr}.cms-prep-next-grid{grid-template-columns:1fr 1fr}}
@media(max-width:720px){.cms-prep-project-grid,.cms-prep-board,.cms-prep-next-grid{grid-template-columns:1fr}.cms-prep-detail-head{display:block}.cms-prep-score{margin-bottom:18px}.cms-prep-add-form{grid-template-columns:1fr 1fr}.cms-prep-overview-head{display:block}.cms-prep-overview-head button{margin-top:10px}}
/* requested public background must remain final */

/* ========================================================= v5.1 PUBLIC ARCHIVE */
.cms-archive-hero{margin:0 0 24px;padding:22px 0;border-bottom:1px solid #bbb}.cms-archive-hero h2{margin:5px 0 8px;font-size:1.7rem}.cms-archive-hero p{max-width:720px}
.cms-archive-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.cms-archive-card{display:block;overflow:hidden;border:1px solid #c8c8c8;border-radius:10px;background:#fff;color:#333!important;text-decoration:none!important}.cms-archive-card:hover{border-color:#777}.cms-archive-thumb{display:flex;align-items:center;justify-content:center;aspect-ratio:4/3;background:#ececec;color:#999;font-size:10px}.cms-archive-thumb img{width:100%;height:100%;object-fit:cover}.cms-archive-card-body{padding:14px}.cms-archive-labels{display:flex;gap:5px;flex-wrap:wrap}.cms-archive-labels span{padding:3px 6px;border:1px solid #bbb;border-radius:99px;font-size:8px;letter-spacing:.07em}.cms-archive-card h3{margin:10px 0 6px}.cms-archive-card p{margin:0 0 8px;color:#666;font-size:12px;line-height:1.7}.cms-archive-card small{font-size:10px;color:#777}
.cms-archive-detail,.cms-tips-detail{max-width:1000px;margin:0 auto;padding:20px 0 50px}.cms-backlink{display:inline-block;margin-bottom:18px;color:#555!important;font-size:10px;font-weight:800}.cms-archive-detail-grid{display:grid;grid-template-columns:minmax(240px,40%) 1fr;gap:28px}.cms-archive-cover,.cms-tips-cover{width:100%;border:1px solid #bbb;border-radius:9px}.cms-archive-detail h2,.cms-tips-detail h2{margin:6px 0 9px;font-size:2rem}.cms-archive-lead{font-size:14px;line-height:1.9;color:#555}.cms-archive-text,.cms-tips-body{margin-top:22px;line-height:2;font-size:14px}.cms-archive-meta{padding:10px 0;border-top:1px solid #ddd;border-bottom:1px solid #ddd}.cms-archive-meta b{margin-right:12px;font-size:9px;letter-spacing:.09em}.cms-model-meta{display:grid;grid-template-columns:100px 1fr;margin:18px 0}.cms-model-meta dt,.cms-model-meta dd{padding:7px;border-bottom:1px solid #ddd}.cms-model-meta dt{font-size:9px;font-weight:800}.cms-model-meta dd{margin:0}.cms-model-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}.cms-archive-subsection{margin-top:34px;padding-top:20px;border-top:1px solid #aaa}.cms-archive-subsection h3{margin:5px 0 14px}.cms-archive-subsection div{line-height:1.9}
.cms-tips-filter{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:18px}.cms-tips-filter a{padding:6px 9px;border:1px solid #bbb;border-radius:99px;background:#fff;color:#555!important;text-decoration:none!important;font-size:9px}.cms-tips-filter a.active{background:#333;color:#fff!important;border-color:#333}.cms-tips-list article{display:grid;grid-template-columns:1fr auto;gap:16px;align-items:center;padding:17px 2px;border-bottom:1px solid #ccc}.cms-tips-list small{font-size:9px;color:#777}.cms-tips-list h3{margin:5px 0}.cms-tips-list h3 a{color:#222!important;text-decoration:none!important}.cms-tips-list p{margin:0;color:#666;font-size:12px}.cms-tips-list article>a{font-size:9px;font-weight:800;color:#333!important}
.cms-archive-editor label{display:block;margin:0 0 13px}.cms-archive-editor label>span{display:block;margin-bottom:5px;font-size:9px;font-weight:800;letter-spacing:.08em;color:#666}.cms-archive-editor input,.cms-archive-editor select,.cms-archive-editor textarea{width:100%;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;font:inherit}.cms-archive-editor .cms-checkline{display:flex;align-items:center;gap:7px}.cms-archive-editor .cms-checkline input{width:auto}.cms-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.cms-simple-admin-list article{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:12px 0;border-bottom:1px solid #ddd}.cms-simple-admin-list article>div:first-child{display:flex;flex-direction:column}.cms-simple-admin-list small,.cms-simple-admin-list span{font-size:9px;color:#777}.cms-simple-admin-list .cms-actions{display:flex;gap:8px;align-items:center}
@media(max-width:900px){.cms-archive-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cms-archive-detail-grid{grid-template-columns:1fr}.cms-archive-cover{max-width:560px}.cms-form-grid{grid-template-columns:1fr 1fr}}
@media(max-width:580px){.cms-archive-grid,.cms-form-grid{grid-template-columns:1fr}.cms-simple-admin-list article{align-items:flex-start;flex-direction:column}}
/* requested public background must remain final */

/* =========================================================
   v5.1.1 BLOG CARD REDESIGN
   ========================================================= */
.cms-blog-page .cms-blog-index{width:100%}
.cms-blog-page .cms-blog-index-head{
    display:flex;
    justify-content:space-between;
    gap:24px;
    align-items:flex-end;
    margin:0 0 18px;
    padding:22px 0 20px;
    border-bottom:1px solid var(--line);
}
.cms-blog-page .cms-blog-index-head h2{margin:4px 0 7px;font-size:1.65rem}
.cms-blog-page .cms-blog-index-head p{margin:0;color:var(--muted);font-size:.78rem}
.cms-blog-page .cms-blog-current-filter{
    flex:0 0 auto;
    padding:7px 10px;
    border:1px solid var(--line);
    border-radius:99px;
    background:var(--surface);
    color:var(--muted);
    font-size:.58rem;
    font-weight:800;
    letter-spacing:.07em;
}
.cms-blog-page .cms-blog-current-filter strong{margin-left:5px;color:var(--ink)}
.cms-blog-page .blog-category-nav{margin-bottom:22px}
.cms-blog-page .cms-blog-card-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px 14px;
}
.cms-blog-page .cms-blog-card{
    display:flex;
    min-width:0;
    flex-direction:column;
    overflow:hidden;
    border:1px solid var(--line);
    border-radius:10px;
    background:var(--surface);
    color:var(--ink);
    text-decoration:none;
    transition:transform .15s ease,border-color .15s ease;
}
.cms-blog-page .cms-blog-card:hover{
    transform:translateY(-2px);
    border-color:#888;
}
.cms-blog-page .cms-blog-card.is-featured{
    grid-column:span 2;
}
.cms-blog-page .cms-blog-card-media{
    position:relative;
    aspect-ratio:16/9;
    overflow:hidden;
    border-bottom:1px solid var(--line);
    background:#ececec;
}
.cms-blog-page .cms-blog-card.is-featured .cms-blog-card-media{
    aspect-ratio:2/1;
}
.cms-blog-page .cms-blog-card-media img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
    transition:transform .25s ease;
}
.cms-blog-page .cms-blog-card:hover .cms-blog-card-media img{
    transform:scale(1.015);
}
.cms-blog-page .cms-blog-card-placeholder{
    display:flex;
    height:100%;
    flex-direction:column;
    justify-content:flex-end;
    padding:16px;
    background:
        linear-gradient(135deg,transparent 0 48%,rgba(0,0,0,.04) 48% 52%,transparent 52% 100%),
        #ededed;
}
.cms-blog-page .cms-blog-card-placeholder span{
    margin-bottom:3px;
    color:#777;
    font-size:.55rem;
    font-weight:800;
    letter-spacing:.1em;
}
.cms-blog-page .cms-blog-card-placeholder b{
    color:#555;
    font-size:1.25rem;
    letter-spacing:.08em;
}
.cms-blog-page .cms-blog-card-external{
    position:absolute;
    top:9px;
    right:9px;
    padding:4px 7px;
    border:1px solid rgba(255,255,255,.8);
    border-radius:99px;
    background:rgba(30,30,30,.72);
    color:#fff;
    font-size:.48rem;
    font-weight:800;
    letter-spacing:.08em;
}
.cms-blog-page .cms-blog-card-content{
    display:flex;
    flex:1;
    flex-direction:column;
    padding:14px;
}
.cms-blog-page .cms-blog-card-meta{
    display:flex;
    justify-content:space-between;
    gap:9px;
    color:var(--muted);
    font-size:.55rem;
    font-weight:800;
    letter-spacing:.06em;
}
.cms-blog-page .cms-blog-card-content h3{
    margin:9px 0 7px;
    font-size:.92rem;
    line-height:1.55;
}
.cms-blog-page .cms-blog-card.is-featured .cms-blog-card-content h3{
    font-size:1.12rem;
}
.cms-blog-page .cms-blog-card-content p{
    display:-webkit-box;
    overflow:hidden;
    margin:0 0 14px;
    color:#666;
    font-size:.7rem;
    line-height:1.75;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:3;
}
.cms-blog-page .cms-blog-card-content p.is-muted{color:#999}
.cms-blog-page .cms-blog-card-read{
    margin-top:auto;
    padding-top:9px;
    border-top:1px solid #e1e1e1;
    font-size:.55rem;
    font-weight:800;
    letter-spacing:.08em;
}
@media(max-width:960px){
    .cms-blog-page .cms-blog-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .cms-blog-page .cms-blog-card.is-featured{grid-column:span 2}
}
@media(max-width:620px){
    .cms-blog-page .cms-blog-index-head{display:block}
    .cms-blog-page .cms-blog-current-filter{display:inline-block;margin-top:12px}
    .cms-blog-page .cms-blog-card-grid{grid-template-columns:1fr}
    .cms-blog-page .cms-blog-card.is-featured{grid-column:auto}
    .cms-blog-page .cms-blog-card.is-featured .cms-blog-card-media,
    .cms-blog-page .cms-blog-card-media{aspect-ratio:16/9}
}
/* requested public background must remain final */

/* =========================================================
   v5.1.3 BLOG GRID HOTFIX
   Keep every card the same footprint; override legacy blog card rules.
   ========================================================= */
body.cms-blog-page .cms-blog-card-grid{
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    grid-auto-flow:row !important;
    align-items:stretch !important;
    gap:14px !important;
}
body.cms-blog-page .cms-blog-card,
body.cms-blog-page .cms-blog-card.is-featured{
    display:flex !important;
    flex-direction:column !important;
    grid-column:auto !important;
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    height:100% !important;
    margin:0 !important;
    padding:0 !important;
    overflow:hidden !important;
    border:1px solid #bdbdbd !important;
    border-radius:10px !important;
    background:#fff !important;
    box-shadow:none !important;
}
body.cms-blog-page .cms-blog-card-media,
body.cms-blog-page .cms-blog-card.is-featured .cms-blog-card-media{
    display:block !important;
    width:100% !important;
    height:auto !important;
    aspect-ratio:16/9 !important;
    flex:0 0 auto !important;
    overflow:hidden !important;
    border-bottom:1px solid #c8c8c8 !important;
    background:#ececec !important;
}
body.cms-blog-page .cms-blog-card-media img{
    display:block !important;
    width:100% !important;
    height:100% !important;
    object-fit:cover !important;
}
body.cms-blog-page .cms-blog-card-content{
    display:flex !important;
    flex:1 1 auto !important;
    flex-direction:column !important;
    width:100% !important;
    min-height:160px !important;
    padding:13px !important;
    background:#fff !important;
}
body.cms-blog-page .cms-blog-card-content h3,
body.cms-blog-page .cms-blog-card.is-featured .cms-blog-card-content h3{
    margin:8px 0 6px !important;
    font-size:.9rem !important;
    line-height:1.55 !important;
}
body.cms-blog-page .cms-blog-card-content p{
    margin:0 0 12px !important;
    font-size:.68rem !important;
    line-height:1.7 !important;
}
body.cms-blog-page .cms-blog-card-read{
    display:block !important;
    margin-top:auto !important;
    padding-top:9px !important;
}
@media(max-width:960px){
    body.cms-blog-page .cms-blog-card-grid{
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
}
@media(max-width:620px){
    body.cms-blog-page .cms-blog-card-grid{
        grid-template-columns:1fr !important;
    }
    body.cms-blog-page .cms-blog-card-content{
        min-height:0 !important;
    }
}
/* requested public background must remain final */

/* ========================================================= v5.2 CHARACTER POMODORO */
.cms-pomo-shell{max-width:1050px;margin:0 auto;padding-bottom:50px}.cms-pomo-head{display:flex;justify-content:space-between;gap:24px;align-items:end;padding:22px 0 18px;border-bottom:1px solid #bbb}.cms-pomo-head h2{margin:4px 0 6px;font-size:1.7rem}.cms-pomo-head p{margin:0;color:#666}.cms-pomo-character-select label{font-size:9px;font-weight:800;letter-spacing:.08em}.cms-pomo-character-select select{display:block;min-width:190px;margin-top:5px;padding:8px;border:1px solid #aaa;border-radius:7px;background:#fff}
.cms-pomo-stage{display:grid;grid-template-columns:minmax(280px,.85fr) minmax(360px,1.15fr);gap:22px;padding-top:22px}.cms-pomo-character,.cms-pomo-timer{border:1px solid #bbb;border-radius:12px;background:#fff;overflow:hidden}.cms-pomo-character{position:relative;display:flex;min-height:560px;flex-direction:column}.cms-pomo-visual{display:flex;flex:1;align-items:flex-end;justify-content:center;min-height:390px;padding:18px 18px 0;background:linear-gradient(180deg,#eee,#f8f8f8)}.cms-pomo-visual img{display:block;max-width:100%;max-height:430px;object-fit:contain;object-position:center bottom}.cms-pomo-noimage{margin:auto;color:#aaa;font-size:10px}.cms-pomo-name{display:flex;align-items:baseline;gap:10px;padding:13px 16px 8px;border-top:1px solid #ddd}.cms-pomo-name small{font-size:8px;letter-spacing:.12em;color:#777}.cms-pomo-name strong{font-size:1.1rem}.cms-pomo-speech{position:relative;margin:0 16px 16px;padding:13px 14px;border:1px solid #aaa;border-radius:9px;background:#fafafa;font-size:13px;line-height:1.75}.cms-pomo-speech:before{content:"";position:absolute;top:-6px;left:22px;width:10px;height:10px;border-left:1px solid #aaa;border-top:1px solid #aaa;background:#fafafa;transform:rotate(45deg)}
.cms-pomo-timer{padding:24px}.cms-pomo-mode-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}.cms-pomo-mode-tabs button{padding:8px 5px;border:1px solid #bbb;border-radius:7px;background:#f7f7f7;font-size:8px;font-weight:800;letter-spacing:.06em;cursor:pointer}.cms-pomo-mode-tabs button.is-active{background:#333;color:#fff;border-color:#333}.cms-pomo-clock{padding:48px 0 34px;text-align:center;font-size:clamp(4.2rem,10vw,7.6rem);font-weight:800;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-.05em}.cms-pomo-progress{height:5px;overflow:hidden;border-radius:99px;background:#e5e5e5}.cms-pomo-progress i{display:block;width:0;height:100%;background:#444;transition:width .2s linear}.cms-pomo-controls{display:flex;justify-content:center;gap:8px;margin:22px 0}.cms-pomo-settings{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;padding-top:18px;border-top:1px solid #ddd}.cms-pomo-settings label{font-size:8px;font-weight:800;color:#666}.cms-pomo-settings input{width:100%;margin-top:5px;padding:7px;border:1px solid #bbb;border-radius:6px;background:#fff}.cms-pomo-rounds{display:flex;align-items:center;gap:10px;margin-top:18px;padding:10px 0;border-top:1px solid #ddd;border-bottom:1px solid #ddd}.cms-pomo-rounds span{font-size:8px;font-weight:800;letter-spacing:.08em}.cms-pomo-rounds strong{font-size:1.2rem}.cms-pomo-rounds button{margin-left:auto;border:0;background:none;font-size:8px;text-decoration:underline;cursor:pointer}.cms-pomo-note{margin:12px 0 0;color:#888;font-size:9px;line-height:1.7}
.cms-pomo-admin label>span,.cms-pomo-message-form label>span{display:block;margin-bottom:5px;font-size:9px;font-weight:800;letter-spacing:.08em}.cms-pomo-admin select,.cms-pomo-message-form input,.cms-pomo-message-form select{width:100%;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff}.cms-pomo-message-form{display:grid;grid-template-columns:180px 1fr 90px auto;gap:8px;align-items:end;margin-top:18px;padding-top:18px;border-top:1px solid #ddd}.cms-pomo-message-form label{margin:0}.cms-pomo-message-list{margin-top:20px}.cms-pomo-message-list article{display:flex;justify-content:space-between;gap:12px;padding:11px 0;border-bottom:1px solid #ddd}.cms-pomo-message-list small{font-size:8px;color:#777}.cms-pomo-message-list p{margin:3px 0 0}
@media(max-width:800px){.cms-pomo-stage{grid-template-columns:1fr}.cms-pomo-character{min-height:460px}.cms-pomo-visual{min-height:320px}.cms-pomo-message-form{grid-template-columns:1fr 1fr}.cms-pomo-message-form label:nth-child(2){grid-column:1/-1}}
@media(max-width:560px){.cms-pomo-head{display:block}.cms-pomo-character-select{margin-top:14px}.cms-pomo-character-select select{width:100%}.cms-pomo-timer{padding:16px}.cms-pomo-clock{padding:38px 0 28px}.cms-pomo-settings{grid-template-columns:1fr}.cms-pomo-message-form{grid-template-columns:1fr}}
/* requested public background must remain final */

/* v5.2.1 POMODORO INTERACTION */
.cms-pomo-visual.mode-waist{min-height:360px;max-height:420px}
.cms-pomo-visual.mode-waist img{max-height:none;height:520px;width:auto;object-fit:contain;object-position:center top;transform:translateY(36px)}
.cms-pomo-visual.mode-bust{min-height:320px;max-height:360px}
.cms-pomo-visual.mode-bust img{max-height:none;height:620px;width:auto;object-fit:contain;object-position:center top;transform:translateY(105px)}
.cms-pomo-visual.mode-full img{max-height:430px;transform:none}
button.cms-pomo-speech{width:auto;text-align:left;color:#333;cursor:pointer;font:inherit}
button.cms-pomo-speech:hover{border-color:#777}
.cms-pomo-audio-row{display:flex;align-items:center;gap:10px;margin-top:14px;padding-top:14px;border-top:1px solid #ddd}
.cms-pomo-audio-row button{padding:6px 9px;border:1px solid #bbb;border-radius:6px;background:#f7f7f7;font-size:8px;font-weight:800}
.cms-pomo-audio-row label{display:flex;align-items:center;gap:7px;font-size:8px;font-weight:800}
.cms-pomo-audio-row input[type=range]{width:120px}
.cms-pomo-settings-admin{margin:20px 0;padding:16px;border:1px solid #ccc;border-radius:9px;background:#fafafa}
.cms-pomo-settings-admin label{display:block;margin:10px 0}.cms-pomo-settings-admin label>span{display:block;margin-bottom:5px;font-size:9px;font-weight:800;letter-spacing:.07em}.cms-pomo-settings-admin input,.cms-pomo-settings-admin select{width:100%;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff}
@media(max-width:800px){.cms-pomo-visual.mode-waist img{height:470px}.cms-pomo-visual.mode-bust img{height:540px}}
/* requested public background must remain final */

/* v5.2.2 POMODORO AUDIO LIBRARY */
.cms-pomo-audio-box{margin-top:14px;padding-top:14px;border-top:1px solid #ddd}
.cms-pomo-bgm-select{display:block;font-size:8px;font-weight:800;letter-spacing:.06em}
.cms-pomo-bgm-select select{display:block;width:100%;margin-top:5px;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff}
.cms-pomo-audio-box .cms-pomo-audio-row{margin-top:8px;padding-top:0;border-top:0}
.cms-pomo-audio-credit{min-height:1em;margin:7px 0 0;color:#777;font-size:8px}
.cms-pomo-audio-credit.has-source{cursor:pointer;text-decoration:underline}
.cms-pomo-audio-library-admin{margin:24px 0;padding:18px;border:1px solid #ccc;border-radius:10px;background:#fff}
.cms-pomo-audio-library-admin h2{margin:3px 0 6px}.cms-pomo-audio-library-form{display:grid;grid-template-columns:1fr 1.4fr 1fr 1.4fr 80px;gap:8px;align-items:end;margin-top:15px}
.cms-pomo-audio-library-form label>span{display:block;margin-bottom:5px;font-size:9px;font-weight:800}.cms-pomo-audio-library-form input{width:100%;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff}.cms-pomo-audio-library-form .cms-checkline{grid-column:1/-2}.cms-pomo-audio-library-list{margin-top:16px}.cms-pomo-audio-library-list article{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid #ddd}.cms-pomo-audio-library-list small{display:block;color:#777;font-size:8px}.cms-pomo-audio-library-list strong{display:block;margin-top:3px}.cms-pomo-audio-library-list p{margin:3px 0 0;color:#666;font-size:10px}
@media(max-width:900px){.cms-pomo-audio-library-form{grid-template-columns:1fr 1fr}.cms-pomo-audio-library-form .cms-checkline{grid-column:1/-1}}
@media(max-width:560px){.cms-pomo-audio-row{flex-wrap:wrap}.cms-pomo-audio-library-form{grid-template-columns:1fr}}
/* requested public background must remain final */

/* v5.2.3 POMODORO STANDING VISUAL + CLICK FIX */
.cms-pomo-character{overflow:hidden}
.cms-pomo-visual.mode-full-standing{
    position:relative;
    display:flex;
    align-items:flex-end;
    justify-content:center;
    min-height:390px;
    height:390px;
    max-height:390px;
    padding:10px 14px 0;
    overflow:hidden;
    cursor:pointer;
    outline:none;
}
.cms-pomo-visual.mode-full-standing:focus-visible{
    box-shadow:inset 0 0 0 2px #555;
}
.cms-pomo-visual.mode-full-standing img{
    display:block;
    width:100%;
    height:100%;
    max-width:100%;
    max-height:100%;
    object-fit:contain !important;
    object-position:center bottom !important;
    transform:none !important;
    pointer-events:none;
    user-select:none;
}
button.cms-pomo-speech{
    position:relative;
    z-index:2;
    display:block;
    width:calc(100% - 32px);
    margin:0 16px 8px;
    appearance:none;
    -webkit-appearance:none;
    pointer-events:auto !important;
    cursor:pointer !important;
}
button.cms-pomo-speech.is-talking{
    animation:cmsPomoTalk .18s ease-out;
}
.cms-pomo-talkhint{
    margin:0 16px 14px;
    color:#999;
    font-size:8px;
    line-height:1.5;
    text-align:right;
}
@keyframes cmsPomoTalk{
    0%{transform:translateY(1px);opacity:.78}
    100%{transform:translateY(0);opacity:1}
}
@media(max-width:800px){
    .cms-pomo-visual.mode-full-standing{
        min-height:340px;
        height:340px;
        max-height:340px;
    }
}
@media(max-width:560px){
    .cms-pomo-visual.mode-full-standing{
        min-height:300px;
        height:300px;
        max-height:300px;
    }
}
/* requested public background must remain final */

/* v5.2.4 POMODORO GLOBAL SE */
.cms-pomo-global-se-admin{margin:24px 0;padding:18px;border:1px solid #ccc;border-radius:10px;background:#fff}
.cms-pomo-global-se-admin h2{margin:3px 0 6px}
.cms-pomo-global-se-form{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-top:15px;align-items:end}
.cms-pomo-global-se-form label>span{display:block;margin-bottom:5px;font-size:9px;font-weight:800;letter-spacing:.06em}
.cms-pomo-global-se-form input{width:100%;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff}
.cms-pomo-global-se-form label:nth-of-type(4),.cms-pomo-global-se-form label:nth-of-type(5){grid-column:span 1}
@media(max-width:800px){.cms-pomo-global-se-form{grid-template-columns:1fr 1fr}}
@media(max-width:560px){.cms-pomo-global-se-form{grid-template-columns:1fr}}
/* requested public background must remain final */

/* =========================================================
   v5.3 KP SCENARIO EDITOR — NOTEBOOK / OUTLINE UI
   ========================================================= */
body.cms-admin:has(.cms-se53){overflow:hidden}
.cms-se53{position:relative;height:calc(100vh - 44px);min-height:620px;margin:-22px -24px -30px;background:#f3f3f3;color:#222}
.cms-se53-form{height:100%;margin:0}
.cms-se53-topbar{position:relative;z-index:40;display:grid;grid-template-columns:250px 1fr auto;align-items:center;height:54px;border-bottom:1px solid #d3d3d3;background:#fff}
.cms-se53-brand{display:flex;align-items:center;min-width:0;height:100%;border-right:1px solid #ddd;padding:0 12px}
.cms-se53-back{display:grid;place-items:center;width:30px;height:30px;margin-right:8px;border-radius:6px;color:#777;font-size:25px;text-decoration:none}
.cms-se53-brand div{min-width:0}.cms-se53-brand small{display:block;color:#8c8c8c;font-size:7px;font-weight:800;letter-spacing:.08em}.cms-se53-brand strong{display:block;max-width:185px;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.cms-se53-tools{display:flex;justify-content:center;align-items:stretch;height:100%}.cms-se53-tools button{min-width:42px;height:54px;border:0;border-left:1px solid #eee;background:#fff;font-size:10px;font-weight:800;cursor:pointer}.cms-se53-tools button:hover{background:#f0f0f0}.cms-se53-tools span{width:8px;border-left:1px solid #ddd}
.cms-se53-actions{display:flex;align-items:center;gap:7px;padding:0 12px}.cms-se53-actions>span{color:#999;font-size:8px}.cms-se53-actions>span.is-dirty{color:#8b6c27}.cms-se53-actions button{border:1px solid #bbb;border-radius:6px;background:#fff;padding:7px 10px;font-size:9px;cursor:pointer}.cms-se53-actions .cms-se53-save{border-color:#333;background:#333;color:#fff}
.cms-se53-notice{position:absolute;z-index:60;top:62px;left:50%;transform:translateX(-50%);margin:0;box-shadow:0 5px 18px rgba(0,0,0,.08)}
.cms-se53-workspace{position:relative;display:grid;grid-template-columns:250px minmax(0,1fr);height:calc(100% - 54px)}
.cms-se53-sidebar{position:relative;z-index:20;display:flex;flex-direction:column;overflow:hidden;border-right:1px solid #d3d3d3;background:#fafafa;transition:width .2s}
.cms-se53-sidehead{display:flex;justify-content:space-between;align-items:center;padding:15px 16px 9px}.cms-se53-sidehead strong{font-size:11px}.cms-se53-sidehead button{border:0;background:none;color:#777;cursor:pointer}
.cms-se53-outline{flex:1;overflow:auto;padding:2px 8px 130px}.cms-se53-outline-item{display:grid;grid-template-columns:14px minmax(0,1fr) auto;align-items:center;width:100%;padding:6px 7px;border:0;border-radius:4px;background:transparent;color:#333;text-align:left;font-size:10px;cursor:pointer}.cms-se53-outline-item:hover{background:#ececec}.cms-se53-outline-item.level-2{padding-left:19px;color:#555}.cms-se53-outline-item.level-3{padding-left:34px;color:#666;font-size:9px}.cms-se53-outline-item small{color:#aaa;font-size:6px}.cms-se53-outline-empty{padding:10px;color:#999;font-size:9px;line-height:1.6}
.cms-se53-addchapter{margin:0 12px 145px;padding:8px;border:0;background:transparent;text-align:left;font-size:9px;cursor:pointer}
.cms-se53-sidebottom{position:absolute;bottom:0;left:0;right:0;padding:8px 10px;border-top:1px solid #ddd;background:#fafafa}.cms-se53-sidebottom a,.cms-se53-sidebottom button{display:block;width:100%;padding:6px 7px;border:0;background:transparent;color:#333;text-align:left;text-decoration:none;font-size:9px;cursor:pointer}.cms-se53-sidebottom a:hover,.cms-se53-sidebottom button:hover{background:#eee}
.cms-se53-main{overflow:auto;padding:34px 45px 80px;background:#f3f3f3}.cms-se53-paper{width:min(820px,100%);min-height:calc(100vh - 145px);margin:0 auto;padding:40px 48px 70px;border:1px solid #e6e6e6;border-radius:9px;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.02)}
.cms-se53-titleline{margin-bottom:34px}.cms-se53-titleline h1{margin:5px 0 0;font-size:29px;line-height:1.35}
.cms-se53-blocks{display:block}.cms-se53-block{position:relative;margin:0 -28px;padding:4px 28px;border:1px solid transparent;border-radius:6px;transition:.15s}.cms-se53-block:hover{border-color:#e5e5e5;background:#fdfdfd}.cms-se53-block.is-target{background:#fff9dc;border-color:#e1d197}
.cms-se53-blockrail{position:absolute;left:1px;top:8px;opacity:0;display:flex;align-items:center;gap:2px;transition:.15s}.cms-se53-block:hover .cms-se53-blockrail{opacity:1}.cms-se53-blockrail button{border:0;background:transparent;color:#aaa;font-size:9px;cursor:pointer}.cms-se53-blockrail .drag{font-size:13px}.cms-se53-blockmenu{display:flex}
.cms-se53-blockbody{min-width:0}.cms-se53-headingrow{display:flex;align-items:center;gap:8px;padding:12px 0 4px}.cms-se53-hlevel{color:#aaa;font-size:8px;font-weight:800}.cms-se53-heading-input{flex:1;min-width:0;border:0!important;border-bottom:1px solid #ddd!important;border-radius:0!important;background:transparent!important;padding:5px 0!important;font-weight:700!important;outline:none}.cms-se53-heading-input.level-1{font-size:22px!important}.cms-se53-heading-input.level-2{font-size:17px!important}.cms-se53-heading-input.level-3{font-size:13px!important}.cms-se53-pagecheck{font-size:7px;color:#777;white-space:nowrap}.cms-se53-headingrow select{width:auto!important;padding:4px!important;font-size:7px!important}
.cms-se53-field{display:block;margin:0;padding:6px 0}.cms-se53-field>span,.cms-se53-inlinefield>span{display:block;margin-bottom:4px;color:#9a9a9a;font-size:7px;font-weight:800;letter-spacing:.08em}.cms-se53-field textarea{display:block;width:100%;resize:vertical;border:0!important;border-radius:0!important;background:transparent!important;padding:4px 0!important;color:#2b2b2b;font-family:Meiryo,"Yu Gothic",sans-serif;font-size:12px;line-height:2;outline:none}.cms-se53-field textarea:focus{background:#fffef8!important}.cms-se53-inlinefield{display:block;margin:8px 0}.cms-se53-inlinefield input{width:100%;border:0!important;border-bottom:1px solid #ddd!important;border-radius:0!important;background:transparent!important;padding:5px 0!important}
.cms-se53-block.type-info,.cms-se53-block.type-secret,.cms-se53-block.type-memo,.cms-se53-block.type-check{margin-top:10px;margin-bottom:10px;padding-top:10px;padding-bottom:10px;border-left:3px solid #aaa!important;background:#fafafa}.cms-se53-block.type-secret{border-left-style:dashed!important}.cms-se53-block.type-memo{background:#f7f7f7}.cms-se53-checkgrid{display:grid;grid-template-columns:1fr 1fr;gap:5px 14px}
.cms-se53-imagebar{margin:8px 0}.cms-se53-imagebar button{padding:6px 9px;border:1px solid #bbb;border-radius:5px;background:#fff;font-size:8px}.cms-se53-docimage{display:block;max-width:100%;max-height:480px;margin:12px auto;object-fit:contain}
.cms-se53-bottomadd{display:block;width:100%;margin-top:18px;padding:10px;border:1px dashed #ddd;border-radius:6px;background:#fafafa;color:#888;font-size:9px;cursor:pointer}
.cms-se53-drawer{position:absolute;z-index:35;top:0;right:0;width:330px;height:100%;overflow:auto;border-left:1px solid #ccc;background:#fff;padding:18px;transform:translateX(101%);transition:transform .2s;box-shadow:-10px 0 25px rgba(0,0,0,.04)}.cms-se53-drawer.is-open{transform:translateX(0)}.cms-se53-drawer header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.cms-se53-drawer header button{border:0;background:none;font-size:20px;cursor:pointer}
.cms-se53-moremenu{display:none;position:absolute;z-index:80;right:10px;top:8px;width:180px;padding:7px;border:1px solid #ccc;border-radius:7px;background:#fff;box-shadow:0 8px 24px rgba(0,0,0,.1)}.cms-se53-moremenu.is-open{display:block}.cms-se53-moremenu a,.cms-se53-moremenu button{display:block;width:100%;padding:8px;border:0;background:transparent;color:#333;text-align:left;text-decoration:none;font-size:9px;cursor:pointer}.cms-se53-moremenu a:hover,.cms-se53-moremenu button:hover{background:#eee}
.cms-se53 .cms-variable-row{display:grid;grid-template-columns:1fr 1fr 28px;gap:5px;margin:6px 0}.cms-se53 .cms-variable-row input{min-width:0;padding:6px;border:1px solid #bbb;border-radius:5px}.cms-se53 .cms-variable-row button{border:0;background:none;cursor:pointer}
@media(max-width:950px){.cms-se53-topbar{grid-template-columns:190px 1fr auto}.cms-se53-workspace{grid-template-columns:210px minmax(0,1fr)}.cms-se53-tools button{min-width:34px;font-size:8px}.cms-se53-main{padding:24px}.cms-se53-paper{padding:32px}}
@media(max-width:720px){body.cms-admin:has(.cms-se53){overflow:auto}.cms-se53{height:auto;min-height:100vh;margin:-16px}.cms-se53-topbar{position:sticky;top:0;grid-template-columns:1fr auto;height:auto;min-height:52px}.cms-se53-brand{border-right:0}.cms-se53-tools{grid-column:1/-1;order:3;overflow-x:auto;justify-content:flex-start;border-top:1px solid #eee}.cms-se53-tools button{flex:0 0 48px;height:42px}.cms-se53-actions>span{display:none}.cms-se53-workspace{display:block;height:auto}.cms-se53-sidebar{position:relative;height:auto;max-height:220px;border-right:0;border-bottom:1px solid #ccc}.cms-se53-outline{max-height:145px;padding-bottom:8px}.cms-se53-sidebottom{display:none}.cms-se53-addchapter{margin-bottom:8px}.cms-se53-main{overflow:visible;padding:14px}.cms-se53-paper{min-height:70vh;padding:24px 18px}.cms-se53-drawer{position:fixed;top:0;height:100vh;width:min(340px,92vw)}.cms-se53-pagecheck{display:none}.cms-se53-checkgrid{grid-template-columns:1fr}}
/* requested public background must remain final */

/* =========================================================
   v5.3.1 KP SCENARIO EDITOR — LAYOUT / CLIPPING POLISH
   ========================================================= */
.cms-se53-main{
    min-width:0;
    padding-left:clamp(20px,3vw,44px);
    padding-right:clamp(20px,3vw,44px);
}
.cms-se53-paper{
    width:min(920px,100%);
    box-sizing:border-box;
}
.cms-se53-workspace.has-drawer .cms-se53-main{
    padding-right:360px;
}
.cms-se53-workspace.has-drawer .cms-se53-paper{
    width:min(900px,100%);
}
.cms-se53-block,
.cms-se53-blockbody,
.cms-se53-headingrow,
.cms-se53-field,
.cms-se53-field textarea,
.cms-se53-inlinefield,
.cms-se53-inlinefield input{
    min-width:0;
    box-sizing:border-box;
}
.cms-se53-field textarea{
    height:auto;
    min-height:42px;
    max-height:none;
    overflow:hidden !important;
    resize:none !important;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
    word-break:break-word;
}
.cms-se53-headingrow{
    display:grid;
    grid-template-columns:auto minmax(0,1fr) auto auto;
    align-items:center;
}
.cms-se53-heading-input{
    width:100%;
}
.cms-se53-pagecheck,
.cms-se53-headingrow select{
    flex:0 0 auto;
}
.cms-se53-outline-item{
    min-width:0;
}
.cms-se53-outline-item>span:nth-child(2){
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.cms-se53-docimage{
    width:auto;
    max-width:100% !important;
    height:auto;
}
.cms-se53-block.type-image{
    overflow:hidden;
}
.cms-se53-imagebar,
.cms-se53-inlinefield{
    max-width:100%;
}
.cms-se53-inlinefield input{
    overflow:hidden;
    text-overflow:ellipsis;
}
@media(max-width:1180px){
    .cms-se53-workspace.has-drawer .cms-se53-main{
        padding-right:330px;
        padding-left:20px;
    }
    .cms-se53-paper{
        padding-left:34px;
        padding-right:34px;
    }
    .cms-se53-headingrow{
        grid-template-columns:auto minmax(0,1fr) auto;
    }
    .cms-se53-headingrow select{
        grid-column:3;
    }
    .cms-se53-pagecheck{
        grid-column:2 / 4;
        justify-self:end;
        margin-top:2px;
    }
}
@media(max-width:950px){
    .cms-se53-workspace.has-drawer .cms-se53-main{
        padding-right:20px;
    }
    .cms-se53-drawer{
        position:fixed;
        top:44px;
        right:0;
        height:calc(100vh - 44px);
        z-index:90;
        box-shadow:-12px 0 28px rgba(0,0,0,.09);
    }
}
@media(max-width:720px){
    .cms-se53-paper{
        width:100%;
        padding-left:18px;
        padding-right:18px;
    }
    .cms-se53-headingrow{
        grid-template-columns:auto minmax(0,1fr);
        gap:5px 7px;
    }
    .cms-se53-pagecheck,
    .cms-se53-headingrow select{
        grid-column:2;
        justify-self:start;
    }
}
/* requested public background must remain final */
/* v5.3.2 SCENARIO TRIGGER CHECK SAVE HOTFIX */
.cms-scenario-trigger-savebar{display:flex;align-items:center;gap:12px;margin-top:16px;padding-top:14px;border-top:1px solid #ddd}.cms-scenario-trigger-savebar span{color:#777;font-size:10px}.cms-scenario-trigger-savebar span.is-saved{color:#3f6b4f;font-weight:700}@media(max-width:620px){.cms-scenario-trigger-savebar{align-items:flex-start;flex-direction:column}}
/* requested public background must remain final */

/* v5.4 KP HANDOUT CARD MAKER */
.cms-hm{max-width:1500px;margin:0 auto;padding:8px 0 40px}.cms-hm-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;margin-bottom:18px}.cms-hm-head h1{margin:3px 0;font-size:28px}.cms-hm-head p{margin:3px 0;color:#777}.cms-hm-head>a{font-size:10px;color:#444}.cms-hm-grid{display:grid;grid-template-columns:350px minmax(0,1fr);gap:18px;align-items:start}.cms-hm-controls{display:grid;gap:10px}.cms-hm-controls section{padding:15px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-hm-controls h2{margin:0 0 10px;font-size:11px;letter-spacing:.08em}.cms-hm-controls label{display:block;margin:8px 0}.cms-hm-controls label>span{display:block;margin-bottom:4px;color:#777;font-size:8px;font-weight:800;letter-spacing:.06em}.cms-hm-controls input:not([type=checkbox]):not([type=range]),.cms-hm-controls select,.cms-hm-controls textarea{width:100%;box-sizing:border-box;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;font:12px Meiryo,"Yu Gothic",sans-serif}.cms-hm-controls textarea{resize:vertical;line-height:1.7}.cms-hm-controls input[type=range]{width:100%}.cms-hm-two{display:grid;grid-template-columns:1fr 1fr;gap:8px}.cms-hm-checks{display:flex;flex-wrap:wrap;gap:12px}.cms-hm-checks label{font-size:9px}.cms-hm-actions{display:flex;flex-wrap:wrap;gap:7px}.cms-hm-previewwrap{position:sticky;top:18px;min-width:0;padding:14px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-hm-previewhead{display:flex;justify-content:space-between;margin-bottom:10px;color:#777;font-size:8px;font-weight:800}.cms-hm-stage{display:grid;place-items:center;min-height:560px;overflow:auto;border:1px solid #ddd;background:#ececec;padding:20px}.cms-hm-stage canvas{display:block;width:min(100%,1000px);height:auto;box-shadow:0 5px 22px rgba(0,0,0,.12);background:#fff}@media(max-width:980px){.cms-hm-grid{grid-template-columns:300px minmax(0,1fr)}.cms-hm-stage{min-height:440px}}@media(max-width:760px){.cms-hm-grid{display:block}.cms-hm-previewwrap{position:static;margin-top:14px}.cms-hm-stage{min-height:300px;padding:8px}.cms-hm-head{align-items:flex-start;flex-direction:column}.cms-hm-two{grid-template-columns:1fr}}
/* requested public background must remain final */

/* v5.4.1 SCENARIO EDITOR -> HANDOUT CARD */
.cms-se53-exportrow{display:flex;align-items:center;gap:9px;margin-top:8px;padding-top:8px;border-top:1px dashed #ddd}.cms-se53-exportrow button{border:1px solid #bbb;border-radius:6px;background:#f7f7f7;padding:6px 9px;color:#333;font:700 9px Meiryo,"Yu Gothic",sans-serif;cursor:pointer}.cms-se53-exportrow button:hover{background:#eee}.cms-se53-exportrow small{color:#888;font-size:8px}
@media(max-width:620px){.cms-se53-exportrow{align-items:flex-start;flex-direction:column}}
/* requested public background must remain final */

/* v5.5 KP MOTION MAKER */
.cms-mm{max-width:1500px;margin:0 auto;padding:8px 0 40px}.cms-mm-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:18px}.cms-mm-head h1{margin:3px 0;font-size:28px}.cms-mm-head p{margin:3px 0;color:#777}.cms-mm-head>a{font-size:10px;color:#444}.cms-mm-layout{display:grid;grid-template-columns:340px minmax(0,1fr);gap:18px}.cms-mm-panel{display:grid;gap:10px}.cms-mm-panel section{padding:15px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-mm-panel h2{margin:0 0 10px;font-size:11px}.cms-mm-panel label{display:block;margin:8px 0}.cms-mm-panel label>span{display:block;margin-bottom:4px;color:#777;font-size:8px;font-weight:800}.cms-mm-panel input:not([type=checkbox]):not([type=range]),.cms-mm-panel select{width:100%;box-sizing:border-box;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;font:11px Meiryo,"Yu Gothic",sans-serif}.cms-mm-panel input[type=range]{width:82%}.cms-mm-panel output{float:right;font-size:9px}.cms-mm-two{display:grid;grid-template-columns:1fr 1fr;gap:8px}.cms-mm-checks{display:flex;flex-wrap:wrap;gap:10px}.cms-mm-checks label{font-size:9px}.cms-mm-work{position:sticky;top:18px;min-width:0;padding:14px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-mm-previewhead{display:flex;justify-content:space-between;margin-bottom:10px;color:#777;font-size:8px;font-weight:800}.cms-mm-stage{display:grid;place-items:center;min-height:560px;overflow:auto;padding:16px;border:1px solid #ddd;background-image:linear-gradient(45deg,#ddd 25%,transparent 25%),linear-gradient(-45deg,#ddd 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ddd 75%),linear-gradient(-45deg,transparent 75%,#ddd 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;background-color:#eee}.cms-mm-stage canvas{display:block;width:min(100%,1000px);height:auto;box-shadow:0 4px 18px rgba(0,0,0,.12);touch-action:none;cursor:crosshair}.cms-mm-playbar{display:flex;align-items:center;gap:7px;margin-top:10px}.cms-mm-playbar button{padding:7px 10px;border:1px solid #bbb;border-radius:6px;background:#f7f7f7;font-size:9px;cursor:pointer}.cms-mm-playbar span{margin-left:auto;font-size:9px}.cms-mm-note{margin-top:8px;color:#777;font-size:8px}.cms-mm-meter{height:4px;margin-top:10px;overflow:hidden;border-radius:9px;background:#e5e5e5}.cms-mm-meter i{display:block;width:0;height:100%;background:#555;transition:width .2s}
@media(max-width:900px){.cms-mm-layout{grid-template-columns:300px minmax(0,1fr)}.cms-mm-stage{min-height:420px}}@media(max-width:720px){.cms-mm-layout{display:block}.cms-mm-work{position:static;margin-top:14px}.cms-mm-stage{min-height:280px;padding:6px}.cms-mm-head{align-items:flex-start;flex-direction:column}.cms-mm-two{grid-template-columns:1fr}}
/* requested public background must remain final */

/* v5.6 KP ROUTE / JOURNEY MAKER */
.cms-rm{max-width:1500px;margin:0 auto;padding:8px 0 40px}.cms-rm-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:18px}.cms-rm-head h1{margin:3px 0;font-size:28px}.cms-rm-head p{margin:3px 0;color:#777}.cms-rm-head>a{font-size:10px;color:#444}.cms-rm-layout{display:grid;grid-template-columns:350px minmax(0,1fr);gap:18px}.cms-rm-panel{display:grid;gap:10px}.cms-rm-panel section{padding:15px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-rm-panel h2{margin:0;font-size:11px}.cms-rm-sectionhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.cms-rm-sectionhead button{border:1px solid #bbb;border-radius:6px;background:#f7f7f7;padding:5px 8px;font-size:9px}.cms-rm-panel label{display:block;margin:8px 0}.cms-rm-panel label>span{display:block;margin-bottom:4px;color:#777;font-size:8px;font-weight:800}.cms-rm-panel input:not([type=checkbox]):not([type=range]),.cms-rm-panel select{width:100%;box-sizing:border-box;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;font:11px Meiryo,"Yu Gothic",sans-serif}.cms-rm-panel input[type=range]{width:82%}.cms-rm-panel output{float:right;font-size:9px}.cms-rm-two{display:grid;grid-template-columns:1fr 1fr;gap:8px}.cms-rm-checks{display:flex;flex-wrap:wrap;gap:10px}.cms-rm-checks label{font-size:9px}.cms-rm-stops{display:grid;gap:6px;max-height:260px;overflow:auto}.cms-rm-stop{display:grid;grid-template-columns:24px 1fr 1fr 25px;gap:5px;align-items:center}.cms-rm-stop b{font-size:8px;color:#777}.cms-rm-stop input{min-width:0!important;padding:6px!important}.cms-rm-stop button{height:27px;border:1px solid #ccc;border-radius:5px;background:#fff}.cms-rm-exportrow{display:flex;gap:7px;flex-wrap:wrap}.cms-rm-work{position:sticky;top:18px;min-width:0;padding:14px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-rm-previewhead{display:flex;justify-content:space-between;margin-bottom:10px;color:#777;font-size:8px;font-weight:800}.cms-rm-stage{display:grid;place-items:center;min-height:560px;overflow:auto;padding:16px;border:1px solid #ddd;background-image:linear-gradient(45deg,#ddd 25%,transparent 25%),linear-gradient(-45deg,#ddd 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ddd 75%),linear-gradient(-45deg,transparent 75%,#ddd 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;background-color:#eee}.cms-rm-stage canvas{display:block;width:min(100%,1000px);height:auto;box-shadow:0 4px 18px rgba(0,0,0,.12);touch-action:none;cursor:crosshair}.cms-rm-scene{display:flex;align-items:center;gap:7px;margin-top:10px}.cms-rm-scene button{padding:7px 10px;border:1px solid #bbb;border-radius:6px;background:#f7f7f7;font-size:9px}.cms-rm-scene strong{font-size:9px}.cms-rm-scene span{margin-left:auto;font-size:9px}.cms-rm-note{margin-top:8px;color:#777;font-size:8px}.cms-rm-meter{height:4px;margin-top:10px;overflow:hidden;border-radius:9px;background:#e5e5e5}.cms-rm-meter i{display:block;width:0;height:100%;background:#555;transition:width .2s}
@media(max-width:920px){.cms-rm-layout{grid-template-columns:310px minmax(0,1fr)}.cms-rm-stage{min-height:420px}}@media(max-width:740px){.cms-rm-layout{display:block}.cms-rm-work{position:static;margin-top:14px}.cms-rm-stage{min-height:280px;padding:6px}.cms-rm-head{align-items:flex-start;flex-direction:column}.cms-rm-two{grid-template-columns:1fr}.cms-rm-stop{grid-template-columns:22px 1fr 1fr 25px}.cms-rm-scene{flex-wrap:wrap}}
/* requested public background must remain final */
/* v5.6.1 ROUTE COLOR CONTROLS */
.cms-rm-colors{display:grid;grid-template-columns:1fr 1fr;gap:6px 9px;margin:8px 0}.cms-rm-colors label{margin:0}.cms-rm-colors input[type=color]{width:100%;height:34px;padding:3px;border:1px solid #bbb;border-radius:6px;background:#fff;cursor:pointer}@media(max-width:740px){.cms-rm-colors{grid-template-columns:1fr 1fr}}
/* requested public background must remain final */

/* v5.7 KP MAGIC CIRCLE MAKER */
.cms-mg{max-width:1500px;margin:0 auto;padding:8px 0 40px}.cms-mg-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:18px}.cms-mg-head h1{margin:3px 0;font-size:28px}.cms-mg-head p{margin:3px 0;color:#777}.cms-mg-head>a{font-size:10px;color:#444}.cms-mg-layout{display:grid;grid-template-columns:350px minmax(0,1fr);gap:18px}.cms-mg-panel{display:grid;gap:10px}.cms-mg-panel section{padding:15px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-mg-panel h2{margin:0;font-size:11px}.cms-mg-sh{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.cms-mg-sh button,.cms-mg-play button,.cms-mg-circle-row button{border:1px solid #bbb;border-radius:6px;background:#f7f7f7;padding:6px 9px;font-size:9px}.cms-mg-panel label{display:block;margin:8px 0}.cms-mg-panel label>span{display:block;margin-bottom:4px;color:#777;font-size:8px;font-weight:800}.cms-mg-panel input:not([type=checkbox]):not([type=range]):not([type=color]),.cms-mg-panel select{width:100%;box-sizing:border-box;padding:8px;border:1px solid #bbb;border-radius:6px;background:#fff;font:11px Meiryo,"Yu Gothic",sans-serif}.cms-mg-panel input[type=color]{width:100%;height:34px;border:1px solid #bbb;border-radius:6px;background:#fff}.cms-mg-panel input[type=range]{width:100%}.cms-mg-two{display:grid;grid-template-columns:1fr 1fr;gap:8px}.cms-mg-checks{display:flex;flex-wrap:wrap;gap:10px}.cms-mg-checks label{font-size:9px}.cms-mg-circle-row{display:grid;grid-template-columns:72px 1fr 30px 28px;gap:6px;align-items:center;padding:6px 0;border-bottom:1px solid #eee}.cms-mg-circle-row b,.cms-mg-circle-row label{font-size:8px;margin:0}.cms-mg-work{position:sticky;top:18px;min-width:0;padding:14px;border:1px solid #ccc;border-radius:10px;background:#fff}.cms-mg-previewhead{display:flex;justify-content:space-between;margin-bottom:10px;color:#777;font-size:8px;font-weight:800}.cms-mg-stage{display:grid;place-items:center;min-height:560px;overflow:auto;padding:16px;border:1px solid #ddd;background-image:linear-gradient(45deg,#ddd 25%,transparent 25%),linear-gradient(-45deg,#ddd 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ddd 75%),linear-gradient(-45deg,transparent 75%,#ddd 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;background-color:#eee}.cms-mg-stage canvas{display:block;width:min(100%,1000px);height:auto;box-shadow:0 4px 18px rgba(0,0,0,.12);touch-action:none;cursor:move}.cms-mg-play{display:flex;align-items:center;gap:7px;margin-top:10px}.cms-mg-play span:nth-last-child(2){margin-left:auto;font-weight:800;font-size:9px}.cms-mg-play span:last-child{font-size:9px}.cms-mg-meter{height:4px;margin-top:10px;overflow:hidden;border-radius:9px;background:#e5e5e5}.cms-mg-meter i{display:block;width:0;height:100%;background:#555;transition:width .2s}
@media(max-width:920px){.cms-mg-layout{grid-template-columns:310px minmax(0,1fr)}.cms-mg-stage{min-height:420px}}@media(max-width:740px){.cms-mg-layout{display:block}.cms-mg-work{position:static;margin-top:14px}.cms-mg-stage{min-height:280px;padding:6px}.cms-mg-head{align-items:flex-start;flex-direction:column}.cms-mg-two{grid-template-columns:1fr}}
/* requested public background must remain final */
html,
body:not(.cms-admin),
body.cms-session-public,
body:not(.cms-admin) main,
body:not(.cms-admin) .main-content{
    background:#f7f7f7 !important;
    background-color:#f7f7f7 !important;
    background-image:none !important;
}
