:root {
  color-scheme: dark;
  --gym-bg: #0b111b;
  --gym-panel: #111b29;
  --gym-panel-2: #142132;
  --gym-line: #304056;
  --gym-line-soft: #26364b;
  --gym-text: #edf2f8;
  --gym-muted: #a9b8cb;
  --gym-blue: #73a9ee;
  --gym-blue-strong: #2f6fb5;
  --gym-card: #162334;
}

.chess-gym-document,
.chess-gym-page {
  min-height: 100%;
}

.chess-gym-page {
  margin: 0;
  background:
    radial-gradient(circle at 80% 8%, rgba(46, 91, 143, .13), transparent 28rem),
    var(--gym-bg);
  color: var(--gym-text);
  overflow-x: hidden;
}

.chess-gym-page button,
.chess-gym-page progress {
  font: inherit;
}

.chess-gym-page button {
  cursor: pointer;
}

.chess-gym-page button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.chess-gym-page :focus-visible {
  outline: 2px solid #8fbaff;
  outline-offset: 2px;
}

.chess-gym-page .skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 1400;
  background: #fff;
  color: #111827;
  padding: .7rem .9rem;
  border-radius: 7px;
}

.chess-gym-page .skip-link:focus {
  top: 1rem;
}

.chess-gym-main {
  box-sizing: border-box;
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: clamp(14px, 2vw, 30px);
}

.chess-gym-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.chess-gym-header h1 {
  margin: 2px 0 0;
  font-size: clamp(1.6rem, 2.5vw, 2.35rem);
  letter-spacing: -.035em;
}

.chess-gym-eyebrow,
.chess-gym-card-kicker,
.chess-gym-board-kicker {
  color: #8faad0;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.chess-gym-eyebrow {
  margin: 0;
}

.chess-gym-tagline {
  margin: 5px 0 0;
  color: var(--gym-muted);
  font-size: .97rem;
}

.chess-gym-session {
  display: grid;
  gap: 1px;
  min-width: 74px;
  text-align: right;
  color: var(--gym-muted);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.chess-gym-session strong {
  color: #fff;
  font-size: 1.2rem;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.chess-gym-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, .85fr);
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}

.chess-gym-board-column {
  min-width: 0;
  width: 100%;
  max-width: 780px;
  justify-self: center;
}

.chess-gym-board-head,
.chess-gym-board-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  color: var(--gym-muted);
}

.chess-gym-board-head > div {
  display: grid;
  gap: 3px;
}

.chess-gym-board-head strong {
  color: #dce7f4;
  font-size: .92rem;
}

.chess-gym-quiet-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  color: #bfd7f5;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}

.chess-gym-quiet-button:hover {
  background: #15253a;
  border-color: #294766;
}

.chess-gym-board-frame {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  box-sizing: border-box;
  border: 4px solid #26364c;
  border-radius: 6px;
  background: #152131;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .38);
}

.chess-gym-board-frame .caissa-board {
  width: 100%;
  height: 100%;
  --caissa-board-light: #e6d3b1;
  --caissa-board-dark: #a7795b;
  --caissa-board-last-move: rgba(255, 206, 66, .5);
  --caissa-board-hint: rgba(86, 157, 239, .62);
  --caissa-board-error: rgba(206, 69, 83, .68);
}

.chess-gym-board-foot {
  min-height: 38px;
  padding: 0 3px;
  font-size: .82rem;
}

.chess-gym-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: var(--gym-workspace-height, 760px);
  max-height: none;
  overflow: hidden;
  background: var(--gym-panel);
  border: 1px solid var(--gym-line);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .2);
}

.chess-gym-panel-head,
.chess-gym-panel-foot-wrap {
  flex: none;
  background: var(--gym-panel-2);
}

.chess-gym-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.chess-gym-tabs button {
  min-height: 54px;
  padding: 15px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--gym-muted);
  font-weight: 800;
}

.chess-gym-tabs button[aria-selected="true"] {
  color: #fff;
  background: #1a2b40;
  border-bottom-color: var(--gym-blue);
}

.chess-gym-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  scrollbar-width: thin;
  scrollbar-color: #536b88 transparent;
}

.chess-gym-panel-body [hidden] {
  display: none !important;
}

.chess-gym-subtabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  background: #0d1623;
  border: 1px solid #263a52;
  border-radius: 9px;
}

.chess-gym-subtabs button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9fb1c7;
  font-weight: 750;
}

