/* 21st.dev adapters: aymanch-03/pricing-section and its supplied shadcn primitives;
   ddoemonn/text-reveal. See .21st/CATALOG.md. Loaded after the incumbent theme.
   The chess film and workspace geometry retain their own layout authority. */
:root {
  --ui-radius: 7px;
  --ui-ease: cubic-bezier(.23, 1, .32, 1);
  --ui-speed: 180ms;
}

/* Actions: catalog button variants, with the product's current color tokens. */
:is(.ui-action, .cta, .btn, .login-magic, .con-free-teach, .t-load-actions a) {
  border-radius: var(--ui-radius);
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -.015em;
  text-decoration: none;
  transition: background-color var(--ui-speed), border-color var(--ui-speed), color var(--ui-speed), box-shadow var(--ui-speed), translate var(--ui-speed);
}
.ui-action.ui-action { display: inline-flex; align-items: center; justify-content: center; gap: .6em; }
:is(.cta, .btn, .login-magic) { box-shadow: var(--ui-shadow-base); }
:is(.cta, .btn, .ui-action, .ui-button):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}
:is(button, input, select, textarea):disabled, [aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
:is(.btn, .cta, .ui-action)[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) {
  :is(.cta, .btn, .login-magic):not(:disabled):hover { translate: 0 -1px; box-shadow: var(--ui-shadow-hover); }
  :is(.cta, .btn, .login-magic):not(:disabled):active { translate: 0 0; box-shadow: none; }
}

/* Form primitives: native label, input, select, checkbox and switch behavior. */
.auth :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea), .teach select {
  border-radius: var(--ui-radius);
  border: 1px solid var(--line-2);
  transition: border-color var(--ui-speed), box-shadow var(--ui-speed), background-color var(--ui-speed);
}
.auth :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 44px;
  background: var(--panel, var(--ebony-2));
  color: var(--fg);
}
.auth.is-auth-split :is(input:not([type="checkbox"]):not([type="radio"]), select),
.auth.is-signup :is(input:not([type="checkbox"]):not([type="radio"]), select) { background: var(--ui-field-ground); color: var(--ink); border-color: var(--ui-control-line); }
.auth label { font-family: var(--sans); font-weight: 500; letter-spacing: -.01em; }
.auth :is(input, select, textarea):focus-visible, .teach select:focus-visible {
  outline: 2px solid currentColor; outline-offset: 2px; box-shadow: 0 0 0 4px var(--ui-focus-wash);
}
.auth :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--ui-error); }
.auth :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--ink); width: 18px; height: 18px; flex-shrink: 0; }
.auth:not(.is-signup):not(.is-auth-split) :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--ivory); }
.field-error, .auth-status:not([hidden]) { border-radius: var(--ui-radius); }
.auth-status:not([hidden]), .con-status:not([hidden]), .t-load-state:not([hidden]), .checkout-access-state:not([hidden]) {
  border-inline-start: 1px solid currentColor;
}

