/* Digital Greenhouse — ear-training.css
   /music/ear-training. The exercise itself is always dark with a cream panel,
   like the play-along piano; the list of levels follows the site theme. */

section.et-section { padding-top: clamp(12px, 2vw, 22px); }
.et-wrap { max-width: 1040px; margin-inline: auto; }
.et [hidden], .et-picker [hidden] { display: none !important; }

.et {
  --et-blue: #1560c4; --et-blue-soft: #cfe2fb;
  --et-good: #237a35; --et-bad: #c92a2a; --et-gold: #e0a100;
  --et-paper: #fffdf8; --et-ink: #1b1b1b;
  border-radius: 18px; overflow: clip; color: #e9efe9;
  background: linear-gradient(180deg, #23292d 0%, #14181b 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 46px -30px rgba(5, 12, 9, 0.6);
  -webkit-user-select: none; user-select: none;
}

/* ---------- Top row ---------- */
.et-top { display: flex; align-items: center; gap: 8px 10px; padding: 10px 14px; flex-wrap: wrap; }
.et-now { min-width: 0; flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.et-now__title { font: 700 1.12rem/1.2 var(--font-display, Georgia, serif); color: #fff; }
.et-now__meta { font-size: 0.8rem; line-height: 1.3; color: #a9b8ae; }
.et-btn, .et-tog, .et-seg button {
  font: 600 0.86rem/1 var(--font-sans, system-ui); color: #e9efe9; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  height: 38px; padding: 0 13px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
}
.et-btn:hover, .et-tog:hover, .et-seg button:hover { background: rgba(255, 255, 255, 0.14); }
.et-btn:disabled { opacity: 0.38; cursor: default; background: rgba(255, 255, 255, 0.06); }
.et button:focus-visible, .et a:focus-visible, .et summary:focus-visible, .et-picker button:focus-visible { outline: 3px solid #9be3bf; outline-offset: 2px; }
.et-midi::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #7c8a82; flex: 0 0 auto; }
.et-midi[data-state="on"] { border-color: #58b98b; background: rgba(63, 179, 127, 0.16); }
.et-midi[data-state="on"]::before { background: #4fd28f; box-shadow: 0 0 0 4px rgba(79, 210, 143, 0.22); }
.et-midi[data-state="wait"]::before { background: #e0b24a; }
.et-midi span { overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }

/* the ten tunes of a round */
.et-pips { display: flex; gap: 5px; padding: 0 18px 10px; }
.et-pip { flex: 1 1 0; max-width: 46px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); }
.et-pip.is-now { background: rgba(255, 255, 255, 0.5); }
.et-pip.is-first { background: var(--et-gold); }
.et-pip.is-got { background: #4fd28f; }
.et-pip.is-skip { background: #8b6f6f; }

/* ---------- The stage: what to do, and one dot for each note ---------- */
.et-play { position: relative; }
.et-stage { background: var(--et-paper); color: var(--et-ink); padding: 18px 16px 20px; text-align: center; min-height: 236px; display: flex; flex-direction: column; align-items: center; }
.et-status { margin: 0; font: 700 clamp(1.3rem, 3.4vw, 1.8rem)/1.2 var(--font-display, Georgia, serif); color: #0E5C3A; }
.et-stage[data-tone="bad"] .et-status { color: #a32020; }
.et-sub { margin: 6px 0 0; min-height: 1.4em; font-size: 0.98rem; line-height: 1.4; color: #4a4a44; max-width: 34rem; }
.et-slots { margin-top: auto; padding-top: 74px; display: flex; justify-content: center; gap: clamp(8px, 2.4vw, 18px); min-height: 48px; }
.et-slot { --lift: 0px; position: relative; width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; border: 3px solid #bdb7a6; background: #fff; transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s, border-color 0.2s; }
.et-slot b { font: 800 1rem/1 var(--font-sans, system-ui); color: #fff; }
.et-slot.is-now { border-color: var(--et-blue); box-shadow: 0 0 0 5px rgba(21, 96, 196, 0.16); }
.et-slot.is-got { background: var(--et-good); border-color: var(--et-good); }
.et-slots.is-shape .et-slot { transform: translateY(var(--lift)); }
.et-slots.is-shape .et-slot:not(.is-got) { background: #6b6b63; border-color: #6b6b63; }
.et-slot.is-on { animation: et-on 0.5s ease-out; }
@keyframes et-on { 0% { box-shadow: 0 0 0 0 rgba(14, 92, 58, 0.55); background-color: #bfe6d1; } 100% { box-shadow: 0 0 0 16px rgba(14, 92, 58, 0); } }

/* ---------- The result card ---------- */
.et-result { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 12px; background: rgba(255, 253, 248, 0.92); overflow: auto; }
.et-result__card { width: min(100%, 30rem); padding: 18px 20px 20px; border-radius: 16px; background: #fff; color: #1b1b1b; text-align: center; border: 1px solid #e3ddcd; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.45); }
.et-result__stars { margin: 0; font-size: 2.3rem; line-height: 1; letter-spacing: 0.12em; color: #b88400; }
.et-result__card h3 { margin: 8px 0 4px; font: 700 1.4rem/1.2 var(--font-display, Georgia, serif); color: #0E5C3A; }
.et-result__line { margin: 0; font-size: 0.98rem; color: #333; }
.et-result__tip { margin: 8px 0 0; font-size: 0.9rem; color: #55554f; }
.et-result__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.et-result .et-btn { color: #0E5C3A; border-color: #0E5C3A; background: #fff; }
.et-result .et-btn:hover { background: #eef6f1; }
.et-result .et-btn--main { color: #fff; background: #0E5C3A; }
.et-result .et-btn--main:hover { background: #12714a; }
.et-result .et-btn:focus-visible { outline-color: #1560c4; }

/* ---------- The keyboard ---------- */
.et-kbwrap { background: #0f1214; padding: 6px 8px 0; border-top: 3px solid #7a1f1f; overflow-x: auto; }
.et-kb { position: relative; height: clamp(120px, 22vh, 176px); min-width: calc(var(--et-whites, 8) * 24px); margin-inline: auto; max-width: calc(var(--et-whites, 8) * 72px); touch-action: none; }
.et-key { position: absolute; top: 0; box-sizing: border-box; cursor: pointer; }
.et-key--w { height: 100%; background: linear-gradient(180deg, #f4f4f0 0%, #ffffff 16%, #f3f2ee 100%); border: 1px solid #a9a9a1; border-top: 0; border-radius: 0 0 6px 6px; z-index: 1; color: #55554f; }
.et-key--b { height: 62%; background: linear-gradient(180deg, #2c2c30 0%, #121214 100%); border-radius: 0 0 4px 4px; z-index: 2; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); color: #d9d9d9; }
/* keys this level doesn't use */
.et-key--w.is-out { background: linear-gradient(180deg, #b9bbb6 0%, #c9cbc6 100%); border-color: #8d8f89; }
.et-key--b.is-out { background: linear-gradient(180deg, #3b3d41 0%, #2a2b2e 100%); box-shadow: none; }
.et-key span { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
.et-key__name { bottom: 6px; font: 700 0.86rem/1 var(--font-sans, system-ui); }
.et-key--b .et-key__name { bottom: 5px; font-size: 0.66rem; }
.et-key--mid .et-key__name { color: #0E5C3A; }
.et-key--mid.et-key--w::after { content: ""; position: absolute; left: 50%; bottom: 24px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #0E5C3A; opacity: 0.55; }
.et-key__pc { top: 6px; font: 600 0.66rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity: 0.7; }
.et-key--b .et-key__pc { top: auto; bottom: 22px; opacity: 0.8; }
.et--midi .et-key__pc { display: none; }
@media (hover: none) { .et-key__pc { display: none; } }
.et-key__tag { bottom: 30px; font: 800 0.66rem/1 var(--font-sans, system-ui); letter-spacing: 0.04em; text-transform: uppercase; color: #fff; }
.et-key__tag:empty { display: none; }
.et-key--b .et-key__tag { display: none; }

.et-key.is-start { background: var(--et-blue); border-color: #0f4a99; color: #fff; }
.et-key.is-start .et-key__name { color: #fff; }
.et-key.is-start::after { display: none; }
.et-key--w.is-help { background: var(--et-blue-soft); box-shadow: inset 0 0 0 4px var(--et-blue); }
.et-key--b.is-help { box-shadow: inset 0 0 0 4px #6aa6f2; }
.et-key--w.is-auto { background: #9fd8ba; }
.et-key--b.is-auto { background: #2f7d5b; }
.et-key.is-down { filter: brightness(0.86); }
.et-key--w.is-down { box-shadow: inset 0 6px 8px -4px rgba(0, 0, 0, 0.45); }
.et-key.is-good { animation: et-good 0.45s ease-out; }
.et-key.is-bad { animation: et-bad 0.5s ease-out; }
@keyframes et-good { 0% { box-shadow: inset 0 0 0 100px rgba(43, 138, 62, 0.95); } 100% { box-shadow: inset 0 0 0 100px rgba(43, 138, 62, 0); } }
@keyframes et-bad { 0% { box-shadow: inset 0 0 0 100px rgba(201, 42, 42, 0.95); } 100% { box-shadow: inset 0 0 0 100px rgba(201, 42, 42, 0); } }

/* ---------- Controls ---------- */
.et-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 14px; }
.et-go { flex: 0 0 auto; height: 52px; min-width: 11rem; padding: 0 22px 0 16px; border-radius: 999px; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: 700 1rem/1 var(--font-sans, system-ui); color: #fff; background: var(--color-emerald, #0E5C3A); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.et-go:hover { background: #12714a; }
.et-go svg { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
.et-go .et-go__ear { display: none; }
.et[data-state="turn"] .et-go .et-go__ear, .et[data-state="listen"] .et-go .et-go__ear { display: block; }
.et[data-state="turn"] .et-go .et-go__play, .et[data-state="listen"] .et-go .et-go__play { display: none; }
.et-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.et-group > span { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: #9fb0a6; }
.et-row { display: flex; flex-wrap: wrap; gap: 8px; }
.et-seg { display: inline-flex; border-radius: 10px; }
.et-seg button { border-radius: 0; margin-left: -1px; }
.et-seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.et-seg button:last-child { border-radius: 0 10px 10px 0; }
.et-seg button[aria-pressed="true"], .et-tog[aria-pressed="true"] { background: #2f7d5b; border-color: #58b98b; color: #fff; position: relative; z-index: 1; }
.et-more { flex: 1 1 100%; font-size: 0.86rem; color: #c9d4cc; }
.et-more summary { cursor: pointer; width: max-content; color: #a9b8ae; font-weight: 600; }
.et-more__body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 10px; }
.et-more label { display: inline-flex; align-items: center; gap: 8px; }
.et-more input[type="range"] { accent-color: #58b98b; width: 9rem; }
.et-hint { margin: 0; padding: 0 16px 14px; min-height: 1.4em; font-size: 0.92rem; line-height: 1.45; color: #c3d0c7; }

/* ---------- The list of levels (follows the site theme) ---------- */
.et-picker { margin-top: var(--space-6, 2rem); scroll-margin-top: 90px; }
.et-picker h2 { font-size: var(--fs-2xl, 1.7rem); margin: 0 0 var(--space-2, 0.5rem); }
.et-picker > p { margin: 0 0 var(--space-3, 0.75rem); color: var(--text-muted, #5b6b62); }
.et-stage-h { margin: var(--space-4, 1rem) 0 var(--space-2, 0.5rem); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted, #5b6b62); }
.et-levels__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.et-level { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: start; text-align: left; padding: 10px 12px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--text, #0B1F17); background: var(--bg-card, #fff); border: 1px solid var(--color-line, #d8e2db); }
.et-level:hover { border-color: var(--color-sprout, #3FB37F); }
.et-level[aria-pressed="true"] { border-color: var(--color-sprout, #3FB37F); box-shadow: inset 0 0 0 2px var(--color-sprout, #3FB37F); }
.et-level__n { grid-column: 1; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted, #5b6b62); }
.et-level__name { grid-column: 1; font-weight: 700; line-height: 1.25; }
.et-level__sub { grid-column: 1 / -1; font-size: 0.84rem; line-height: 1.4; color: var(--text-muted, #5b6b62); }
.et-level__stars { grid-column: 2; grid-row: 1 / span 2; font-size: 0.95rem; letter-spacing: 0.08em; color: #a87500; white-space: nowrap; }
[data-theme="dark"] .et-level__stars { color: #e7bd4f; }

.et-about { margin-top: var(--space-7, 3rem); }
.et-about .crumb { margin-bottom: var(--space-2, 0.5rem); }
.prose .et-steps, .et-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4, 1rem); margin: var(--space-4, 1rem) 0; padding: 0; list-style: none; counter-reset: et; }
.prose .et-steps li, .et-steps li { counter-increment: et; margin: 0; padding: var(--space-4, 1rem); border-radius: var(--radius, 14px); background: var(--bg-card, #fff); border: 1px solid var(--color-line, #d8e2db); }
.et-steps li::before { content: counter(et); display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 8px; border-radius: 50%; background: var(--color-emerald, #0E5C3A); color: #fff; font-weight: 700; }
.et-steps strong { display: block; margin-bottom: 4px; }

@media (max-width: 720px) {
  .et { border-radius: 12px; }
  .et-top { padding: 8px 10px; }
  .et-now { flex-basis: 100%; order: -1; }
  .et-pips { padding: 0 12px 8px; gap: 4px; }
  .et-stage { padding: 14px 10px 16px; min-height: 216px; }
  .et-slot { width: 40px; height: 40px; }
  .et-bar { gap: 10px 12px; padding: 12px 10px; }
  .et-go { height: 48px; min-width: 9.5rem; }
  .et-btn, .et-tog, .et-seg button { height: 36px; padding: 0 10px; font-size: 0.82rem; }
  .et-kb { height: 136px; }
  .et-hint { padding: 0 12px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .et-slot { transition: none; }
  .et-slot.is-on, .et-key.is-good, .et-key.is-bad { animation-duration: 0.01s; }
}
@media print { .et, .et-picker { display: none; } }
