/* The allocation editor uses the original playground's type, color and form controls. */
:root {
  --piu-tint-0:rgba(79,143,201,.10); --piu-tint-1:rgba(201,90,106,.10);
  --piu-tint-2:rgba(62,142,107,.10); --piu-tint-3:rgba(122,91,207,.10);
}
#setup { max-width:1580px; margin:0 auto; padding:0 32px; }
body.wide header.top .wrap { max-width:1580px; }
.form { grid-template-columns:210px minmax(0,1fr); gap:23px 26px; margin-top:24px; }
.form>div { min-width:0; }
.form .hint { max-width:90ch!important; }
.allocation-label { font-size:15px; font-weight:600; padding-top:14px; }
.allocation-shell { border:1px solid var(--rule); border-radius:6px; padding:20px; min-width:0; }
.allocation-main { display:grid; grid-template-columns:minmax(0,1fr); gap:22px; }
.allocation-task,.allocation-people { min-width:0; }
.allocation-shell h2 { font:600 17px/1.35 var(--head); margin:0 0 14px; }
.allocation-task #q-task { font:600 21px/1.35 var(--head); letter-spacing:-.012em; margin:0 0 10px; max-width:65ch; text-wrap:pretty; }
.task-explanation { font-size:15px; line-height:1.55; color:var(--ink-2); margin-top:8px; max-width:90ch; }
.reference-answer { font-size:14px; line-height:1.5; margin-top:13px; }
.reference-answer summary,.case-source summary { cursor:pointer; color:var(--ink-2); width:fit-content; }
.reference-answer>p { margin-top:8px; color:var(--ink-2); max-width:90ch; }
.evidence-heading { padding-top:17px; border-top:1px solid var(--rule); margin-top:18px!important; margin-bottom:12px!important; }
.source-pool { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.source-pool[data-count="4"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
.source-unit,.assigned-unit { display:flex; flex-direction:column; gap:8px; min-width:0; text-align:left; background:var(--bg); cursor:grab; border:1px solid var(--rule); border-radius:5px; padding:11px; position:relative; color:var(--ink); }
.unit-heading { display:flex; align-items:center; gap:8px; min-width:0; line-height:1.35; }
.unit-heading strong { font-size:13px; font-weight:600; flex:1; overflow-wrap:anywhere; }
.unit-id { display:inline-flex; align-items:baseline; justify-content:center; min-width:32px; flex:none; padding:2px 8px; border-radius:4px; font:italic 18px/1.15 Georgia,serif; color:color-mix(in srgb,var(--unit-color) 78%,var(--ink)); background:var(--unit-tint); }
.unit-id sub { font:500 11px/1 var(--head); transform:translateY(2px); margin-left:1px; }
.unit-text { font-size:14px; line-height:1.5; white-space:normal; overflow-wrap:anywhere; min-width:0; }
.unit-grip { color:var(--muted); font:20px/1 var(--head); margin-left:auto; padding:4px; touch-action:none; user-select:none; cursor:grab; }
.source-unit:hover,.assigned-unit:hover { border-color:var(--unit-color); background:var(--unit-tint); }
[data-piu][aria-pressed=true] { outline:2px solid var(--unit-color); outline-offset:2px; }
.allocation-people { border-top:1px solid var(--rule); padding-top:20px; }
.people-heading { display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.people-heading h2 { margin:0; }
.participant-count { display:inline-flex; border:1px solid var(--rule); border-radius:4px; align-items:center; height:32px; overflow:hidden; font-size:14px; }
.participant-count button { width:34px; height:32px; font-size:18px; }
.participant-count button:hover:not(:disabled) { background:var(--soft); }
.participant-count button:disabled { opacity:.35; cursor:default; }
.participant-count output { display:inline-grid; place-items:center; min-width:32px; font-size:14px; font-weight:550; }
/* Rows grow with their contents; no nested scrolling or fixed packet heights. */
.participant-list { display:flex; flex-direction:column; gap:9px; }
.participant-slot { border:1px solid var(--rule); border-radius:5px; display:grid; grid-template-columns:180px minmax(0,1fr); gap:16px; align-items:start; min-height:76px; padding:10px; background:var(--bg); transition:background .14s,border-color .14s; }
.participant-identity { display:flex; gap:9px; align-items:flex-start; min-width:0; }
.participant-identity>div { min-width:0; }
.participant-letter { display:inline-grid; place-items:center; flex:none; width:28px; height:30px; background:var(--soft); border:1px solid var(--rule); border-radius:4px; font-size:16px; font-weight:550; }
.participant-role { font-size:13.5px; line-height:1.4; color:var(--ink-2); overflow-wrap:anywhere; padding-top:3px; }
.participant-material,.common-material { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:8px; min-width:0; }
.held-unit { display:flex; align-items:stretch; position:relative; min-width:0; }
.assigned-unit { border:0; flex:1; background:var(--unit-tint); padding:9px 29px 9px 9px; gap:7px; width:100%; }
.assigned-unit .unit-heading { gap:4px; }
.assigned-unit .unit-grip { font-size:17px; padding:0 3px; }
.assigned-unit .unit-text { font-size:13.5px; }
/* One packet uses the row width; multiple packets form a wrapping grid. */
.held-unit:only-child .assigned-unit { display:grid; grid-template-columns:52px minmax(0,1fr); align-items:start; }
.remove-unit { position:absolute; right:1px; top:3px; color:var(--muted); height:27px; width:27px; font-size:18px; border-radius:4px; }
.remove-unit:hover { color:var(--bad); background:var(--bg); }
.empty-packet { color:var(--muted); font-size:13px; padding:6px 0; min-height:40px; }
.common-slot { border:1px dashed var(--rule); border-radius:5px; padding:12px; margin-top:12px; min-height:76px; }
.common-slot h3 { font:550 15px/1.35 var(--head); margin:0; }
.common-slot p { font-size:13px; line-height:1.5; color:var(--muted); margin-top:3px; }
.common-material { margin-top:10px; }
.common-material:empty { display:none; }
.give-unit { display:none; font-size:12px; color:var(--ink-2); border:1px dashed var(--rule); border-radius:3px; padding:4px 7px; text-align:left; margin-top:7px; background:var(--bg); }
.has-picked-unit .give-unit { display:inline-block; }
.has-picked-unit [data-drop] { cursor:pointer; }
.is-drop-target { border:1px dashed var(--drop-color)!important; background:color-mix(in srgb,var(--drop-color) 7%,var(--bg))!important; outline:1px solid var(--drop-color); outline-offset:1px; }
.role-preview { font-size:12px; color:var(--ink); line-height:1.4; margin-top:7px; }
.allocation-help { display:flex; align-items:baseline; justify-content:space-between; gap:16px; padding:13px 0 12px; border-top:1px solid var(--rule); margin-top:18px; color:var(--muted); font-size:12px; line-height:1.5; }
.allocation-help p { max-width:80ch; }
.allocation-help p span { display:block; }
.allocation-mode { flex:none; font-size:12px; text-align:right; max-width:35ch; }
.preset-row { display:flex; align-items:center; gap:14px; border-top:1px solid var(--rule); padding-top:14px; flex-wrap:wrap; }
.preset-row label { font-size:14px; font-weight:550; min-width:100px; }
.preset-row select { min-width:0; max-width:420px; width:100%; flex:1; font-size:14px; }
.preset-row .btn { padding:6px 18px; font-size:13px; border-color:var(--rule); }
.allocation-status { font-size:12px; line-height:1.5; color:var(--ink-2); margin-top:10px; }
.allocation-status:empty,.allocation-shell #warn:empty,#setup-error:empty { display:none; }
.case-source { font-size:12px; color:var(--muted); margin-top:14px; }
.case-source p { margin-top:8px; white-space:pre-wrap; line-height:1.5; }
.case-source>details { margin-top:9px; }
.case-source>details>p { max-height:220px; overflow:auto; padding:8px; background:var(--soft); }
#setup-error { margin-top:18px; }
.touch-drag-ghost { position:fixed!important; z-index:10000; pointer-events:none; width:240px!important; max-height:190px; overflow:hidden; box-shadow:0 8px 20px rgba(20,24,28,.17); opacity:.9; transform:rotate(1deg); }
.allocation-shell .hint { font-size:13px; }
.allocation-task>h3 { margin:0; }
@media(max-width:1200px) {
  .form { grid-template-columns:180px minmax(0,1fr); gap:22px 20px; }
  .allocation-shell { padding:16px; }
  .participant-slot { grid-template-columns:150px minmax(0,1fr); gap:12px; }
  .allocation-task #q-task { font-size:20px; }
}
@media(max-width:1050px) {
  .source-pool { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .participant-slot { grid-template-columns:130px minmax(0,1fr); }
  .participant-material,.common-material { grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr)); }
}
@media(max-width:700px) {
  #setup { padding:0 18px; }
  .form { grid-template-columns:1fr; gap:9px; margin-top:20px; }
  .form>label.f:not(:first-child),.allocation-label { margin-top:13px; }
  .form>span:empty { display:none; }
  .form>div>select,.form .line2>select { min-width:0; width:100%; }
  .form>div>.line2 { align-items:stretch; flex-wrap:wrap; }
  .form label.f { font-size:14px; }
  .allocation-shell { padding:13px; }
  .allocation-task #q-task { font-size:19px; }
  .source-pool { gap:8px; }
  .source-unit { padding:9px; }
  .unit-heading { gap:6px; }
  .unit-heading strong { font-size:12px; }
  .unit-text { font-size:13px; }
  .participant-slot { grid-template-columns:minmax(0,1fr); padding:10px; gap:10px; }
  .participant-identity { align-items:center; }
  .participant-role { padding:0; }
  .assigned-unit .unit-text { font-size:13px; }
  .allocation-help { display:block; }
  .allocation-mode { display:block; text-align:left; margin-top:7px; }
  .preset-row { gap:10px; }
  .preset-row label { min-width:0; width:100%; }
  .preset-row select { flex:1; width:calc(100% - 80px); font-size:13px; }
  .preset-row .btn { padding:7px 12px; }
  .task-explanation { font-size:14px; }
  .reference-answer { font-size:13px; }
  .participant-count button { width:36px; }
  .allocation-shell h2 { font-size:16px; }
}
@media(max-width:480px) {
  .source-pool,.source-pool[data-count="4"] { grid-template-columns:minmax(0,1fr); }
  .unit-heading strong { font-size:13px; }
  .participant-material,.common-material { grid-template-columns:minmax(0,1fr); }
  .held-unit:only-child .assigned-unit { display:flex; }
}
@media(prefers-reduced-motion:reduce) {
  .participant-slot { transition:none; }
  .touch-drag-ghost { transform:none; }
}
