.puzzle-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.puzzle-journey-room {
  --world-tone: #3f7f9d;
  --board-height-reserve: 150px;
  position: relative;
}

.puzzle-journey-title {
  margin-bottom: 1rem;
}

.puzzle-actions svg {
  width: 18px;
  height: 18px;
}

.workspace-page .puzzle-journey-layout {
  display: grid;
  grid-template-columns: minmax(575px, 1.8fr) minmax(215px, .65fr) minmax(290px, .9fr);
  grid-template-areas:
    "board controls route"
    "board daily route";
  align-items: start;
  gap: .85rem;
}

.puzzle-journey-room .puzzle-board-stage {
  grid-area: board;
  min-width: 0;
  width: min(100%, calc(100dvh - var(--board-height-reserve)));
  justify-self: start;
}

.puzzle-quest-card {
  grid-area: controls;
  overflow: visible;
}

.puzzle-daily-card {
  grid-area: daily;
  padding: 1rem !important;
}

.puzzle-route-card {
  grid-area: route;
  min-width: 0;
  max-height: none;
  padding: 1.1rem !important;
  overflow: visible;
  border-color: color-mix(in srgb, var(--world-tone) 28%, var(--theme-border));
}

.puzzle-quest-card .puzzle-card-topline {
  display: grid;
  grid-template-columns: auto 1fr auto;
}

.puzzle-card-topline-meta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.puzzle-elapsed-timer {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .48rem;
  border: 1px solid var(--theme-border);
  border-radius: 7px;
  background: var(--theme-surface-alt);
  color: var(--theme-text);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

.puzzle-elapsed-timer svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--theme-accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.puzzle-difficulty-badge {
  padding: .28rem .48rem;
  color: var(--theme-text);
  font-size: .7rem;
  font-weight: 800;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 7px;
}

.puzzle-reward-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  margin: .15rem 0 .8rem;
  color: var(--theme-text-muted);
  font-size: .77rem;
}

.puzzle-reward-preview > span {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.puzzle-reward-preview svg {
  width: 15px;
  height: 15px;
  color: var(--theme-gold);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.puzzle-result-panel {
  margin: .8rem 0;
  padding: .85rem;
  background: color-mix(in srgb, var(--puzzle-positive) 13%, var(--theme-surface));
  border: 1px solid color-mix(in srgb, var(--puzzle-positive) 35%, var(--theme-border));
  border-radius: 13px;
}

.puzzle-result-panel[hidden],
.puzzle-next-action[hidden],
.puzzle-action-row[hidden] {
  display: none !important;
}

.puzzle-result-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .65rem;
}

.puzzle-result-check {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--theme-surface);
  background: var(--puzzle-positive);
  border-radius: 50%;
}

.puzzle-result-check svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.puzzle-result-heading > div {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.puzzle-result-heading span {
  color: var(--theme-text-muted);
  font-size: .72rem;
  font-weight: 750;
}

.puzzle-result-total {
  color: var(--puzzle-positive) !important;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.puzzle-bonus-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .35rem;
  margin: .75rem 0 0;
}

.puzzle-bonus-list > div {
  min-width: 0;
  padding-top: .5rem;
  border-top: 1px solid color-mix(in srgb, var(--theme-border) 70%, transparent);
}

.puzzle-bonus-list dt {
  overflow: hidden;
  color: var(--theme-text-muted);
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.puzzle-bonus-list dd {
  margin: .12rem 0 0;
  color: var(--theme-text);
  font-size: .78rem;
  font-weight: 800;
}

.puzzle-result-note {
  margin: .65rem 0 0;
  color: var(--theme-text-muted);
  font-size: .72rem;
}

.puzzle-earned-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .75rem;
}

.puzzle-earned-summary > div {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .45rem;
  padding: .5rem .55rem;
  border: 1px solid color-mix(in srgb, var(--theme-border) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--theme-surface-alt) 80%, transparent);
}

.puzzle-earned-summary > .is-elo { grid-column: 1 / -1; }
.puzzle-earned-summary > div > span:first-child { font-size: 1rem; }
.puzzle-earned-summary > div > span:last-child { display: grid; min-width: 0; gap: .08rem; }
.puzzle-earned-summary small { color: var(--theme-text-muted); font-size: .58rem; font-weight: 750; }
.puzzle-earned-summary strong { color: var(--theme-text); font-size: .78rem; font-variant-numeric: tabular-nums; }
.puzzle-earned-summary b,
.puzzle-earned-summary i { font: inherit; }
.puzzle-earned-summary i { margin-left: .25rem; color: var(--theme-text-muted); }
.puzzle-earned-summary i.is-up { color: var(--puzzle-positive); }
.puzzle-earned-summary i.is-down { color: var(--puzzle-negative); }

.puzzle-xp-breakdown { margin-top: .65rem; }
.puzzle-xp-breakdown summary {
  color: var(--theme-accent-text);
  cursor: pointer;
  font-size: .68rem;
  font-weight: 800;
}

.puzzle-xp-breakdown .puzzle-bonus-list { margin-top: .55rem; }

.puzzle-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
}

.puzzle-action-row .btn {
  min-width: 0;
}

.puzzle-route-jump {
  display: none;
}

.puzzle-next-action {
  background: var(--puzzle-positive);
  border-color: color-mix(in srgb, var(--puzzle-positive) 75%, var(--theme-border));
}

.puzzle-route-header,
.puzzle-section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: .65rem;
}

.puzzle-route-header h2 {
  margin: .1rem 0 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.6rem;
}

.puzzle-route-stage,
.puzzle-mission-reward {
  flex: 0 0 auto;
  padding: .3rem .5rem;
  color: color-mix(in srgb, var(--world-tone) 70%, var(--theme-text));
  font-size: .7rem;
  font-weight: 850;
  background: color-mix(in srgb, var(--world-tone) 13%, var(--theme-surface));
  border: 1px solid color-mix(in srgb, var(--world-tone) 28%, var(--theme-border));
  border-radius: 7px;
}

.puzzle-route-intro {
  margin: .55rem 0 .35rem;
  color: var(--theme-text-muted);
  font-size: .76rem;
  line-height: 1.45;
}

.puzzle-route {
  margin: 0;
  padding: .25rem 0 .6rem;
  list-style: none;
}

.puzzle-route-node {
  position: relative;
  height: 88px;
}

.puzzle-route-connector {
  position: absolute;
  z-index: 0;
  inset: -47px 0 auto;
  width: 100%;
  height: 94px;
  overflow: visible;
}

.puzzle-route-connector path {
  fill: none;
  stroke: color-mix(in srgb, var(--theme-border) 82%, transparent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 5 6;
}

.puzzle-route-node.is-completed .puzzle-route-connector path,
.puzzle-route-node.is-current .puzzle-route-connector path {
  stroke: color-mix(in srgb, var(--node-tone) 68%, var(--theme-border));
  stroke-dasharray: none;
}

.puzzle-route-node-shell {
  position: absolute;
  z-index: 1;
  top: 50%;
  display: flex;
  align-items: center;
  gap: .55rem;
  width: min(72%, 210px);
  transform: translateY(-50%);
}

.puzzle-route-node.lane-left .puzzle-route-node-shell {
  left: 5%;
}

.puzzle-route-node.lane-right .puzzle-route-node-shell {
  right: 5%;
  flex-direction: row-reverse;
  text-align: right;
}

.puzzle-route-medallion {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  color: color-mix(in srgb, var(--node-tone) 76%, var(--theme-text));
  background: color-mix(in srgb, var(--node-tone) 12%, var(--theme-surface-alt));
  border: 2px solid color-mix(in srgb, var(--node-tone) 38%, var(--theme-border));
  border-radius: 50%;
  box-shadow: 0 5px 14px color-mix(in srgb, #000 16%, transparent);
}

.puzzle-route-medallion svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.puzzle-route-node.is-current .puzzle-route-medallion {
  color: var(--theme-surface);
  background: color-mix(in srgb, var(--node-tone) 84%, var(--theme-text));
  border-color: color-mix(in srgb, var(--node-tone) 85%, var(--theme-text));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--node-tone) 18%, transparent);
}

.puzzle-route-node.is-completed .puzzle-route-medallion {
  color: var(--theme-surface);
  background: color-mix(in srgb, var(--node-tone) 65%, var(--theme-text));
}

.puzzle-route-node.is-locked {
  opacity: .62;
}

.puzzle-route-node.is-portal {
  height: 102px;
}

.puzzle-route-node.is-portal .puzzle-route-medallion {
  width: 62px;
  height: 62px;
  border-radius: 18px;
}

.puzzle-route-node.is-portal .puzzle-route-medallion svg {
  width: 36px;
  height: 36px;
}

.puzzle-route-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: .06rem;
}

.puzzle-route-state {
  color: color-mix(in srgb, var(--node-tone) 72%, var(--theme-text));
  font-size: .59rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.puzzle-route-copy strong {
  overflow: hidden;
  color: var(--theme-text);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.03rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.puzzle-route-copy small {
  color: var(--theme-text-muted);
  font-size: .68rem;
  font-variant-numeric: tabular-nums;
}

.puzzle-daily-card .card-title {
  font-size: 1rem;
}

.puzzle-mission-reward {
  color: color-mix(in srgb, var(--theme-gold) 75%, var(--theme-text));
  background: color-mix(in srgb, var(--theme-gold) 13%, var(--theme-surface));
  border-color: transparent;
}

.puzzle-daily-card > p {
  margin: .55rem 0;
  color: var(--theme-text-muted);
  font-size: .78rem;
}

.puzzle-mission-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.puzzle-mission-pips {
  display: flex;
  align-items: center;
  flex: 1;
}

.puzzle-mission-pips span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--theme-text-muted);
  font-size: .72rem;
  font-weight: 850;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 50%;
}

