/* 後台「可以玩的遊戲學習單」勾選元件（2026-11-22 正式，搭配 grant-picker.js；預覽與說明在 ../redesign-preview/admin-v2/00_先看我.md）
   學生後台（index.html，body.fun-portal）和班級頁（classes.html）共用：按鈕類的樣式寫成 html body .x.x（同一個 class 寫兩次）＝蓋過兩邊頁面本來的按鈕樣式 */
/* ── 學生後台：編輯／建立學生帳號視窗放寬、上面的欄位兩個一排，留更多空間給遊戲 ── */
html body.fun-portal dialog#student-dialog.gpk-on{width:min(900px,calc(100vw - 28px))}
#student-dialog.gpk-on #student-form{display:grid;grid-template-columns:1fr 1fr;column-gap:16px;align-items:end}
#student-dialog.gpk-on #student-form>*{grid-column:1/-1}
#student-dialog.gpk-on #student-form>label:not(.inline){grid-column:auto}
#student-dialog.gpk-on #password-help{grid-column:2;align-self:center;margin:0 0 6px}
#student-dialog.gpk-on fieldset{margin-top:14px}
#student-dialog.gpk-on fieldset>legend{font-size:17px;color:#2E5E12}
#student-dialog.gpk-on #game-permissions{display:block}