/* Card and badge hierarchy from the catalog pricing card. */
:is(.billing-card, .rate-band, .auth-card, .manage-panel, .checkout-card, .con-session, .library-card) {
  border-radius: 10px;
  box-shadow: var(--ui-shadow-card);
}
.pg .billing-card { background: var(--ivory); border-color: var(--ui-card-line); gap: 18px; }
.pg .billing-card.is-recommended { border: 2px solid var(--ink); transform: none; box-shadow: var(--ui-shadow-featured); }
.pg .billing-card.is-invert { background: var(--ebony); color: var(--ivory); border-color: var(--ebony); }
.pg .billing-card .billing-name { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; }
.pg .billing-price strong { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 3.4vw, 3rem); }
.pg .billing-items { margin-top: auto; line-height: 1.55; }
.pg .billing-cta { min-height: 44px; font-size: .86rem; }
.ui-arrow { flex-shrink: 0; transition: transform 180ms var(--ui-ease); }
.billing-cta:hover .ui-arrow { transform: translateX(3px); }
.billing-frequency { display: none; width: fit-content; gap: 4px; padding: 4px; margin: 0 0 26px; background: var(--ivory-2); border: 1px solid var(--line); border-radius: 8px; }
.ui-has-pricing .billing-frequency { display: flex; }
.billing-frequency > button { display: flex; align-items: center; gap: 8px; border: 0; padding: 9px 13px; background: transparent; color: var(--ink); cursor: pointer; font: 500 .82rem var(--sans); }
.billing-frequency .ui-badge { padding: 3px 6px; background: var(--ui-discount-wash); color: inherit; font-size: .66rem; }
.billing-frequency.ui-segmented { --ui-active-bg: var(--ivory); --ui-active-fg: var(--ink); }
.billing-frequency .ui-selection { box-shadow: var(--ui-shadow-selection); }
.pg .billing-card .billing-mark { color: var(--ivory); background: var(--ink); padding: 5px 8px; border-radius: 5px; letter-spacing: 0; font-family: var(--sans); font-size: .65rem; }
.rate .rate-band { border-radius: 9px; }
.rate .rate-band.is-fit { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
:is(.ui-badge, .pg-chip, .con-chip, .rate-chip, .billing-chip) { border-radius: 5px; font-weight: 500; }
.pg .pg-chip { font-family: var(--sans); font-size: .68rem; letter-spacing: 0; padding: 3px 7px; }
.pg .pg-chip-free { background: var(--ui-free-ground); border-color: var(--ui-free-line); color: var(--ui-free-ink); }

/* A single sliding plate shared by all segmented selections. The children
   remain ordinary buttons/links with their established aria state. */
:is(.rate-bill, .billing-frequency, .cu-filter, .pg-track-bar, .t-views, .con-tracks, .checkout-billing) {
  position: relative; isolation: isolate; border-radius: 8px;
}
.ui-segmented { --ui-active-bg: var(--fg, var(--ink)); --ui-active-fg: var(--fg-inv, var(--ivory)); }
.ui-segmented > .ui-selection {
  position: absolute; top: 0; left: 0; pointer-events: none; z-index: -1;
  width: 100%; height: 100%;
  /* Animate the visible plate, not layout dimensions. The mask retains physical
     6px corners even as billing/filter options have different text widths. */
  clip-path: inset(var(--ui-selection-y, 0px)
    calc(100% - var(--ui-selection-x, 0px) - var(--ui-selection-w, 0px))
    calc(100% - var(--ui-selection-y, 0px) - var(--ui-selection-h, 0px))
    var(--ui-selection-x, 0px) round 6px);
  border-radius: 6px; background: var(--ui-active-bg);
  transition: clip-path 320ms var(--ui-ease);
}
.ui-segmented > :is(button, a) { position: relative; z-index: 0; border-radius: 6px; transition: color 180ms, background-color 180ms; }
.ui-segmented > :is(button, a):is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .is-on) {
  background: transparent; box-shadow: none; color: var(--ui-active-fg);
}
.rate-bill.ui-segmented { --ui-active-bg: var(--ivory); --ui-active-fg: var(--ink); background: var(--ui-pressed-track); border-color: var(--ui-control-line); }
.rate-bill.ui-segmented > .ui-selection { box-shadow: var(--ui-shadow-selection); }
.rate-bill.ui-segmented .rate-bill-b { letter-spacing: 0; font-family: var(--sans); }

/* Navigation follows the catalog menu's clear current/hover states. */
:is(.pg-links, .nav-links, .foot-map, .con-tabs, .manage-tabs) a { transition: color 160ms, background-color 160ms; }
.pg .pg-links { gap: 4px; }
.pg .pg-links a { padding: 7px 11px; border-radius: 6px; font-family: var(--sans); font-size: .79rem; }
.pg .pg-links a[aria-current="page"] { background: var(--ivory-2); color: var(--ink); }
.pg .pg-links a::after { display: none; }
@media (hover: hover) {
  .pg .pg-links a:hover { background: var(--ui-hover-ground); }
  .pg-founder .pg-links a:hover, .pg-founder .pg-links a[aria-current="page"] { background: var(--ink-2); color: var(--ivory); }
}
.pg .cu-s { border-radius: 6px; transition: background-color 160ms; }
.pg .cu-s:focus-within { background: var(--ui-hover-ground); }
@media (hover: hover) { .pg .cu-s:hover { background: var(--ui-row-hover); } }
.pg .cu-t { font-weight: 500; }
.pg .cu-rail { border-radius: 9px; }
.pg .cu-rail li.is-on > a { border-radius: 6px; }
.pg :is(.pg-plate, .pg-swap > div, .is-kit > li) { border-radius: 8px; }
.auth :is(.manage-list button, .con-list button, .library-list > li, .bookmark-card, .con-delivery) { border-radius: 8px; }
.auth .con-list button:hover, .auth .con-list button:focus-visible { background: var(--ebony-3); }
.auth .con-tracks.ui-segmented { --ui-active-bg: var(--ivory); --ui-active-fg: var(--ink); }
.auth details > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth details > summary::-webkit-details-marker { display: none; }
.auth details > summary::after { content: '+'; font: 400 1.3rem var(--sans); }
.auth details[open] > summary::after { content: '−'; }
.auth details > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.pg .pg-foot-col a, .foot-map a { text-underline-offset: .25em; }

