/* 全画面の共通表示倍率。1 が従来の100%、0.75 が75%。 */
:root{--culdraft-display-scale:0.75;zoom:var(--culdraft-display-scale)}
*{box-sizing:border-box}
.site-title a{color:inherit;text-decoration:none}
.site-title a[aria-disabled="true"]{cursor:default}
.site-header{position:sticky;top:0;z-index:100}
html,body{margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;color:#222;background:#fff}
.site-header{background:#000;color:#fff}.header-inner{width:min(960px,calc(100% - 24px));min-height:56px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0;flex-wrap:wrap}.site-title,.header-inner h1{font-size:22px;font-weight:700;line-height:1.5;margin:0;white-space:nowrap}
.page-frame{width:min(960px,calc(100% - 24px));margin:18px auto 28px}
.system-message{display:none}.system-message.is-visible{display:block;margin:0 0 18px;padding:10px 12px;border:1px solid #c00;background:#fff5f5;color:#b00000;font-size:16px;font-weight:600;line-height:1.5}
.system-message.is-visible.is-normal{border-color:#7aa4c7;background:#f0f8ff;color:#183b56;font-weight:500}
.simple-description{margin:0 0 18px}.description-title{margin-bottom:4px;font-size:17px;font-weight:700;line-height:1.5}.description-text{font-size:16px;font-weight:400;line-height:1.5}
.group{margin-bottom:18px}.group-user,.group-draft-pack,.group-other{--group-width:100%;width:var(--group-width);max-width:100%}
.group-user h2,.group-user .simple-table,.group-draft-pack h2,.group-draft-pack .simple-table,.group-other h2,.group-other .simple-table{width:100%}
.group h2{margin:0;padding:8px 10px;font-size:17px;background:#f1f1f1;border:1px solid #bbb;border-bottom:0}
.simple-table{display:grid;grid-template-columns:220px minmax(0,1fr);border-top:1px solid #aaa;border-left:1px solid #aaa}
.simple-table>div{min-height:42px;padding:9px 10px;display:flex;align-items:center;gap:8px;border-right:1px solid #aaa;border-bottom:1px solid #aaa}
.draft-table{grid-template-columns:220px minmax(0,1fr) minmax(0,1fr) 150px}.draft-table-title{grid-column:1/-1;min-height:42px;padding:9px 10px;display:flex;align-items:center;font-size:17px;font-weight:600;background:#f1f1f1;border-right:1px solid #aaa;border-bottom:1px solid #aaa}
.draft-description-wide{grid-column:span 2}.draft-history-label{font-weight:700}.draft-description-full{grid-column:span 3}
.draft-action,.session-label,.session-input-cell{min-height:42px;padding:9px 10px;display:flex;align-items:center;gap:8px;border-right:1px solid #aaa;border-bottom:1px solid #aaa}
.session-input-cell input{width:180px;max-width:100%}.table-label{background:#f7f7f7;font-weight:600}.table-label a{color:inherit;text-decoration:underline}.rowspan-label{grid-row:span 2}.input-cell input{width:100%}
input[type=text]{height:32px;padding:4px 8px;border:1px solid #999;border-radius:2px}button{padding:5px 12px;cursor:pointer}
.site-footer{width:min(960px,calc(100% - 24px));margin:0 auto 18px;padding:10px;text-align:center;font-size:14px}.site-footer a{color:inherit;text-decoration:underline}
@media(max-width:600px){.site-title,.header-inner h1{font-size:19px}.simple-table{grid-template-columns:150px minmax(0,1fr)}.draft-table{grid-template-columns:150px minmax(0,1fr) minmax(0,1fr) 120px}.draft-description-wide{grid-column:span 2}.draft-description-full{grid-column:span 3}.simple-table>div,.session-label,.session-input-cell,.draft-action{min-height:44px;padding:8px}.system-message.is-visible{margin-bottom:14px}}


.system-message-list {
  margin: 0;
  padding-left: 1.5em;
}

.system-message-list li + li {
  margin-top: 4px;
}

/* ブックメーカー：PC・タッチ操作共通 */
.bookmaker-page{width:min(1600px,calc(100% - 24px))}
.wide-page .header-inner{width:min(1600px,calc(100% - 24px))}

.bookmaker-page .group h2.book-section-heading{background:#d0d0d0}
.bookmaker-page .book-card-heading{display:flex;align-items:center;flex-wrap:wrap;gap:6px}
.bookmaker-page #game-title-heading{display:flex;align-items:center}
.bookmaker-page .book-card-heading button{margin-left:auto;white-space:nowrap}
.bookmaker-layout{display:grid;grid-template-columns:minmax(240px,280px) minmax(0,1fr) minmax(240px,max-content);gap:14px;align-items:start}
.bookmaker-layout>*{min-width:0}
.bookmaker-controls .group{margin-bottom:14px}
.bookmaker-controls fieldset{border:0;margin:0;padding:0;min-width:0}
.bookmaker-controls .book-actions{flex-direction:column;align-items:stretch}
.bookmaker-controls .book-note{margin:0;overflow-wrap:anywhere}
.book-statistics{margin:0;padding:10px;font-size:14px}
.book-stat-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding:4px 0}
.book-stat-row dt{font-weight:400}
.book-stat-row dt{display:flex;align-items:center;gap:6px}
.book-stat-row.book-stat-total dt,.book-stat-row.book-stat-total dd,.book-stat-row.book-stat-major dt{font-weight:700}
.book-stat-row #count.is-over-limit{color:#c00}
.book-stat-icon{height:20px;width:auto;max-width:30px;object-fit:contain;flex:none}
.book-stat-multi{display:grid;grid-template-columns:repeat(2,10px);width:20px;height:20px;flex:none}
.book-stat-multi img{width:10px;height:10px;object-fit:contain}
.book-stat-row dd{margin:0;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.book-stat-row.book-stat-child{padding-left:44px}
.book-stat-section{border-top:1px solid #999;margin-top:8px;padding-top:8px}
.book-stat-toggle-row{cursor:pointer;min-height:36px}
.bookmaker-page .book-stat-toggle{display:flex;align-items:center;gap:6px;min-height:36px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-align:left;cursor:pointer}
.book-stat-toggle::before{content:'▸';width:12px;flex:none}
.book-stat-toggle[aria-expanded="true"]::before{content:'▾'}
.bookmaker-controls details{padding:0 10px 10px}
.bookmaker-controls summary{cursor:pointer;min-height:44px;align-content:center}
.bookmaker-page .system-message.is-visible.is-warning{border-color:#a16c00;background:#fff8df;color:#704900}
 :is(.table-page,.pack-page) .system-message.is-visible.is-normal{border-color:#43824e;background:#eff9ef;color:#24532c}
 :is(.table-page,.pack-page) .system-message.is-visible.is-warning{border-color:#a16c00;background:#fff8df;color:#704900}
 :is(.table-page,.pack-page) .system-message.is-visible.is-error{border-color:#c00;background:#fff5f5;color:#b00000}
@media(max-width:900px){.bookmaker-layout{grid-template-columns:minmax(0,1fr)}.bookmaker-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.bookmaker-controls>p{grid-column:1/-1}}
@media(max-width:600px){.bookmaker-controls{display:block}}
.bookmaker-page .cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;padding:12px}
.bookmaker-page .book-card{border:1px solid #aaa;padding:6px;min-width:0;background:#fff}
.bookmaker-page .book-card>button:first-child{position:relative;width:100%;background:#fff;border:0;color:#222;cursor:pointer;padding:0}
.bookmaker-page .book-card>button:first-child{font-family:Arial,sans-serif;font-size:13.3333px;line-height:normal}
.bookmaker-page .book-card-image{position:relative}
.bookmaker-page #book .book-card>button{display:flex;flex-direction:column}
.bookmaker-page #book .book-card>button>img{order:0}
.bookmaker-page #book .book-card-name{order:2}
.bookmaker-page #book .card-quantity{position:static;display:block;order:1;width:100%;padding:2px 0;margin-top:2px;border:1px solid #ccc;background:#f7f7f7;color:#111;font-size:var(--card-quantity-font-size,14px);font-weight:700;line-height:1.3;white-space:nowrap;overflow-wrap:normal;text-align:center}
.bookmaker-page #book .card-quantity.is-single{display:none}
@media(hover:none) and (pointer:coarse){.bookmaker-page #book .card-quantity.is-single{display:block}}
.bookmaker-page .cards img{width:100%;max-width:150px;display:block;margin:auto}
.bookmaker-page .cards span{display:block;overflow-wrap:anywhere}
.bookmaker-page .book-actions{display:flex;gap:12px;flex-wrap:wrap;padding:10px;align-items:end}
.bookmaker-controls #book-controls>.book-actions{padding-bottom:0}
.bookmaker-controls #book-controls+.book-actions{padding-top:12px}
.bookmaker-page #issue-code,.bookmaker-page #issue-json,.bookmaker-page #import-json{width:100%;align-self:stretch}
.bookmaker-page .book-display-controls{display:flex;align-items:center;justify-content:center;gap:12px;flex:1;flex-wrap:wrap}
.bookmaker-page .book-image-size-control{display:flex;align-items:center;gap:6px;min-width:150px;font-size:14px;white-space:nowrap}
.bookmaker-page .book-image-size-control input{width:110px;min-width:60px;min-height:0}
.bookmaker-page .book-show-names-control{display:inline-flex;align-items:center;gap:4px;font-size:14px;white-space:nowrap}
.bookmaker-page #book.hide-card-names .book-card-name{display:none}
.bookmaker-page #book img{max-width:none}
.bookmaker-page #book-code-popup{width:min(321px,calc(100% - 24px));max-height:85vh;overflow:auto;padding:16px;text-align:center}
.bookmaker-page #book-code-popup textarea{width:100%;box-sizing:border-box}
.bookmaker-page #book-code-popup #book-code{text-align:left;caret-color:transparent}
.bookmaker-page #book-code-popup .book-actions{justify-content:center;align-items:center}
.bookmaker-page .book-actions label{display:flex;flex-direction:column;gap:4px;min-width:0;max-width:100%}
.bookmaker-page input,.bookmaker-page textarea{max-width:100%;box-sizing:border-box}
.bookmaker-page #server-filename{width:370px}
.bookmaker-page button,.bookmaker-page input:not([type=checkbox]){min-height:44px}
.bookmaker-page button:focus-visible{outline:3px solid #1769aa}
.bookmaker-page .card-detail-action{margin-right:8px}
.bookmaker-page .book-card label{display:inline-flex;align-items:center;min-height:44px;gap:4px}
.bookmaker-page #status,.bookmaker-page .empty,.bookmaker-page .book-note{padding:12px}
.bookmaker-page label.book-note{display:block}
.bookmaker-page #book-code{display:block;width:100%;font-family:monospace;font-size:22px;white-space:pre;overflow-wrap:normal;line-height:1.6}
.bookmaker-page [hidden]{display:none!important}
.bookmaker-page #unused,.bookmaker-page #unusable{grid-template-columns:minmax(0,1fr);align-items:start}
.bookmaker-page .book-unused-card{display:flex;align-items:center;gap:2px;text-align:left;background:#fff;border:1px solid #aaa;padding:6px;min-width:max-content}
.bookmaker-page .book-unused-card img{width:auto;height:25px;max-width:none;margin:0;flex:none}
.bookmaker-page .book-unused-card .unused-name{white-space:nowrap;overflow-wrap:normal;flex:1}
.bookmaker-page .book-unused-card .unused-quantity{font-weight:bold;white-space:nowrap}
.bookmaker-page .book-unused-card.book-unusable-card{background:#fafafa;border-color:#ddd;color:#aaa;cursor:default}
.bookmaker-page .book-unusable-card img{filter:grayscale(1);opacity:.45}
@media(max-width:600px){.bookmaker-page .cards{grid-template-columns:repeat(auto-fill,minmax(110px,1fr));padding:8px}.bookmaker-page .book-actions{align-items:stretch}.bookmaker-page .book-actions label{width:100%}}

/* テーブル・パック画面で共用する文字サイズとフォーム部品 */
.compact-page .page-frame,.compact-page dialog{font-size:14px}
.compact-page .page-frame button,.compact-page .page-frame input,.compact-page .page-frame select{font-size:12px}
.control-input{height:32px;padding:4px 8px;border:1px solid #999;border-radius:2px}
.choice-input{margin:0;width:16px;height:16px;flex:none}
.help-dialog{max-width:min(520px,calc(100% - 24px));border:1px solid #aaa;padding:18px;background:#fff;color:#222}
.help-dialog h2{font-size:15px;margin-top:0}.help-dialog::backdrop{background:#0006}
.help-dialog .help-text{white-space:pre-wrap;overflow-wrap:anywhere}

.compact-page .system-message.is-visible{font-size:14px}
.pack-page .system-message-list{white-space:pre-line;overflow-wrap:anywhere}

.compact-page button.return-top,.compact-page button.button-soft-red{background:#ffe5e5;border:1px solid #c98b8b;color:#702020}
.compact-page button.return-top:disabled{background:#eee;border-color:#bbb;color:#888;cursor:default}

@media(max-width:600px){.header-inner{min-height:104px;align-content:center}.header-inner>.site-title,.header-inner>h1{width:100%}}

/* ヘッダの操作ボタンはルール作成画面のサイズに統一。 */
.site-header .header-inner button{box-sizing:border-box;height:34px;padding:5px 12px;border-width:2px;font-family:inherit;font-size:12px;line-height:20px;white-space:nowrap}

.compact-page button.button-soft-blue{background:#e5f2ff;border-color:#8baac9;color:#204b70}
.bookmaker-page-title{margin:0 0 18px;color:#000;font-size:22px;font-weight:700}
@media(max-width:600px){.bookmaker-page-title{font-size:19px}}

/* 全ページ共通：閉じる操作をポップアップ右上に統一する。 */
dialog > .popup-close-bar{display:flex;justify-content:flex-end;align-items:center;padding:5px 8px;box-sizing:border-box;position:absolute;top:0;right:0;z-index:5;background:transparent}
dialog > .popup-close-bar > .popup-close-button{position:static;float:none;flex:none;width:auto;min-width:4em;margin:0;padding:3px 10px;font-size:14px;line-height:1.5;white-space:nowrap;cursor:pointer;background:ButtonFace;color:ButtonText;border:2px outset ButtonBorder;border-radius:2px}

/* 閉じるボタンは既存の先頭行に重ね、見出しとの重なりを避ける。 */
dialog:has(> .popup-close-bar) > h2:not(#card-detail-title){padding-right:90px;min-height:40px;box-sizing:border-box}
#card-detail-popup .card-detail-header{padding-right:80px;min-height:30px;box-sizing:border-box}


/* タッチ端末のカード長押しは共通の詳細表示に使用する。 */
@media(hover:none) and (pointer:coarse){[data-card-id],[data-card-id] img{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}}

/* スマートフォン共通：タイトル行と操作行を分ける。 */
@media(max-width:600px){
 .site-header .header-inner{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:10px;min-height:104px}
 .site-header .header-inner>.site-title,.site-header .header-inner>h1{width:100%;text-align:left;align-self:flex-start}
 .site-header .header-inner>button,.site-header .header-inner>a{align-self:flex-end;margin-left:auto}
 .site-header .header-inner>.header-actions{width:100%;justify-content:flex-end;align-self:flex-end;flex-wrap:wrap}
 /* ブックステータスのカテゴリ詳細・レア度は2項目ずつ。 */
 .bookmaker-page .bookmaker-controls [id^="stat-children-"]:not([hidden]),.bookmaker-page .bookmaker-controls .book-stat-section:has(#stat-rarity-N){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:12px;row-gap:2px}
 .bookmaker-page .book-stat-child{padding-left:0;min-width:0}
 .bookmaker-page .book-stat-child dt,.bookmaker-page .book-stat-section:has(#stat-rarity-N) dt{min-width:0;flex-wrap:wrap;gap:4px;overflow-wrap:anywhere}
 .bookmaker-page .book-stat-row{min-width:0}
 .bookmaker-page .bookmaker-controls .book-actions{display:flex;flex-direction:column;align-items:stretch}
 .bookmaker-page .bookmaker-controls .book-actions>button{width:100%}
 .bookmaker-page #unused,.bookmaker-page #unusable{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .bookmaker-page #unused>.empty,.bookmaker-page #unusable>.empty{grid-column:1/-1}
 .bookmaker-page .book-unused-card{min-width:0;width:100%;gap:2px;padding:5px}
 .bookmaker-page .book-unused-card img{height:18px;max-width:22px}
 .bookmaker-page .book-unused-card .unused-name{min-width:0;white-space:normal;overflow-wrap:anywhere;flex:1}
 .bookmaker-page .book-unused-card .unused-quantity{flex:none;white-space:nowrap}
}

/* ブック編集の操作3ボタンをスマートフォンでは同じ行に配置する。 */
@media(max-width:600px){
 .bookmaker-page .book-operation-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:10px}
 .bookmaker-page .book-operation-actions>#book-controls,.bookmaker-page .book-operation-actions .book-actions{display:contents}
 .bookmaker-page .book-operation-actions .book-actions>button{min-width:0;width:100%;height:auto;white-space:normal;overflow-wrap:anywhere;padding:6px}
}

@media(max-width:600px){.bookmaker-page #editor>#book-operation-section{width:100%;margin-bottom:0}}

@media(min-width:601px) and (hover:hover) and (pointer:fine){
 .bookmaker-page #book .book-card>button{display:grid;grid-template-columns:minmax(0,1fr);position:relative}
 .bookmaker-page #book .book-card>button>img{grid-area:1/1;width:100%}
 .bookmaker-page #book .book-card-name{grid-area:2/1}
 .bookmaker-page #book .card-quantity{grid-area:1/1;position:relative;z-index:2;align-self:end;justify-self:end;width:auto;margin:2px;padding:1px 3px;border:0;background:#111b;color:#fff;font-size:var(--card-quantity-font-size,14px);line-height:1.3;pointer-events:none}
}

.bookmaker-page #book .book-card>button>img{height:auto;aspect-ratio:3/5;object-fit:contain}
