/* is-back/pack-generation/ — the look of card-gallery (styles.css there) */

.pg-page { padding: 0 2rem 3rem; max-width: 1500px; margin: 0 auto; box-sizing: border-box; }
.pg-loading, .pg-empty { color: #aaa; text-align: center; padding: 3rem 1rem; }
.pg-denied { text-align: center; padding: 4rem 1rem; color: #aaa; }
.pg-denied h2 { color: #ff0066; margin: 0 0 .5rem; }

/* Rows: a little room between rows, and between the items on a row */
.pg-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin: .6rem 0; }
.pg-row.end { justify-content: flex-end; }
.pg-filter-row { align-items: flex-end; }
.pg-spacer { flex: 1; }
.pg-muted { color: #8b949e; font-size: .88rem; }
.pg-ok { color: #3fb950; }
.pg-bad { color: #ff4d6d; }

/* Buttons and fields */
.pg-btn {
    display: inline-flex; align-items: center; gap: .35rem;
    background: rgba(26,26,26,0.85); color: #e6edf3;
    border: 1px solid #333; border-radius: 8px;
    padding: .45rem .9rem; font-size: .9rem; cursor: pointer; white-space: nowrap;
    text-decoration: none; transition: border-color .15s, color .15s, background .15s;
}
.pg-btn:hover:not(:disabled) { border-color: #00ffcc; color: #00ffcc; }
.pg-btn:disabled { opacity: .45; cursor: not-allowed; }
.pg-btn.primary { background: linear-gradient(90deg, #00ffcc, #00ccff); color: #000; border: none; font-weight: 600; box-shadow: 0 0 10px rgba(0,255,204,.5); }
.pg-btn.primary:hover:not(:disabled) { color: #000; box-shadow: 0 0 16px rgba(0,255,204,.75); }
.pg-btn.accent { color: #00ffcc; border-color: #00ffcc; font-weight: 600; }
.pg-btn.accent:hover:not(:disabled) { background: rgba(0,255,204,.1); }
.pg-btn.danger { color: #ff4d6d; border-color: #5c1f2b; }
.pg-btn.danger:hover:not(:disabled) { border-color: #ff4d6d; color: #ff4d6d; background: rgba(255,77,109,.08); }
.pg-btn.small { padding: .25rem .55rem; font-size: .8rem; border-radius: 6px; }
.pg-btn.icon { padding: .2rem .5rem; min-width: 1.9rem; justify-content: center; }

.pg-field { display: inline-flex; flex-direction: column; gap: 4px; }
.pg-field > span:not(.pg-num) { font-size: .82rem; color: #aaa; padding-left: 2px; }
.pg-input, .pg-select {
    background: rgba(26,26,26,0.85); color: #fff;
    border: 1px solid #333; border-radius: 8px;
    padding: .5rem .7rem; font-size: .9rem; outline: none; box-sizing: border-box;
    font-family: inherit;
}
.pg-input:focus, .pg-select:focus { border-color: #00ffcc; }
.pg-input.num { width: 5.2rem; }
.pg-input.tiny { width: 4rem; padding: .35rem .5rem; }
/* Number boxes: mp3-tracks' stepper (two slim chevrons inside the right edge), no browser spinner */
.pg-num { position: relative; display: inline-flex; align-self: flex-start; }
.pg-num input[type="number"] { -moz-appearance: textfield; appearance: textfield; padding-right: 1.7rem; }
.pg-num input[type="number"]::-webkit-inner-spin-button,
.pg-num input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pg-num input.tiny { width: 4.8rem; }
.pg-num-btns { position: absolute; top: 3px; right: 3px; bottom: 3px; width: 1.2rem; display: flex; flex-direction: column; gap: 2px; }
.pg-num-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 0;
    background: #262626; border: none; border-radius: 4px; color: #aaa; cursor: pointer;
    transition: background .15s, color .15s;
}
.pg-num-btn:hover { background: rgba(0,255,204,0.15); color: #00ffcc; }
.pg-num-btn:active { background: rgba(0,255,204,0.3); }
.pg-num input:disabled + .pg-num-btns .pg-num-btn { opacity: .4; cursor: default; pointer-events: none; }
.pg-num-btn svg { width: .55rem; height: .35rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pg-select.small, .pg-input.small { padding: .35rem .5rem; font-size: .85rem; border-radius: 6px; }
.pg-name-input { font-size: 1.05rem; font-weight: 600; min-width: 14rem; flex: 0 1 22rem; }

/* View toggle (card-gallery's) */
.pg-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .8rem; }
.pg-tab {
    padding: .5rem .9rem; border-radius: 8px;
    background: rgba(26,26,26,0.72); border: 1px solid #333; color: #fff;
    cursor: pointer; user-select: none; font-size: .92rem;
}
.pg-tab.active { border-color: #00ffcc; box-shadow: 0 0 0 2px rgba(0,255,204,.1); }
.pg-tab .pg-tab-count { margin-left: .4rem; font-size: .8rem; }
.pg-tab .pg-unsaved { color: #ffd21a; font-weight: 600; }
.pg-seg { display: inline-flex; border: 1px solid #333; border-radius: 8px; overflow: hidden; }
.pg-seg button { background: rgba(26,26,26,0.85); color: #aaa; border: none; padding: .4rem .8rem; cursor: pointer; font-size: .85rem; }
.pg-seg button + button { border-left: 1px solid #333; }
.pg-seg button.active { color: #000; background: #00ffcc; font-weight: 600; }

.pg-panel {
    background: rgba(22,27,34,0.62); border: 1px solid #30363d; border-radius: 10px;
    padding: .8rem 1rem; margin: .8rem 0;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.pg-panel h3 { margin: .1rem 0 .5rem; font-size: 1rem; color: #e6edf3; font-weight: 600; }

/* Pack list */
.pg-pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.pg-pack-tile {
    background: rgba(22,27,34,0.62); border: 1px solid #30363d; border-radius: 10px; padding: .7rem;
    cursor: pointer; display: flex; flex-direction: column; gap: .5rem; transition: border-color .15s, transform .15s;
    color: inherit; text-decoration: none;
}
.pg-pack-tile:hover { border-color: #00ffcc; transform: translateY(-2px); }
.pg-pack-tile .pg-pack-name { font-weight: 600; }
.pg-pack-meta { display: flex; align-items: center; gap: .5rem; }
.pg-pack-meta .pg-muted { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-pack-meta .pg-pack-export { flex: 0 0 auto; }

/* A card picture, the 20px print bleed cropped like card-gallery's */
.pg-card {
    position: relative; aspect-ratio: 1086 / 1512; overflow: hidden; background: #111;
    border-radius: min(45px, 12%) / min(45px, 8.62%);
}
.pg-card img {
    position: absolute; top: -1.323%; left: -1.842%; width: 103.684%; height: 102.646%;
    display: block; user-select: none; pointer-events: none;
}
.pg-card .pg-card-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px; font-size: .75rem; color: #aaa; }
.pg-thumb-btn { width: 64px; flex: 0 0 auto; cursor: pointer; border: none; padding: 0; background: none; }
.pg-thumb-btn .pg-card { box-shadow: 0 0 0 1px #333; transition: box-shadow .15s; }
.pg-thumb-btn:hover .pg-card { box-shadow: 0 0 0 2px #00ffcc; }
.pg-thumb-empty { width: 64px; aspect-ratio: 1086/1512; border: 1px dashed #444; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #666; font-size: 1.4rem; }

/* Sheet card grid */
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .9rem .7rem; margin-top: 2rem; }
/* Sheets: 10 cards a row (easier to count) */
.pg-grid.tens { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.pg-tile { display: flex; flex-direction: column; gap: .35rem; user-select: none; }
.pg-tile .pg-card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.pg-tile .pg-card:hover { transform: scale(1.03); box-shadow: 0 0 12px rgba(0,255,204,.3); }
.pg-tile.on .pg-card { box-shadow: 0 0 0 3px #00ffcc, 0 0 14px 3px rgba(0,255,204,.55); }
.pg-tile:not(.on) .pg-card img { filter: brightness(.55) saturate(.6); }
.pg-tile-count {
    position: absolute; right: 6%; top: 4%; z-index: 1;
    background: #00ffcc; color: #000; font-weight: 700; font-size: .8rem;
    border-radius: 10px; padding: 0 .45rem; line-height: 1.5;
}
.pg-tile-foot { display: flex; align-items: center; justify-content: center; min-height: 1.7rem; margin-top: .12rem; }
.pg-tile-name { font-size: .75rem; color: #c9d1d9; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; min-width: 0; }
.pg-stepper { display: inline-flex; align-items: center; gap: .2rem; flex: 0 0 auto; }
.pg-stepper button { width: 1.55rem; height: 1.55rem; border-radius: 6px; border: 1px solid #333; background: #1a1a1a; color: #e6edf3; cursor: pointer; padding: 0; font-size: .9rem; line-height: 1; }
.pg-stepper button:hover:not(:disabled) { border-color: #00ffcc; color: #00ffcc; }
.pg-stepper button:disabled { opacity: .35; cursor: default; }
.pg-tile:not(.on) .pg-stepper span { color: #666; }
.pg-stepper span { min-width: 1.2rem; text-align: center; font-weight: 600; font-size: .85rem; }

.pg-fill { font-weight: 700; font-size: 1.05rem; }

/* Stats */
.pg-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: .6rem 0; }
.pg-stat { background: rgba(13,17,23,0.6); border: 1px solid #30363d; border-radius: 8px; padding: .55rem .75rem; }
.pg-stat b { display: block; font-size: 1.25rem; color: #00ffcc; }
.pg-stat span { font-size: .8rem; color: #8b949e; }
.pg-error { background: rgba(255,0,102,.08); border: 1px solid #ff0066; color: #ff6b9a; border-radius: 8px; padding: .6rem .9rem; margin: .6rem 0; }
.pg-gen-warn { color: #ffd21a; }
.pg-error ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.pg-error li { margin: .2rem 0; }

/* Card rows (extras, decklists) */
.pg-list { display: flex; flex-direction: column; gap: .3rem; margin: .4rem 0; }
.pg-line { display: flex; align-items: center; gap: .55rem; padding: .25rem .4rem; border-radius: 8px; }
.pg-line:hover { background: rgba(255,255,255,.03); }
.pg-line .pg-card { width: 34px; flex: 0 0 auto; }
.pg-line-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .9rem; }
.pg-line-sub { color: #8b949e; font-size: .8rem; white-space: nowrap; }
.pg-qty { font-weight: 700; color: #00ffcc; min-width: 2rem; font-size: .9rem; }
.pg-foil-tag { color: #ffd21a; font-size: .75rem; font-weight: 700; }

/* Rules */
.pg-rule { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .5rem; padding: .5rem .6rem; background: rgba(13,17,23,0.55); border: 1px solid #30363d; border-radius: 8px; margin: .45rem 0; }
.pg-rule.off { opacity: .5; }
.pg-rule .pg-rule-word { color: #8b949e; font-size: .85rem; }
.pg-rule.fixed { color: #c9d1d9; font-size: .9rem; }
.pg-rule.fixed.off .pg-chk { text-decoration: line-through; }
.pg-chk { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; font-size: .88rem; color: #c9d1d9; }
.pg-chk input { accent-color: #00ffcc; width: 16px; height: 16px; }

/* Generations */
.pg-gen-list { display: flex; flex-direction: column; gap: .35rem; }
.pg-gen { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; padding: .4rem .6rem; border: 1px solid #30363d; border-radius: 8px; background: rgba(13,17,23,0.55); }
.pg-gen.active { border-color: #00ffcc; }
.pg-gen-name { font-weight: 600; cursor: pointer; }
.pg-progress { height: 6px; background: #21262d; border-radius: 3px; overflow: hidden; flex: 1; min-width: 120px; max-width: 320px; }
.pg-progress div { height: 100%; background: linear-gradient(90deg, #00ffcc, #00ccff); width: 0; transition: width .2s; }

.pg-blocks { display: grid; grid-template-columns: 1fr; gap: .9rem; margin-top: .8rem; }
.pg-blocks.decklists { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.pg-block { background: rgba(22,27,34,0.62); border: 1px solid #30363d; border-radius: 10px; padding: .7rem .9rem; }
/* Regular extras on the left, foil on the right (also when there are only foil extras) */
.pg-extras { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; align-items: start; }
.pg-extras .pg-block.foil { grid-column: 2; }
.pg-block-head { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .7rem; margin-bottom: .5rem; }
.pg-block-title { font-weight: 700; color: #58a6ff; }
.pg-pack { display: flex; align-items: center; gap: .6rem; margin: .9rem 0; }
.pg-pack-label { width: 4.6rem; flex: 0 0 auto; font-size: .8rem; color: #8b949e; }
.pg-pack-label.god { color: #ffd21a; font-weight: 600; }
.pg-pack-cards { --pg-card-gap: .3rem; --pg-group-gap: .9rem; display: flex; gap: var(--pg-group-gap); flex: 1; min-width: 0; }
.pg-pack-group { display: grid; gap: var(--pg-card-gap); flex: 0 0 auto; }
.pg-pack-cards .pg-card { cursor: default; }

/* Type × power table (deck builder's) */
.pg-dist { border-collapse: collapse; font-size: .78rem; margin: .4rem 0; width: auto; }
.pg-dist th { position: static; background: none; }
.pg-dist th, .pg-dist td { padding: .15rem .4rem; text-align: center; border-bottom: 1px solid #21262d; }
.pg-dist thead th { color: #8b949e; font-weight: 600; }
.pg-dist tbody th, .pg-dist tfoot th { color: #8b949e; text-align: right; font-weight: 500; }
.pg-dist td.zero { color: #30363d; }
.pg-dist tfoot td, .pg-dist tfoot th { border-top: 1px solid #30363d; font-weight: 700; }
/* Keyword counts in columns filling the width next to the type × power table */
.pg-kw-box { flex: 1 1 14rem; min-width: 0; margin: .4rem 0; }
.pg-kw-toggle { background: none; border: none; color: #8b949e; font-size: .8rem; font-weight: 600; cursor: pointer; padding: .15rem .3rem; font-family: inherit; }
.pg-kw-toggle:hover { color: #00ffcc; }
.pg-kw-title { display: inline-block; color: #8b949e; font-size: .8rem; font-weight: 600; padding: .15rem .3rem; margin-bottom: .4rem; }
.pg-kw-toggle::before { content: '▾ '; }
.kw-closed .pg-kw-toggle::before { content: '▸ '; }
.kw-closed .pg-kw-box.collapsible .pg-kw-dist { display: none; }
.pg-kw-dist { columns: 11rem; column-gap: 1.2rem; font-size: .78rem; margin: .2rem 0 0; }
.pg-kw-dist > div { display: flex; justify-content: space-between; gap: .6rem; padding: .15rem .3rem; border-bottom: 1px solid #21262d; break-inside: avoid; }
.pg-kw-dist span { color: #8b949e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-kw-dist b.zero { color: #30363d; font-weight: 400; }
.pg-dist-wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: flex-start; }
.stat-rock { color: #4CAF50; }
.stat-paper { color: #2196F3; }
.stat-scissors { color: #FF9800; }
.stat-gun { color: #FFC107; }

/* Modal (thumbnail picker, confirm) */
.pg-modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 1rem; }
.pg-modal-box { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 1rem 1.2rem; width: 100%; max-width: 900px; max-height: 88vh; overflow: auto; box-sizing: border-box; }
.pg-modal-box.narrow { max-width: 420px; }
.pg-confirm-msg { margin-bottom: 1.6rem; }
.pg-modal-box h3 { margin: 0 0 .6rem; }

.pg-toast {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 400; display: none;
    background: #21262d; border: 1px solid #30363d; color: #e6edf3; padding: .75rem 1rem; border-radius: 10px;
}
.pg-toast.err { background: #ff0066; border-color: #ff0066; color: #fff; box-shadow: 0 0 15px rgba(255,0,102,.5); }
.pg-toast.ok { border-color: #2ea043; color: #3fb950; }

@media (max-width: 767px) {
    .pg-page { padding: 0 1rem 2rem; }
    .pg-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
    .pg-grid.tens { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .pg-pack { flex-direction: column; align-items: stretch; gap: .25rem; }
    .pg-pack-label { width: auto; }
    .pg-blocks.decklists { grid-template-columns: 1fr; }
    .pg-extras { grid-template-columns: minmax(0, 1fr); }
    .pg-extras .pg-block.foil { grid-column: auto; }
}

/* Card picker (app.js openCardPicker(), domain-settings' rigged card picker): a button + a list with a search box */
.pg-pick { position: relative; width: 100%; max-width: 22rem; }
.pg-pick-btn {
    width: 100%; display: flex; align-items: center; text-align: left;
    background: rgba(26,26,26,0.85); border: 1px solid #333; border-radius: 8px; color: #aaa;
    padding: .4rem 1.6rem .4rem .65rem; font-size: .88rem; font-family: inherit; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; transition: border-color .15s;
}
.pg-pick-btn::after {
    content: ''; position: absolute; right: .6rem; top: 50%; width: .4rem; height: .4rem;
    border-right: 1.6px solid #aaa; border-bottom: 1.6px solid #aaa; transform: translateY(-70%) rotate(45deg);
}
.pg-pick-btn:hover { border-color: #444; }
.pg-pick-btn:focus-visible, .pg-pick-btn[aria-expanded="true"] { outline: none; border-color: #00ffcc; }
.pg-pick-pop {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 14rem;
    background: #161616; border: 1px solid #00ffcc55; border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.6); overflow: hidden;
}
.pg-pick-search {
    width: 100%; box-sizing: border-box; background: #1a1a1a; border: none; border-bottom: 1px solid #333;
    color: #fff; padding: .5rem .65rem; font-size: .88rem; font-family: inherit;
}
.pg-pick-search:focus { outline: none; }
.pg-pick-list { list-style: none; margin: 0; padding: .25rem; max-height: 15rem; overflow-y: auto; }
.pg-pick-list li { padding: .35rem .5rem; border-radius: 5px; font-size: .88rem; color: #ddd; cursor: pointer; }
.pg-pick-list li.active { background: rgba(0,255,204,.14); color: #fff; }
.pg-pick-list .pg-pick-empty { color: #8b949e; cursor: default; }