/* Teaching controls: tactile, quiet, and compact around the real board. */
.teach :is(.t-board-tools button, .t-line-btns button, .t-beats button, .t-collapse, .t-clock-actions button) {
  border-radius: 5px;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
.teach .t-board-tools { gap: 4px; }
.teach .t-board-tools button { border-color: var(--ui-tool-line); background: var(--ebony-2); }
.teach .t-board-tools button:hover { background: var(--ink-2); border-color: var(--ui-tool-hover); }
.teach .t-board-tools button[aria-pressed="true"] { background: var(--ivory); color: var(--ink); }
.teach .t-flow li button { border-radius: 6px; transition: background-color 160ms, border-color 160ms; }
.teach .t-flow li.is-on button { box-shadow: inset 3px 0 0 currentColor; }
.teach :is(.t-coach-cue, .t-solution) { border-radius: 8px; }
.teach .t-bar, .teach .t-bar i { border-radius: 2px; }
.teach .t-bar i { transition: transform 240ms linear; }

/* One rounded reading surface over the live chess film. Reuse the catalog card
   contract with the owner's Apple-style material direction; keep layout/timing. */
:is(.sun-beats .sb, .stages-head, .stages .stage-panel, .spine .scrub, .chaos .cv-col) {
  border: 1px solid var(--ui-story-border);
  border-radius: var(--ui-story-radius);
  background: linear-gradient(145deg, var(--ui-story-sheen), transparent 60%), var(--ui-story-surface);
  box-shadow: var(--ui-story-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
  backdrop-filter: blur(18px) saturate(115%);
  background-clip: padding-box;
}
/* The inherited negative-inset plate drew a second square behind every beat. */
.sun-beats .sb::before { content: none; }
.stages-head { border-top-color: var(--hue); }
.stages .stage-panel { border-left: 1px solid var(--sc); }
.chaos .cv-col { border-radius: clamp(14px, 1.4vw, 20px); }
/* This panel's background has its own scroll-opacity driver. Keep that driver
   on the pseudo-element so the glass cannot appear ahead of the story text. */
.chaos .cv-one, .chaos .cv-one::before { border-radius: var(--ui-story-radius); }
.chaos .cv-one::before {
  border-color: var(--ui-story-border);
  background: linear-gradient(145deg, var(--ui-story-sheen), transparent 60%), var(--ui-story-surface);
  box-shadow: var(--ui-story-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
  backdrop-filter: blur(18px) saturate(115%);
}
@media (max-width: 600px) { .act { --ui-story-radius: 20px; } }
/* The opaque fallback remains readable on browsers/devices without backdrop blur. */
@supports not (backdrop-filter: blur(1px)) {
  :is(.sun-beats .sb, .stages-head, .stages .stage-panel, .spine .scrub, .chaos .cv-col),
  .chaos .cv-one::before { background-color: var(--ebony-2); }
}

/* Text remains readable in the delivered HTML. Only an active WAAPI animation
   applies the source reveal's opacity/10px travel/8px blur, for at most 1.6s. */
.ui-reveal-word { display: inline-block; white-space: nowrap; vertical-align: baseline; }
.ui-reveal-word { max-width: 100%; overflow-wrap: anywhere; }
.ui-price-changing { animation: ui-price-in 320ms var(--ui-ease); }
@keyframes ui-price-in { from { opacity: .45; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .pg .pg-links a { padding: 6px 8px; font-size: .73rem; }
  .pg .billing-card { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-selection, .ui-price-changing, .ui-reveal-word, .ui-arrow, .teach .t-bar i,
  :is(.cta, .btn, .ui-action, .ui-button, input, select, textarea, .cu-s, .t-flow button) {
    animation: none !important; transition: none !important; translate: none !important;
  }
}