.chess-gym-subtabs button[aria-selected="true"] {
  background: #203954;
  color: #fff;
}

.chess-gym-daily,
.chess-gym-current,
.chess-gym-guidance,
.chess-gym-mentor-card,
.chess-gym-move-explainer {
  border: 1px solid var(--gym-line);
  border-radius: 10px;
  background: linear-gradient(180deg, #17263a 0%, #121f30 100%);
}

.chess-gym-daily {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  margin-bottom: 22px;
}

.chess-gym-daily h2,
.chess-gym-current h2,
.chess-gym-guidance h2,
.chess-gym-mentor-card h2,
.chess-gym-panel-title h2,
.chess-gym-section-heading h2 {
  margin: 3px 0 0;
  color: #fff;
  font-size: 1.06rem;
}

.chess-gym-daily p,
.chess-gym-current p,
.chess-gym-guidance p,
.chess-gym-mentor-card p,
.chess-gym-panel-title p,
.chess-gym-move-explainer p {
  margin: 7px 0 0;
  color: #b3c2d3;
  line-height: 1.45;
  font-size: .88rem;
}

.chess-gym-daily button,
.chess-gym-guidance-actions button,
.chess-gym-primary-action,
.chess-gym-secondary-action {
  border-radius: 8px;
  font-weight: 800;
}

.chess-gym-daily button {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #6597ce;
  background: #2f6fb5;
  color: #fff;
  white-space: nowrap;
}

.chess-gym-section-heading,
.chess-gym-current-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.chess-gym-section-heading {
  margin-bottom: 10px;
}

.chess-gym-section-heading > span {
  color: #8fa5be;
  font-size: .78rem;
}

.chess-gym-skill-groups {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.chess-gym-skill-group {
  display: grid;
  gap: 7px;
}

.chess-gym-skill-group h3 {
  margin: 0;
  color: #8fa6c0;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.chess-gym-skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.chess-gym-skill-button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 10px 11px;
  text-align: left;
  border: 1px solid #30465f;
  border-radius: 8px;
  background: #142235;
  color: #dce8f6;
}

.chess-gym-skill-button strong {
  font-size: .9rem;
}

.chess-gym-skill-button small {
  color: #8fa6c0;
  font-size: .7rem;
}

.chess-gym-skill-button:hover {
  border-color: #5278a2;
  background: #172a41;
}

.chess-gym-skill-button[aria-pressed="true"] {
  border-color: #78a9df;
  background: #203a57;
  box-shadow: inset 0 0 0 1px rgba(120, 169, 223, .2);
}

.chess-gym-skill-button[data-ready="false"] {
  opacity: .7;
}

.chess-gym-current {
  padding: 15px;
}

.chess-gym-status-badge {
  flex: none;
  padding: 4px 7px;
  border-radius: 999px;
  background: #173d35;
  color: #a8e9d0;
  font-size: .7rem;
  font-weight: 800;
}

.chess-gym-status-badge.is-next {
  background: #352f22;
  color: #f1d89a;
}

.chess-gym-prompt {
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #0d1724;
  border: 1px solid #263d58;
  color: #d8e6f5;
  line-height: 1.4;
  font-size: .88rem;
}

.chess-gym-prompt.is-correct {
  border-color: #377764;
  background: #102920;
  color: #c4f3df;
}

.chess-gym-prompt.is-wrong {
  border-color: #7d4852;
  background: #2b171c;
  color: #ffd2d7;
}

.chess-gym-learn-grid {
  display: grid;
  gap: 9px;
}

.chess-gym-learn-grid article {
  padding: 14px;
  border: 1px solid #2d425c;
  border-radius: 9px;
  background: #132135;
}

.chess-gym-learn-grid span {
  color: #8fbaff;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.chess-gym-learn-grid h3 {
  margin: 5px 0 0;
  font-size: .98rem;
}

.chess-gym-learn-grid p {
  margin: 5px 0 0;
  color: #aebed0;
  font-size: .82rem;
  line-height: 1.4;
}

.chess-gym-panel-title {
  margin-bottom: 18px;
}

.chess-gym-attempt-log {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.chess-gym-attempt-log li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #2d4259;
  border-radius: 7px;
  background: #0f1b2a;
  color: #dbe7f4;
  font-size: .86rem;
}

.chess-gym-attempt-log li strong {
  font-variant-numeric: tabular-nums;
}

.chess-gym-attempt-log li.is-correct strong {
  color: #8fe0c3;
}

.chess-gym-attempt-log li.is-wrong strong {
  color: #efa1ac;
}

.chess-gym-attempt-log li.is-empty {
  display: block;
  color: #879bb3;
  font-style: italic;
}

.chess-gym-move-explainer {
  padding: 14px;
}

.chess-gym-move-explainer h3 {
  margin: 0;
  font-size: .93rem;
}

.chess-gym-progress-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.chess-gym-progress-summary div {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid #2e425a;
  border-radius: 8px;
  background: #101c2b;
}

.chess-gym-progress-summary span {
  color: #8fa5be;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.chess-gym-progress-summary strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.chess-gym-skill-bars {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

.chess-gym-skill-bars > div {
  display: grid;
  grid-template-columns: 92px 1fr 34px;
  gap: 10px;
  align-items: center;
  color: #b5c4d4;
  font-size: .8rem;
}

.chess-gym-skill-bars progress {
  width: 100%;
  height: 7px;
  accent-color: #669fe1;
}

.chess-gym-skill-bars strong {
  text-align: right;
  color: #dce8f6;
  font-size: .75rem;
}

.chess-gym-progress-tabs {
  margin-top: 2px;
}

.chess-gym-guidance,
.chess-gym-mentor-card {
  padding: 16px;
}

.chess-gym-guidance-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.chess-gym-guidance-actions button {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #3e5d7d;
  background: #18304a;
  color: #ddecfb;
}

.chess-gym-mentor-card {
  position: relative;
  overflow: hidden;
}

.chess-gym-mentor-card::after {
  content: "";
  position: absolute;
  inset: auto -35px -50px auto;
  width: 135px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(113, 84, 181, .14);
}

.chess-gym-mentor-icon {
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  margin-bottom: 10px;
  border-radius: 9px;
  background: #352859;
  color: #c9afff;
}

.chess-gym-mentor-card a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  margin-top: 14px;
  color: #c9b5ff;
  font-weight: 800;
  text-decoration: none;
}

.chess-gym-panel-foot-wrap {
  flex: none;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--gym-line);
  background: var(--gym-panel-2);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, .015);
}