/* ── 視窗下面一直看得到：這次改了什麼＋取消／儲存 ── */
.gpk-foot{position:sticky;bottom:-26px;z-index:3;margin:14px -26px -26px;padding:10px 26px 16px;background:linear-gradient(rgba(255,253,247,.86),#fffdf7 30%);border-top:1px solid #E3E6E1;display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.gpk-foot .dialog-actions{margin:0 0 0 auto!important}
.gpk-sum{margin:0;flex:1 1 260px;font-size:14.5px;font-weight:700;color:#4b524d;min-height:1.3em}
.gpk-sum b.a{color:#2f7d14}.gpk-sum b.r{color:#c0392b}
.gpk-sum.toast{color:#2E5E12}

/* ── 元件本體 ── */
.gpk{--g:#6B9C09;--g2:#3f6b0a;--gl:#f3f9e6;--gb:#bcdc7f;--y:#f2c94c;--line:#dfe3dc;--ink:#2d322f;--mut:#6b726d;color:var(--ink);font-size:15px}
.gpk [hidden]{display:none!important}
.gpk-top{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:2px 0 8px}
.gpk-total{font-weight:800;white-space:nowrap;font-size:15px}.gpk-total b{font-size:18px;color:var(--g2)}
html body .gpk-search.gpk-search{position:relative;flex:1 1 240px;display:block;margin:0!important;font-size:15px!important}
.gpk-search svg{position:absolute;left:11px;top:50%;width:18px;height:18px;transform:translateY(-50%);fill:none;stroke:#7b8a72;stroke-width:2.2;stroke-linecap:round;pointer-events:none}
html body .gpk-search.gpk-search input{width:100%;box-sizing:border-box;min-height:38px;height:38px;margin:0!important;padding:4px 12px 4px 36px!important;border:2px solid #c9d1bd!important;border-radius:12px!important;font-size:15px!important;font-weight:700;background:#fff;color:#2d322f}
.gpk-quick{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 10px}
.gpk-spacer{flex:1}
html body .gpk-copy.gpk-copy{display:flex!important;flex-direction:row!important;align-items:center;gap:6px;margin:0!important;font-size:14px!important;font-weight:800;color:#4b524d}
html body .gpk-copy.gpk-copy select{min-height:34px;height:34px;padding:2px 8px;border:2px solid #c9d1bd;border-radius:10px;font-size:14px;font-weight:700;background:#fff;color:#2d322f;max-width:300px}
.gpk-note{margin:0 0 10px;padding:8px 12px;border-radius:12px;background:#fff8e1;border:1px solid #f1d98a;color:#6b5200;font-size:14px;font-weight:700}
.gpk-found{margin:-2px 0 10px;font-size:14px;font-weight:700;color:#4b524d;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.gpk-found b{color:var(--g2);font-size:16px}
.gpk-sep{margin:14px 0 8px;padding-top:12px;border-top:2px dashed #d9ded6;font-size:13.5px;font-weight:800;color:#7a817b}
.gpk-tip{margin:10px 2px 0;font-size:12.5px;color:#8a918c;font-weight:700}

/* 按鈕（兩邊頁面本來的按鈕樣式都很強，這裡要用 !important 蓋過） */
html body .gpk-btn.gpk-btn{display:inline-flex;align-items:center;justify-content:center;min-height:34px!important;height:auto!important;padding:3px 12px!important;border-radius:10px!important;border:1px solid #B7BFB5!important;background:#fff!important;color:#2d322f!important;font-size:14px!important;font-weight:800!important;font-family:inherit;box-shadow:none!important;text-shadow:none!important;line-height:1.2!important;white-space:nowrap;cursor:pointer;transform:none!important;filter:none!important}
html body .gpk-btn.gpk-btn:hover{background:#f3f9e6!important;border-color:#9fc65a!important}
html body .gpk-btn.gpk-btn.sm{min-height:30px!important;padding:2px 10px!important;font-size:13px!important}
html body .gpk-btn.gpk-btn.primary{background:#6B9C09!important;border-color:#6B9C09!important;color:#fff!important}
html body .gpk-btn.gpk-btn.primary:hover{background:#5a8507!important}
html body .gpk-btn.gpk-btn:disabled{opacity:.45;cursor:not-allowed}
html body .gpk-link.gpk-link{display:inline;min-height:0!important;height:auto!important;padding:0 2px!important;border:0!important;background:none!important;box-shadow:none!important;text-shadow:none!important;color:#3E7A0C!important;font-size:13px!important;font-weight:800!important;font-family:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer;transform:none!important;filter:none!important}

/* 分類一列 */
.gpk-cat{border:1px solid var(--line);border-left:5px solid #cfd5cb;border-radius:14px;background:#fff;margin-bottom:8px;overflow:hidden;transition:border-color .2s}
.gpk-cat.some{border-left-color:var(--y)}.gpk-cat.all{border-left-color:var(--g)}
.gpk-head{display:grid;grid-template-columns:16px minmax(0,1fr) 110px 74px 70px auto;align-items:center;gap:10px;padding:7px 10px 7px 12px;cursor:pointer;user-select:none;min-height:46px;box-sizing:border-box}
.gpk-head:hover{background:#fafcf6}
.gpk-head:focus-visible{outline:3px solid #cfe7a0;outline-offset:-3px}
.gpk-arrow{width:16px;height:16px;display:grid;place-items:center}
.gpk-arrow::before{content:'';width:7px;height:7px;border-right:2.6px solid var(--g2);border-bottom:2.6px solid var(--g2);transform:translateX(-2px) rotate(-45deg);transition:transform .22s}
.gpk-cat.open .gpk-arrow::before{transform:translateY(-2px) rotate(45deg)}
.gpk-name{font-weight:900;font-size:16px;color:#2E5E12;display:flex;align-items:center;gap:8px;min-width:0;white-space:nowrap}
.gpk-tag{font-style:normal;font-size:12px;font-weight:800;padding:1px 8px;border-radius:999px;background:#eef0ec;color:#6b726d}
.gpk-meter{height:8px;border-radius:99px;background:#eef0ec;overflow:hidden}
.gpk-meter i{display:block;height:100%;width:0;border-radius:99px;background:var(--y);transition:width .25s}
.gpk-cat.all .gpk-meter i{background:var(--g)}
.gpk-n{font-weight:800;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;font-size:14.5px;color:#4b524d}
.gpk-cat.all .gpk-n{color:var(--g2)}
.gpk-delta{font-size:13px;font-weight:900;white-space:nowrap;display:flex;gap:6px;justify-content:flex-end}
.gpk-delta .a{color:#2f7d14}.gpk-delta .r{color:#c0392b}
.gpk-acts{display:flex;gap:6px}

/* 滑出來的遊戲 */
.gpk-body{display:grid;grid-template-rows:0fr;transition:grid-template-rows .28s ease}
.gpk-cat.open .gpk-body{grid-template-rows:1fr}
.gpk-inner{min-height:0;overflow:hidden}
.gpk-pad{padding:10px 12px 12px;border-top:1px solid #eef0ec;background:#fcfdfa}
.gpk-group+.gpk-group{margin-top:12px}
.gpk-ghead{display:flex;align-items:baseline;gap:8px;margin:0 0 6px;font-size:14px}
.gpk-ghead b{color:var(--g2);font-size:14.5px}
.gpk-ghead small{color:var(--mut);font-weight:700;margin-right:4px}
.gpk-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.gpk-items.dense{grid-template-columns:repeat(auto-fill,minmax(68px,1fr))}
html body .gpk-it.gpk-it{position:relative;display:flex!important;flex-direction:row!important;align-items:center;gap:8px;user-select:none;-webkit-user-select:none;margin:0!important;padding:6px 9px;border:1px solid #e3e6e1;border-radius:10px;background:#fff;cursor:pointer;font-weight:700!important;font-size:14px!important;line-height:1.3;color:#2d322f!important;min-width:0;white-space:normal;transition:background .15s,border-color .15s}
.gpk-it:hover{border-color:#b9d48a}
.gpk-it input{width:18px!important;height:18px!important;min-height:0!important;flex:none;margin:0!important;accent-color:#6B9C09;cursor:inherit}
.gpk-tx{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html body .gpk-items.dense .gpk-it.gpk-it{justify-content:flex-start;padding:6px 8px}
.gpk-items.dense .gpk-tx{font-size:17px;letter-spacing:.02em}
html body .gpk-it.gpk-it.on{background:var(--gl);border-color:var(--gb)}
html body .gpk-it.gpk-it.some{background:#fffaea;border-color:#f0d78a}
.gpk-it.add{box-shadow:inset 4px 0 0 #2f7d14}
html body .gpk-it.gpk-it.del{box-shadow:inset 4px 0 0 #c0392b;background:#fff5f4;border-color:#f0c3bd}
html body .gpk-it.gpk-it.off{opacity:.42;cursor:not-allowed;background:#f4f5f3}
.gpk-mini{font-style:normal;margin-left:auto;flex:none;font-size:11px;font-weight:800;color:#6b726d;background:#eef0ec;border-radius:99px;padding:1px 7px}
.gpk-frac{margin-left:auto;flex:none;font-size:11.5px;font-weight:800;color:#8a6d00}
.gpk-items.dense .gpk-frac{display:none}
.gpk-items.dense .gpk-it.some::after{content:'';position:absolute;top:4px;right:5px;width:8px;height:8px;border-radius:50%;background:#e0a800;box-shadow:0 0 0 2px #fffaea}
.gpk-part{font-style:normal;font-size:12px;font-weight:800;padding:1px 8px;border-radius:999px;background:#fff3c4;color:#7a5c00}
.gpk-part[hidden]{display:none}

/* ── 學生後台的學生列表：左邊勾選框＋一起設定的工具列 ── */
#students td.gpk-sel,#admin table th.gpk-sel{width:38px;padding-left:12px!important;padding-right:0!important;text-align:center}
#students td.gpk-sel input,#admin table th.gpk-sel input{width:19px;height:19px;accent-color:#6B9C09;cursor:pointer;margin:0}
#students tr.gpk-picked>td{background:#f6fbec}
.gpk-bulk{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 10px;padding:8px 12px;border-radius:14px;border:1px dashed #c9d1bd;background:#fafcf6;font-size:14px;font-weight:700;color:#6b726d}
.gpk-bulk.on{border-style:solid;border-color:#9fc65a;background:#f3f9e6;color:#2d322f}
.gpk-bulk b{color:var(--g2,#3f6b0a);font-size:16px}
.gpk-bulk .gpk-bulk-n{margin-right:auto}

/* ── 學生後台：多位學生一起設定的視窗 ── */
html body.fun-portal dialog.gpk-dlg{width:min(900px,calc(100vw - 28px))}
.gpk-dlg .dialog-top h2{font-size:22px}
.gpk-who{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 6px}
.gpk-who span{display:inline-flex;align-items:baseline;gap:4px;padding:3px 10px;border-radius:999px;background:#f3f9e6;border:1px solid #bcdc7f;font-weight:800;font-size:14px;color:#2E5E12}
.gpk-who small{font-weight:700;color:#6b726d;font-size:12px}
.gpk-how{margin:4px 0 12px!important}
.gpk-berr{margin:8px 0 0}
@media(max-width:1100px){.gpk-head{grid-template-columns:16px minmax(0,1fr) 70px 66px 56px auto;gap:8px}}
@media(max-width:720px){.gpk-head{grid-template-columns:16px minmax(0,1fr) 62px auto;gap:6px}.gpk-meter,.gpk-delta{display:none}}