.puzzle-mission-pips span:not(:last-child) {
  margin-right: 24px;
}

.puzzle-mission-pips span:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 25px;
  height: 2px;
  background: var(--theme-border);
}

.puzzle-mission-pips span.is-complete {
  color: var(--theme-surface);
  background: var(--puzzle-positive);
  border-color: var(--puzzle-positive);
}

.puzzle-mission-pips svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.puzzle-mission-progress > strong,
.puzzle-session-stats strong {
  color: var(--theme-text);
  font-variant-numeric: tabular-nums;
}

.puzzle-session-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  margin-top: .8rem;
}

.puzzle-session-stats span {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .45rem;
  color: var(--theme-text-muted);
  font-size: .63rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
}

.puzzle-save-note {
  padding-top: .65rem;
  border-top: 1px solid var(--theme-border);
}

.puzzle-save-note a {
  color: var(--theme-link);
  font-weight: 750;
}

.puzzle-promotion-dialog {
  position: relative;
  width: min(430px, calc(100vw - 2rem));
  padding: 2rem;
  overflow: hidden;
  color: var(--theme-text);
  text-align: center;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 24px;
  box-shadow: 0 26px 80px color-mix(in srgb, #000 35%, transparent);
}

.puzzle-promotion-dialog::backdrop {
  background: color-mix(in srgb, #101817 70%, transparent);
  backdrop-filter: blur(5px);
}

.puzzle-promotion-dialog h2 {
  margin: .15rem 0 .25rem;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.puzzle-promotion-dialog > p:not(.workspace-kicker) {
  margin: 0;
  color: var(--theme-text-muted);
}

.puzzle-promotion-emblem {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 0 auto 1rem;
  color: var(--world-tone);
  background: color-mix(in srgb, var(--world-tone) 14%, var(--theme-surface));
  border: 1px solid color-mix(in srgb, var(--world-tone) 42%, var(--theme-border));
  border-radius: 28px;
}

.puzzle-promotion-emblem svg {
  width: 56px;
  height: 56px;
}

.puzzle-promotion-dialog .btn {
  min-height: 46px;
  margin-top: 1.25rem;
}

.puzzle-promotion-dialog[open] {
  animation: puzzle-promotion-in .32s cubic-bezier(.2, .9, .3, 1.15);
}

@keyframes puzzle-promotion-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 1161px) {
  .puzzle-journey-title {
    min-height: 0;
    margin-bottom: .5rem;
  }

  .puzzle-journey-title .puzzle-page-lead {
    display: none;
  }

  .puzzle-journey-title .puzzle-heading-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .puzzle-journey-title h1 {
    font-size: clamp(1.7rem, 2.2vw, 2.2rem);
  }

}

@media (max-width: 1260px) {
  .workspace-page .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    grid-template-areas:
      "board controls"
      "route daily";
  }

  .puzzle-route-card {
    max-height: none;
    overflow: visible;
  }

  .puzzle-route {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    padding-top: .75rem;
  }

  .puzzle-route-node,
  .puzzle-route-node.is-portal {
    height: 82px;
  }

  .puzzle-route-connector {
    display: none;
  }

  .puzzle-route-node-shell,
  .puzzle-route-node.lane-left .puzzle-route-node-shell,
  .puzzle-route-node.lane-right .puzzle-route-node-shell {
    position: static;
    width: 100%;
    height: 100%;
    padding: .45rem;
    flex-direction: row;
    text-align: left;
    background: color-mix(in srgb, var(--theme-surface-alt) 72%, transparent);
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    transform: none;
  }

  .puzzle-route-medallion,
  .puzzle-route-node.is-portal .puzzle-route-medallion {
    width: 48px;
    height: 48px;
    border-radius: 50%;
  }
}

@media (max-width: 1100px) {
  .workspace-page .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "board"
      "controls"
      "route"
      "daily";
  }
}

@media (max-width: 900px) {
  .puzzle-route {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .puzzle-bonus-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Acabado del panel de juego: iconos de línea y estados sin manchas negras. */
.puzzle-journey-room .puzzle-card-icon > svg,
.puzzle-journey-room .puzzle-actions .btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.puzzle-journey-room .puzzle-card-icon {
  color: var(--theme-accent-text);
  background: var(--theme-accent-soft);
}

.puzzle-journey-room .puzzle-actions .btn svg {
  color: var(--theme-accent-text);
}

.puzzle-journey-room .puzzle-actions .btn {
  border-color: color-mix(in srgb, var(--theme-border) 86%, var(--theme-accent));
  background: color-mix(in srgb, var(--theme-surface-alt) 94%, var(--theme-accent-soft));
}

.puzzle-journey-room .puzzle-actions .btn:hover {
  border-color: color-mix(in srgb, var(--theme-accent) 38%, var(--theme-border));
  background: color-mix(in srgb, var(--theme-accent-soft) 32%, var(--theme-surface-alt));
}

.tactical-progress-card__rating {
  display: flex;
  align-items: center;
  min-width: 10.5rem;
  min-height: 50px;
  margin-left: auto;
  padding: .35rem .48rem;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: var(--theme-surface-alt);
  box-shadow: inset 0 1px color-mix(in srgb, white 5%, transparent);
}
.tactical-progress-card__rating-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  margin-right: .5rem;
  border-radius: 9px;
  color: var(--theme-accent-text);
  background: var(--theme-accent-soft);
}
.tactical-progress-card__rating-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tactical-progress-card__rating-copy {
  display: grid;
  min-width: 0;
}
.tactical-progress-card__rating-copy small,
.tactical-progress-card__rating-band small {
  color: var(--theme-text-muted);
  font-size: .52rem;
  font-weight: 850;
  letter-spacing: .06em;
  line-height: 1.05;
  text-transform: uppercase;
}
.tactical-progress-card__rating-copy > strong {
  color: var(--theme-title);
  font-size: 1.08rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.tactical-progress-card__rating-band {
  display: grid;
  margin-left: auto;
  padding-left: .55rem;
  border-left: 1px solid var(--theme-border);
  text-align: right;
}
.tactical-progress-card__rating-band b {
  color: var(--theme-accent-text);
  font-size: .58rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .tactical-progress-card__rating {
    min-width: 9.3rem;
    padding-inline: .35rem;
  }
  .tactical-progress-card__rating-mark { display: none; }
}

@media (max-width: 560px) {
  .puzzle-journey-title {
    grid-template-columns: auto 1fr;
  }

  .puzzle-journey-title .puzzle-availability {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .puzzle-route {
    display: block;
    padding-left: .2rem;
  }

  .puzzle-route-node,
  .puzzle-route-node.is-portal {
    height: 88px;
  }

  .puzzle-route-node-shell,
  .puzzle-route-node.lane-left .puzzle-route-node-shell,
  .puzzle-route-node.lane-right .puzzle-route-node-shell {
    position: absolute;
    width: min(76%, 250px);
    height: auto;
    padding: .4rem;
    transform: translateY(-50%);
  }

  .puzzle-route-node.lane-left .puzzle-route-node-shell {
    right: auto;
    left: 2%;
  }

  .puzzle-route-node.lane-right .puzzle-route-node-shell {
    right: 2%;
    left: auto;
    flex-direction: row-reverse;
    text-align: right;
  }

  .puzzle-route-connector {
    display: block;
    inset: -44px 0 auto;
    height: 88px;
  }

  .puzzle-route-medallion,
  .puzzle-route-node.is-portal .puzzle-route-medallion {
    width: 48px;
    height: 48px;
  }

  .puzzle-result-heading {
    grid-template-columns: auto 1fr;
  }

  .puzzle-result-total {
    grid-column: 2;
  }

  .puzzle-bonus-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .puzzle-action-row {
    grid-template-columns: 1fr 1fr;
  }

  .puzzle-route-jump {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin-top: .7rem;
    padding: .55rem .7rem;
    color: var(--theme-accent-text);
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
    background: color-mix(in srgb, var(--theme-accent) 10%, var(--theme-surface-alt));
    border: 1px solid color-mix(in srgb, var(--theme-accent) 28%, var(--theme-border));
    border-radius: 10px;
  }

  .puzzle-route-jump svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }
}

/* Progreso táctico: reemplaza el mapa ilustrado por información útil y
   accesos directos. Las reglas viven al final para retirar limpiamente las
   variantes anteriores del camino sin afectar Rush, Battle o Personalizados. */
.tactical-progress-card {
  display: grid;
  grid-template-columns: minmax(12rem, .72fr) minmax(18rem, 1.35fr) auto;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: .65rem;
  padding: .9rem 1rem !important;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--theme-gold) 34%, var(--theme-border));
  background:
    radial-gradient(circle at 0 50%, color-mix(in srgb, var(--theme-gold) 12%, transparent), transparent 32%),
    var(--theme-surface);
}

.tactical-progress-card__identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: .72rem;
}

