/* Selector inferior de temas y juegos, incluidos tema y responsive. */
#category-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 7px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-line-menu);
  border-radius: 13px;
  text-align: left;
  color: var(--color-ink-control);
}
#category-open strong {
  display: block;
  font-size: calc(14px * var(--text-scale, 1));
}
#category-open small {
  display: block;
  font-size: calc(10px * var(--text-scale, 1));
  margin-top: 2px;
  color: #7890a3;
}

html[data-appearance="dark"] #category-subtitle {
  color: #c3d8e8;
}
/* Previous / next navigation with a central category picker. */
.category-selector {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding: 4px;
  border: 1px solid var(--color-line-menu);
  border-radius: 13px;
}
.category-selector #category-open {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 3px 6px;
  min-height: 34px;
  justify-content: center;
  text-align: center;
}
/* Arrows are wide touch targets (≥44px) that fill the selector height; the label keeps the rest. */
.category-step {
  display: grid;
  place-items: center;
  flex: none;
  align-self: stretch;
  width: 52px;
  height: auto;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--ad-soft);
  color: #527c9b;
  box-shadow: none;
}
.category-step svg {
  width: 20px;
  height: 20px;
}
.category-step:hover {
  background: #dfeffc;
  color: #28658f;
}
.category-selector button:focus-visible {
  outline: 2px solid #70a8d6;
  outline-offset: 1px;
  box-shadow: none;
}
html[data-appearance="dark"] .category-selector {
  background: #21394f;
  border-color: #47637b;
}
html[data-appearance="dark"] .category-step {
  background: var(--ad-soft);
  color: #c3dfef;
}
@media (max-width: 850px), (pointer: coarse) and (max-width: 1100px) {
  .category-selector {
    padding: 2px;
  }

  .category-selector #category-open {
    min-height: 36px;
    height: 36px;
    padding: 2px 5px;
  }

  .category-step {
    width: 56px;
    min-height: 36px;
    border-radius: 9px;
  }

  .category-step svg {
    width: 19px;
    height: 19px;
  }
}
/* Short landscape keeps the original height for the card grid, but the arrows stay wide. */
@media (max-width: 850px) and (orientation: landscape) and (max-height: 500px),
  (pointer: coarse) and (max-width: 1100px) and (orientation: landscape) and (max-height: 500px) {
  .category-selector #category-open {
    min-height: 30px;
    height: 30px;
  }

  .category-step {
    min-height: 30px;
  }
}

@media (max-width: 850px), (pointer: coarse) and (max-width: 1100px) {
  #category-open {
    min-height: 34px;
    height: 34px;
    padding: 3px 9px;
  }

  #category-open strong {
    font-size: calc(12px * var(--text-scale, 1));
  }

  #category-open small {
    display: none;
  }

  #category-open {
    flex-shrink: 0;
  }
}
.panel > .category-selector {
  margin-top: auto;
}
.category-selector #category-subtitle {
  font-size: calc(10px * var(--text-scale, 1));
  margin-top: 1px;
  line-height: 1.15;
}

html[data-appearance="dark"] .category-selector #category-subtitle {
  color: var(--ad-ink-soft);
}

body[data-navigation-area] .category-selector #category-subtitle {
  color: var(--area-ink);
}

/* Short landscape phones keep their 10-11px footer and tab text: one extra pixel overflows the panel. */
@media (orientation: portrait), (min-height: 501px) {
  .category-selector #category-subtitle {
    font-size: calc(11px * var(--text-scale, 1));
  }
}
@media (max-width: 850px) and (orientation: portrait) and (min-height: 800px),
  (pointer: coarse) and (max-width: 1100px) and (orientation: portrait) and (min-height: 800px) {
  .category-step,
  .category-selector #category-open {
    min-height: 44px;
    height: 44px;
  }
}
/* Topic navigation: one clear title; the mode is selected in the top navigation. */
.category-selector #category-subtitle {
  display: none;
}
.category-selector #category-open > span {
  min-width: 0;
  max-width: 100%;
}
.category-selector #category-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: calc(17px * var(--text-scale, 1));
  line-height: 1.2;
}
.category-current-icon {
  display: inline-block;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  font-size: 27px;
  line-height: 30px;
}
.category-current-label {
  min-width: 0;
  overflow-wrap: normal;
}
@media (max-width: 600px), (orientation: landscape) and (max-height: 500px) {
  .category-selector #category-name {
    gap: 7px;
    font-size: calc(15px * var(--text-scale, 1));
  }

  .category-current-icon {
    flex-basis: 27px;
    width: 27px;
    height: 27px;
    font-size: 25px;
    line-height: 27px;
  }
}
@media (min-width: 601px) and (min-height: 501px) {
  .category-selector #category-open {
    height: auto;
    min-height: 44px;
  }
}
/* Tablet fingers need larger arrows in both orientations, including wide iPads. */
@media (pointer: coarse) and (min-width: 600px) and (min-height: 501px) {
  .category-selector {
    gap: 6px;
    padding: 4px;
  }

  .category-selector .category-step {
    width: 72px;
    min-height: 60px;
    border-radius: 12px;
  }

  .category-step svg {
    width: 32px;
    height: 32px;
  }

  .category-selector #category-open {
    height: auto;
    min-height: 60px;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 1100px) {
  .category-selector #category-name {
    font-size: calc(14px * var(--text-scale, 1));
    line-height: 1.1;
  }
}
/* Shared surface; dimensions and reading order stay with each existing component. */
.category-selector #category-open {
  position: relative;
  background: linear-gradient(180deg, var(--tile-top), var(--tile-face));
  border-color: var(--tile-edge);
  color: var(--tile-ink);
  font-weight: 700;
}
/* A press lowers the bevel, without moving surrounding controls or the stage. */
.category-selector #category-open:not(:disabled):active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 0 #ffffff60,
    0 1px 0 var(--tile-base);
}
.category-selector {
  border-color: var(--ad-line);
  background: var(--ad-paper);
  box-shadow: 0 3px 0 var(--ad-base);
}
.category-selector #category-open {
  box-shadow: inset 0 1px 0 #fff8;
  border-radius: 10px;
}
.category-selector #category-name {
  font-weight: 800;
  color: var(--ad-ink);
}
html[data-appearance="dark"] .category-selector #category-open {
  background: linear-gradient(180deg, var(--tile-top), var(--tile-face));
  border-color: var(--tile-edge);
  color: var(--tile-ink);
  box-shadow:
    inset 0 1px 0 #ffffff28,
    0 3px 0 var(--tile-base);
}

/* In a free challenge the points are for the topic being played, so the topic bar goes away; leave via the back pill. */
body.practice-active:not([data-journey-active]) .category-selector {
  display: none;
}
