/* Selection UI from mastersam.org, scoped to the local site's controls. */
:root { --control-paper: #fff9f1; --control-cream: #fff0d9; --control-line: #e5dfd5; --control-muted: #605e59; }
html.select-overlay-open { overflow: hidden; overscroll-behavior: none; }
body.select-overlay-open { position: fixed; top: var(--select-overlay-scroll-top); width: 100%; overflow: hidden; }
.course-controls { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 22px; margin: 0 0 24px; padding: 0; }
.filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.direction-filter { display: none; }
.filter { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 11px 16px; border: 1px solid var(--control-line); border-radius: 10px; background: white; color: var(--ink); font-size: 16px; line-height: 1.2; font-weight: 600; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.filter.is-active { background: var(--ink); color: white; border-color: var(--ink); }
.filter:hover:not(.is-active) { background: var(--control-paper); }
.filter span { font-size: 14px; opacity: .7; }
.age-filter { display: flex; flex: none; align-items: center; gap: 10px; font-size: 16px; color: var(--control-muted); white-space: nowrap; }
.course-controls select[data-custom-select] { min-width: 0; width: 190px; height: 46px; padding: 9px 14px; border: 1px solid var(--control-line); border-radius: 10px; background: white; color: var(--ink); font-size: 16px; }
.form-audience { display: flex; padding: 4px; gap: 4px; background: #ece6de; border-radius: 10px; }
.form-audience button { flex: 1; padding: 11px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.form-audience button.is-active { background: white; color: var(--ink); box-shadow: 0 1px 4px #0000000c; }
.form-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.form-field > label { font-size: 16px; font-weight: 600; color: var(--ink); }
.select-trigger, .select-sheet-close { cursor: pointer; touch-action: manipulation; }
.filter:focus-visible, .select-trigger:focus-visible, .form-audience button:focus-visible { outline: 2px solid #bc7e2e; outline-offset: 3px; }
.custom-select { position: relative; min-width: 0; width: 100%; }
.select-trigger { display: flex; align-items: center; gap: 14px; width: 100%; min-width: 0; height: 50px; padding: 12px 14px; border: 1px solid #d9d2c7; border-radius: 10px; background: white; color: var(--ink); font-size: 17px; font-weight: 400; line-height: 1.3; text-align: left; transition: border-color .2s, box-shadow .2s, background .2s; }
.select-trigger:hover { border-color: #bcac94; background: #fffdf9; }
.select-trigger[aria-expanded="true"] { border-color: #d77c10; box-shadow: 0 0 0 3px #ff8a0018; }
.custom-select--locked .select-trigger, .custom-select--locked .select-trigger:hover { cursor: default; color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; background: white; border-color: #d9d2c7; box-shadow: none; }
.custom-select--locked .select-chevron { display: none; }
.custom-select--locked .select-value { white-space: normal; overflow: visible; }
.select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chevron { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--control-paper); color: #77634a; }
.select-chevron::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.75px 1.75px 0; transform: translateY(-2px) rotate(45deg); transition: transform .22s ease; }
.select-trigger[aria-expanded="true"] .select-chevron::before { transform: translateY(2px) rotate(225deg); }
.age-filter .custom-select { width: 190px; }
.age-filter .select-trigger { height: 46px; padding: 9px 11px 9px 14px; font-size: 16px; }
.select-menu { position: fixed; z-index: 400; overflow-y: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid #e5dac9; border-radius: 15px; background: #fffdf9; box-shadow: 0 14px 40px #3c2b161c, 0 2px 6px #3c2b160a; color: var(--ink); scrollbar-width: thin; scrollbar-color: #d4b994 transparent; }
.select-menu::-webkit-scrollbar { width: 6px; }
.select-menu::-webkit-scrollbar-thumb { background: #d4b994; border-radius: 6px; }
.select-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; padding: 11px 12px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 16px; font-weight: 400; line-height: 1.3; }
.select-option + .select-option { margin-top: 3px; }
.select-option-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.select-option-meta { font-size: 13px; color: var(--control-muted); }
.select-option:hover, .select-option.is-focused { background: #f6efe4; }
.select-option[aria-selected="true"] { background: var(--control-cream); color: #673c08; }
.select-option.is-focused { border-color: #d5b082; }
.select-check { flex: 0 0 16px; width: 16px; height: 16px; opacity: 0; }
.select-check::after { content: ""; display: block; width: 5px; height: 9px; margin: 1px 4px; border: solid #a45d06; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.select-option[aria-selected="true"] .select-check { opacity: 1; }
.select-sheet { position: fixed; inset: var(--select-overlay-viewport-top,0px) 0 auto; width: 100%; max-width: none; height: min(100svh,var(--select-overlay-viewport-height,100svh)); max-height: none; margin: 0; padding: 16px 0 0; border: 0; background: transparent; color: var(--ink); overflow: hidden; }
.select-sheet[open] { display: flex; flex-direction: column; justify-content: flex-end; }
.select-sheet::backdrop { background: #171a1bb3; backdrop-filter: blur(3px); }
.select-sheet-panel { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; max-height: min(100%,720px); padding: 0 16px calc(20px + env(safe-area-inset-bottom,0px)); border-radius: 24px 24px 0 0; background: #fffdf9; overflow: hidden; box-shadow: 0 -12px 60px #20202020; }
.select-sheet-panel::before { content: ""; flex: 0 0 4px; width: 36px; margin: 10px auto 4px; border-radius: 3px; background: #d6cfc4; }
.select-sheet-header { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px 18px; }
.select-sheet-header h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.03em; }
.select-sheet-close { flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid var(--control-line); border-radius: 50%; background: white; color: var(--ink); font: 27px/1 Arial,sans-serif; }
.select-sheet .select-menu { position: relative; flex: 0 1 auto; min-height: 0; width: 100%; padding: 2px 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow-y: auto; scroll-padding-block: 8px; -webkit-overflow-scrolling: touch; }
.select-sheet .select-menu:focus-visible { outline: none; }
.select-sheet .select-option { min-height: 58px; padding: 14px; border-radius: 12px; font-size: 17px; }
.select-sheet .select-option + .select-option { margin-top: 5px; }
.select-sheet .select-option.is-focused:not([aria-selected="true"]) { background: transparent; border-color: transparent; }
.select-sheet .select-menu:focus-visible .select-option.is-focused { border-color: #bc7e2e; }
.select-sheet .select-option[aria-selected="true"] { border-color: #efc994; color: var(--ink); font-weight: 600; }
.select-sheet .select-check { flex-basis: 22px; width: 22px; height: 22px; border: 1px solid #d6cfc4; border-radius: 50%; opacity: 1; }
.select-sheet .select-check::after { opacity: 0; margin: 4px 7px; border-color: white; }
.select-sheet .select-option[aria-selected="true"] .select-check { background: var(--ink); border-color: var(--ink); }
.select-sheet .select-option[aria-selected="true"] .select-check::after { opacity: 1; }

@media (max-width: 820px) {
  .course-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .course-controls .filter-buttons { display: none; }
  .direction-filter, .course-controls .age-filter { position: relative; display: block; margin: 0; white-space: normal; }
  .direction-filter > label, .course-controls .age-filter > label { position: absolute; z-index: 1; left: 16px; top: 9px; color: var(--control-muted); font-size: 12px; line-height: 1.2; pointer-events: none; }
  .course-controls .custom-select { width: 100%; }
  .course-controls .select-trigger, .course-controls select[data-custom-select] { width: 100%; height: 66px; padding: 27px 14px 11px 16px; border-radius: 13px; font-size: 17px; font-weight: 600; }
  .course-controls .select-chevron { align-self: center; transform: translateY(-8px); background: transparent; }
  .course-controls .select-value { white-space: normal; }
}
@media (max-width: 720px) {
  .form-audience { padding: 3px; }
  .form-audience button { min-height: 44px; font-size: 14px; padding: 10px 4px; }
  .form .select-trigger { height: auto; min-height: 46px; padding: 10px; font-size: 16px; gap: 8px; }
  .form .select-value { white-space: normal; overflow: visible; }
  .form-field > label { font-size: 14px; }
}
