/* WordPress風スタイル */
*, *::before, *::after{ box-sizing:border-box; }
body{
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    margin:0; padding:0; background:#f1f1f1;
    min-height:100vh;
}
.headerbar{
    width:100%;height:56px; background:#23282d;
    color:#f1f1f1;font-size:1.15em;line-height:56px;padding:0 22px;font-weight:600;
    box-shadow:0 1px 0 rgba(0,0,0,0.1);
    position:fixed;z-index:30;left:0;top:0;
    display:flex;align-items:center;justify-content:flex-start;gap:10px;
}
.app-logo,
.title-icon {
    display:inline-flex;
    width:1.15em;
    height:1.15em;
    margin-right:10px;
    vertical-align:middle;
    fill:currentColor;
}
.app-logo { margin-right:12px; }
.app-logo svg,
.title-icon svg { width:100%; height:100%; }
#main-app-cont{
    min-height:100vh;
    padding-top:72px;
}
.window-window {
    background:#fff;
    border-radius:8px;
    box-shadow:0 1px 3px rgba(0,0,0,0.08);
    margin:auto;
    max-width:760px;
    min-width:300px;
    padding:0;
    border:1px solid #dcdcdc;
}
.window-title {
    background:#f7f7f7;
    border-radius:8px 8px 0 0;
    font-size:1.06em;
    padding:14px 18px;
    font-weight:600;
    border-bottom:1px solid #dcdcdc;
    letter-spacing:.01em;
    display:flex;align-items:center;
    color:#23282d;
}
.window-body{padding:18px 22px 18px 22px;}
.win-btn{
    display:inline-flex;cursor:pointer;align-items:center;justify-content:center;
    padding:10px 18px;
    border-radius:6px;
    font-family:inherit;font-size:0.95em;
    border:1px solid #ccd0d4;
    background:#f7f7f7;
    color:#32373c;
    font-weight:600;
    margin:2px 2px 2px 0;
    transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
    vertical-align:middle;
    white-space:nowrap;
    min-width:120px;
    box-shadow:0 1px 4px rgba(0,0,0,.05);
}
.win-btn:hover{ background:#f0f4fb; border-color:#9fb6d5; transform:translateY(-1px); }
.win-btn:active{ background:#e2ebf7; box-shadow:inset 0 1px 2px rgba(0,0,0,.08); }
.win-btn-main{
    border-color:#0073aa;
    background:#0073aa;
    color:#fff;
}
.win-btn-main:hover{ background:#006799; }
.win-btn-light{
    background:#fff;
    border:1px solid #dcdcdc;
    color:#32373c;
    font-weight:600;
}
button, .pw-toggle-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    white-space:nowrap;
    min-width:80px;
    padding:10px 14px;
    border-radius:6px;
    border:1px solid #ccd0d4;
    background:#fff;
    color:#32373c;
    cursor:pointer;
}
button:hover, .pw-toggle-btn:hover{background:#f0f4fb;}
button:focus-visible, .pw-toggle-btn:focus-visible{outline:2px solid rgba(0,115,170,.3); outline-offset:2px;}
.flex{ display:flex; gap:12px; flex-wrap:wrap; }
.flex-row{ display:flex; flex-wrap:wrap; align-items:flex-start; gap:10px; margin-bottom:12px; justify-content:flex-start; }
.flex-row > *{ min-width:0; }
.form-label{ min-width:100px; text-align:right; font-weight:600; color:#32373c; flex:0 0 auto; white-space:nowrap; }
.flex-row > div:not(.form-label), .flex-row span{ flex:1 1 0; min-width:0; word-break:break-word; }
input,textarea,select{ padding:12px 14px; margin:4px 0; outline:none; box-sizing:border-box; max-width:100%; width:100%; border:1px solid #dcdcdc; border-radius:8px; overflow-wrap:break-word; }
button{ margin:4px 0; }
textarea{ min-height:120px; resize:vertical;}
input:focus,textarea:focus,select:focus{ border-color:#0073aa; box-shadow:0 0 0 1px rgba(0,115,170,.12); }
input[type='checkbox']{ width:18px; height:18px; }
input[type='file']{ padding:0; }
textarea{ min-height:100px; resize:vertical;}
.card{
    background:#fff;
    border:1px solid #dcdcdc;
    border-radius:8px;
    padding:14px;
    margin-bottom:14px;
    box-shadow:0 1px 2px rgba(0,0,0,.05);
    display:flex; align-items:flex-start; justify-content:space-between;
}
.card-public{ background:#f7f7f7; }
.card-main{
    flex: 1 1 auto;
    min-width:0;
}
.card-actions{
    display:flex; flex-direction:column; gap:8px; align-items:stretch; justify-content:flex-start;
    margin-left:18px; min-width:120px;
}
.card .char-name{
    font-size:1.05em; font-weight:700; margin-bottom:4px; word-break:break-all;
    display: flex; align-items: center;
}
.card .char-public-status{
    display:inline-block; text-align:left; margin-top:6px; margin-bottom:8px;
    font-size:.92em; font-weight:600; padding:6px 10px; border-radius:10px;
    max-width:100px;
}
.card .char-public-status.public{ background:#dff0d8; color:#27632a; }
.card .char-public-status.private{ background:#f1f1f1; color:#606c76; }
.card .url-area{
    margin-top:8px; margin-bottom:4px; display:flex; align-items:center; gap:8px;
}
.card .url-area input{
    width:100%; font-size:0.95em; background:#fafafa; border:1px solid #dcdcdc; color:#32373c;
    border-radius:4px; padding:10px;
}
.card .url-area button{ margin:0; }
.card .images{ margin-top:8px; }
.card .images img{ max-width:108px; max-height:108px; width:auto; height:auto; align-self:flex-start; margin-right:6px; margin-bottom:6px; border-radius:6px; cursor:pointer; object-fit:cover; }
.image-confirm-wrapper{ position:relative; display:inline-flex; align-items:center; justify-content:center; min-width:140px; min-height:140px; border-radius:10px; overflow:hidden; background:#111; color:#fff; flex:0 0 auto; }
/* 一覧カード内では通常画像(108px)とサイズを揃えて表示ズレを防止 */
.card .images .image-confirm-wrapper{ width:108px; height:108px; min-width:0; min-height:0; }
/* 詳細画面(設定確認)ではdetail-imageサイズに揃える */
.image-confirm-wrapper:has(.detail-image){ width:85px; height:85px; min-width:0; min-height:0; }
.image-confirm-wrapper::before{ content:''; position:absolute; inset:0; background:linear-gradient(180deg,rgba(0,0,0,0.08),rgba(0,0,0,0.4)); pointer-events:none; }
.image-confirm-wrapper.revealed{ background:transparent; }
.image-confirm-wrapper.revealed::before{ display:none; }
.image-confirm-wrapper .image-confirm-img{ display:block; max-width:100%; max-height:100%; border-radius:10px; object-fit:cover; }
.image-confirm-button{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:16px 20px;border:none;cursor:pointer;background:rgba(0,0,0,0.72);color:#fff;font-weight:700;font-size:0.95rem;line-height:1.2;text-align:center;backdrop-filter:blur(4px);transition:background .15s;}
.image-confirm-button:hover{background:rgba(0,0,0,0.85);}
.image-confirm-wrapper .image-confirm-img[hidden]{display:none;}
.image-confirm-wrapper img.clickable{cursor:pointer;}
/* 画像1点分(ワンクッション画像+理由)をまとめる単位。理由は画像の「隣」に配置し、画像には絶対に重ねない */
.image-item{ display:flex; align-items:flex-start; gap:8px; margin-right:6px; margin-bottom:6px; max-width:100%; }
.image-confirm-note{
    position:static;
    flex:1 1 160px;
    max-width:220px;
    padding:8px 10px;
    background:#f7f7f7;
    border:1px solid #dcdcdc;
    color:#32373c;
    border-radius:8px;
    font-size:0.85rem;
    line-height:1.4;
    word-break:break-word;
    align-self:stretch;
}
.image-meta-row{display:flex;align-items:flex-start;gap:10px;margin-bottom:10px;position:relative;}
.image-meta-controls{display:flex;flex-direction:column;gap:6px;flex:1;}
.image-note-input{width:100%;min-height:62px;padding:10px;border:1px solid #dcdcdc;border-radius:8px;resize:vertical;}
.image-confirm-checkbox{display:flex;align-items:center;gap:6px;font-weight:600;color:#32373c;}
#expand-modal {
    display:none;position:fixed;z-index:99999;top:0;right:0;bottom:0;left:0;
    background:rgba(30,32,38,0.92);justify-content:center;align-items:center;
}
#expand-modal-inner{
    display:flex;align-items:center;justify-content:center;
    position:relative;min-width:30vw;min-height:50vh;
    padding:32px;
    box-sizing:border-box;
    max-width:min(95vw,1080px);
}
#expand-modal-inner img{
    max-width:calc(100% - 32px);
    max-height:calc(100vh - 160px);
    width:auto;
    height:auto;
    border-radius:16px;
    box-shadow:0 0 19px #101028;
    background:#fff;
    display:block;
}
#expand-modal-close{
    position:fixed;
    top:16px;
    right:16px;
    z-index:100000;
    display:flex;
    align-items:center;
    justify-content:center;
    width:34px;
    height:34px;
    min-width:0;
    min-height:0;
    border:none;
    border-radius:12px;
    background:rgba(44,44,44,0.95);
    color:#fff;
    cursor:pointer;
    font-size:1.2em;
}
#expand-modal-close:hover{background:#c00;color:#fff;}
.modal-close-hint{
    position:absolute;left:50%;bottom:16px;transform:translateX(-50%);
    color:#fff;font-size:0.95em;background:rgba(0,0,0,0.45);
    padding:8px 12px;border-radius:999px;letter-spacing:.02em;
    box-shadow:0 2px 12px rgba(0,0,0,.3);
}
@media(max-width:600px){
    #expand-modal-inner{min-width:unset;min-height:unset;width:min(100vw,calc(100vw - 24px));height:auto;padding:18px;}
    #expand-modal-inner img{max-width:100%;max-height:calc(100vh - 100px);}
    #expand-modal-close{top:12px;right:12px;width:32px;height:32px;font-size:1.4em;}
    .modal-close-hint{font-size:0.85em;bottom:12px;padding:6px 10px;}
    .card .images img{max-width:84px;max-height:84px;}
    .card .images .image-confirm-wrapper{width:84px;height:84px;}
    .image-confirm-note{flex-basis:120px;max-width:150px;font-size:0.8rem;padding:6px 8px;}
    .window-window{min-width:unset;}
}
@media(max-width:900px){
    .window-window{max-width:95vw;padding:0 1.5vw;}
    .card{padding:14px;}
    .card-actions{margin-left:0;}
}
@media(max-width:640px){
    body,#main-app-cont{padding:12px;}
    #main-app-cont{padding-top:84px;}
    .window-window{max-width:100%;}
    .window-title{font-size:1rem;}
    .flex,.flex-row{flex-direction:column;gap:10px;align-items:stretch;}
    .form-label{min-width:unset;text-align:left;}
    input,textarea,select,button,.win-btn{width:100%!important;}
    .window-body{padding:16px 16px 18px 16px;}
    .form-buttons-row{flex-direction:column;gap:10px;}
    .card{flex-direction:column;}
    .card-actions{flex-direction:column; margin-left:0; margin-top:10px;gap:8px;width:100%; justify-content:stretch;}
    .card-actions > a,
    .card-actions > form{ width:100%; }
    .card-main{margin-bottom:10px;}
    .card .url-area{flex-direction:column;gap:10px;}
    .card .url-area input{width:100%;}
    .wide-button{width:100%;}
    .window-window{padding:0;}
    .image-meta-row{flex-direction:column;align-items:stretch;}
    .image-meta-row .preview-thumb{max-width:140px;width:auto;}
    /* チェックボックス類・トグルスイッチはwidth:100%強制の対象から除外（レイアウト崩れ防止） */
    input[type='checkbox']{width:18px!important;height:18px!important;}
    .toggle-switch input{width:0!important;height:0!important;}
}
.form-buttons-row{
    display: flex;
    gap: 12px;
    margin-top: 20px;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap:wrap;
}
@media(max-width:600px){
    .form-buttons-row{ flex-direction:column; gap:8px; margin-top:15px;}
}
/* character form additional styles */
#previewArea{margin:5px 0;}
.preview-area{margin:5px 0;}
.image-preview-wrapper{position:relative;display:inline-block;margin:4px;}
.preview-thumb{max-width:80px;margin:0;border-radius:10px;display:block;}
.preview-delete{
    position:absolute;
    top:8px;
    right:8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:30px;
    height:30px;
    min-width:0;
    min-height:0;
    padding:0;
    border-radius:8px;
    background:rgba(255,255,255,0.95);
    border:1px solid #ccd0d4;
    box-shadow:0 1px 2px rgba(0,0,0,.12);
    color:#c00;
    font-size:18px;
    line-height:1;
    text-align:center;
}
.preview-delete:hover{background:#fff;}
#existingImages>div{position:relative;display:inline-block;}
#existingImages>div button{position:absolute;top:8px;right:8px;font-size:11px;}
#otherContainer{margin:12px 0;}
#otherContainer .flex{align-items:flex-start;gap:8px;margin-bottom:8px;}
#otherContainer input,#otherContainer textarea{width:100%;}
#otherContainer input{width:30%;}
#otherContainer textarea{width:65%;height:38px;}
#otherContainer .win-btn-light{align-self:flex-start;}
#pubchk{margin-right:12px;}
.toggle-switch{position:relative;display:inline-block;width:46px;height:26px;}
.toggle-switch input{opacity:0;width:0;height:0;}
.switch-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#ccc;border-radius:26px;transition:.4s;}
.switch-slider:before{position:absolute;content:"";height:20px;width:20px;left:3px;bottom:3px;background:white;border-radius:50%;transition:.4s;}
.toggle-switch input:checked + .switch-slider{background:#0073aa;}
.toggle-switch input:checked + .switch-slider:before{transform:translateX(20px);}
@media(max-width:600px){
    #otherContainer .flex{flex-direction:column;align-items:stretch;}
    #otherContainer input,#otherContainer textarea{width:100%;}
}
.window-error { margin:28px auto 0 auto; }
.window-title-error { color:#c00; }
.window-body-error { color:#a22828; font-size:1.07em; }
.window-spaced-top { margin-top:44px; }
.window-spaced-top-sm { margin-top:28px; }
.window-spaced-bottom { margin-bottom:18px; }
.window-narrow { max-width:400px; }
.centered-actions { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
.wide-button { width:60%; min-width:140px; }
.wide-input { width:75%; display:inline-block; }
.window-body-no-top-padding { padding-top:0; }
.empty-state { margin:12px 0 0 7px; }
.detail-image { max-width:85px; }
.detail-row{ padding-bottom:10px; margin-bottom:12px; border-bottom:1px solid #ececec; }
.detail-row:last-of-type{ border-bottom:none; }
.detail-label-top { vertical-align:top; }
.detail-list { margin-left:0; padding-left:15px; }
.detail-list li { margin-bottom:0.75rem; word-break:break-word; }
.notice-text { color:#346adc; }
.button-save-row { margin-top:30px; }
.button-save { width:30%; font-size:1.2em; }
.button-back { margin-left:8px; }
.public-info { margin-left:20px; color:#546a96; font-size:13px; display:block; }
.public-info span.blue { color:#0a7cf1; }
.public-info span.dark { color:#444; }
.public-page .window-window { margin-top:44px; }
.public-page .public-image { max-width:121px; border-radius:9px; box-shadow:0 2px 12px rgba(0,0,0,0.2); margin:4px; cursor:pointer; }
.public-image { max-width:121px; max-height:121px; width:auto; height:auto; border-radius:9px; box-shadow:0 2px 12px rgba(0,0,0,0.2); margin:4px; cursor:pointer; }

.image-confirm-wrapper .image-confirm-img.public-image { max-width:121px; max-height:121px; width:auto; height:auto; display:block; }
/* public page: keep wrapper compact so revealed images align with thumbnails */
.public-page .image-confirm-wrapper{ min-width:0; min-height:0; display:inline-flex; align-items:center; justify-content:center; }
.image-confirm-wrapper:has(.public-image){ width:121px; height:121px; min-width:0; min-height:0; }
.public-page .image-confirm-wrapper::before{ display:none; }
.preview-area { margin:5px 0; }
.preview-thumb-small { width:60px; margin:2px; }
.other-container { margin:12px 0; }
.other-row { align-items:flex-start; gap:8px; margin-bottom:8px; }
.other-title { width:30%; }
.other-text { width:65%; height:38px; }
.public-label { margin-left:12px; font-weight:bold; }
.section-top-sm { margin-top:14px; }
.section-top-md { margin-top:20px; }
.section-top-lg { margin-top:24px; }
.button-small { font-size:1em; }
.section-top-sm { margin-top:14px; }
.section-top-md { margin-top:20px; }
.section-top-lg { margin-top:24px; }
.hidden { display:none !important; }
/* Prevent background scroll when modal is open (html側にも適用しないとスクロールが残るブラウザがある) */
html.modal-open, .modal-open { overflow: hidden; height:100%; }

/* Upload error display */
#uploadErrorArea {
    color: #d32f2f;
    margin: 10px 0;
    padding: 12px 14px;
    background: #ffebee;
    border-left: 4px solid #d32f2f;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.6;
}
#uploadErrorArea strong {
    font-weight: 600;
}

