/* ==========================================================================
   Zone 3: Lower 2-Column Liquid Glass Bento Deck (Stats + Cube Side-by-Side)
   ========================================================================== */

.arena-bottom-stack {
  align-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 820px;
  z-index: 25;
}

#bento-deck {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  min-width: 0;
  height: 138px;
}

.bento-deck-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 22px;
  background: var(--glass-capsule-fill);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  box-shadow: var(--liquid-shadow-md);
  position: relative;
  overflow: hidden;
  min-width: 0;
  cursor: pointer;
}

.bento-deck-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  padding: 1px;
  background: var(--liquid-rim-refraction);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.bento-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  z-index: 2;
}

.bento-card-title {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.bento-card-title strong {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.bento-best-full {
  display: inline;
}

.bento-best-short {
  display: none;
}

.cube-view-mode-full {
  display: inline;
}

.cube-view-mode-short {
  display: none;
}

.bento-orient-hint {
  display: inline;
}

.bento-best-pill {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: rgba(48, 209, 88, 0.10);
  border: 1px solid rgba(48, 209, 88, 0.24);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s var(--ease-apple), border-color 0.16s var(--ease-apple), transform 0.14s var(--ease-apple);
}

.bento-best-pill:hover {
  background: rgba(48, 209, 88, 0.22);
  border-color: rgba(48, 209, 88, 0.45);
  transform: scale(1.04);
}

.bento-best-pill b {
  font-family: var(--font-mono);
  color: var(--green);
  margin-left: 3px;
}

.bento-stats-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 14px;
  margin-top: auto;
  margin-bottom: auto;
  min-width: 0;
}

.telemetry-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 3px 6px;
  border-radius: var(--r-xs);
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  cursor: pointer;
  min-width: 0;
  transition: background 0.16s var(--ease-apple), transform 0.14s var(--ease-apple);
}

.telemetry-cell:hover {
  background: rgba(255, 255, 255, 0.065);
}

.telemetry-cell:active {
  transform: scale(0.97);
}

.telemetry-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-tertiary);
}

.telemetry-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: #F5F5F7;
}

/* Not enough solves for this average yet: "ещё 3" in quiet text instead of a dash */
.telemetry-cell .telemetry-val.is-pending {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-tertiary) !important;
}

/* Right Bento Card: Cube Preview & Main Cube Gear Badge */
#cube-preview-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  min-width: 0;
}

/* Cube gear row removed from main bento card to eliminate clutter and unblock 3D cube model */
.bento-cube-gear-row {
  display: none !important;
}

.cube-preview-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.cube-preview-wrapper:active {
  cursor: grabbing;
}

.cube-net-svg {
  width: 132px;
  height: 98px;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
}

.cube-3d-svg {
  width: 118px;
  height: 94px;
  display: block;
  overflow: visible;
}

.cube-card-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.cube-reset-pill {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  width: 22px;
  height: 20px;
  border-radius: var(--r-pill);
  font-size: 0.70rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s var(--ease-apple), background 0.16s var(--ease-apple);
}

.cube-reset-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}

#bento-cube-card {
  cursor: default;
}

/* 2D | 3D segmented switch on the scramble preview card */
.cube-view-seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.cube-view-seg-btn {
  min-width: 30px;
  height: 22px;
  padding: 0 8px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s var(--ease-apple), color 0.16s var(--ease-apple);
}

.cube-view-seg-btn:hover {
  color: #FFFFFF;
}

.cube-view-seg-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.25);
  cursor: default;
}

.cube-view-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s var(--ease-apple), color 0.16s var(--ease-apple), border-color 0.16s var(--ease-apple);
}

.cube-view-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

/* Desktop Keyboard Hints — quiet single line + "All shortcuts" popover */
#keyboard-hints-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 18px;
  width: 100%;
  max-width: 820px;
  min-width: 0;
  padding: 2px 12px;
}

.hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-tertiary);
  font-weight: 500;
  white-space: nowrap;
}

#keyboard-hints-bar kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-width: 2px;
  color: rgba(255, 255, 255, 0.82);
}

.hint-pill kbd + kbd {
  margin-left: -2px;
}

.hint-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 6px 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s var(--ease-apple), color 0.16s var(--ease-apple), border-color 0.16s var(--ease-apple);
}

.hint-more-btn:hover,
.hint-more-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

.shortcuts-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 16px 18px 14px;
  border-radius: var(--r-lg);
  background: rgba(16, 18, 24, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  z-index: 300;
  animation: shortcutsIn 0.18s var(--ease-apple);
}

.shortcuts-popover[hidden] {
  display: none;
}

@keyframes shortcutsIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.shortcuts-popover h4 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 9px 12px;
}

.shortcuts-grid dt {
  display: flex;
  gap: 3px;
  justify-content: flex-end;
}

.shortcuts-grid dd {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Desktop: the analytics sidebar already shows every average, so the bottom
   deck keeps only the scramble preview and the timer gets a csTimer-style
   ao5 · ao12 line underneath. */
@media (min-width: 921px) and (min-height: 521px), (min-width: 1101px) {
  #live-telemetry-strip {
    display: none;
  }

  #bento-deck {
    grid-template-columns: minmax(0, 320px);
    justify-content: center;
    height: clamp(150px, 16vh, 172px);
  }
}

/* Scramble preview: the drawing fills the whole card and the caption and the
   2D/3D switch sit in the top corners the net leaves empty, so the stickers
   stay readable at a glance. */
#bento-cube-card {
  padding: 10px;
}

#bento-cube-card .bento-card-head {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 10px;
  width: auto;
  align-items: flex-start;
  pointer-events: none;
}

#bento-cube-card .cube-card-controls {
  pointer-events: auto;
}

#bento-cube-card .bento-card-title {
  flex: 0 1 auto;
  max-width: 84px;
  padding-top: 5px;
  white-space: normal;
  line-height: 1.35;
}

#bento-cube-card .bento-orient-hint {
  display: block;
}

#bento-cube-card .cube-preview-wrapper {
  height: 100%;
}

#bento-cube-card .cube-net-svg,
#bento-cube-card .cube-3d-svg {
  width: 100%;
  height: 100%;
}

/* Phones: the half-width card is too narrow for a caption beside the net */
@media (max-width: 920px), (max-width: 1100px) and (max-height: 520px) {
  #bento-cube-card {
    padding: 8px;
  }

  #bento-cube-card .bento-card-head {
    top: 8px;
    left: 8px;
    right: 8px;
    justify-content: flex-end;
  }

  #bento-cube-card .bento-card-title {
    display: none;
  }

  #bento-cube-card .cube-view-seg-btn {
    min-width: 26px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.64rem;
  }
}

/* Desktop with the analytics panel open: one wide scramble card with the net
   and the 3D cube side by side, mirroring the scramble capsule above */
@media (min-width: 921px) and (min-height: 521px), (min-width: 1101px) {
  #app:not(.sidebar-collapsed) #bento-deck {
    grid-template-columns: minmax(0, 460px);
  }
}

#cube-preview-container.is-dual .bento-card-title {
  display: none;
}

.cube-preview-dual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  height: 100%;
  min-height: 0;
}

.cube-dual-net {
  display: flex;
  align-items: center;
  height: 100%;
  min-width: 0;
}

#cube-preview-container.is-dual .cube-preview-wrapper {
  flex: 0 1 auto;
  height: 100%;
}

#cube-preview-container.is-dual .cube-net-svg,
#cube-preview-container.is-dual .cube-3d-svg {
  width: auto;
  height: 100%;
}

.cube-dual-divider {
  align-self: stretch;
  width: 1px;
  margin: 18px 0;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.10), transparent);
  flex-shrink: 0;
}
