.picture-pair-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-bottom:16px}
.picture-pair-count{margin-left:auto;color:var(--text-soft);font-size:12px}
.picture-pair-row{padding:14px 0;border-top:1px solid var(--line)}
.picture-pair-row>header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.picture-pair-sides{display:grid;grid-template-columns:minmax(0,1fr) 20px minmax(0,1fr);align-items:center;gap:10px}
.picture-pair-link{width:18px;color:var(--primary)}
.picture-pair-side{min-width:0;display:grid;gap:8px}
.picture-pair-side .field{margin:0}
.picture-pair-image{position:relative;height:140px;border:1px dashed var(--line);border-radius:8px;background:var(--surface);overflow:hidden}
.picture-pair-image.has-image{border-style:solid}
.picture-pair-image>img{width:100%;height:100%;object-fit:contain}
.picture-pair-image>.icon-btn{position:absolute;right:6px;top:6px;background:var(--surface)}
.picture-pair-upload{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;height:100%;border:0;background:transparent;color:var(--text-soft);font:inherit;font-size:12px;cursor:pointer}
.picture-pair-upload>svg{width:28px;height:28px;color:var(--primary)}
.picture-pair-upload:hover{background:var(--primary-soft)}
.picture-pair-replace{position:absolute;bottom:6px;right:6px;width:32px;height:32px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--text);cursor:pointer}
.picture-pair-replace>svg{width:16px;height:16px}
.picture-library{padding:14px 0 18px;border-top:1px solid var(--line)}
.picture-library-tools{display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin-bottom:14px}
.picture-library-tools>.school-search{flex:1 1 180px;min-width:0;margin:0}
.picture-library-tools>.field{flex:1 1 150px;margin:0}
.picture-library-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.picture-library-card{position:relative;display:grid;grid-template-rows:110px 1fr;min-width:0;overflow:hidden;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer}
.picture-library-card:has(input:checked){border-color:var(--primary);box-shadow:0 0 0 1px var(--primary)}
.picture-library-card>input{position:absolute;top:8px;right:8px;width:18px;height:18px;accent-color:var(--primary)}
.picture-library-card>img{width:100%;height:110px;object-fit:contain;background:var(--surface-2)}
.picture-library-card>span{display:grid;gap:4px;padding:10px;overflow-wrap:anywhere;font-size:12px}
.picture-library-card strong{font-size:19px;font-weight:600}
.picture-library-card small{color:var(--text-soft)}
.picture-library-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-top:14px}
.picture-library-pagination{display:flex;align-items:center;gap:6px;color:var(--text-soft);font-size:12px}
.picture-library-state{grid-column:1/-1;display:grid;justify-items:center;gap:10px;padding:24px 8px;color:var(--text-soft)}
.picture-library-custom{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:12px 0 20px;border-bottom:1px solid var(--line);margin-bottom:16px}
.picture-library-custom .field{margin:0;min-width:0}
.picture-library-custom img{height:80px;max-width:100%;object-fit:contain;border-radius:6px}
.picture-library-custom input[type=file]{max-width:100%;font-size:12px}
.learn-match-board.picture-match .learn-match-label,.learn-match-board.picture-match .learn-match-target{min-height:132px;border-radius:8px;flex-wrap:wrap}
.learn-match-board.picture-match .learn-match-label img,.learn-match-board.picture-match .learn-match-assigned img{width:110px;height:100px;object-fit:contain;border-radius:6px}
.learn-match-board.picture-match .learn-match-chip img{width:96px;height:80px;object-fit:contain}
.learn-match-board.picture-match .learn-match-bank{border-radius:8px}
.learn-match-board.picture-match .learn-match-chip{border-radius:8px;min-height:48px}
.learn-match-board.picture-match .learn-match-label>span,.learn-match-board.picture-match .learn-match-assigned>span,.learn-match-board.picture-match .learn-match-chip>span{white-space:pre-line;overflow-wrap:anywhere}
.modal:has(.picture-pair-editor){max-width:850px}
.picture-pair-editor .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.picture-pair-editor .field{min-width:0}
.picture-exercise-shuffle{display:flex;align-items:center;gap:8px;margin:4px 0 18px;font-size:13px}
.picture-exercise-shuffle input{width:18px;height:18px;accent-color:var(--primary)}
.picture-exercise-settings{border-top:1px solid var(--line);padding-top:16px}
.picture-exercise-settings>summary{cursor:pointer;font-size:13px;font-weight:600;margin-bottom:14px}
.picture-exercise-scoring{padding-top:16px;border-top:1px solid var(--line)}
@media(max-width:600px){
  .picture-pair-editor .form-grid{grid-template-columns:minmax(0,1fr)}
  .picture-pair-sides{grid-template-columns:minmax(0,1fr);gap:14px}
  .picture-pair-link{display:none}
  .picture-pair-side .field>span{font-size:11px}
  .picture-pair-image{height:116px}
  .picture-pair-upload{font-size:11px;padding:6px}
  .picture-library-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .picture-library-custom{grid-template-columns:minmax(0,1fr)}
  .learn-match-board.picture-match .learn-match-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;border:0;padding:0}
  .learn-match-board.picture-match .learn-match-label,.learn-match-board.picture-match .learn-match-target{padding:8px;min-height:126px}
  .learn-match-board.picture-match .learn-match-label img,.learn-match-board.picture-match .learn-match-assigned img{width:100%;height:90px;min-width:0}
  .learn-match-board.picture-match .learn-match-assigned{flex-wrap:wrap}
  .learn-match-board.picture-match .learn-match-target>button{position:absolute;top:3px;right:3px;background:var(--surface)}
  .learn-match-board.picture-match .learn-match-placeholder{font-size:12px;overflow-wrap:anywhere}
}

