/* Concerto Tools: shared look. Colours follow the page text colour so the tools fit a light or dark theme. */
.ct-tool {
  --ct-accent: #4f7cff;
  --ct-ok: #1f9d55;
  --ct-bad: #d64545;
  --ct-hl: #ffb020;
  --ct-surface: color-mix(in srgb, currentColor 5%, transparent);
  --ct-border: color-mix(in srgb, currentColor 18%, transparent);
  --ct-kb-h: 190px;
  font: inherit;
  max-width: 100%;
  box-sizing: border-box;
}
.ct-tool *, .ct-tool *::before, .ct-tool *::after { box-sizing: border-box; }
.ct-tool .ct-loading { opacity: .6; padding: 1rem 0; }

.ct-frame { border: 1px solid var(--ct-border); border-radius: 14px; background: var(--ct-surface); padding: 16px; }
.ct-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.ct-head:empty { display: none; }
.ct-head > *, .ct-row > * { min-width: 0; max-width: 100%; }
.ct-body { display: flex; flex-direction: column; gap: 14px; }
.ct-foot { margin-top: 12px; font-size: .82em; opacity: .75; }
.ct-foot p { margin: 4px 0; }
.ct-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.ct-spacer { flex: 1; }
.ct-big { font-size: 1.6em; font-weight: 700; line-height: 1.2; }
.ct-center { text-align: center; }
.ct-muted { opacity: .7; }

