/* Shared visual vocabulary only. Submission, retry, focus order and timing stay
   with the existing page handlers. Read after ui_language.css; specificity also
   supports pages that load their older component sheets after ui_head(). */
:root {
 --wwi-button-depth:7px;
 --wwi-button-radius:10px;
 --wwi-button-top:#fff;
 --wwi-button-bottom:#eaf1f6;
 --wwi-button-border:#7893a5;
 --wwi-button-ink:#173d56;
 --wwi-button-edge:#a7bac9;
 --wwi-button-edge-dark:#69879d;
 --wwi-button-shade:#173d562b;
 --wwi-button-light:#ffffffb3;
}

/* Leave image thumbnails, image choices and the hidden tutorial guide control
   to their own geometry. In particular, never crop an image to draw a keycap. */
:root body :is(button,.button,input[type=submit],input[type=button],input[type=reset],.image-nav-arrow,.learning-word-button,.wwi-gallery-trigger):not([data-wwi-button-exempt]):not(:where(#tutorial-guide-next,.gallery-thumbnail,.wwi-image-grid button,button:has(>img),.wwi-button-exempt)) {
 position:relative;
 box-sizing:border-box;
 min-height:48px;
 max-width:100%;
 white-space:normal;
 overflow-wrap:anywhere;
 border:2px solid var(--wwi-button-border);
 border-radius:var(--wwi-button-radius);
 color:var(--wwi-button-ink);
 background:linear-gradient(var(--wwi-button-top),var(--wwi-button-bottom));
 box-shadow:inset 0 2px 0 var(--wwi-button-light),inset 0 -1px 0 #173d561a,
  0 1px 0 var(--wwi-button-edge),0 var(--wwi-button-depth) 0 var(--wwi-button-edge),
  0 calc(var(--wwi-button-depth) + 1px) 0 var(--wwi-button-edge-dark),
  0 calc(var(--wwi-button-depth) + 5px) 12px var(--wwi-button-shade);
 font-family:inherit;
 font-weight:600;
 text-decoration:none;
 vertical-align:middle;
 cursor:pointer;
 transition:box-shadow .08s ease-out,filter .12s ease-out;
}

:root body :is(button,.button,input[type=submit],input[type=button]):is(.wwi-button-primary,.primary,.auth-choice-button):not(.wwi-button-secondary),
:root body .assessment-paper>button:not(.wwi-button-secondary):not(.wwi-button-danger) {
 min-height:56px;
 --wwi-button-top:#296c90;
 --wwi-button-bottom:#205e83;
 --wwi-button-border:#164664;
 --wwi-button-ink:#fff;
 --wwi-button-edge:#123d57;
 --wwi-button-edge-dark:#092a40;
 --wwi-button-shade:#123d5740;
 --wwi-button-light:#ffffff55;
}

/* Only the two public entry pages use this light-green Login secondary face.
   Other secondary controls retain the shared white tokens and behavior. */
:root body.auth-page .auth-choice-actions>a.wwi-button-secondary.wwi-button-login {
 --wwi-button-top:#e9f6e9;
 --wwi-button-bottom:#d6edd6;
 --wwi-button-border:#64886c;
 --wwi-button-ink:#21482e;
 --wwi-button-edge:#9abca0;
 --wwi-button-edge-dark:#5f8068;
 --wwi-button-shade:#21482e2b;
 --wwi-button-light:#ffffffb3;
}

:root body :is(button,.button,input[type=submit],input[type=button]):is(.wwi-button-danger,.danger,.danger-button,.set-delete-button) {
 --wwi-button-top:#ad363c;
 --wwi-button-bottom:#9e2c30;
 --wwi-button-border:#6f1e23;
 --wwi-button-ink:#fff;
 --wwi-button-edge:#6f1e23;
 --wwi-button-edge-dark:#4f1118;
 --wwi-button-shade:#6f1e2338;
 --wwi-button-light:#ffffff44;
}

/* Compact controls keep the same face, focus and pressed states, with a shorter
   edge for existing dense administrative tables. Text and minimum hit area stay. */
:root body :is(.wwi-button-compact,table button,.inline-action button) {--wwi-button-depth:3px;}

/* Navigation cards keep room for their title and explanation; they are not
   compact table actions. Layout and destination stay with admin_menu.php. */
:root body .admin-menu-list a.wwi-button-menu {
 min-height:104px;
 padding:18px;
 text-align:left;
 --wwi-button-depth:7px;
}
@media (max-width:600px) {
 :root body .admin-menu-list a.wwi-button-menu {min-height:88px;padding:15px;}
}

/* All peer answers have identical geometry and colors before selection. Legacy
   bad/neutral/good class names do not set their visual weight. */
:root body .word-response-box>.rating-options {display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);width:100%;min-width:0;gap:8px;}
:root body .word-response-box>.rating-options>.rating-option {width:100%;min-width:0;box-sizing:border-box;padding-inline:6px;}
:root body .wwi-prior-answers {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;min-width:0;}
:root body .wwi-prior-answers>p {grid-column:1/-1;}
:root body .wwi-prior-answers>.rating-option {width:100%;min-width:0;}
:root body :is(button,.button):is(.wwi-button-choice,.rating-option,[aria-pressed]),
:root body :is(.rating-options,.wwi-prior-answers) .rating-option,
:root body .rating-dimension[data-rating-dimension]>.rating-options>.rating-option {
 --wwi-button-depth:3px;
 --wwi-button-top:#fff;
 --wwi-button-bottom:#f0f4f7;
 --wwi-button-border:#64748b;
 --wwi-button-ink:#1e293b;
 --wwi-button-edge:#a9bac7;
 --wwi-button-edge-dark:#758fa2;
 --wwi-button-shade:#173d561a;
 --wwi-button-light:#fff;
 min-height:48px;
 border:2px solid var(--wwi-button-border);
 border-radius:var(--wwi-button-radius);
 color:var(--wwi-button-ink);
 background:linear-gradient(var(--wwi-button-top),var(--wwi-button-bottom));
 box-shadow:inset 0 2px 0 #fff,0 var(--wwi-button-depth) 0 var(--wwi-button-edge),
  0 calc(var(--wwi-button-depth) + 1px) 0 var(--wwi-button-edge-dark),0 6px 9px #173d561a;
 font-weight:500;
}

