/* ================================================================
   THE DRILL ⋯ MENU, THE FEEDBACK DIALOG, THE THUMBS — practice/drill-menu.js

   The ⋯ is a SQUARE WITH ROUNDED CORNERS (Seth, 2026-10-28), at the far
   right of the question. The dialog copies claude.ai's feedback dialog:
   bold title, an optional issue select, an optional details box with an
   accent focus ring, a small italic line about what is sent, then Cancel
   (quiet) and Submit (solid, strongest ink). Theme tokens only
   (styles/variables.css): nothing here may be a raw light-on-dark colour.
   ================================================================ */

/* ── ⋯ button + menu ──────────────────────────────────────────── */
.dd-drill-menu {
  display: inline-block;
  /* Study's cards set the serif prose font; the menu is chrome, not prose. */
  font-family: var(--ui-font);
  position: relative;
  line-height: 0;
}

.dd-drill-menu-btn {
  align-items: center;
  background: rgb(var(--tint-rgb) / calc(0.04 * var(--tint-k)));
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  padding: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  width: 30px;
}

.dd-drill-menu-btn:hover,
.dd-drill-menu.is-open .dd-drill-menu-btn {
  background: rgb(var(--tint-rgb) / calc(0.1 * var(--tint-k)));
  border-color: var(--border-strong);
  color: var(--text);
}

.dd-drill-menu-btn:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.dd-drill-menu-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.28);
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: normal;
  min-width: 220px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
}

.dd-drill-menu.is-up .dd-drill-menu-list {
  bottom: calc(100% + 6px);
  top: auto;
}

.dd-drill-menu-list[hidden] {
  display: none;
}

.dd-drill-menu-item {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.dd-drill-menu-item[hidden] {
  display: none;
}

.dd-drill-menu-item:hover:not(:disabled),
.dd-drill-menu-item:focus-visible:not(:disabled) {
  background: rgb(var(--tint-rgb) / calc(0.08 * var(--tint-k)));
  color: var(--white);
  outline: none;
}

.dd-drill-menu-item:disabled {
  color: var(--muted-dim);
  cursor: default;
}

/* Practice page: the far right of the prompt. `.practice-left` is a flex
   COLUMN (layout.css), where a float does nothing, so the slot is a
   zero-height row pinned right and the square hangs from it; the prompt
   keeps a gutter on its right so its first line never runs under it. */
.dd-drill-menu-slot {
  align-self: stretch;
  flex: none;
  height: 0;
  position: relative;
  z-index: 5;
}

.dd-drill-menu-slot > .dd-drill-menu {
  position: absolute;
  right: 0;
  top: 0;
}

body:not(.lesson-mode) .dd-drill-menu-slot:not(:empty) + .question-text {
  padding-right: 44px;
}

.dd-drill-menu-slot:empty,
body.lesson-mode .dd-drill-menu-slot {
  display: none;
}

/* Study: the top-right corner of the question card. */
.ct-question.has-drill-menu {
  position: relative;
}

/* Above the cards after it: each card's rise animation leaves it its own
   stacking context, which would paint the next card over an open menu. */
.ct-question.has-drill-menu:has(.dd-drill-menu.is-open) {
  z-index: 20;
}

.ct-question > .dd-drill-menu {
  float: right;
  margin: 0 0 6px 12px;
}

/* ── The dialog ───────────────────────────────────────────────── */
.dd-fbm-backdrop {
  align-items: center;
  background: var(--scrim-modal);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 10000;
}

.dd-fbm {
  background: var(--surface);
  font-family: var(--ui-font);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgb(0 0 0 / 0.35);
  color: var(--text);
  max-width: 572px;
  padding: 20px 18px 16px;
  width: 100%;
}

.dd-fbm-title {
  color: var(--white);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 14px;
}

.dd-fbm-label {
  color: var(--text);
  display: block;
  font-size: 15px;
  margin: 0 0 6px;
}

.dd-fbm-label-muted {
  color: var(--muted);
  margin-top: 18px;
}

.dd-fbm-select-wrap {
  display: block;
  position: relative;
}

.dd-fbm-select {
  appearance: none;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  padding: 6px 34px 6px 8px;
  width: 100%;
}

.dd-fbm-select.is-empty {
  color: var(--muted-dim);
}

.dd-fbm-select option {
  background: var(--surface);
  color: var(--text);
}

.dd-fbm-chevron {
  color: var(--muted);
  pointer-events: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.dd-fbm-select:focus-visible,
.dd-fbm-text:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 1px var(--info);
  outline: none;
}

.dd-fbm-text {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--text);
  display: block;
  font: inherit;
  font-size: 15px;
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.dd-fbm-text::placeholder {
  color: var(--muted-dim);
}

.dd-fbm-note {
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.55;
  margin: 14px 0 0;
}

.dd-fbm-status {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
}

.dd-fbm-status[hidden] {
  display: none;
}

.dd-fbm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.dd-fbm-cancel,
.dd-fbm-submit {
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 5px 10px;
}

.dd-fbm-cancel {
  background: rgb(var(--tint-rgb) / calc(0.07 * var(--tint-k)));
  border: 1px solid transparent;
  color: var(--text);
}

.dd-fbm-cancel:hover:not(:disabled) {
  background: rgb(var(--tint-rgb) / calc(0.13 * var(--tint-k)));
}

/* Solid in the theme's strongest ink: near-black on light, near-white on the
   dark themes, as claude.ai's black Submit is the strongest thing on its page. */
.dd-fbm-submit {
  background: var(--white);
  border: 1px solid var(--white);
  color: var(--surface);
  font-weight: 600;
}

.dd-fbm-submit:hover:not(:disabled) {
  opacity: 0.88;
}

.dd-fbm-cancel:disabled,
.dd-fbm-submit:disabled {
  cursor: default;
  opacity: 0.6;
}

.dd-fbm-cancel:focus-visible,
.dd-fbm-submit:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.dd-fbm-toast {
  background: var(--white);
  font-family: var(--ui-font);
  border-radius: 8px;
  bottom: 24px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
  color: var(--surface);
  font-size: 14px;
  left: 50%;
  opacity: 0;
  padding: 9px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 8px);
  transition: opacity 0.18s, transform 0.18s;
  z-index: 10001;
}

.dd-fbm-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Copy / 👍 / 👎 under what the AI says ───────────────────── */
/* A practice tutor reply: the row goes UNDER the bubble, not beside it
   (.tutor-row is a flex row, practice/tutor.css). */
.tutor-row--assistant.has-actions {
  align-items: flex-start;
  flex-direction: column;
}

.tutor-row--assistant.has-actions .dd-msg-actions {
  margin-top: 4px;
}

.dd-msg-actions {
  display: flex;
  font-family: var(--ui-font);
  gap: 2px;
  margin-top: 8px;
}

.dd-msg-action {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  padding: 0;
  width: 28px;
}

.dd-msg-action:hover {
  background: rgb(var(--tint-rgb) / calc(0.08 * var(--tint-k)));
  color: var(--text);
}

.dd-msg-action.is-on {
  color: var(--white);
}

.dd-msg-action.is-on svg {
  fill: currentColor;
  fill-opacity: 0.18;
}

.dd-msg-action:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 1px;
}

@media (max-width: 600px) {
  .dd-fbm {
    padding: 18px 14px 14px;
  }

  .dd-drill-menu-list {
    min-width: 200px;
  }
}