/* Controls */
.ct-btn, .ct-choice, .ct-tab, .ct-select {
  font: inherit; color: inherit; background: transparent;
  border: 1px solid var(--ct-border); border-radius: 9px;
  padding: 7px 12px; min-height: 38px; cursor: pointer; line-height: 1.2;
}
.ct-btn:hover, .ct-choice:hover, .ct-tab:hover { border-color: var(--ct-accent); }
.ct-btn:focus-visible, .ct-choice:focus-visible, .ct-tab:focus-visible, .ct-select:focus-visible { outline: 2px solid var(--ct-accent); outline-offset: 2px; }
.ct-btn.ct-primary { background: var(--ct-accent); border-color: var(--ct-accent); color: #fff; }
.ct-btn[aria-pressed="true"], .ct-choice.ct-selected { background: var(--ct-accent); border-color: var(--ct-accent); color: #fff; }
.ct-btn:disabled, .ct-choice:disabled { opacity: .55; cursor: default; }
.ct-select { padding-right: 8px; max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.ct-select option { color: #111; }
.ct-field { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; }
.ct-field-label { opacity: .8; font-size: .92em; }
.ct-range { accent-color: var(--ct-accent); }

.ct-tabs { display: inline-flex; border: 1px solid var(--ct-border); border-radius: 10px; padding: 3px; gap: 3px; }
.ct-tab { border: 0; min-height: 32px; padding: 5px 14px; }
.ct-tab[aria-selected="true"] { background: var(--ct-accent); color: #fff; }

.ct-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.ct-choices.ct-compact .ct-choice { min-width: 46px; padding: 6px 8px; }
.ct-choice.ct-right { background: var(--ct-ok); border-color: var(--ct-ok); color: #fff; }
.ct-choice.ct-wrong { background: var(--ct-bad); border-color: var(--ct-bad); color: #fff; }

.ct-score { font-weight: 600; }
.ct-feedback { min-height: 1.4em; font-weight: 600; }
.ct-feedback.ct-ok { color: var(--ct-ok); }
.ct-feedback.ct-bad { color: var(--ct-bad); }

/* Piano keyboard */
.ct-kb {
  position: relative; width: 100%; height: var(--ct-kb-h);
  --ct-black-w: calc(100% / var(--ct-whites) * 0.62);
  touch-action: none; user-select: none; -webkit-user-select: none;
  border-radius: 0 0 8px 8px; overflow: hidden;
  background: #222; padding-top: 4px;
}
.ct-key { position: absolute; top: 0; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; }
.ct-white {
  width: calc(100% / var(--ct-whites)); height: 100%;
  background: linear-gradient(#f4f4f2, #fff 85%, #e9e9e6); border: 1px solid #9a9a9a; border-top: 0;
  border-radius: 0 0 6px 6px; color: #333; z-index: 1;
}
.ct-black {
  width: var(--ct-black-w); height: 62%;
  background: linear-gradient(#3a3a3a, #111 70%, #000); border-radius: 0 0 4px 4px;
  color: #eee; z-index: 2; box-shadow: 0 2px 3px rgba(0,0,0,.5);
}
.ct-label { font-size: clamp(9px, 1.6vw, 13px); padding-bottom: 8px; pointer-events: none; text-align: center; line-height: 1.1; white-space: nowrap; }
.ct-black .ct-label { font-size: clamp(8px, 1.3vw, 11px); }
.ct-white.ct-down { background: linear-gradient(#cfd9ff, #b8c8ff); }
.ct-black.ct-down { background: linear-gradient(#36458a, #2a3780); }
.ct-white.ct-hl { background: linear-gradient(#ffe2a6, #ffcf66); }
.ct-black.ct-hl { background: linear-gradient(#c98a10, #a86f00); }
.ct-white.ct-root { background: linear-gradient(#ffc78a, #ff9f40); }
.ct-black.ct-root { background: linear-gradient(#d96d00, #b35500); }
.ct-white.ct-right { background: linear-gradient(#b7f0c9, #7fdc9d); }
.ct-black.ct-right { background: linear-gradient(#1f9d55, #157a40); }
.ct-white.ct-wrong { background: linear-gradient(#ffc4c4, #ff9a9a); }
.ct-black.ct-wrong { background: linear-gradient(#d64545, #a52f2f); }
.ct-hl .ct-label, .ct-root .ct-label, .ct-right .ct-label, .ct-wrong .ct-label { font-weight: 700; }

/* Staff (drawn in SVG, coloured by currentColor) */
.ct-staff { display: block; margin: 0 auto; overflow: visible; color: inherit; }
.ct-staff-wrap { padding: 12px; border-radius: 10px; background: #fffdf8; color: #1b1b1b; display: flex; justify-content: center; }
.ct-line { stroke: currentColor; stroke-width: 1; }
.ct-ink { fill: currentColor; }
.ct-clef-stroke { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ct-notehead { fill: currentColor; }
.ct-hole { fill: #fffdf8; }
.ct-thin { fill: none; stroke: currentColor; stroke-width: 1.3; }
.ct-thick { fill: none; stroke: currentColor; stroke-width: 3; }
.ct-staff-label { font-size: 11px; fill: currentColor; }
.ct-col.ct-right { color: var(--ct-ok); }
.ct-col.ct-wrong { color: var(--ct-bad); }
.ct-col.ct-hl { color: var(--ct-accent); }

/* Tools index: [concerto_tools_index] */
.ct-index { --ct-accent: #4f7cff; --ct-border: color-mix(in srgb, currentColor 18%, transparent); display: flex; flex-direction: column; gap: 28px; }
.ct-index-title { margin: 0 0 12px; }
.ct-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.ct-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px;
  border: 1px solid var(--ct-border); background: color-mix(in srgb, currentColor 4%, transparent);
  color: inherit; text-decoration: none; transition: border-color .15s, transform .15s;
}
.ct-card:hover, .ct-card:focus-visible { border-color: var(--ct-accent); transform: translateY(-2px); }
.ct-card:focus-visible { outline: 2px solid var(--ct-accent); outline-offset: 2px; }
.ct-card-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ct-accent); background: color-mix(in srgb, var(--ct-accent) 14%, transparent); }
.ct-card-title { font-weight: 700; font-size: 1.05em; line-height: 1.25; }
.ct-card-text { font-size: .9em; opacity: .78; line-height: 1.45; }

/* Guitar fretboard (used by guitar tools) */
.ct-neck { width: 100%; overflow-x: auto; }
.ct-neck svg { display: block; min-width: 640px; width: 100%; }

@media (max-width: 600px) {
  .ct-frame { padding: 12px; border-radius: 10px; }
  .ct-tool { --ct-kb-h: 150px; }
  .ct-big { font-size: 1.35em; }
}
