.memory-panel {
  margin-top: 0;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: var(--panel-blue);
  border: none;
  border-radius: 0;
  padding: 16px 16px 18px;
  min-height: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(0, 0, 0, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.memory-panel-inner {
  width: min(640px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.memory-header h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
  text-align: center;
  color: #fff;
}

.subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  text-align: center;
  font-size: 1.05rem;
}

.memory-stats {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.memory-stats p {
  margin: 0;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.92);
}

.status-text {
  min-height: 1.8em;
  margin: 10px 0 12px;
  text-align: center;
  color: #eef3ff;
}

.memory-grid {
  width: min(360px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.grid-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition:
    transform 80ms ease,
    background-color 120ms ease,
    border-color 120ms ease;
}

.grid-cell:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.44);
}

.grid-cell:active:not(:disabled) {
  transform: scale(0.98);
}

.grid-cell.active {
  background: #fff;
  border-color: #fff;
}

.grid-cell:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  .memory-header h1 {
    font-size: 1.7rem;
  }

  .memory-panel {
    margin-top: 0;
    padding: 14px 12px 16px;
  }
}