:root body :is(button,.button):is(.wwi-button-choice,.rating-option,[aria-pressed]):is([aria-pressed=true],.is-selected),
:root body :is(.rating-options,.wwi-prior-answers) .rating-option.is-selected,
:root body .rating-dimension[data-rating-dimension]>.rating-options>.rating-option.is-selected {
 --wwi-button-border:#163b70;
 --wwi-button-ink:#102c50;
 border:2px solid #163b70;
 color:#102c50;
 background:linear-gradient(#eaf2ff,#dce8fb);
 box-shadow:inset 0 1px 3px #163b7026,inset 0 0 0 1px #163b70,0 1px 0 #a4bad0;
}
:root body button:is(.wwi-button-choice,.rating-option):is([aria-pressed=true],.is-selected):not([aria-busy=true])::before {
 content:'';
 position:absolute;
 top:4px;right:6px;width:5px;height:9px;
 border:solid currentColor;border-width:0 2px 2px 0;
 transform:rotate(45deg);
 pointer-events:none;
}

/* A real native radio/checkbox remains in the choice; checked state supplies the
   non-color indication. No pseudo-input, default answer or value mapping here. */
:root body :is(label.wwi-choice-option,label.choice:has(input[type=radio])) {
 box-sizing:border-box;
 min-height:52px;
 min-width:0;
 border:2px solid #8497a5;
 border-radius:10px;
 background:linear-gradient(#fff,#f0f4f7);
 color:#1e293b;
 box-shadow:inset 0 2px 0 #fff,0 3px 0 #a7bac9,0 4px 0 #7893a5,0 7px 9px #173d5617;
 cursor:pointer;
}
:root body :is(label.wwi-choice-option,label.choice:has(input[type=radio])):has(input:checked) {
 border-color:#163b70;
 background:linear-gradient(#eaf2ff,#dce8fb);
 color:#102c50;
 box-shadow:inset 0 1px 3px #163b7026,inset 0 0 0 1px #163b70,0 1px 0 #a4bad0;
}

/* Keep the native hit area fixed between pointerdown and pointerup. Hover
   brightens the face; active flattens the drop shadow and shades the inset. */
@media (hover:hover) and (pointer:fine) {
 :root body :is(button,.button,input[type=submit],input[type=button],input[type=reset],.image-nav-arrow,.learning-word-button,.wwi-gallery-trigger):not([data-wwi-button-exempt]):not(:where(#tutorial-guide-next,.gallery-thumbnail,.wwi-image-grid button,button:has(>img),.wwi-button-exempt)):not(:disabled):not([aria-disabled=true]):not([aria-busy=true]):hover {
  filter:brightness(1.025);
 }
}
:root body :is(button,.button,input[type=submit],input[type=button],input[type=reset],.image-nav-arrow,.learning-word-button,.wwi-gallery-trigger):not([data-wwi-button-exempt]):not(:where(#tutorial-guide-next,.gallery-thumbnail,.wwi-image-grid button,button:has(>img),.wwi-button-exempt)):not(:disabled):not([aria-disabled=true]):not([aria-busy=true]):active {
 filter:none;
 box-shadow:inset 0 var(--wwi-button-depth) 8px -4px #071e3040,inset 0 1px 2px #071e3026,0 1px 0 #132d401a;
}

:root body :is(button,.button,input[type=submit],input[type=button],input[type=reset],.image-nav-arrow,.learning-word-button,.wwi-gallery-trigger):focus-visible,
:root body :is(label.wwi-choice-option,label.choice:has(input[type=radio])):focus-within {
 outline:3px solid #1263c2;
 outline-offset:5px;
}

:root body :is(button,.button,input[type=submit],input[type=button],input[type=reset],.image-nav-arrow,.learning-word-button,.wwi-gallery-trigger):is(:disabled,[aria-disabled=true],.disabled):not(:where(.gallery-thumbnail,.wwi-image-grid button,button:has(>img))),
:root body :is(button,.button):is(.wwi-button-choice,.rating-option,[aria-pressed]):is(:disabled,[aria-disabled=true]),
:root body :is(.rating-options,.wwi-prior-answers) .rating-option:is(:disabled,[aria-disabled=true]),
:root body .rating-dimension[data-rating-dimension]>.rating-options>.rating-option:is(:disabled,[aria-disabled=true]) {
 border-color:#9aabb7;
 color:#425564;
 background:#e3e9ed;
 box-shadow:inset 0 1px 0 #ffffffb3,0 1px 0 #c2cdd5;
 opacity:1;
 transform:none;
 filter:none;
 cursor:not-allowed;
}
:root body :is(label.wwi-choice-option,label.choice:has(input[type=radio])):has(input:disabled) {
 border-color:#9aabb7;color:#425564;background:#e3e9ed;box-shadow:0 1px 0 #c2cdd5;cursor:not-allowed;
}
:root body :is(button,.button,input[type=submit],input[type=button]):is([aria-busy=true],.wwi-generating) {
 border-color:#7893a5;
 color:#173d56;
 background:#e9f1f6;
 box-shadow:inset 0 2px 3px #173d5618,0 1px 0 #b8c7d2;
 opacity:1;
 transform:none;
 filter:none;
 cursor:wait;
}

/* Do not use ::after: the real generation border and tutorial overlays own it. */
:root body button[aria-busy=true]:not(.wwi-generating):not([data-wwi-button-exempt])::before {
 content:'';
 display:inline-block;
 width:14px;height:14px;
 margin-inline-end:8px;
 border:2px solid currentColor;border-right-color:transparent;border-radius:50%;
 vertical-align:-2px;
 animation:wwi-button-busy .9s linear infinite;
}
@keyframes wwi-button-busy {to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce) {
 :root body :is(button,.button,input[type=submit],input[type=button],input[type=reset],.image-nav-arrow,.learning-word-button,.wwi-gallery-trigger) {transition:none;}
 :root body button[aria-busy=true]::before {animation:none;border-style:dotted;border-right-color:currentColor;}
}