.chess-gym-panel-foot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
}

.chess-gym-panel-foot-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.chess-gym-panel-foot-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dbe7f4;
  font-size: .82rem;
  font-weight: 750;
}

.chess-gym-panel-foot-copy small {
  color: #8196ae;
  font-size: .7rem;
}

.chess-gym-primary-action,
.chess-gym-secondary-action {
  min-height: 40px;
  padding: 8px 13px;
}

.chess-gym-primary-action {
  border: 1px solid #6698d0;
  background: var(--gym-blue-strong);
  color: #fff;
}

.chess-gym-secondary-action {
  border: 1px solid #3d526b;
  background: #17263a;
  color: #c9d7e6;
}

@media (max-width: 1120px) {
  .chess-gym-workspace {
    grid-template-columns: minmax(0, 1.18fr) minmax(340px, .82fr);
  }

  .chess-gym-skill-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .chess-gym-main {
    padding: 14px;
  }

  .chess-gym-workspace {
    grid-template-columns: 1fr;
  }

  .chess-gym-board-column {
    max-width: min(100%, 760px);
  }

  .chess-gym-panel {
    width: min(100%, 760px);
    justify-self: center;
    height: auto;
    min-height: 560px;
    max-height: none;
  }

  .chess-gym-skill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .chess-gym-header {
    align-items: start;
    margin-top: 8px;
  }

  .chess-gym-session {
    min-width: 60px;
  }

  .chess-gym-board-head {
    min-height: 38px;
  }

  .chess-gym-board-head strong {
    font-size: .82rem;
  }

  .chess-gym-board-kicker {
    font-size: .66rem;
  }

  .chess-gym-board-frame {
    border-width: 3px;
  }

  .chess-gym-panel-body {
    padding: 16px;
  }

  .chess-gym-daily {
    grid-template-columns: 1fr;
  }

  .chess-gym-daily button {
    width: 100%;
  }

  .chess-gym-skill-grid {
    grid-template-columns: 1fr;
  }

  .chess-gym-progress-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chess-gym-skill-bars > div {
    grid-template-columns: 80px 1fr 30px;
  }

  .chess-gym-panel-foot-copy {
    display: none;
  }

  .chess-gym-panel-foot {
    grid-template-columns: 1fr 1fr;
  }

  .chess-gym-primary-action,
  .chess-gym-secondary-action {
    width: 100%;
  }
}