.tactical-progress-card__crest {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--theme-gold) 42%, var(--theme-border));
  border-radius: 13px;
  color: color-mix(in srgb, var(--theme-gold) 88%, white);
  background: color-mix(in srgb, var(--theme-accent) 16%, var(--theme-surface-alt));
  font-size: 1.45rem;
}

.tactical-progress-card__identity .workspace-kicker { margin: 0 0 .12rem; }
.tactical-progress-card__identity h2 {
  margin: 0;
  color: var(--theme-title);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.42rem;
  line-height: 1;
}

.tactical-progress-card__meter { display: grid; min-width: 0; gap: .35rem; }
.tactical-progress-card__meter-copy { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.tactical-progress-card__meter-copy strong { color: var(--theme-text); font-size: .83rem; font-variant-numeric: tabular-nums; }
.tactical-progress-card__meter-copy > span,
.tactical-progress-card__meter small { color: var(--theme-text-muted); font-size: .68rem; font-weight: 750; }
.tactical-progress-card__meter b { color: var(--theme-accent-text); }
.tactical-progress-card__meter progress {
  width: 100%;
  height: .55rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: color-mix(in srgb, var(--theme-text) 10%, transparent);
}
.tactical-progress-card__meter progress::-webkit-progress-bar { border-radius: inherit; background: color-mix(in srgb, var(--theme-text) 10%, transparent); }
.tactical-progress-card__meter progress::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, var(--theme-accent), var(--theme-gold)); }
.tactical-progress-card__meter progress::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, var(--theme-accent), var(--theme-gold)); }

.tactical-progress-card__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(7.2rem, auto));
  gap: .45rem;
  margin: 0;
}
.tactical-progress-card__stats > div {
  min-width: 0;
  padding: .5rem .65rem;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--theme-accent) 5%, var(--theme-surface-alt));
}
.tactical-progress-card__stats dt { color: var(--theme-text-muted); font-size: .61rem; font-weight: 800; }
.tactical-progress-card__stats dd { margin: .12rem 0 0; color: var(--theme-text); font-size: .82rem; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tactical-progress-card__guide { grid-column: 1 / -1; margin: -.5rem 0 0; color: var(--theme-text-muted); font-size: .69rem; line-height: 1.35; }

.puzzle-tactical-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
  margin-bottom: .75rem;
}
.puzzle-tactical-modes > a {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  min-height: 76px;
  gap: .7rem;
  padding: .7rem .75rem;
  border: 1px solid var(--theme-border);
  border-radius: 15px;
  color: var(--theme-text);
  background: var(--theme-surface);
  box-shadow: 0 5px 15px color-mix(in srgb, var(--theme-shadow) 55%, transparent);
  text-decoration: none;
  transition: transform 150ms var(--ease-out), border-color 150ms var(--ease-out), background 150ms var(--ease-out);
}
.puzzle-tactical-modes > a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--theme-accent) 44%, var(--theme-border)); background: var(--theme-surface-alt); }
.puzzle-tactical-modes > a:focus-visible { outline: 3px solid color-mix(in srgb, var(--theme-accent) 32%, transparent); outline-offset: 2px; }
.puzzle-tactical-modes > a.is-active { border-color: color-mix(in srgb, var(--theme-gold) 48%, var(--theme-border)); background: color-mix(in srgb, var(--theme-gold) 7%, var(--theme-surface)); }
.puzzle-tactical-modes > a > span:nth-child(2) { display: grid; min-width: 0; gap: .16rem; }
.puzzle-tactical-modes strong { overflow: hidden; font-size: .83rem; text-overflow: ellipsis; white-space: nowrap; }
.puzzle-tactical-modes small { overflow: hidden; color: var(--theme-text-muted); font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.puzzle-tactical-modes i { color: var(--theme-accent-text); font-size: .95rem; font-style: normal; }
.puzzle-tactical-modes__icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  background: var(--theme-surface-alt);
}
.puzzle-tactical-modes__icon img { width: 42px; height: 42px; object-fit: contain; }
.puzzle-tactical-modes__icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.puzzle-tactical-modes__icon.is-daily { background: color-mix(in srgb, #ef8b2c 13%, var(--theme-surface-alt)); }
.puzzle-tactical-modes__icon.is-rush { color: #d88a1d; background: color-mix(in srgb, #efad3d 15%, var(--theme-surface-alt)); }
.puzzle-tactical-modes__icon.is-battle { color: #367cba; background: color-mix(in srgb, #4b94d0 14%, var(--theme-surface-alt)); }
.puzzle-tactical-modes__icon.is-custom { color: #717c91; background: color-mix(in srgb, #8d96a9 14%, var(--theme-surface-alt)); }

.puzzle-journey-room .puzzle-journey-layout {
  grid-template-columns: minmax(520px, 1fr) minmax(260px, 340px);
  grid-template-areas:
    "board controls"
    "board daily";
  justify-content: center;
}

@media (max-width: 1180px) {
  .tactical-progress-card { grid-template-columns: minmax(12rem, .8fr) minmax(16rem, 1.2fr); }
  .tactical-progress-card__stats { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .puzzle-tactical-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .puzzle-journey-room .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "controls" "daily";
  }
  .tactical-progress-card { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .tactical-progress-card__stats { grid-column: auto; }
  .puzzle-tactical-modes > a { min-height: 68px; }
}

@media (max-width: 560px) {
  .puzzle-journey-title { margin-bottom: .6rem; }
  .tactical-progress-card { padding: .78rem !important; border-radius: 15px; }
  .tactical-progress-card__meter-copy { align-items: flex-start; flex-direction: column; gap: .12rem; }
  .tactical-progress-card__stats { gap: .35rem; }
  .tactical-progress-card__stats > div { padding: .45rem .5rem; }
  .puzzle-tactical-modes { gap: .4rem; }
  .puzzle-tactical-modes > a { grid-template-columns: 42px minmax(0, 1fr); min-height: 66px; gap: .55rem; padding: .55rem; border-radius: 13px; }
  .puzzle-tactical-modes > a > i { display: none; }
  .puzzle-tactical-modes__icon { width: 42px; height: 42px; border-radius: 11px; }
  .puzzle-tactical-modes__icon img { width: 37px; height: 37px; }
  .puzzle-tactical-modes__icon svg { width: 23px; height: 23px; }
  .puzzle-tactical-modes strong { font-size: .76rem; }
  .puzzle-tactical-modes small { display: none; }
}

/* En teléfono apaisado el límite decisivo es la altura, no el ancho. Esta
   regla vive junto al componente porque puzzle_journey.css se carga después
   de la escala compartida de main.css. */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .puzzle-workspace .puzzle-game-layout,
  .custom-trainer-room .custom-training-layout,
  .custom-study-layout {
    width: min(100%, calc(100dvh - 88px));
    margin-inline: auto;
  }

  .puzzle-workspace .board-col,
  .puzzle-board-stage,
  .custom-trainer-room .custom-training-board,
  .custom-study-layout .puzzle-board-stage {
    width: min(100%, calc(100dvh - 88px));
    max-width: calc(100dvh - 88px);
    justify-self: center;
  }
}

/* Problemas personalizados: una mesa de trabajo compacta. La configuración
   conserva los filtros reales del servidor; al iniciar, el tablero queda a la
   izquierda y los controles de resolución a la derecha. */
.custom-trainer-room {
  --custom-board-size: min(690px, calc(100dvh - 182px), calc(100vw - 29rem));
  width: min(100%, 1220px);
  margin-inline: auto;
}

.custom-trainer-room .puzzle-page-header,
.custom-trainer-room .puzzle-mode-nav,
.custom-trainer-room .custom-config-card,
.custom-trainer-room .custom-empty-state,
.custom-trainer-room .custom-training {
  width: 100%;
}

.custom-trainer-room .custom-config-card {
  max-width: 980px;
  margin: .75rem auto 0;
}

.custom-trainer-room .custom-training-layout {
  grid-template-columns: minmax(0, var(--custom-board-size)) minmax(18rem, 22rem);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: center;
  justify-content: start;
}

.custom-trainer-room .custom-training-board {
  width: min(100%, var(--custom-board-size));
}

.custom-trainer-room .custom-training-board .puzzle-board-frame,
.custom-trainer-room .custom-training-board .cg-wrap {
  width: 100%;
  aspect-ratio: 1;
}

.custom-trainer-room .custom-training-board .cg-wrap {
  overflow: visible;
}

.custom-trainer-room .custom-training-board cg-board {
  overflow: hidden;
}

.custom-trainer-room .custom-training-panel {
  display: grid;
  gap: .8rem;
  padding: clamp(1rem, 2vw, 1.35rem);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 18px;
  box-shadow: var(--theme-shadow-sm);
}

.custom-trainer-room .custom-training-meta {
  padding-bottom: .7rem;
}

.custom-trainer-room .custom-training-status {
  min-height: 0;
  margin: 0;
  padding: .85rem .9rem;
  font-size: .95rem;
}

.custom-trainer-room .custom-active-themes,
.custom-trainer-room .custom-solution-line {
  margin-top: 0;
}

.custom-trainer-room .custom-training-actions {
  gap: .55rem;
}

.custom-trainer-room .custom-training-actions .btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
}

.custom-trainer-room .custom-training-actions [data-custom-next],
.custom-trainer-room .custom-training-actions [data-custom-copy-fen] {
  grid-column: 1 / -1;
}

.custom-study-layout {
  grid-template-columns: minmax(0, min(690px, calc(100dvh - 200px))) minmax(18rem, 22rem);
  align-items: start;
  justify-content: center;
}

.custom-study-layout .puzzle-board-stage {
  width: min(100%, min(690px, calc(100dvh - 200px)));
}

.custom-study-rail {
  display: grid;
  gap: .8rem;
}

.custom-study-rail .card {
  margin: 0;
}

@media (max-width: 1100px), (max-height: 760px) {
  .custom-trainer-room {
    --custom-board-size: min(700px, calc(100vw - 3rem));
  }

  .custom-trainer-room .custom-training-layout,
  .custom-study-layout {
    grid-template-columns: minmax(0, var(--custom-board-size));
  }

  .custom-trainer-room .custom-training-panel,
  .custom-study-rail,
  .custom-study-layout .puzzle-board-stage {
    width: min(100%, var(--custom-board-size));
  }
}

@media (max-width: 560px) {
  .custom-trainer-room {
    --custom-board-size: calc(100vw - 1.5rem);
  }

  .custom-trainer-room .custom-training-layout {
    gap: .85rem;
  }

  .custom-trainer-room .custom-training-panel {
    padding: .9rem;
    border-radius: 14px;
  }

  .custom-trainer-room .custom-training-actions {
    grid-template-columns: 1fr;
  }

  .custom-trainer-room .custom-training-actions [data-custom-next],
  .custom-trainer-room .custom-training-actions [data-custom-copy-fen] {
    grid-column: auto;
  }
}

/* Ajuste final: estas reglas van al final porque los estilos heredados del
   antiguo entrenador se declaraban después de su primera versión. */
@media (min-width: 1101px) and (min-height: 761px) {
  .custom-trainer-room:not(.is-training-active) {
    --custom-board-size: min(690px, calc(100dvh - 182px), calc(100vw - 29rem));
  }

  .custom-trainer-room.is-training-active {
    --custom-board-size: min(690px, calc(100dvh - 142px), calc(100vw - 29rem));
  }

  .custom-trainer-room .custom-training-layout {
    grid-template-columns: minmax(0, var(--custom-board-size)) minmax(18rem, 22rem);
    gap: clamp(1rem, 2vw, 1.5rem);
  }

  .custom-trainer-room .custom-training-panel {
    display: grid;
    gap: .8rem;
    padding: clamp(1rem, 2vw, 1.35rem);
    border-radius: 18px;
  }
}

@media (max-width: 1100px), (max-height: 760px) {
  .custom-trainer-room {
    --custom-board-size: min(700px, calc(100vw - 3rem));
  }

  .custom-trainer-room .custom-training-layout,
  .custom-study-layout {
    grid-template-columns: minmax(0, var(--custom-board-size));
  }
}

@media (max-width: 560px) {
  .custom-trainer-room .custom-training-actions {
    grid-template-columns: 1fr;
  }

  .custom-trainer-room .custom-training-actions [data-custom-next],
  .custom-trainer-room .custom-training-actions [data-custom-copy-fen] {
    grid-column: auto;
  }
}

/* Camino táctico ilustrado v2. El arte es estático; toda la progresión,
   numeración, estados y avatar permanecen como HTML accesible. */
.puzzle-journey-room .puzzle-journey-layout {
  grid-template-columns: minmax(540px, 1.55fr) minmax(220px, .62fr) minmax(350px, 1fr);
  gap: .75rem;
}

.puzzle-journey-room .puzzle-route-card {
  height: min(760px, calc(100dvh - 142px));
  min-height: 580px;
  padding: 0 !important;
  overflow: hidden;
  background: color-mix(in srgb, var(--theme-surface) 94%, var(--world-tone));
  border-color: color-mix(in srgb, var(--world-tone) 42%, var(--theme-border));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--theme-shadow) 82%, transparent);
}

.puzzle-journey-room .puzzle-route-header {
  position: relative;
  z-index: 8;
  min-height: 78px;
  padding: .85rem .9rem .75rem;
  align-items: center;
  background: color-mix(in srgb, var(--theme-surface) 94%, transparent);
  border-bottom: 1px solid var(--theme-border);
  backdrop-filter: blur(14px);
}

.puzzle-journey-room .puzzle-route-header h2 {
  max-width: 15rem;
  font-size: clamp(1.28rem, 1.8vw, 1.7rem);
  line-height: 1.05;
}

.puzzle-route-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
}

.puzzle-route-stage {
  white-space: nowrap;
}

.puzzle-route-home {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: .35rem;
  padding: .45rem .6rem;
  color: var(--theme-accent-text);
  font: inherit;
  font-size: .68rem;
  font-weight: 850;
  background: var(--theme-accent-soft);
  border: 1px solid color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border));
  border-radius: 9px;
  cursor: pointer;
}