/* Paged player only; editor, library and legacy matches keep their layout. */
.learn-exercise:has(.picture-match-paged),.learn-question-scene:has(.picture-match-paged){min-width:0;overflow:visible}
.learn-stage:has(.picture-match-paged){margin:8px auto}
.learn-question-scene:has(.picture-match-paged){min-height:0;padding:10px 0;justify-content:flex-start}
.learn-question-scene:has(.picture-match-paged)>.learn-points-line{margin-bottom:6px}
.learn-question-scene:has(.picture-match-paged)>.learn-instruction{margin-bottom:6px}
.learn-question-scene:has(.picture-match-paged)>h2,.learn-stage:has(.picture-match-paged)>h2{margin-bottom:12px}
.learn-match-board.picture-match.picture-match-paged{display:grid;gap:16px;min-width:0;width:100%;color:var(--text)}
.picture-match-paged .picture-match-header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;color:var(--text-soft);font-size:12px;line-height:1.4}
.picture-match-paged .picture-match-header>span{min-width:0;overflow-wrap:anywhere;font-size:12px;line-height:1.4}
.picture-match-paged .picture-match-progress{display:block;width:100%;height:4px;min-height:0;padding:0;border:0;background:var(--line)}
.picture-match-paged .picture-match-progress>span{display:block;max-width:100%;height:100%;min-height:0;padding:0;border:0;background:var(--primary)}
.picture-match-paged .picture-match-layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);align-items:start;gap:24px;min-width:0;overflow:visible}
.picture-match-paged .picture-match-pages{display:grid;gap:12px;min-width:0}
.picture-match-paged .learn-pairs.picture-match-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:1fr;gap:12px;min-width:0}
.picture-match-paged .picture-match-card-empty{min-width:0;min-height:190px;border:0;background:transparent;pointer-events:none}
.picture-match-paged .picture-match-option-empty{min-width:0;min-height:44px;border:0;background:transparent;pointer-events:none}
.picture-match-paged.has-option-media .picture-match-option-empty{min-height:102px}
.learn-match-board.picture-match.picture-match-paged .learn-match-row{position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:1fr auto;align-items:stretch;gap:8px;min-width:0;padding:10px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.learn-match-board.picture-match.picture-match-paged .learn-match-row.is-selected-row{border-color:var(--primary)}
.picture-match-paged .picture-match-number{position:absolute;top:6px;left:6px;z-index:1;display:grid;place-items:center;min-width:20px;min-height:20px;padding:1px 4px;border-radius:6px;background:var(--primary-soft);color:var(--primary);font-size:12px;font-weight:600}
.learn-match-board.picture-match.picture-match-paged .learn-match-label{display:flex;flex-direction:column;justify-content:center;gap:8px;min-height:0;padding:0;border:0;background:transparent;text-align:center;font-size:16px;line-height:1.4}
.learn-match-board.picture-match.picture-match-paged .learn-match-label img{display:block;width:100%;height:100px;max-width:100%;min-width:0;object-fit:contain;background:var(--surface-2)}
.learn-match-board.picture-match.picture-match-paged .learn-match-label>span{padding-inline:24px}
.learn-match-board.picture-match.picture-match-paged .learn-match-target[data-match-slot]{display:flex;align-items:center;flex-wrap:nowrap;gap:6px;min-height:58px;padding:6px;border-radius:6px;font-size:15px;line-height:1.4}
.learn-match-board.picture-match.picture-match-paged.has-option-media .learn-match-target[data-match-slot]{min-height:94px}
.learn-match-board.picture-match.picture-match-paged .learn-match-assigned{display:flex;flex:1 1 0;flex-direction:column;align-items:center;gap:6px;min-width:0;text-align:center}
.learn-match-board.picture-match.picture-match-paged .learn-match-assigned img{display:block;width:100%;max-width:100%;height:80px;min-width:0;object-fit:contain}
.learn-match-board.picture-match.picture-match-paged .learn-match-target button[data-match-clear]{position:static;inset:auto;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;align-self:center;background:var(--surface);cursor:pointer}
.learn-match-board.picture-match.picture-match-paged .learn-match-bank.picture-match-bank{display:grid;gap:12px;min-width:0;padding:0;border:0;border-radius:0;background:transparent}
.picture-match-paged .picture-match-bank>strong{font-size:15px;line-height:1.4;overflow-wrap:anywhere}
.learn-match-board.picture-match.picture-match-paged .picture-match-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(44px,1fr);align-items:stretch;gap:8px;min-width:0}
.learn-match-board.picture-match.picture-match-paged .learn-match-chip[data-match-option]{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:6px;width:100%;min-width:0;min-height:44px;height:auto;padding:10px 8px;font-size:20px;line-height:1.4;text-align:center;box-shadow:none;cursor:pointer}
.learn-match-board.picture-match.picture-match-paged.has-long-options .learn-match-chip[data-match-option]{font-size:16px}
.learn-match-board.picture-match.picture-match-paged .learn-match-chip img{display:block;width:100%;max-width:100%;height:80px;min-width:0;object-fit:contain}
.picture-match-paged .learn-match-label>span,.picture-match-paged .learn-match-assigned>span,.picture-match-paged .learn-match-chip>span{max-width:100%;min-width:0;white-space:pre-line;overflow-wrap:anywhere}
.picture-match-paged .learn-match-chip:disabled.used{opacity:.45;cursor:default;transform:none;box-shadow:none}
.picture-match-paged .picture-match-nav{display:flex;align-items:center;justify-content:center;gap:10px;min-width:0}
.picture-match-paged .picture-match-nav>span{min-width:0;text-align:center;font-size:14px;line-height:1.4;color:var(--text-soft);overflow-wrap:anywhere}
.picture-match-paged .picture-match-nav button.icon-btn[data-match-page]{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--primary)}
.picture-match-paged .picture-match-nav button:disabled{opacity:.45;cursor:default}
.picture-match-paged button:focus-visible,.picture-match-paged [data-match-slot]:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
@media(min-width:601px){
  .learn-player:has(.picture-match-paged) .learn-heading{min-height:64px;padding:8px 0}
  .learn-stage:has(.picture-match-paged){padding:12px 0 18px}
  .learn-exercise:has(.picture-match-paged){box-sizing:border-box;width:min(980px,100%);margin-inline:auto;padding:16px 20px;border:0;box-shadow:none}
}
@media(max-width:600px){
  .learn-stage:has(.picture-match-paged){margin:4px auto}
  .learn-exercise:has(.picture-match-paged){padding:8px 10px}
  .learn-question-scene:has(.picture-match-paged){padding:4px 0}
  .learn-question-scene:has(.picture-match-paged)>h2,.learn-stage:has(.picture-match-paged)>h2{margin-bottom:8px;font-size:18px}
  .learn-match-board.picture-match.picture-match-paged{gap:10px}
  .picture-match-paged .picture-match-layout{height:var(--picture-match-height,320px);grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;align-items:stretch;gap:8px;min-height:0}
  .picture-match-paged .picture-match-pages{grid-template-rows:minmax(0,1fr) 44px;gap:6px;min-height:0}
  .picture-match-paged .learn-pairs.picture-match-grid{grid-auto-rows:max-content;align-content:start;gap:8px;min-height:0;overflow-y:auto}
  .picture-match-paged .picture-match-card-empty{min-height:140px}
  .picture-match-paged.has-option-media .picture-match-option-empty{min-height:62px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-row{grid-template-rows:1fr auto;gap:6px;min-height:140px;box-sizing:border-box;padding:6px}
  .picture-match-paged .picture-match-number{position:absolute;top:6px;left:6px;z-index:1}
  .learn-match-board.picture-match.picture-match-paged .learn-match-label{font-size:14px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-label>span{box-sizing:border-box;width:100%;padding-inline:26px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-label img{height:56px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-target[data-match-slot]{box-sizing:border-box;min-height:44px;padding:4px;gap:4px;font-size:14px}
  .learn-match-board.picture-match.picture-match-paged.has-option-media .learn-match-target[data-match-slot]{min-height:66px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-placeholder{font-size:14px;line-height:1.4}
  .learn-match-board.picture-match.picture-match-paged .learn-match-assigned img{height:56px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-bank.picture-match-bank{position:static;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:44px auto;align-items:center;padding:6px 0 0;gap:6px;border-top:1px solid var(--line);background:var(--surface)}
  .picture-match-paged .picture-match-bank>strong{grid-area:1 / 1;font-size:14px}
  .picture-match-paged .picture-match-bank>.picture-match-nav{grid-area:1 / 2}
  .picture-match-paged .picture-match-bank>.picture-match-options{grid-area:2 / 1 / 3 / -1}
  .learn-match-board.picture-match.picture-match-paged .picture-match-options{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
  .learn-match-board.picture-match.picture-match-paged.has-long-options .picture-match-options,.learn-match-board.picture-match.picture-match-paged.has-option-media .picture-match-options{grid-template-columns:repeat(2,minmax(0,1fr))}
  .learn-match-board.picture-match.picture-match-paged .learn-match-chip[data-match-option]{padding:6px 4px;font-size:18px;line-height:1.4}
  .learn-match-board.picture-match.picture-match-paged.has-long-options .learn-match-chip[data-match-option]{font-size:14px}
  .learn-match-board.picture-match.picture-match-paged .learn-match-chip img{height:48px}
  .picture-match-paged .picture-match-nav{gap:8px}
}
