/* Practice Gym — Notes dock (host page). Placement is set by
   practice-gym-notes.js on #gym-workspace:
     data-notes-layout="side"    a column of its own beside the question
     data-notes-layout="inline"  under the question, in the question's column
     data-notes-cols="1|2"       the inline template's own column count
   Colours are studio tokens only, so light, dark and high-contrast themes
   carry through. */

.gym-v3 .gym-notes-dock {
  min-width: 0; box-sizing: border-box;
  border: 1px solid var(--line-strong); border-radius: 20px;
  background: var(--surface-2); color: var(--ink);
  box-shadow: 0 15px 40px -28px var(--gym-navy);
  scroll-margin-top: calc(var(--header-height, 72px) + 12px);
}
.gym-v3 .gym-notes-dock[hidden] { display: none; }
.gym-v3 .gym-notes-head { flex-wrap: wrap; border-radius: 20px 20px 0 0; }
.gym-notes-heading { flex: 1 1 11rem; min-width: 0; }
.gym-notes-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-left: auto; }
.gym-notes-actions .gym-button { min-height: 44px; padding: 0.5rem 0.8rem; font-size: 0.84rem; }
.gym-notes-new[aria-expanded="true"] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }

/* Quick note: a short form above the search, in the dock's own flow. */
.gym-quick-note { display: grid; gap: 0.4rem; padding: 0.9rem 1rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.gym-quick-note[hidden] { display: none; }
.gym-quick-note label { font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.gym-quick-note input, .gym-quick-note textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.6rem 0.7rem;
  min-height: 44px; width: 100%; box-sizing: border-box; min-width: 0;
}
.gym-quick-note textarea { resize: vertical; min-height: 7.5rem; line-height: 1.55; }
.gym-quick-note input:focus-visible, .gym-quick-note textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.gym-quick-context, .gym-quick-hint { margin: 0; font-size: 0.8rem; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
.gym-quick-context { font-weight: 600; color: var(--ink); }
.gym-quick-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.gym-quick-row .gym-button { min-height: 44px; }
.gym-quick-status { margin: 0; padding: 0 1rem; font-size: 0.86rem; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.gym-quick-status:empty { display: none; }
.gym-quick-status[data-state] { padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); }
.gym-quick-status[data-state="saved"] { color: var(--ink); }
.gym-quick-status[data-state="error"] { color: var(--ink); font-weight: 600; }
.gym-quick-status a { color: var(--accent); font-weight: 600; }
.gym-v3 #gym-notes-mount { padding-top: 0.25rem; }
/* Search controls stack in a narrow dock; result cards are one column. */
.gym-notes-dock .nsp-controls { padding-top: 0.4rem; }
.gym-notes-dock .nsp-results { grid-template-columns: minmax(0, 1fr); }
.gym-notes-dock .nsp-keys { margin: 0; font-size: 0.78rem; }

/* ---- Inline: under the question, in its own column ------------------------ */
.gym-v3 .gym-workspace[data-notes-layout="inline"] > .gym-mountwrap { grid-column: 1; grid-row: 1; }
.gym-v3 .gym-workspace[data-notes-layout="inline"] > .gym-notes-dock { grid-column: 1; grid-row: 2; }
.gym-v3 .gym-workspace[data-notes-layout="inline"][data-notes-cols="2"] > .gym-tools { grid-column: 2; grid-row: 1 / span 2; }
.gym-v3 .gym-workspace[data-notes-layout="inline"][data-notes-cols="1"] > .gym-tools { grid-column: 1; grid-row: 3; }
/* Beside a docked tool, the tool column spans the question and the notes and
   stays under the header while either is read. A note shorter than the window
   would end that column early and push the tool up under the header, so the
   dock is at least a window tall here. */
.gym-v3 .gym-workspace[data-notes-layout="inline"][data-notes-cols="2"] > .gym-notes-dock { min-height: calc(100dvh - 48px); }

/* ---- Side: a column of its own, sticky under the header ------------------- */
.gym-v3 .gym-workspace[data-notes-layout="side"] { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
.gym-v3 .gym-workspace[data-notes-layout="side"][data-tool-open="true"] { grid-template-columns: minmax(0, 1fr) minmax(280px, 320px) minmax(360px, 390px); }
.gym-v3 .gym-workspace[data-notes-layout="side"] > .gym-mountwrap { grid-column: 1; grid-row: 1; }
.gym-v3 .gym-workspace[data-notes-layout="side"] > .gym-notes-dock { grid-column: 2; grid-row: 1; }
.gym-v3 .gym-workspace[data-notes-layout="side"] > .gym-tools { grid-column: 3; grid-row: 1; }
.gym-v3 .gym-workspace[data-notes-layout="side"] > .gym-notes-dock {
  position: sticky; top: calc(var(--header-height, 72px) + 14px);
  max-height: calc(100dvh - var(--header-height, 72px) - 28px);
  overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
}
.gym-v3 .gym-workspace[data-notes-layout="side"] .gym-notes-dock .nsp-reader { max-height: none; overflow: visible; }

/* Accommodations and print */
body.a11y-high-contrast .gym-v3 .gym-notes-dock { border: 2px solid var(--ink); }
body.a11y-high-contrast .gym-quick-note input, body.a11y-high-contrast .gym-quick-note textarea { border-color: var(--ink); }
@media print { .gym-notes-dock { display: none !important; } }
/* Under the fixed site header a sticky head would slide out of sight: inline,
   the head scrolls with the dock. */
.gym-v3 .gym-workspace[data-notes-layout="inline"] .gym-notes-head { position: static; }

/* Daily card-drop notice, seated under the practice set (practice-gym-v3.js). */
.gym-reward-slot:empty { display: none; }
.gym-reward-slot { margin-top: 1rem; }
.gym-reward-notice { margin: 0; padding: 0.85rem 1rem; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 0.92rem; line-height: 1.5; overflow-wrap: anywhere; }
.gym-reward-notice a { color: var(--accent); font-weight: 600; }
.gym-reward-notice button { min-height: 44px; margin-left: 0.5rem; }