.puzzle-route-home svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* En la columna del mapa el icono conserva el área táctil sin comprimir el título. */
.puzzle-route-home span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.puzzle-route-home {
  width: 44px;
  justify-content: center;
  padding: 0;
}

.puzzle-route-home:hover {
  background: color-mix(in srgb, var(--theme-accent) 18%, var(--theme-surface));
}

.puzzle-route-home:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--theme-accent) 52%, transparent);
  outline-offset: 2px;
}

.puzzle-map-viewport {
  height: calc(100% - 78px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--world-tone) 64%, var(--theme-border)) transparent;
  scrollbar-width: thin;
}

.puzzle-map {
  width: 100%;
  background: #071521;
}

.puzzle-map-world {
  position: relative;
  width: 100%;
  aspect-ratio: 793 / 1983;
  isolation: isolate;
  content-visibility: auto;
  contain-intrinsic-size: auto 875px;
}

.puzzle-map-world::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--theme-surface) 7%, transparent),
    transparent 12% 88%,
    color-mix(in srgb, var(--theme-surface) 7%, transparent)
  );
}

.puzzle-map-world.is-current-world {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--theme-gold) 75%, white);
}

.puzzle-map-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.puzzle-map-world-name {
  position: absolute;
  z-index: 4;
  top: 2.3%;
  left: 50%;
  max-width: 84%;
  margin: 0;
  padding: .45rem .7rem;
  color: #f7f1e3;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(1rem, 1.55vw, 1.35rem);
  line-height: 1.05;
  text-align: center;
  text-wrap: balance;
  background: color-mix(in srgb, #071521 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--node-tone) 55%, #f1ede1);
  border-radius: 12px;
  box-shadow: 0 8px 24px #0008;
  transform: translateX(-50%);
  backdrop-filter: blur(7px);
}

.puzzle-route-world {
  position: absolute;
  z-index: 3;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.puzzle-journey-room .puzzle-route-node,
.puzzle-journey-room .puzzle-route-node.is-portal,
.puzzle-journey-room .puzzle-route-node.is-final {
  position: absolute;
  bottom: calc(6.2% + (var(--route-order) - 1) * 4.55%);
  width: 58px;
  height: 58px;
  transform: translate(-50%, 50%);
}

.puzzle-journey-room .puzzle-route-node.lane-left {
  left: 36%;
}

.puzzle-journey-room .puzzle-route-node.lane-right {
  left: 64%;
}

.puzzle-journey-room .puzzle-route-medallion {
  position: absolute;
  z-index: 3;
  inset: 7px;
  width: 44px;
  height: 44px;
  color: #d9e1e5;
  background: color-mix(in srgb, #0b2033 88%, var(--node-tone));
  border: 3px solid #71808a;
  border-radius: 50%;
  box-shadow: 0 5px 12px #0009, inset 0 1px 0 #fff2;
}

.puzzle-journey-room .puzzle-route-medallion svg {
  width: 22px;
  height: 22px;
}

.puzzle-journey-room .puzzle-route-node.is-completed .puzzle-route-medallion {
  color: #f7f1e3;
  background: color-mix(in srgb, var(--node-tone) 72%, #173647);
  border-color: #d8e7df;
}

.puzzle-journey-room .puzzle-route-node.is-available .puzzle-route-medallion {
  color: #0b2033;
  background: #f1ede1;
  border-color: color-mix(in srgb, var(--theme-gold) 70%, white);
}

.puzzle-journey-room .puzzle-route-node.is-current .puzzle-route-medallion {
  inset: 3px;
  width: 52px;
  height: 52px;
  color: #0b2033;
  background: #e5a640;
  border-color: #fff3ce;
  box-shadow: 0 0 0 7px #e5a64042, 0 8px 20px #000b;
  animation: puzzle-current-breathe 2.8s ease-in-out infinite;
}

.puzzle-route-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #0b2033;
  font-size: .9rem;
  font-weight: 900;
  background: #f8f2e5;
  border-radius: 50%;
}

.puzzle-journey-room .puzzle-route-node.is-milestone .puzzle-route-medallion,
.puzzle-journey-room .puzzle-route-node.is-portal .puzzle-route-medallion,
.puzzle-journey-room .puzzle-route-node.is-final .puzzle-route-medallion {
  inset: 1px;
  width: 56px;
  height: 56px;
  border-width: 3px;
}

.puzzle-journey-room .puzzle-route-node.is-portal .puzzle-route-medallion,
.puzzle-journey-room .puzzle-route-node.is-final .puzzle-route-medallion {
  border-radius: 17px;
}

.puzzle-journey-room .puzzle-route-node.is-portal .puzzle-route-medallion svg,
.puzzle-journey-room .puzzle-route-node.is-final .puzzle-route-medallion svg {
  width: 34px;
  height: 34px;
}

.puzzle-route-medallion [data-milestone-number] {
  color: inherit;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.puzzle-journey-room .puzzle-route-node.is-locked {
  opacity: .74;
}

.puzzle-journey-room .puzzle-route-copy {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: none;
  width: max-content;
  max-width: 145px;
  gap: .05rem;
  padding: .32rem .48rem;
  background: color-mix(in srgb, #071521 84%, transparent);
  border: 1px solid #f1ede140;
  border-radius: 8px;
  box-shadow: 0 5px 12px #0008;
  transform: translateY(-50%);
  backdrop-filter: blur(7px);
}

.puzzle-journey-room .lane-left .puzzle-route-copy {
  left: 54px;
}

.puzzle-journey-room .lane-right .puzzle-route-copy {
  right: 54px;
  text-align: right;
}

.puzzle-journey-room :is(.is-current, .is-milestone, .is-portal, .is-final) .puzzle-route-copy {
  display: flex;
}

.puzzle-journey-room .puzzle-route-copy strong {
  color: #fff8e8;
  font-family: inherit;
  font-size: .7rem;
  line-height: 1.15;
  white-space: normal;
}

.puzzle-journey-room .puzzle-route-copy small {
  color: #d5dce0;
  font-size: .6rem;
}

.puzzle-route-node.is-just-unlocked .puzzle-route-medallion {
  animation: puzzle-portal-unlock .8s cubic-bezier(.2, .8, .25, 1);
}

@keyframes puzzle-current-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes puzzle-portal-unlock {
  0% { transform: scale(.75); filter: brightness(.8); }
  55% { transform: scale(1.14); filter: brightness(1.35); }
  100% { transform: scale(1); filter: none; }
}

@media (max-width: 1260px) {
  .puzzle-journey-room .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
    grid-template-areas:
      "board controls"
      "route daily";
  }

  .puzzle-journey-room .puzzle-route-card {
    width: min(100%, 680px);
    height: auto;
    min-height: 0;
  }

  .puzzle-journey-room .puzzle-map-viewport {
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 1100px) {
  .puzzle-journey-room .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "board"
      "controls"
      "route"
      "daily";
  }

  .puzzle-journey-room .puzzle-route-card,
  .puzzle-journey-room .puzzle-daily-card,
  .puzzle-journey-room .puzzle-quest-card {
    width: min(100%, 720px);
  }
}

@media (max-width: 560px) {
  .puzzle-journey-room .puzzle-route-header {
    min-height: 72px;
    padding: .7rem;
  }

  .puzzle-journey-room .puzzle-route-header-actions {
    gap: .25rem;
  }

  .puzzle-route-home span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .puzzle-route-home {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .puzzle-map-world {
    contain-intrinsic-size: auto 900px;
  }

  .puzzle-map-world-name {
    max-width: 78%;
    font-size: 1rem;
  }

  .puzzle-journey-room .puzzle-route-node,
  .puzzle-journey-room .puzzle-route-node.is-portal,
  .puzzle-journey-room .puzzle-route-node.is-final {
    width: 52px;
    height: 52px;
  }

  .puzzle-journey-room .puzzle-route-medallion {
    inset: 4px;
  }

  .puzzle-journey-room .puzzle-route-node.is-current .puzzle-route-medallion,
  .puzzle-journey-room .puzzle-route-node.is-milestone .puzzle-route-medallion,
  .puzzle-journey-room .puzzle-route-node.is-portal .puzzle-route-medallion,
  .puzzle-journey-room .puzzle-route-node.is-final .puzzle-route-medallion {
    inset: 0;
    width: 52px;
    height: 52px;
  }

  .puzzle-journey-room .puzzle-route-copy {
    max-width: 112px;
  }

  .puzzle-journey-room .lane-left .puzzle-route-copy {
    left: 48px;
  }

  .puzzle-journey-room .lane-right .puzzle-route-copy {
    right: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .puzzle-journey-room .puzzle-route-node.is-current .puzzle-route-medallion,
  .puzzle-route-node.is-just-unlocked .puzzle-route-medallion {
    animation: none;
  }
}

/* Selector de coronación del entrenador personalizado. */
.custom-promotion-dialog {
  width: min(34rem, calc(100vw - 1.5rem));
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border-radius: 20px;
}

.custom-promotion-dialog .play-promotion-options {
  gap: .65rem;
}

.custom-promotion-dialog .play-promotion-options button {
  min-width: 0;
  min-height: 126px;
  color: var(--theme-title);
  background: var(--theme-surface-alt);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--theme-border) 75%, transparent);
}

.custom-promotion-piece.cg-wrap {
  display: grid;
  width: 64px;
  height: 64px;
  aspect-ratio: 1;
  place-items: center;
}

.custom-promotion-piece.cg-wrap piece {
  position: static;
  display: block;
  width: 64px;
  height: 64px;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 3px 2px color-mix(in srgb, var(--theme-shadow) 70%, transparent));
  transform: none;
}

.custom-promotion-dialog .play-promotion-options button:hover {
  color: var(--theme-accent-text);
  background: var(--theme-accent-soft);
}

@media (max-width: 520px) {
  .custom-promotion-dialog .play-promotion-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-promotion-dialog .play-promotion-options button {
    min-height: 108px;
  }
}

/* Problemas personalizados: panel de preparación compacto y mesa protagonista.
   Los controles se agrupan por decisión para no dejar tarjetas aisladas. */
.custom-trainer-room {
  --custom-board-size: min(720px, calc(100dvh - 210px));
}

.custom-trainer-room .puzzle-page-header {
  width: min(100%, 1180px);
  margin-inline: auto;
}

.custom-config-card,
.custom-empty-state {
  width: min(100%, 1180px);
  margin-top: .8rem;
}

.custom-config-card {
  padding: clamp(1rem, 1.8vw, 1.4rem);
  box-shadow: 0 14px 32px var(--theme-shadow);
}

.custom-config-heading {
  align-items: center;
  padding-bottom: .85rem;
}

.custom-config-heading h2 {
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  letter-spacing: -.02em;
}

.custom-filter-form {
  grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
  gap: .75rem;
  padding-top: .85rem;
}

.custom-filter-section {
  padding: .9rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 14px;
}

.custom-filter-section legend {
  margin-bottom: .7rem;
  color: var(--theme-title);
}

.custom-theme-section {
  grid-column: 1 / -1;
}

.custom-theme-grid {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: .5rem;
}

.custom-theme-chip > span {
  background: var(--theme-surface);
}

.custom-form-error,
.custom-config-actions {
  grid-column: 1 / -1;
}

.custom-form-error:not(:empty) {
  min-height: 0;
  padding: .65rem .8rem;
  background: color-mix(in srgb, var(--theme-danger, #d85c5c) 10%, var(--theme-surface));
  border: 1px solid color-mix(in srgb, var(--theme-danger, #d85c5c) 35%, var(--theme-border));
  border-radius: 10px;
}

.custom-config-actions {
  justify-content: space-between;
  padding-top: .15rem;
}

.custom-config-actions .btn {
  min-width: min(100%, 15rem);
}

.custom-training {
  width: min(100%, 1180px);
  margin: .45rem auto 0;
}

.custom-training-topbar {
  justify-content: space-between;
  min-height: 36px;
  padding-inline: .15rem;
}

.custom-training-topbar > span {
  overflow: hidden;
  color: var(--theme-muted);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-training-layout {
  grid-template-columns: minmax(0, var(--custom-board-size)) minmax(18rem, 21rem);
  gap: clamp(.85rem, 1.5vw, 1.25rem);
  align-items: center;
  justify-content: start;
}

.custom-training-panel {
  padding: 1rem;
  border-radius: 16px;
}

.custom-training-status {
  margin: .8rem 0;
}

.custom-training-actions {
  gap: .45rem;
}

.custom-training-actions .btn {
  min-height: 44px;
}

@media (max-width: 1100px), (max-height: 760px) {
  .custom-trainer-room {
    --custom-board-size: min(700px, calc(100vw - 3rem));
  }

  .custom-training-layout {
    grid-template-columns: minmax(0, var(--custom-board-size));
  }
}

@media (max-width: 720px) {
  .custom-filter-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .custom-theme-section,
  .custom-form-error,
  .custom-config-actions {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .custom-trainer-room {
    --custom-board-size: calc(100vw - 1.5rem);
  }

  .custom-config-card {
    padding: .8rem;
  }

  .custom-filter-section {
    padding: .75rem;
  }

  .custom-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-config-actions .btn {
    width: 100%;
  }
}

/* La resoluci\u00f3n es una mesa de trabajo, no una p\u00e1gina de lectura. En
   escritorio se reserva el alto visible para tablero y controles; al volver a
   configurar, la clase se elimina y la p\u00e1gina recupera su flujo habitual. */
@media (min-width: 901px) {
  body:has(.custom-trainer-room.is-training-active) {
    overflow: hidden;
  }

  body:has(.custom-trainer-room.is-training-active) .shell,
  main:has(.custom-trainer-room.is-training-active) {
    height: 100dvh;
    overflow: hidden;
  }

  main:has(.custom-trainer-room.is-training-active) {
    width: 100%;
    max-width: none;
    padding: clamp(.55rem, 1.15dvh, .9rem) clamp(.75rem, 1.6vw, 1.6rem);
  }

  .custom-trainer-room.is-training-active {
    /* La resolución es la tarea: en una pantalla de escritorio el tablero
       ocupa la mayor parte del alto disponible y los controles acompañan,
       sin una franja vacía alrededor. */
    --custom-board-size: min(760px, calc(100dvh - 142px), calc(100vw - 31rem));

    display: grid;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .custom-trainer-room.is-training-active .custom-trainer-header,
  .custom-trainer-room.is-training-active .puzzle-mode-nav {
    display: none;
  }

  .custom-trainer-room.is-training-active .custom-training {
    display: grid;
    min-height: 0;
    margin-top: 0;
    grid-template-rows: 38px minmax(0, 1fr);
  }

  .custom-trainer-room.is-training-active .custom-training-topbar {
    min-height: 38px;
  }

  .custom-trainer-room.is-training-active .custom-training-layout {
    grid-template-columns: minmax(0, var(--custom-board-size)) minmax(290px, 360px);
    gap: clamp(.8rem, 1.35vw, 1.25rem);
    align-items: center;
    min-height: 0;
  }

  .custom-trainer-room.is-training-active .custom-training-panel {
    width: 100%;
    align-self: center;
    padding: .95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .puzzle-promotion-dialog[open] {
    animation: none;
    transition: none;
  }
}

/* Entrenamiento personalizado */
.custom-trainer-room {
  --custom-board-size: min(660px, calc(100vh - 190px));
}

.custom-trainer-room [hidden] {
  display: none !important;
}

.custom-trainer-header {
  align-items: center;
}

.custom-header-link {
  min-height: 44px;
  margin-left: auto;
  padding: .7rem .9rem;
  color: var(--theme-accent-text);
  font-size: .8rem;
  font-weight: 800;
  text-decoration: none;
  background: var(--theme-accent-soft);
  border: 1px solid color-mix(in srgb, var(--theme-accent) 32%, var(--theme-border));
  border-radius: 10px;
}

.custom-header-link:hover {
  background: color-mix(in srgb, var(--theme-accent) 18%, var(--theme-surface));
}

.custom-header-link:focus-visible,
.custom-training-topbar button:focus-visible,
.custom-reset-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--theme-accent) 52%, transparent);
  outline-offset: 2px;
}

.puzzle-study-room .puzzle-control-rail {
  max-height: none;
  overflow: visible;
}

.custom-config-card,
.custom-empty-state {
  width: min(100%, 1040px);
  margin: 1rem auto 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  color: var(--theme-text);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-lg, 18px);
  box-shadow: var(--theme-shadow-sm);
}

.custom-config-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--theme-border);
}

.custom-config-heading h2,
.custom-empty-state h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.custom-config-heading p,
.custom-empty-state p {
  margin: .25rem 0 0;
  color: var(--theme-muted);
  font-size: .84rem;
}

.custom-filter-count {
  padding: .35rem .6rem;
  color: var(--theme-accent-text);
  font-size: .72rem;
  font-weight: 850;
  background: var(--theme-accent-soft);
  border-radius: 999px;
}

.custom-filter-form {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(300px, 1fr);
  gap: 1.1rem 1.5rem;
  padding-top: 1.15rem;
}

.custom-filter-section {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.custom-filter-section legend {
  margin-bottom: .55rem;
  padding: 0;
  color: var(--theme-text);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .035em;
}

.custom-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
}

.custom-segmented label {
  min-width: 0;
}

.custom-segmented input,
.custom-theme-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.custom-segmented span {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: .5rem;
  color: var(--theme-muted);
  font-size: .82rem;
  font-weight: 800;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.custom-segmented input:checked + span {
  color: var(--theme-text);
  background: var(--theme-surface);
  border-color: var(--theme-border);
  box-shadow: var(--theme-shadow-xs);
}

.custom-segmented input:focus-visible + span,
.custom-theme-chip input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--theme-accent) 50%, transparent);
  outline-offset: 1px;
}

.custom-segmented input:disabled + span {
  cursor: not-allowed;
  opacity: .48;
}

.custom-auth-note,
.custom-range-note {
  margin: .35rem 0 0;
  color: var(--theme-faint);
  font-size: .72rem;
}

.custom-auth-note a {
  color: var(--theme-accent-text);
  font-weight: 750;
}

.custom-rating-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: .55rem;
  align-items: end;
}

.custom-rating-row label span {
  display: block;
  margin-bottom: .3rem;
  color: var(--theme-muted);
  font-size: .7rem;
  font-weight: 750;
}

.custom-rating-row input {
  width: 100%;
  min-height: 44px;
  padding: .55rem .7rem;
  color: var(--theme-text);
  font-variant-numeric: tabular-nums;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 10px;
}

.custom-rating-row > span {
  padding-bottom: .7rem;
  color: var(--theme-faint);
}

.custom-theme-section {
  grid-column: 1 / -1;
}

.custom-theme-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .45rem;
}

.custom-theme-chip {
  min-width: 0;
}

.custom-theme-chip > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  min-height: 44px;
  padding: .55rem .7rem;
  color: var(--theme-muted);
  font-size: .75rem;
  font-weight: 760;
  line-height: 1.15;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  cursor: pointer;
}

.custom-theme-chip > span:hover {
  color: var(--theme-text);
  border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border));
}

.custom-theme-chip input:checked + span {
  color: var(--theme-accent-text);
  background: var(--theme-accent-soft);
  border-color: color-mix(in srgb, var(--theme-accent) 42%, var(--theme-border));
}

.custom-theme-chip small {
  color: var(--theme-faint);
  font-size: .65rem;
  font-variant-numeric: tabular-nums;
}

.custom-theme-all {
  display: block;
  width: fit-content;
}

.custom-form-error {
  min-height: 1.1rem;
  margin: 0;
  color: var(--theme-danger, #d85c5c);
  font-size: .78rem;
}

.custom-config-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .8rem;
}

.custom-config-actions .btn {
  min-height: 46px;
}

.custom-reset-button,
.custom-training-topbar button {
  min-height: 44px;
  padding: .55rem .35rem;
  color: var(--theme-muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 750;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.custom-reset-button:hover,
.custom-training-topbar button:hover {
  color: var(--theme-text);
}

.custom-empty-state {
  display: grid;
  min-height: 260px;
  place-content: center;
  text-align: center;
}

.custom-empty-state > div {
  display: flex;
  justify-content: center;
  gap: .6rem;
  margin-top: 1rem;
}

.custom-training {
  margin-top: .7rem;
}

.custom-training-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .7rem;
  min-height: 44px;
  color: var(--theme-muted);
  font-size: .76rem;
}

.custom-training-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--custom-board-size)) minmax(280px, 340px);
  gap: clamp(.9rem, 2vw, 1.4rem);
  align-items: start;
  justify-content: center;
}

.custom-training-board {
  width: min(100%, var(--custom-board-size));
  min-width: 0;
}

.custom-training-board .puzzle-board-frame {
  width: 100%;
}

.custom-training-board .board-frame {
  width: 100%;
}

.custom-training-board .cg-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: visible;
}

.custom-training-board cg-board {
  overflow: hidden;
}

.custom-training-panel {
  padding: 1.1rem;
  color: var(--theme-text);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-lg, 18px);
  box-shadow: var(--theme-shadow-sm);
}

.custom-training-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--theme-border);
}

.custom-training-meta span {
  color: var(--theme-muted);
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.custom-training-meta strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.custom-active-themes,
.custom-solution-line {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .8rem;
}

.custom-active-themes span,
.custom-solution-line span {
  padding: .32rem .5rem;
  color: var(--theme-muted);
  font-size: .7rem;
  font-weight: 750;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: 999px;
}

.custom-solution-line span {
  color: var(--theme-text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.custom-training-status {
  min-height: 2.8rem;
  margin: 1rem 0;
  padding: .72rem .8rem;
  color: var(--theme-text);
  font-size: .9rem;
  font-weight: 800;
  background: var(--theme-surface-alt);
  border-left: 3px solid var(--theme-accent);
  border-radius: 8px;
}

.custom-training-status.is-ok {
  color: var(--theme-success, #4f9b67);
}

.custom-training-status.is-fail {
  color: var(--theme-danger, #d85c5c);
}

.custom-training-status.is-loading {
  color: var(--theme-muted);
}

.custom-training-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.custom-training-actions .btn {
  min-width: 0;
  min-height: 46px;
  padding-inline: .65rem;
}

.custom-training-actions [data-custom-next] {
  grid-column: 1 / -1;
}

.custom-training-actions [data-custom-copy-fen] {
  grid-column: 1 / -1;
}

.custom-training-actions [data-custom-copy-fen].is-copied {
  color: var(--theme-success, #4f9b67);
  border-color: color-mix(in srgb, var(--theme-success, #4f9b67) 55%, var(--theme-border));
  background: color-mix(in srgb, var(--theme-success, #4f9b67) 10%, var(--theme-surface-alt));
}

@media (max-width: 1100px), (max-height: 760px) {
  .custom-trainer-room {
    --custom-board-size: min(700px, calc(100vw - 3rem));
  }

  .custom-training-layout {
    grid-template-columns: minmax(0, var(--custom-board-size));
  }

  .custom-training-panel {
    width: min(100%, 700px);
  }
}

@media (max-width: 720px) {
  .custom-trainer-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .custom-trainer-header .custom-header-link {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  .custom-filter-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .custom-theme-section {
    grid-column: auto;
  }

  .custom-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-form-error,
  .custom-config-actions {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .custom-trainer-room {
    --custom-board-size: calc(100vw - 1.5rem);
    padding-inline: .75rem;
  }

  .custom-config-card {
    margin-top: .65rem;
    padding: .9rem;
    border-radius: 14px;
  }

  .custom-config-heading {
    align-items: center;
  }

  .custom-theme-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .custom-training {
    margin-top: .25rem;
  }

  .custom-training-topbar {
    justify-content: space-between;
  }

  .custom-training-layout {
    gap: .65rem;
  }

  .custom-training-panel {
    padding: .85rem;
    border-radius: 14px;
  }

  .custom-empty-state > div,
  .custom-config-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* La composición definitiva de Problemas ya no reserva una tercera columna
   para el camino antiguo. Se repite al final para superar sus reglas legacy. */
.puzzle-journey-room .puzzle-journey-layout {
  grid-template-columns: minmax(520px, 1fr) minmax(260px, 340px);
  grid-template-areas:
    "board controls"
    "board daily";
}

@media (max-width: 900px) {
  .puzzle-journey-room .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "board" "controls" "daily";
  }
}

/* Escritorio: el tablero abre la página y usa tanto la altura como el ancho
   disponibles. El progreso y las acciones forman una columna lateral densa. */
@media (min-width: 901px) {
  .puzzle-journey-room { --board-height-reserve: 72px; }
  body:has(.puzzle-journey-room) main {
    width: 100%;
    max-width: none;
    padding: .75rem 1rem 1rem;
  }
  .puzzle-journey-room .puzzle-journey-title { display: none; }
  .puzzle-journey-room .puzzle-tactical-modes { display: none; }
  .puzzle-journey-room .puzzle-journey-layout {
    width: 100%;
    max-width: calc(100dvh + 300px);
    margin-inline: auto;
    grid-template-columns: minmax(520px, 1fr) minmax(300px, 360px);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "board progress"
      "board controls"
      "board daily"
      "board empty";
    min-height: calc(100dvh - 2rem);
    align-items: start;
    gap: .65rem .8rem;
  }
  .puzzle-journey-room .puzzle-board-stage {
    grid-area: board;
    grid-row: 1 / -1;
    width: min(100%, calc(100dvh - 72px)) !important;
    max-width: calc(100dvh - 72px) !important;
    justify-self: start;
  }
  .puzzle-journey-room .tactical-progress-card {
    grid-area: progress;
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
    margin: 0;
    padding: .85rem !important;
  }
  .puzzle-journey-room .tactical-progress-card__stats {
    grid-column: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .puzzle-journey-room .puzzle-quest-card { grid-area: controls; }
  .puzzle-journey-room .puzzle-daily-card { grid-area: daily; }
}

/* Tablet: conserva la composición tablero + controles, pero convierte la
   navegación lateral en un rail de iconos. Con los 218 px de escritorio el
   panel derecho se salía de la pantalla en 1024 px. */
@media (min-width: 901px) and (max-width: 1100px) {
  body:has(.puzzle-journey-room) { --sidebar-w: 76px; }

  body:has(.puzzle-journey-room) .sidebar {
    align-items: center;
    gap: .55rem;
    padding: .65rem .45rem;
  }

  body:has(.puzzle-journey-room) .logo {
    width: 48px;
    height: 48px;
    justify-content: center;
    padding: 0;
    overflow: hidden;
  }

  body:has(.puzzle-journey-room) .logo-full { display: none; }
  body:has(.puzzle-journey-room) .logo::before {
    content: "♞";
    color: var(--theme-accent-text);
    font-size: 2rem;
    line-height: 1;
  }

  body:has(.puzzle-journey-room) :is(.side-nav, .side-item, .side-foot) { width: 100%; }
  body:has(.puzzle-journey-room) .side-link {
    justify-content: center;
    min-height: 48px;
    padding: .55rem;
  }

  body:has(.puzzle-journey-room) .side-link > span,
  body:has(.puzzle-journey-room) .side-caret,
  body:has(.puzzle-journey-room) .energy64-counter__copy,
  body:has(.puzzle-journey-room) .side-admin-link > span,
  body:has(.puzzle-journey-room) .side-username { display: none; }

  body:has(.puzzle-journey-room) .side-link :is(.icon, .icon-img) {
    width: 25px;
    height: 25px;
  }

  body:has(.puzzle-journey-room) :is(.energy64-counter, .side-admin-link, .side-profile) {
    justify-content: center;
    padding-inline: .45rem;
  }

  body:has(.puzzle-journey-room) .side-foot > .btn {
    min-width: 0;
    padding-inline: .45rem;
    font-size: 0;
  }

  body:has(.puzzle-journey-room) .side-foot > .btn::after {
    content: "→";
    font-size: 1.15rem;
  }
}

/* Móvil: progreso y accesos rápidos sí van antes del tablero. */
@media (max-width: 900px) {
  .puzzle-journey-room .puzzle-journey-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "progress"
      "modes"
      "board"
      "controls"
      "daily";
    min-height: 0;
  }
  .puzzle-journey-room .tactical-progress-card { grid-area: progress; margin: 0; }
  .puzzle-journey-room .puzzle-tactical-modes { grid-area: modes; display: grid; margin: 0; }
}

/* Panel lateral de escritorio: información de entrenamiento más legible sin
   restar altura al tablero. */
@media (min-width: 901px) {
  .puzzle-journey-room .tactical-progress-card {
    gap: .8rem;
    padding: 1rem !important;
    border-radius: 16px;
  }
  .puzzle-journey-room .tactical-progress-card__crest {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    font-size: 1.65rem;
  }
  .puzzle-journey-room .tactical-progress-card__identity .workspace-kicker {
    font-size: .72rem;
  }
  .puzzle-journey-room .tactical-progress-card__identity h2 {
    font-size: 1.65rem;
  }
  .puzzle-journey-room .tactical-progress-card__meter-copy strong {
    font-size: .94rem;
  }
  .puzzle-journey-room .tactical-progress-card__meter-copy > span,
  .puzzle-journey-room .tactical-progress-card__meter small {
    font-size: .74rem;
  }
  .puzzle-journey-room .tactical-progress-card__meter progress {
    height: .7rem;
  }
  .puzzle-journey-room .tactical-progress-card__stats > div {
    padding: .65rem .75rem;
    border-radius: 12px;
  }
  .puzzle-journey-room .tactical-progress-card__stats dt {
    font-size: .68rem;
  }
  .puzzle-journey-room .tactical-progress-card__stats dd {
    margin-top: .2rem;
    font-size: .96rem;
  }
  .puzzle-journey-room .puzzle-quest-card {
    padding: 1.15rem !important;
    border-radius: 16px;
  }
  .puzzle-journey-room .puzzle-quest-card > .card-title {
    font-size: 1.7rem;
    line-height: 1.08;
  }
  .puzzle-journey-room .puzzle-reward-preview,
  .puzzle-journey-room .puzzle-status {
    font-size: .86rem;
  }
  .puzzle-journey-room .puzzle-status {
    min-height: 58px;
    padding: .85rem 1rem;
  }
  .puzzle-journey-room .puzzle-actions .btn {
    min-height: 48px;
    font-size: .86rem;
  }
  .puzzle-journey-room .puzzle-daily-card {
    padding: .72rem .82rem !important;
    border-radius: 16px;
    background:
      radial-gradient(circle at 100% 0, color-mix(in srgb, var(--theme-gold) 10%, transparent), transparent 42%),
      var(--theme-surface);
  }
  .puzzle-journey-room .puzzle-daily-card .puzzle-section-heading {
    align-items: center;
  }
  .puzzle-journey-room .puzzle-daily-eyebrow {
    margin: 0 0 .18rem;
    color: var(--theme-gold);
    font-size: .64rem;
    font-weight: 850;
    letter-spacing: .11em;
    text-transform: uppercase;
  }
  .puzzle-journey-room .puzzle-daily-card .card-title {
    font-size: 1.18rem;
  }
  .puzzle-journey-room .puzzle-mission-reward {
    padding: .48rem .65rem;
    font-size: .78rem;
    border: 1px solid color-mix(in srgb, var(--theme-gold) 25%, transparent);
    border-radius: 10px;
  }
  .puzzle-journey-room .puzzle-mission-copy {
    margin: .5rem 0 .65rem;
    color: var(--theme-text-muted);
    font-size: .75rem;
    line-height: 1.35;
  }
  .puzzle-journey-room .puzzle-mission-pips span {
    width: 32px;
    height: 32px;
    font-size: .8rem;
  }
  .puzzle-journey-room .puzzle-mission-pips span:not(:last-child) {
    margin-right: 30px;
  }
  .puzzle-journey-room .puzzle-mission-pips span:not(:last-child)::after {
    width: 31px;
    height: 3px;
  }
  .puzzle-journey-room .puzzle-mission-progress > strong {
    padding: .4rem .55rem;
    color: var(--theme-title);
    font-size: 1rem;
    background: var(--theme-surface-alt);
    border-radius: 9px;
  }
  .puzzle-journey-room .puzzle-session-stats {
    gap: .5rem;
    margin-top: .9rem;
  }
  .puzzle-journey-room .puzzle-session-stats span {
    min-height: 56px;
    justify-content: center;
    padding: .55rem .6rem;
    font-size: .68rem;
    border-radius: 10px;
  }
  .puzzle-journey-room .puzzle-session-stats strong {
    font-size: 1.05rem;
  }
}

@media (min-width: 1600px) {
  .puzzle-journey-room .puzzle-journey-layout {
    max-width: calc(100dvh + 340px);
    grid-template-columns: minmax(520px, 1fr) 400px;
  }
}

/* En portátiles bajos conserva la misma jerarquía, pero comprime la altura
   para que tablero y panel lateral sigan cabiendo sin scroll. */
@media (min-width: 901px) and (max-height: 929px) {
  .puzzle-journey-room .tactical-progress-card {
    gap: .55rem;
    padding: .78rem !important;
  }
  .puzzle-journey-room .tactical-progress-card__crest {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    font-size: 1.45rem;
  }
  .puzzle-journey-room .tactical-progress-card__identity h2 { font-size: 1.45rem; }
  .puzzle-journey-room .tactical-progress-card__meter-copy strong { font-size: .84rem; }
  .puzzle-journey-room .tactical-progress-card__meter-copy > span,
  .puzzle-journey-room .tactical-progress-card__meter small { font-size: .68rem; }
  .puzzle-journey-room .tactical-progress-card__meter progress { height: .55rem; }
  .puzzle-journey-room .tactical-progress-card__stats > div { padding: .48rem .6rem; }
  .puzzle-journey-room .tactical-progress-card__stats dt { font-size: .62rem; }
  .puzzle-journey-room .tactical-progress-card__stats dd { font-size: .84rem; }
  .puzzle-journey-room .puzzle-quest-card { padding: 1rem !important; }
  .puzzle-journey-room .puzzle-quest-card > .card-title { font-size: 1.55rem; }
  .puzzle-journey-room .puzzle-status { min-height: 52px; padding: .7rem .85rem; }
  .puzzle-journey-room .puzzle-actions .btn { min-height: 44px; }
  .puzzle-journey-room .puzzle-daily-card { padding: .82rem !important; }
  .puzzle-journey-room .puzzle-daily-eyebrow { font-size: .58rem; }
  .puzzle-journey-room .puzzle-daily-card .card-title { font-size: 1.08rem; }
  .puzzle-journey-room .puzzle-mission-reward { padding: .35rem .5rem; }
  .puzzle-journey-room .puzzle-mission-copy { margin: .38rem 0 .55rem; font-size: .69rem; }
  .puzzle-journey-room .puzzle-mission-pips span { width: 31px; height: 31px; }
  .puzzle-journey-room .puzzle-mission-pips span:not(:last-child) { margin-right: 24px; }
  .puzzle-journey-room .puzzle-mission-pips span:not(:last-child)::after { width: 25px; height: 2px; }
  .puzzle-journey-room .puzzle-mission-progress > strong { font-size: .9rem; }
  .puzzle-journey-room .puzzle-session-stats { margin-top: .6rem; }
  .puzzle-journey-room .puzzle-session-stats span { min-height: 50px; padding: .42rem .5rem; }
  .puzzle-journey-room .puzzle-session-stats strong { font-size: .92rem; }
}

@media (max-width: 900px) {
  .puzzle-journey-room .puzzle-daily-eyebrow {
    margin: 0 0 .12rem;
    color: var(--theme-gold);
    font-size: .58rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  .puzzle-journey-room .puzzle-mission-copy {
    margin: .45rem 0 .65rem;
    color: var(--theme-text-muted);
    font-size: .72rem;
  }
}

/* Debe permanecer al final: neutraliza los paddings compactos de escritorio. */
.puzzle-journey-room .puzzle-status,
.puzzle-journey-room .puzzle-status.is-loading {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: .72rem .9rem .72rem 1.75rem;
}

.puzzle-journey-room .puzzle-status::before,
.puzzle-journey-room .puzzle-status.is-loading::before {
  top: 50%;
  left: .85rem;
  width: 4px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--theme-accent);
  box-shadow: none;
  transform: translateY(-50%);
  animation: none;
}

.puzzle-journey-room .puzzle-status.is-ok::before {
  background: var(--puzzle-positive);
}

.puzzle-journey-room .puzzle-status:is(.is-fail, .is-error)::before {
  background: var(--puzzle-negative);
}

.puzzle-journey-room .puzzle-status.is-hint::before {
  background: var(--puzzle-warm);
}

/* Acciones y progreso inmediato del ejercicio. Mantener al final para ganar
   a las reglas compactas genéricas de escritorio. */
.puzzle-journey-room .puzzle-reward-preview .puzzle-current-streak {
  padding: .2rem .45rem;
  border: 1px solid color-mix(in srgb, var(--theme-gold) 34%, var(--theme-border));
  border-radius: 999px;
  color: var(--theme-text);
  background: color-mix(in srgb, var(--theme-gold) 10%, var(--theme-surface-alt));
  font-weight: 750;
}

.puzzle-journey-room .puzzle-current-streak svg {
  color: var(--theme-gold);
}

.puzzle-journey-room .puzzle-current-streak strong {
  color: var(--theme-accent-text);
  font-variant-numeric: tabular-nums;
}

.puzzle-journey-room .puzzle-actions .puzzle-next-action {
  border-color: color-mix(in srgb, var(--puzzle-positive) 72%, var(--theme-border));
  color: #fff;
  background: var(--puzzle-positive);
  font-weight: 900;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--puzzle-positive) 18%, transparent);
}

.puzzle-journey-room .puzzle-actions .puzzle-next-action:hover {
  color: #fff;
  background: color-mix(in srgb, var(--puzzle-positive) 86%, white);
}

.puzzle-journey-room .puzzle-actions .puzzle-next-action svg {
  color: currentColor;
}

/* Problemas: un resumen persistente, sin tarjetas de estadísticas repetidas. */
body:has(.puzzle-journey-room) .energy64-counter,
body:has(.puzzle-journey-room) .mobile-energy64 { display: none; }

.puzzle-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.puzzle-journey-room .tactical-progress-card {
  grid-template-columns: minmax(0, 1fr);
  gap: .62rem;
  padding: .85rem 1rem !important;
  background: var(--theme-surface);
}

.puzzle-journey-room .tactical-progress-card__identity {
  justify-content: space-between;
  gap: .55rem;
}

.puzzle-journey-room .tactical-progress-card__crest {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  font-size: 1.25rem;
}

.puzzle-journey-room .tactical-progress-card__identity h2 {
  font-family: inherit;
  font-size: 1.15rem;
  line-height: 1.15;
}

.puzzle-journey-room .tactical-progress-card__rating {
  min-width: 0;
  margin-left: auto;
  padding: .3rem .45rem;
}

.puzzle-journey-room .tactical-progress-card__rating-mark { display: none; }
.puzzle-journey-room .tactical-progress-card__rating-copy { gap: .05rem; }
.puzzle-journey-room .tactical-progress-card__rating-copy small { font-size: .62rem; }
.puzzle-journey-room .tactical-progress-card__rating-copy > strong { font-size: 1.05rem; }

.puzzle-journey-room .tactical-progress-card__stats {
  display: grid;
  grid-column: auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: .25rem;
  padding-top: .65rem;
  border-top: 1px solid var(--theme-border);
}

.puzzle-journey-room .tactical-progress-card__stats > div {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.puzzle-journey-room .tactical-progress-card__stats dd {
  margin: 0;
  font-size: .9rem;
  font-weight: 800;
}

.puzzle-journey-room .tactical-progress-card__stats > div:nth-child(2) { text-align: center; }
.puzzle-journey-room .tactical-progress-card__stats > div:nth-child(3) { text-align: right; }

.puzzle-journey-room .puzzle-result-panel {
  margin: .65rem 0;
  padding: .65rem .75rem;
}

.puzzle-journey-room .puzzle-quest-card:has(.puzzle-result-panel:not([hidden])) .puzzle-status {
  display: none;
}

.puzzle-journey-room .puzzle-result-heading {
  display: flex;
  gap: .45rem;
  color: var(--puzzle-positive);
  font-size: .9rem;
}

.puzzle-journey-room .puzzle-result-check { width: 24px; height: 24px; }
.puzzle-journey-room .puzzle-result-check svg { width: 15px; height: 15px; }

.puzzle-journey-room .puzzle-earned-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: .28rem;
  margin-top: .5rem;
}

.puzzle-journey-room .puzzle-earned-summary > div,
.puzzle-journey-room .puzzle-earned-summary > .is-elo {
  display: flex;
  grid-column: auto;
  gap: .45rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: .8rem;
  line-height: 1.35;
}

.puzzle-journey-room .puzzle-earned-summary > div > span:last-child {
  display: inline;
}

.puzzle-journey-room .puzzle-earned-summary strong { font-size: inherit; }
.puzzle-journey-room .puzzle-result-note[hidden] { display: none; }

.puzzle-journey-room .puzzle-daily-card {
  padding: .7rem .85rem !important;
  background: var(--theme-surface);
}

.puzzle-journey-room .puzzle-mission-progress { margin-top: .55rem; }
